Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CONFIGURATION
- -- specific name of the chest, or "top", "bottom", "left", "right", "front", "back"
- local sourceName = "back"
- local destName = "front"
- -- The exact NBT key and value we are looking for
- -- Note: Use square brackets ['key'] because the name contains a colon
- local targetKey = "apotheosis:rarity"
- local targetValue = "apotheosis:epic"
- -- WRAP PERIPHERALS
- local source = peripheral.wrap(sourceName)
- local dest = peripheral.wrap(destName)
- if not source or not dest then
- print("Error: Could not find chests. Check names.")
- return
- end
- print("Scanning for Epic items...")
- -- MAIN LOOP
- -- Get the size of the inventory
- local size = source.size()
- for slot = 1, size do
- -- Get detailed info about the item in the current slot
- local item = source.getItemDetail(slot)
- -- Check if there is an item and if it has NBT data
- if item and item.nbt then
- -- Check the specific NBT tag
- -- We use brackets because of the colon in the name
- local rarity = item.nbt[targetKey]
- if rarity == targetValue then
- print("Found Epic Item: " .. item.displayName)
- -- Move the item to the destination
- -- pushItems(toName, fromSlot, limit, toSlot)
- source.pushItems(destName, slot)
- end
- end
- end
- print("Scan complete.")
Advertisement
Add Comment
Please, Sign In to add comment