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() blockrotation.Roll(self.Blocks, self.Data) log.info(u"N/S Roll: Relocating entities...") mcedit_ids_get = self.defsIds.mcedit_ids.get for i, entity in enumerate(self.Entities): newX = self.Width - entity["Pos"][1].value newY = entity["Pos"][0].value entity["Pos"][0].value = newX entity["Pos"][1].value = newY if "Motion" in entity: newX = entity["Motion"][1].value newY = -entity["Motion"][0].value entity["Motion"][0].value = newX entity["Motion"][1].value = newY # I think this is right # Although rotation isn't that important as most entities can't rotate and mobs # don't serialize rotation. newX = entity["Rotation"][1].value newY = -entity["Rotation"][0].value entity["Rotation"][0].value = newX entity["Rotation"][1].value = newY if entity["id"].value in ( "Painting", "ItemFrame") or mcedit_ids_get( entity["id"].value) in ('DEFS_ENTITIES_PAINTING', 'DEFS_ENTITIES_ITEM_FRAME'): newX = self.Width - entity["TileY"].value - 1 newY = entity["TileX"].value entity["TileX"].value = newX entity["TileY"].value = newY for tileEntity in self.TileEntities: newX = self.Width - tileEntity["y"].value - 1 newY = tileEntity["x"].value tileEntity["x"].value = newX tileEntity["y"].value = newY if hasattr(self, "TileTicks"): for tileTick in self.TileTicks: newX = self.Width - tileTick["y"].value - 1 newY = tileTick["x"].value tileTick["x"].value = newX tileTick["y"].value = newY
def rollBlocks(self): """ rolls the blocks direction without the block location """ blockrotation.Roll(self.Blocks, self.Data)