Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CONSTANTS
- local INTERVAL = 120
- local PIPE_SIDE = "bottom"
- local REQUEST_IDS = {
- --Swords
- 267, --Iron
- 268, --Wood
- 272, --Stone
- 276, --Diamond
- 283, --Gold
- 4369, --Quarz
- 5648, --Green Sapphire
- 5649, --Ruby
- 5650, --Blue Sapphire
- 30198, --Bronze
- --Pickaxe
- 257, --Iron
- 270, --Wood
- 274, --Stone
- 278, --Diamond
- 285, --Gold
- 4368, --Quarz
- 5633, --Green Sapphire
- 5634, --Ruby
- 5635, --Blue Sapphire
- 30200, --Bronze
- --Axe
- 258, --Iron
- 271, --Wooden
- 275, --Stone
- 279, --Dia
- 286, --Gold
- 4365, --Quarz
- 5590, --Green Sapphine
- 5591, --Ruby
- 5592, --Blue Sapphire
- 30199, --Bronze
- --Shovel
- 256, --Iron
- 269, --Wooden
- 273, --Stone
- 277, --Dia
- 284, --Gold
- 4367, --Quarz
- 5637, --Green Sapphire
- 5638, --Ruby
- 5639, --Blue Sapphire
- 30197, --Bronze
- --Battle Axe
- 11532, --Iron
- 11530, --Wooden
- 11531, --Stone
- 11533, --Dia
- 11534, --Gold
- --Hoe
- 292, --Iron
- 290, --Wood
- 291, --Stone
- 293, --Dia
- 294, --Gold
- 4366, --Quarz
- 5593, --Green Sapphire
- 5597, --Ruby
- 5598, --Blue Sapphire
- 30196, --Bronze
- --Warhammer
- 11537, --Iron
- 11535, --Wooden
- 11536, --Stone
- 11538, --Dia
- 11539, --Gold
- 5577, --Diamond Handsaw
- 261, --Bow
- 11555,--Crossbow
- }
- -- IMPLEMENTATION
- function convertNBT(nbt)
- local conv = {}
- if (nbt == nil) then
- return nil
- elseif (nbt["type"] == "NBTTagCompound") or (nbt["type"] == "NBTTagList") then
- for key, value in pairs(nbt["value"]) do
- conv[key] = convertNBT(value)
- end
- else
- conv = nbt["value"]
- end
- return conv
- end
- function getItems(pipe)
- pipe.getAvailableItems()
- local event, result = os.pullEvent("available_items_return")
- return result
- end
- function inList(item)
- for _, id in pairs(REQUEST_IDS) do
- if item.id == id then
- return true
- end
- end
- return false
- end
- -- MAIN
- local pipe = peripheral.wrap(PIPE_SIDE)
- while true do
- for i, result in pairs(getItems(pipe)) do
- local iid, amount = unpack(result)
- local item = {
- id = pipe.getItemID(iid),
- dmg = pipe.getItemDamage(iid),
- nbt = convertNBT(pipe.getNBTTagCompound(iid))
- }
- if inList(item) then
- pipe.makeRequest(iid, amount)
- sleep(2)
- end
- end
- sleep(INTERVAL)
- end
Add Comment
Please, Sign In to add comment