Skip to content

Instantly share code, notes, and snippets.

@JackNoordhuis
Created August 20, 2019 17:01
Show Gist options
  • Save JackNoordhuis/3602a3540ac7c0411cce3347010173bd to your computer and use it in GitHub Desktop.
Save JackNoordhuis/3602a3540ac7c0411cce3347010173bd to your computer and use it in GitHub Desktop.
Filter for converting ender chests to chests in mcedit.
from pymclevel import TAG_Int, TAG_Compound, TAG_List, TAG_String
displayName = "EnderChest2Chest"
inputs = (
(
"Converts ender chests to chests.", "label"
),
)
def perform(level, box, options):
for (chunk, slices, point) in level.getChunkSlices(box):
for tile in chunk.TileEntities:
if tile["id"].value == "EnderChest":
chest = TAG_Compound()
chest["id"] = TAG_String("Chest")
chest["x"] = TAG_Int(tile["x"].value)
chest["y"] = TAG_Int(tile["y"].value)
chest["z"] = TAG_Int(tile["z"].value)
chest["items"] = TAG_List()
level.setBlockAt(tile["x"].value, tile["y"].value, tile["z"].value, 54)
chunk.TileEntities.append(chest)
chunk.TileEntities.remove(tile)
chunk.Dirty = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment