Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function sortInventory()
- local inventory = {}
- for curSlot=1,16 do
- if turtle.getItemCount(curSlot) ~= 0 then
- inventory[curSlot] = turtle.getItemDetail(curSlot)
- else
- inventory[curSlot] = "empty"
- end
- end
- for slotA=1,16 do
- if inventory[slotA] ~= "empty" then
- for slotB=1,16 do
- if inventory[slotB] ~= "empty" then
- if slotA ~= slotB then
- if (inventory[slotA].name == inventory[slotB].name) and (inventory[slotA].damage == inventory[slotB].damage) then
- if inventory[slotA].count + inventory[slotB].count <= 64 then
- turtle.select(slotB)
- turtle.transferTo(slotA)
- inventory[slotB] = "empty"
- end
- end
- end
- end
- end
- end
- end
- end
- sortInventory()
Advertisement
Add Comment
Please, Sign In to add comment