Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SLOT_COUNT = 16
- function getItemIndex(itemName)
- for slot = 1, SLOT_COUNT, 1 do
- local item = turtle.getItemDetail(slot)
- if(item ~= nil) then
- if(item["name"] == itemName) then
- return slot
- end
- end
- end
- return 17
- end
- while true do
- while true do
- local event, p1 = os.pullEvent("turtle_inventory")
- for slot = 1, SLOT_COUNT, 1 do
- local item = turtle.getItemDetail(slot)
- if(item ~= nil) then
- turtle.select(slot)
- if (item["name"] == "minecraft:wheat") then
- turtle.drop()
- else
- turtle.dropUp()
- end
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment