Advertisement
Kopasz7

Empty chests

Oct 30th, 2012
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. from pymclevel import MCSchematic
  2. from pymclevel import TileEntity
  3. from pymclevel import TAG_Compound
  4. from pymclevel import TAG_Short
  5. from pymclevel import TAG_Byte
  6. from pymclevel import TAG_String
  7. from pymclevel import TAG_Int
  8. from pymclevel import TAG_List
  9. from numpy import zeros
  10.  
  11. displayName = "Empty chests"
  12.  
  13. def perform(level, box, options):  
  14.     minx = int(box.minx/16)*16
  15.     minz = int(box.minz/16)*16
  16.  
  17.     for x in xrange(minx, box.maxx, 16):
  18.         for z in xrange(minz, box.maxz, 16):
  19.             chunk = level.getChunk(x / 16, z / 16)
  20.  
  21.             for te in chunk.TileEntities:
  22.                 px = te["x"].value
  23.                 py = te["y"].value
  24.                 pz = te["z"].value
  25.  
  26.                 if px < box.minx or px >= box.maxx:
  27.                     continue
  28.                 if py < box.miny or py >= box.maxy:
  29.                     continue
  30.                 if pz < box.minz or pz >= box.maxz:
  31.                     continue
  32.  
  33.                    
  34.                 if te["id"].value == "Chest":
  35.                     te["Items"] = []
  36.                            
  37.                     chunk.dirty = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement