Added: Block rotation for several new blocks.
This commit is contained in:
parent
d02d44641e
commit
3dcd449e68
114
blockrotation.py
114
blockrotation.py
@ -60,7 +60,6 @@ def genericNorthSouthFlip(cls):
|
|||||||
|
|
||||||
rotationClasses = []
|
rotationClasses = []
|
||||||
|
|
||||||
|
|
||||||
def genericFlipRotation(cls):
|
def genericFlipRotation(cls):
|
||||||
cls.rotateLeft = genericRotation(cls)
|
cls.rotateLeft = genericRotation(cls)
|
||||||
|
|
||||||
@ -68,6 +67,7 @@ def genericFlipRotation(cls):
|
|||||||
cls.flipEastWest = genericEastWestFlip(cls)
|
cls.flipEastWest = genericEastWestFlip(cls)
|
||||||
cls.flipNorthSouth = genericNorthSouthFlip(cls)
|
cls.flipNorthSouth = genericNorthSouthFlip(cls)
|
||||||
rotationClasses.append(cls)
|
rotationClasses.append(cls)
|
||||||
|
return cls
|
||||||
|
|
||||||
|
|
||||||
class Torch:
|
class Torch:
|
||||||
@ -418,22 +418,10 @@ applyPistonBit(PistonBody)
|
|||||||
|
|
||||||
class PistonHead(PistonBody):
|
class PistonHead(PistonBody):
|
||||||
blocktypes = [alphaMaterials.PistonHead.ID]
|
blocktypes = [alphaMaterials.PistonHead.ID]
|
||||||
|
|
||||||
rotationClasses.append(PistonHead)
|
rotationClasses.append(PistonHead)
|
||||||
|
|
||||||
|
|
||||||
class Vines:
|
|
||||||
blocktypes = [alphaMaterials.Vines.ID]
|
|
||||||
|
|
||||||
WestBit = 1
|
|
||||||
NorthBit = 2
|
|
||||||
EastBit = 4
|
|
||||||
SouthBit = 8
|
|
||||||
|
|
||||||
rotateLeft = arange(16, dtype='uint8')
|
|
||||||
flipEastWest = arange(16, dtype='uint8')
|
|
||||||
flipNorthSouth = arange(16, dtype='uint8')
|
|
||||||
|
|
||||||
|
|
||||||
#Mushroom types:
|
#Mushroom types:
|
||||||
#Value Description Textures
|
#Value Description Textures
|
||||||
#0 Fleshy piece Pores on all sides
|
#0 Fleshy piece Pores on all sides
|
||||||
@ -462,6 +450,19 @@ class HugeMushroom:
|
|||||||
|
|
||||||
generic8wayRotation(HugeMushroom)
|
generic8wayRotation(HugeMushroom)
|
||||||
|
|
||||||
|
|
||||||
|
class Vines:
|
||||||
|
blocktypes = [alphaMaterials.Vines.ID]
|
||||||
|
|
||||||
|
WestBit = 1
|
||||||
|
NorthBit = 2
|
||||||
|
EastBit = 4
|
||||||
|
SouthBit = 8
|
||||||
|
|
||||||
|
rotateLeft = arange(16, dtype='uint8')
|
||||||
|
flipEastWest = arange(16, dtype='uint8')
|
||||||
|
flipNorthSouth = arange(16, dtype='uint8')
|
||||||
|
|
||||||
#Hmm... Since each bit is a direction, we can rotate by shifting!
|
#Hmm... Since each bit is a direction, we can rotate by shifting!
|
||||||
Vines.rotateLeft = 0xf & ((Vines.rotateLeft >> 1) | (Vines.rotateLeft << 3))
|
Vines.rotateLeft = 0xf & ((Vines.rotateLeft >> 1) | (Vines.rotateLeft << 3))
|
||||||
# Wherever each bit is set, clear it and set the opposite bit
|
# Wherever each bit is set, clear it and set the opposite bit
|
||||||
@ -474,6 +475,91 @@ Vines.flipNorthSouth[(Vines.flipNorthSouth & NorthSouthBits) > 0] ^= NorthSouthB
|
|||||||
rotationClasses.append(Vines)
|
rotationClasses.append(Vines)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Anvil:
|
||||||
|
blocktypes = [alphaMaterials.Anvil.ID]
|
||||||
|
|
||||||
|
NorthSouth = 0
|
||||||
|
WestEast = 1
|
||||||
|
|
||||||
|
rotateLeft = arange(16, dtype='uint8')
|
||||||
|
flipEastWest = arange(16, dtype='uint8')
|
||||||
|
flipNorthSouth = arange(16, dtype='uint8')
|
||||||
|
|
||||||
|
rotateLeft[NorthSouth] = WestEast
|
||||||
|
rotateLeft[WestEast] = NorthSouth
|
||||||
|
|
||||||
|
rotationClasses.append(Anvil)
|
||||||
|
|
||||||
|
@genericFlipRotation
|
||||||
|
class FenceGate:
|
||||||
|
blocktypes = [alphaMaterials.FenceGate.ID]
|
||||||
|
|
||||||
|
South = 0
|
||||||
|
West = 1
|
||||||
|
North = 2
|
||||||
|
East = 3
|
||||||
|
|
||||||
|
@genericFlipRotation
|
||||||
|
class EnderPortal:
|
||||||
|
blocktypes = [alphaMaterials.EnderPortal.ID]
|
||||||
|
|
||||||
|
South = 0
|
||||||
|
West = 1
|
||||||
|
North = 2
|
||||||
|
East = 3
|
||||||
|
|
||||||
|
@genericFlipRotation
|
||||||
|
class CocoaPlant:
|
||||||
|
blocktypes = [alphaMaterials.CocoaPlant.ID]
|
||||||
|
|
||||||
|
North = 0
|
||||||
|
East = 1
|
||||||
|
South = 2
|
||||||
|
West = 3
|
||||||
|
|
||||||
|
applyBits48(CocoaPlant) # growth state
|
||||||
|
|
||||||
|
@genericFlipRotation
|
||||||
|
class TripwireHook:
|
||||||
|
blocktypes = [alphaMaterials.TripwireHook.ID]
|
||||||
|
|
||||||
|
South = 0
|
||||||
|
West = 1
|
||||||
|
North = 2
|
||||||
|
East = 3
|
||||||
|
|
||||||
|
applyBits48(TripwireHook) # activation/ready state
|
||||||
|
|
||||||
|
@genericFlipRotation
|
||||||
|
class MobHead:
|
||||||
|
blocktypes = [alphaMaterials.MobHead.ID]
|
||||||
|
|
||||||
|
North = 2
|
||||||
|
South = 3
|
||||||
|
East = 4
|
||||||
|
West = 5
|
||||||
|
|
||||||
|
@genericFlipRotation
|
||||||
|
class Hopper:
|
||||||
|
blocktypes = [alphaMaterials.Hopper.ID]
|
||||||
|
|
||||||
|
South = 2
|
||||||
|
North = 3
|
||||||
|
East = 4
|
||||||
|
West = 5
|
||||||
|
|
||||||
|
@genericFlipRotation
|
||||||
|
class RedstoneComparator:
|
||||||
|
blocktypes = [alphaMaterials.RedstoneComparatorInactive.ID, alphaMaterials.RedstoneComparatorActive.ID]
|
||||||
|
|
||||||
|
South = 0
|
||||||
|
West = 1
|
||||||
|
North = 2
|
||||||
|
East = 3
|
||||||
|
|
||||||
|
applyBits48(RedstoneComparator)
|
||||||
|
|
||||||
def masterRotationTable(attrname):
|
def masterRotationTable(attrname):
|
||||||
# compute a materials.id_limitx16 table mapping each possible blocktype/data combination to
|
# compute a materials.id_limitx16 table mapping each possible blocktype/data combination to
|
||||||
# the resulting data when the block is rotated
|
# the resulting data when the block is rotated
|
||||||
|
Reference in New Issue
Block a user