mlard811

Untitled

Jan 10th, 2026 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | Gaming | 0 0
  1. -- CONFIGURATION
  2. -- specific name of the chest, or "top", "bottom", "left", "right", "front", "back"
  3. local sourceName = "back"
  4. local destName = "front"
  5.  
  6. -- The exact NBT key and value we are looking for
  7. -- Note: Use square brackets ['key'] because the name contains a colon
  8. local targetKey = "apotheosis:rarity"
  9. local targetValue = "apotheosis:epic"
  10.  
  11. -- WRAP PERIPHERALS
  12. local source = peripheral.wrap(sourceName)
  13. local dest = peripheral.wrap(destName)
  14.  
  15. if not source or not dest then
  16.     print("Error: Could not find chests. Check names.")
  17.     return
  18. end
  19.  
  20. print("Scanning for Epic items...")
  21.  
  22. -- MAIN LOOP
  23. -- Get the size of the inventory
  24. local size = source.size()
  25.  
  26. for slot = 1, size do
  27.     -- Get detailed info about the item in the current slot
  28.     local item = source.getItemDetail(slot)
  29.  
  30.     -- Check if there is an item and if it has NBT data
  31.     if item and item.nbt then
  32.        
  33.         -- Check the specific NBT tag
  34.         -- We use brackets because of the colon in the name
  35.         local rarity = item.nbt[targetKey]
  36.  
  37.         if rarity == targetValue then
  38.             print("Found Epic Item: " .. item.displayName)
  39.            
  40.             -- Move the item to the destination
  41.             -- pushItems(toName, fromSlot, limit, toSlot)
  42.             source.pushItems(destName, slot)
  43.         end
  44.     end
  45. end
  46.  
  47. print("Scan complete.")
Tags: minecraft
Advertisement
Add Comment
Please, Sign In to add comment