Convo_bomber34

(mcedit) Add chest

Dec 8th, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. from pymclevel import TAG_List
  2. from pymclevel import TAG_Int
  3. from pymclevel import TAG_Compound
  4. from pymclevel import TAG_String
  5.  
  6. def perform(level, box, options):
  7.     global l
  8.     l = level
  9.  
  10.  
  11. def addChest(x, y, z, items):
  12.     global l
  13.     chunk = l.getChunk(x/16, z/16)
  14.     TileEnt = l.tileEntityAt(x, y, z)
  15.     if TileEnt != None:
  16.         chunk.TileEntities.remove(TileEnt)
  17.     chest = TAG_Compound()
  18.     chest["id"] = TAG_String(u"Chest")
  19.     chest["CustomName"] = TAG_String("Random Chest") #Optional
  20.     chest["x"] = TAG_Int(x)
  21.     chest["y"] = TAG_Int(y)
  22.     chest["z"] = TAG_Int(z)
  23.    
  24.     chest["Items"] = items;
  25.     #items is a TAG_List of TAG_Compounds (http://minecraft.gamepedia.com/Player.dat_Format#Item_structure for the item structure)
  26.    
  27.     l.setBlockAt(x, y, z, 54)
  28.     l.setBlockDataAt(x, y, z, 0)
  29.     chunk.TileEntities.append(chest)
  30.     chunk.dirty = True
Advertisement
Add Comment
Please, Sign In to add comment