0

Add Jigsaw block

This commit is contained in:
Joseph Camp
2020-06-20 14:22:10 +00:00
parent 46d48bf1f8
commit 70ce68da4b
3 changed files with 37 additions and 2 deletions

View File

@@ -257,6 +257,7 @@ enum mc_block_id {
block_concrete = 251,
block_concrete_powder = 252,
block_structure_block = 255,
block_jigsaw = 256,
block_prismarine_stairs = 11337,
block_dark_prismarine_stairs = 11338,
block_prismarine_brick_stairs = 11339,

View File

@@ -5090,6 +5090,39 @@ def structure_block(self, blockid, data):
img = self.load_image_texture("assets/minecraft/textures/block/structure_block_data.png")
return self.build_block(img, img)
# Jigsaw block
@material(blockid=256, data=list(range(6)), solid=True)
def jigsaw_block(self, blockid, data):
# Do rotation
if self.rotation in [1, 2, 3] and data in [2, 3, 4, 5]:
rotation_map = {1: {2: 5, 3: 4, 4: 2, 5: 3},
2: {2: 3, 3: 2, 4: 5, 5: 4},
3: {2: 4, 3: 5, 4: 3, 5: 2}}
data = rotation_map[self.rotation][data]
top = self.load_image_texture("assets/minecraft/textures/block/jigsaw_top.png")
bottom = self.load_image_texture("assets/minecraft/textures/block/jigsaw_bottom.png")
side = self.load_image_texture("assets/minecraft/textures/block/jigsaw_side.png")
if data == 0: # Down
img = self.build_full_block(bottom.rotate(self.rotation * 90), None, None,
side.rotate(180), side.rotate(180))
elif data == 1: # Up
img = self.build_full_block(top.rotate(self.rotation * 90), None, None, side, side)
elif data == 2: # North
img = self.build_full_block(side, None, None, side.rotate(90), bottom.rotate(180))
elif data == 3: # South
img = self.build_full_block(side.rotate(180), None, None, side.rotate(270), top.rotate(270))
elif data == 4: # West
img = self.build_full_block(side.rotate(90), None, None, top.rotate(180), side.rotate(270))
elif data == 5: # East
img = self.build_full_block(side.rotate(270), None, None, bottom.rotate(180),
side.rotate(90))
return img
# beetroots(207), berry bushes (11505)
@material(blockid=[207, 11505], data=list(range(4)), transparent=True, nospawn=True)
def crops(self, blockid, data):

View File

@@ -690,6 +690,7 @@ class RegionSet(object):
'minecraft:black_glazed_terracotta': (250, 0),
'minecraft:structure_block': (255, 0),
'minecraft:jigsaw': (256, 0),
'minecraft:armor_stand': (416, 0), # not rendering
@@ -1031,7 +1032,7 @@ class RegionSet(object):
data = int(palette_entry['Properties']['age'])
elif (key.endswith('shulker_box') or key.endswith('piston') or
key in ['minecraft:observer', 'minecraft:dropper', 'minecraft:dispenser',
'minecraft:piston_head']):
'minecraft:piston_head', 'minecraft:jigsaw']):
p = palette_entry['Properties']
data = {'down': 0, 'up': 1, 'north': 2, 'south': 3, 'west': 4, 'east': 5}[p['facing']]
if ((key.endswith('piston') and p.get('extended', 'false') == 'true') or