Getting Chest Inventory - FTB Unleashed

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

elfin8er

New Member
Jul 29, 2019
22
0
0
Hello one and all!

I'm trying to create a high-tech storage system in FTB. I need to be able to check the exact amount of items that are in a chest, and send the result to computercraft. Is there any way to do that? I know there's a way to do it with OpenCCSensors, but OpenCCSensors doesn't seem to be installed in FTB Unleashed. Also, the more compact I can make this, the better!
 

Bomb Bloke

New Member
Jul 29, 2019
612
0
0
OpenPeripheral is in there. Should be able to tell a computer to wrap the chest as a peripheral, then use the functions that gives you to query what's in there.

Running by memory and a minimal amount of experience with OP, an example would be something like:

Code:
chest = peripheral.wrap("right")

for i=1,27 do
  local slot = chest.getStackInSlot(i)
  print(slot.name.." is in slot "..i)
end

You can run the below if you simply want a list of the functions the peripheral has:

Code:
chest = peripheral.wrap("right")

for item,content in pairs(chest) do
  print(item)
end
 

elfin8er

New Member
Jul 29, 2019
22
0
0
OpenPeripheral is in there. Should be able to tell a computer to wrap the chest as a peripheral, then use the functions that gives you to query what's in there.

Running by memory and a minimal amount of experience with OP, an example would be something like:

Code:
chest = peripheral.wrap("right")

for i=1,27 do
  local slot = chest.getStackInSlot(i)
  print(slot.name.." is in slot "..i)
end

You can run the below if you simply want a list of the functions the peripheral has:

Code:
chest = peripheral.wrap("right")

for item,content in pairs(chest) do
  print(item)
end
Ahh, thanks. I was thinking of the old OpenCCSensors that had it's own peripheral that would interact with inventories. I think this is exactly what I need though. Do you know of anywhere that I can get documentation for this?
 

Bomb Bloke

New Member
Jul 29, 2019
612
0
0
Here, but the function names have been changing recently. Those listed there may not mesh with those actually available to you. Use the code I mentioned above to get an actual list of the functions a peripheral has.