Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- output = {}
- 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 getNBT(side)
- local pipe = peripheral.wrap(side)
- pipe.getAvailableItems()
- local event, items = os.pullEvent("available_items_return")
- for k,v in pairs(items) do
- iid = v
- nbt = convertNBT(pipe.getNBTTagCompound(iid))
- id = pipe.getItemID(iid)
- dmg = pipe.getItemDamage(iid)
- pkg = {}
- table.insert(pkg,id)
- table.insert(pkg,dmg)
- table.insert(pkg,nbt)
- table.insert(output,pkg)
- print("found item "..id..":"..dmg)
- end
- return output
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement