Advertisement
Guest User

chunkManipulation

a guest
Dec 3rd, 2010
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import mclevel
  4. import os;
  5.  
  6. worldFile = "../saves/World4"
  7. world = mclevel.fromFile(worldFile)
  8.  
  9. def removeChunk(xPos, zPos):
  10.   global world
  11.   if world.containsChunk(xPos, zPos):
  12.     aChunk = world.getChunk(xPos, zPos)
  13.     os.remove(aChunk.filename)
  14.     world.saveInPlace()
  15.   return
  16.  
  17. def createNullChunk(xPos, zPos):
  18.   global world
  19.   if not world.containsChunk(xPos, zPos):
  20.     aChunk = mclevel.InfdevChunk(world, [xPos, zPos], True)
  21.     aChunk.chunkChanged()
  22.     world.saveInPlace()
  23.     world = mclevel.fromFile(worldFile)
  24.   aChunk = world.getChunk(xPos, zPos)
  25.   aChunk.Blocks[:,:,0] = world.materials.materialNamed("Adminium")
  26.   aChunk.Blocks[:,:,1:] = 0
  27.   aChunk.chunkChanged()
  28.   world.generateLights()
  29.   #Save and reload to pick up changes (required to save at some stage!)
  30.   world.saveInPlace()
  31.   world = mclevel.fromFile(worldFile)
  32.   return
  33.  
  34. removeChunk(-18, 21)
  35. createNullChunk(-18, 21)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement