Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --configuration--
- filterItem = "tconstruct:sword"
- --software--
- local manager = peripheral.find("inventoryManager")
- local chest = peripheral.find("blockReader")
- if chest == nil then error("Chest is not present") end
- if manager == nil then error("Inventory Manager is not present") end
- hand = {}
- id = ""
- function removeItem()
- hand = manager.getItemInHand()
- if hand["name"] == filterItem then
- tankCap = hand["nbt"]["tic_volatile_data"]["tconstruct:tank_capacity"]
- --print(tankCap)
- if hand["nbt"]["tic_persistent_data"]["tconstruct:tank_fluid"]["Amount"] >= tankCap then
- manager.removeItemFromPlayer("top", 1, -1, filterItem)
- print("Removed: "..hand["displayName"])
- end
- end
- end
- function returnItem()
- if chest.getBlockData()["Items"][0] ~= nil then
- print("Got Item")
- id = chest.getBlockData()["Items"][0]["id"]
- print(id)
- if id == filterItem then
- print("Trying to insert item")
- manager.addItemToPlayer("top", 1, 5, filterItem)
- end
- end
- end
- while true do
- removeItem()
- returnItem()
- sleep(0.2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement