0

Add 1.3 orientable wood blocks.

This commit is contained in:
Alejandro Aguilera
2012-07-26 21:17:53 +02:00
parent 5d32e722ff
commit be45052ce3

View File

@@ -852,17 +852,36 @@ block(blockid=15, top_index=33)
# coal ore # coal ore
block(blockid=16, top_index=34) block(blockid=16, top_index=34)
@material(blockid=17, data=range(4), solid=True) @material(blockid=17, data=range(12), solid=True)
def wood(self, blockid, data): def wood(self, blockid, data):
# extract orientation and wood type frorm data bits
wood_type = data & 3
wood_orientation = data & 12
if self.rotation == 1:
if wood_orientation == 4: wood_orientation = 8
elif wood_orientation == 8: wood_orientation = 4
elif self.rotation == 2:
if wood_orientation == 4: wood_orientation = 8
elif wood_orientation == 8: wood_orientation = 4
# choose textures
top = self.terrain_images[21] top = self.terrain_images[21]
if data == 0: # normal if wood_type == 0: # normal
return self.build_block(top, self.terrain_images[20]) side = self.terrain_images[20]
if data == 1: # birch if wood_type == 1: # birch
return self.build_block(top, self.terrain_images[116]) side = self.terrain_images[116]
if data == 2: # pine if wood_type == 2: # pine
return self.build_block(top, self.terrain_images[117]) side = self.terrain_images[117]
if data == 3: # jungle wood if wood_type == 3: # jungle wood
return self.build_block(top, self.terrain_images[153]) side = self.terrain_images[153]
# choose orientation and paste textures
if wood_orientation == 0:
return self.build_block(top, side)
elif wood_orientation == 4: # east-west orientation
return self.build_full_block(side.rotate(90), None, None, top, side.rotate(90))
elif wood_orientation == 8: # north-south orientation
return self.build_full_block(side, None, None, side.rotate(270), top)
@material(blockid=18, data=range(16), transparent=True, solid=True) @material(blockid=18, data=range(16), transparent=True, solid=True)
def leaves(self, blockid, data): def leaves(self, blockid, data):