Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sortLocations = {
- up = { "minecraft:apple", "minecraft:pufferfish", "minecraft:cookie" },
- down = { "minecraft:paper", "minecraft:barrel" }
- }
- local function InTable(t, value)
- for i, v in pairs(t) do
- if v == value then
- return true
- end
- end
- return false
- end
- local function GetBarrel()
- -- get the correct barrel based off of its lore tag
- for slot = 1, 16 do
- if turtle.getItemCount(slot) > 0 then
- local data = turtle.getItemDetail(slot, true)
- if data.lore ~= nil and (data.lore[1] == "The fabled prize awaits at the bottom...") then
- turtle.select(slot)
- turtle.transferTo(1)
- turtle.select(1)
- return true
- end
- end
- end
- return false
- end
- local function SortDrops()
- -- sort drops from barrel into other barrels (up for cookies and apples and pufferfish bottom for papers and barrels)
- for slot = 1, 16 do
- if turtle.getItemCount(slot) > 0 then
- local data = turtle.getItemDetail(slot, true)
- if not (data.lore ~= nil and data.lore[1] == "The fabled prize awaits at the bottom...") then
- if InTable(sortLocations.down, data.name) then
- turtle.select(slot)
- turtle.dropDown()
- end
- if InTable(sortLocations.up, data.name) then
- turtle.select(slot)
- turtle.dropUp()
- end
- end
- end
- end
- end
- while true do
- if turtle.detect() then
- turtle.dig()
- SortDrops()
- end
- if GetBarrel() then
- turtle.place()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement