Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pymclevel import TAG_List
- from pymclevel import TAG_Int
- from pymclevel import TAG_Compound
- from pymclevel import TAG_String
- def perform(level, box, options):
- global l
- l = level
- def addChest(x, y, z, items):
- global l
- chunk = l.getChunk(x/16, z/16)
- TileEnt = l.tileEntityAt(x, y, z)
- if TileEnt != None:
- chunk.TileEntities.remove(TileEnt)
- chest = TAG_Compound()
- chest["id"] = TAG_String(u"Chest")
- chest["CustomName"] = TAG_String("Random Chest") #Optional
- chest["x"] = TAG_Int(x)
- chest["y"] = TAG_Int(y)
- chest["z"] = TAG_Int(z)
- chest["Items"] = items;
- #items is a TAG_List of TAG_Compounds (http://minecraft.gamepedia.com/Player.dat_Format#Item_structure for the item structure)
- l.setBlockAt(x, y, z, 54)
- l.setBlockDataAt(x, y, z, 0)
- chunk.TileEntities.append(chest)
- chunk.dirty = True
Advertisement
Add Comment
Please, Sign In to add comment