added shouldRetainData check - checks BlockRotation to see if they have the same rotation type, implying their blockData has the same meaning.
This commit is contained in:
parent
dbd65c7e21
commit
21c756de78
@ -361,12 +361,24 @@ def masterRotationTable(attrname):
|
||||
|
||||
return table
|
||||
|
||||
def rotationTypeTable():
|
||||
table = {}
|
||||
for cls in rotationClasses:
|
||||
for b in cls.blocktypes:
|
||||
table[b] = cls
|
||||
|
||||
return table
|
||||
|
||||
class BlockRotation:
|
||||
rotateLeft = masterRotationTable("rotateLeft");
|
||||
flipEastWest = masterRotationTable("flipEastWest");
|
||||
flipNorthSouth = masterRotationTable("flipNorthSouth");
|
||||
flipVertical = masterRotationTable("flipVertical");
|
||||
typeTable = rotationTypeTable()
|
||||
|
||||
def SameRotationType(blocktype1, blocktype2):
|
||||
#use different default values for typeTable.get() to make it return false when neither blocktype is present
|
||||
return BlockRotation.typeTable.get(blocktype1.ID) == BlockRotation.typeTable.get(blocktype2.ID, BlockRotation)
|
||||
|
||||
def FlipVertical(blocks, data):
|
||||
data[:] = BlockRotation.flipVertical[blocks, data]
|
||||
|
@ -2419,6 +2419,7 @@ class MCInfdevOldLevel(EntityLevel):
|
||||
|
||||
if len(blocksToReplace):
|
||||
blocktable = self.blockReplaceTable(blocksToReplace)
|
||||
shouldRetainData = all([blockrotation.SameRotationType(blockInfo, b) for b in blocksToReplace])
|
||||
|
||||
newAbsorption = self.materials.lightAbsorption[blockInfo.ID]
|
||||
oldAbsorptions = [self.materials.lightAbsorption[b.ID] for b in blocksToReplace]
|
||||
|
3
level.py
3
level.py
@ -344,8 +344,9 @@ class MCLevel(object):
|
||||
blocks = self.Blocks[slices[0], slices[2], slices[1]]
|
||||
if len(blocksToReplace):
|
||||
blocktable = self.blockReplaceTable(blocksToReplace)
|
||||
shouldRetainData = (self.materials == alphaMaterials) and all([blockrotation.SameRotationType(blockInfo, b) for b in blocksToReplace])
|
||||
|
||||
if hasattr(self, "Data"):
|
||||
if hasattr(self, "Data") and shouldRetainData:
|
||||
data = self.Data[slices[0], slices[2], slices[1]]
|
||||
mask = blocktable[blocks, data]
|
||||
|
||||
|
Reference in New Issue
Block a user