Permalink
Browse files

Fixed: Schematic entities have wrong positions after rotating.

It is probably bad to cache _fakeEntities in the first place, but clear it when transforming the schematic.

Fixes mcedit/mcedit#292
  • Loading branch information...
1 parent 57e5188 commit c830ee6d712efb5bc92cbc053ef9d1e194ff8a71 @codewarrior0 codewarrior0 committed Feb 16, 2013
Showing with 8 additions and 0 deletions.
  1. +8 −0 schematic.py
View
@@ -217,7 +217,9 @@ def _update_shape(self):
root_tag["Length"] = nbt.TAG_Short(shape[1])
root_tag["Width"] = nbt.TAG_Short(shape[0])
+
def rotateLeft(self):
+ self._fakeEntities = None
self._Blocks = swapaxes(self._Blocks, 1, 2)[:, ::-1, :] # x=z; z=-x
if "Biomes" in self.root_tag:
self.root_tag["Biomes"].value = swapaxes(self.root_tag["Biomes"].value, 0, 1)[::-1, :]
@@ -261,13 +263,15 @@ def rotateLeft(self):
def roll(self):
" xxx rotate stuff - destroys biomes"
self.root_tag.pop('Biomes', None)
+ self._fakeEntities = None
self._Blocks = swapaxes(self._Blocks, 2, 0)[:, :, ::-1] # x=y; y=-x
self.root_tag["Data"].value = swapaxes(self.root_tag["Data"].value, 2, 0)[:, :, ::-1]
self._update_shape()
def flipVertical(self):
" xxx delete stuff "
+ self._fakeEntities = None
blockrotation.FlipVertical(self.Blocks, self.Data)
self._Blocks = self._Blocks[::-1, :, :] # y=-y
@@ -277,6 +281,8 @@ def flipNorthSouth(self):
if "Biomes" in self.root_tag:
self.root_tag["Biomes"].value = self.root_tag["Biomes"].value[::-1, :]
+ self._fakeEntities = None
+
blockrotation.FlipNorthSouth(self.Blocks, self.Data)
self._Blocks = self._Blocks[:, :, ::-1] # x=-x
self.root_tag["Data"].value = self.root_tag["Data"].value[:, :, ::-1]
@@ -305,6 +311,8 @@ def flipEastWest(self):
if "Biomes" in self.root_tag:
self.root_tag["Biomes"].value = self.root_tag["Biomes"].value[:, ::-1]
+ self._fakeEntities = None
+
blockrotation.FlipEastWest(self.Blocks, self.Data)
self._Blocks = self._Blocks[:, ::-1, :] # z=-z
self.root_tag["Data"].value = self.root_tag["Data"].value[:, ::-1, :]

0 comments on commit c830ee6

Please sign in to comment.