Advertisement
Muzze77

CC AMI NBT Changer

Jan 30th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. shell.run("clear")
  2. if not fs.exists("api") then
  3.     shell.run("pastebin get QMct3H9x api")
  4. else
  5.     shell.run("delete api")
  6.     shell.run("pastebin get QMct3H9x api")
  7. end
  8.  
  9. f = os.loadAPI("api")
  10. crafting = {}
  11. crafting["242:6"] = {4093,0}
  12. crafting["9258:2"] = {351,4}
  13. crafting["9258:1"] = {388,0}
  14. crafting["9258:0"] = {377,0}
  15. crafting["9258:6"] = {264,0}
  16. crafting["1133:0"] = {54,0}
  17. crafting["20261:69"] = {19264,0}
  18.  
  19. p = peripheral.wrap("top")
  20. ID = p.getPeripheralWorldID()
  21. w = p.getWorld(ID)
  22. pl = p.getPlayerByName("Muzze77")
  23. ent = pl.asEntity()
  24. x, y, z = p.getPeripheralPos()
  25.  
  26. if w.getBlockID(x,y+2,z) == 0 then
  27. w.setBlock(x, y+2, z, 54,0)
  28. end
  29.  
  30.  
  31.  
  32.  
  33.  
  34. items = {}
  35. while true do
  36.    
  37.         shell.run("clear")
  38.  
  39.         te = w.getTileEntity(x,y+2,z)
  40.  
  41.         nbt = api.readTileNBT(te)
  42.         tab = nbt.value.Items.value
  43.         i = textutils.serialize(tab)
  44.        
  45.         for v, k in pairs(tab) do
  46.             slot = k.value.Slot.value
  47.             item = k.value.id.value
  48.             meta = k.value.Damage.value
  49.             count = k.value.Count.value
  50.             for a,b in pairs(crafting) do
  51.                 itemCheck = item .. ":" .. meta
  52.                
  53.                 if  itemCheck == a then
  54.                     k.value.id.value = b[1]
  55.                     k.value.Damage.value = b[2]
  56.                     print("Switched " .. itemCheck .. " with " .. b[1] .. ":" .. b[2])
  57.                    
  58.                 end
  59.             end
  60.            
  61.  
  62.         end
  63.  
  64.    
  65.     api.writeTileNBT(te,nbt)
  66.     for tm = 1, 0,-0.1 do
  67.         gx,gy = term.getSize()
  68.         term.setCursorPos(2,gy-1)
  69.         term.write(tm)
  70.         term.setCursorPos(5,gy-1)
  71.         term.write("                                     ")
  72.  
  73.         sleep(0.1)
  74.     end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement