@@ -1927,8 +1927,8 @@ def slabs(self, blockid, data):
19271927
19281928 return self .build_slab_block (top , side , data & 8 == 8 );
19291929
1930- # torch, redstone torch (off), redstone torch(on), soul_torch
1931- @material (blockid = [50 , 75 , 76 , 1039 ], data = [1 , 2 , 3 , 4 , 5 ], transparent = True )
1930+ # torch, redstone torch (off), redstone torch(on), soul_torch, copper_torch
1931+ @material (blockid = [50 , 75 , 76 , 1039 , 264 ], data = [1 , 2 , 3 , 4 , 5 ], transparent = True )
19321932def torches (self , blockid , data ):
19331933 # first, rotations
19341934 if self .rotation == 1 :
@@ -1956,6 +1956,9 @@ def torches(self, blockid, data):
19561956 small = self .load_image_texture (BLOCKTEXTURE + "redstone_torch.png" )
19571957 elif blockid == 1039 : # soul torch
19581958 small = self .load_image_texture (BLOCKTEXTURE + "soul_torch.png" )
1959+ elif blockid == 264 : # soul torch
1960+ small = self .load_image_texture (BLOCKTEXTURE + "copper_torch.png" )
1961+
19591962 # compose a torch bigger than the normal
19601963 # (better for doing transformations)
19611964 torch = Image .new ("RGBA" , (16 ,16 ), self .bgcolor )
@@ -1999,13 +2002,19 @@ def torches(self, blockid, data):
19992002 return img
20002003
20012004# lantern
2002- @material (blockid = [11373 , 1038 ], data = [0 , 1 ], transparent = True )
2005+ @material (blockid = [11373 , 1038 , 1156 , 1157 , 1158 , 1159 ], data = [0 , 1 ], transparent = True )
20032006def lantern (self , blockid , data ):
20042007 # get the multipart texture of the lantern
2005- if blockid == 11373 :
2006- inputtexture = self .load_image_texture (BLOCKTEXTURE + "lantern.png" )
2007- if blockid == 1038 :
2008- inputtexture = self .load_image_texture (BLOCKTEXTURE + "soul_lantern.png" )
2008+ texmap = {
2009+ 11373 : "lantern.png" ,
2010+ 1038 : "soul_lantern.png" ,
2011+ 1156 : "copper_lantern.png" ,
2012+ 1157 : "exposed_copper_lantern.png" ,
2013+ 1158 : "weathered_copper_lantern.png" ,
2014+ 1159 : "oxidized_copper_lantern.png" ,
2015+ }
2016+
2017+ inputtexture = self .load_image_texture (BLOCKTEXTURE + texmap [blockid ])
20092018
20102019
20112020 # # now create a textures, using the parts defined in lantern.json
@@ -2349,7 +2358,7 @@ def rect(tex,coords):
23492358
23502359# normal, locked (used in april's fool day), ender and trapped chest
23512360# NOTE: locked chest used to be id95 (which is now stained glass)
2352- @material (blockid = [54 , 130 , 146 ], data = list (range (30 )), transparent = True )
2361+ @material (blockid = [54 , 130 , 146 , 11425 , 11426 , 11427 , 11428 ], data = list (range (30 )), transparent = True )
23532362def chests (self , blockid , data ):
23542363 # the first 3 bits are the orientation as stored in minecraft,
23552364 # bits 0x8 and 0x10 indicate which half of the double chest is it.
@@ -2376,12 +2385,20 @@ def chests(self, blockid, data):
23762385 # iterate.c will only return the ancil data (without pseudo
23772386 # ancil data) for locked and ender chests, so only
23782387 # ancilData = 2,3,4,5 are used for this blockids
2379-
2388+
2389+ texture_base_name = {
2390+ 11425 : "copper" ,
2391+ 11426 : "copper_exposed" ,
2392+ 11427 : "copper_weathered" ,
2393+ 11428 : "copper_oxidized" ,
2394+ }.get (blockid , "normal" )
2395+
23802396 if data & 24 == 0 :
2381- if blockid == 130 : t = self .load_image ("assets/minecraft/textures/entity/chest/ender.png" )
2397+ if blockid == 130 :
2398+ t = self .load_image ("assets/minecraft/textures/entity/chest/ender.png" )
23822399 else :
23832400 try :
2384- t = self .load_image ("assets/minecraft/textures/entity/chest/normal .png" )
2401+ t = self .load_image (f "assets/minecraft/textures/entity/chest/{ texture_base_name } .png" )
23852402 except (TextureException , IOError ):
23862403 t = self .load_image ("assets/minecraft/textures/entity/chest/chest.png" )
23872404
@@ -2440,8 +2457,8 @@ def chests(self, blockid, data):
24402457 # large chest
24412458 # the textures is no longer in terrain.png, get it from
24422459 # item/chest.png and get all the needed stuff
2443- t_left = self .load_image ("assets/minecraft/textures/entity/chest/normal_left .png" )
2444- t_right = self .load_image ("assets/minecraft/textures/entity/chest/normal_right .png" )
2460+ t_left = self .load_image (f "assets/minecraft/textures/entity/chest/{ texture_base_name } _left .png" )
2461+ t_right = self .load_image (f "assets/minecraft/textures/entity/chest/{ texture_base_name } _right .png" )
24452462 # for some reason the 1.15 images are upside down
24462463 t_left = ImageOps .flip (t_left )
24472464 t_right = ImageOps .flip (t_right )
@@ -4852,12 +4869,20 @@ def huge_mushroom(self, blockid, data):
48524869# iron bars and glass pane
48534870# TODO glass pane is not a sprite, it has a texture for the side,
48544871# at the moment is not used
4855- @material (blockid = [101 ,102 , 160 ], data = list (range (256 )), transparent = True , nospawn = True )
4872+ @material (blockid = [101 ,102 , 160 , 260 , 261 , 262 , 263 ], data = list (range (256 )), transparent = True , nospawn = True )
48564873def panes (self , blockid , data ):
48574874 # no rotation, uses pseudo data
48584875 if blockid == 101 :
48594876 # iron bars
48604877 t = self .load_image_texture (BLOCKTEXTURE + "iron_bars.png" )
4878+ elif blockid == 260 :
4879+ t = self .load_image_texture (BLOCKTEXTURE + "copper_bars.png" )
4880+ elif blockid == 261 :
4881+ t = self .load_image_texture (BLOCKTEXTURE + "exposed_copper_bars.png" )
4882+ elif blockid == 262 :
4883+ t = self .load_image_texture (BLOCKTEXTURE + "weathered_copper_bars.png" )
4884+ elif blockid == 263 :
4885+ t = self .load_image_texture (BLOCKTEXTURE + "oxidized_copper_bars.png" )
48614886 elif blockid == 160 :
48624887 t = self .load_image_texture (BLOCKTEXTURE + "%s_stained_glass.png" % color_map [data & 0xf ])
48634888 else :
@@ -6772,14 +6797,26 @@ def froglight(self, blockid, data):
67726797 return self .build_axis_block (top , side , data )
67736798
67746799# Chain
6775- @material (blockid = 11419 , data = list (range (3 )), solid = True , transparent = True , nospawn = True )
6800+ @material (blockid = [ 11419 , 11420 , 11421 , 11422 , 11423 , 11424 ] , data = list (range (3 )), solid = True , transparent = True , nospawn = True )
67766801def chain (self , blockid , data ):
6777- # In versions prior to 1.21.10 chain was adequate, versions after 1.21.10 chain may be iron
6802+ # Updated in 1.21.9: chain -> iron_chain
6803+ # Most people are probably going to have newer versions, so let's try new first.
6804+
6805+ texture_dict = {
6806+ 11419 : "chain" ,
6807+ 11420 : "iron_chain" ,
6808+ 11421 : "copper_chain" ,
6809+ 11422 : "exposed_copper_chain" ,
6810+ 11423 : "weathered_copper_chain" ,
6811+ 11424 : "oxidized_copper_chain" ,
6812+ }
6813+
67786814 try :
6779- tex = self .load_image_texture (BLOCKTEXTURE + "chain.png" )
6780- except :
6781- tex = self .load_image_texture (BLOCKTEXTURE + "iron_chain.png" )
6782-
6815+ tex = self .load_image_texture (BLOCKTEXTURE + texture_dict [blockid ] + ".png" )
6816+ except (TextureException , IOError ):
6817+ # Texture load failed, assume texture doesn't exist.
6818+ return None
6819+
67836820 sidetex = Image .new (tex .mode , tex .size , self .bgcolor )
67846821 mask = tex .crop ((0 , 0 , 6 , 16 ))
67856822 alpha_over (sidetex , mask , (5 , 0 ), mask )
@@ -6936,9 +6973,17 @@ def cave_vines(self, blockid, data):
69366973 tex = self .load_image_texture (BLOCKTEXTURE + "cave_vines.png" )
69376974 return self .build_sprite (tex )
69386975
6939- @material (blockid = 1118 , data = list (range (6 )), transparent = True , solid = True )
6976+ @material (blockid = [ 1118 , 1153 , 1154 , 1155 ] , data = list (range (6 )), transparent = True , solid = True )
69406977def lightning_rod (self , blockid , data ):
6941- tex = self .load_image_texture (BLOCKTEXTURE + "lightning_rod.png" )
6978+ texmap = {
6979+ 1118 : "lightning_rod" ,
6980+ 1153 : "exposed_lightning_rod" ,
6981+ 1154 : "weathered_lightning_rod" ,
6982+ 1155 : "oxidized_lightning_rod" ,
6983+ }
6984+
6985+
6986+ tex = self .load_image_texture (BLOCKTEXTURE + texmap [blockid ] + '.png' )
69426987 img = Image .new ("RGBA" , (24 , 24 ), self .bgcolor )
69436988
69446989 mask = tex .crop ((0 , 4 , 2 , 16 ))
@@ -7600,6 +7645,91 @@ def test_block(self, _, data):
76007645 tex = self .load_image_texture (BLOCKTEXTURE + 'test_block_' + ['start' ,'accept' ,'fail' ,'log' ][data ] + '.png' )
76017646 return self .build_block (tex , tex )
76027647
7648+ @material (blockid = list (range (12700 , 12712 )), data = list (range (0b111 )), transparent = True )
7649+ def shelf (self , block_id , data ):
7650+ texmap = {
7651+ 12700 : 'oak_shelf' ,
7652+ 12701 : 'spruce_shelf' ,
7653+ 12702 : 'birch_shelf' ,
7654+ 12703 : 'jungle_shelf' ,
7655+ 12704 : 'acacia_shelf' ,
7656+ 12705 : 'dark_oak_shelf' ,
7657+ 12706 : 'crimson_shelf' ,
7658+ 12707 : 'warped_shelf' ,
7659+ 12708 : 'mangrove_shelf' ,
7660+ 12709 : 'cherry_shelf' ,
7661+ 12710 : 'bamboo_shelf' ,
7662+ 12711 : 'pale_oak_shelf' ,
7663+ }
7664+
7665+ tex = self .load_image (BLOCKTEXTURE + texmap [block_id ] + '.png' )
7666+
7667+ powered = (data & 0b100 ) == 0b100
7668+ direction = data & 0b011
7669+
7670+ direction = (direction + self .rotation ) % 4
7671+
7672+ front = Image .new ("RGBA" , (16 , 16 ), self .bgcolor )
7673+ alpha_over (front , tex .crop ((0 , 0 , 16 , 16 )), (0 , 0 ))
7674+
7675+ if powered :
7676+ # fake this for now
7677+ chain = 'center'
7678+
7679+ if chain == 'left' :
7680+ alpha_over (front , tex .crop ((0 , 16 , 16 , 23 )), (0 , 4 ))
7681+ pass
7682+ elif chain == 'right' :
7683+ alpha_over (front , tex .crop ((16 , 16 , 32 , 24 )), (0 , 4 ))
7684+ pass
7685+ elif chain == 'center' :
7686+ alpha_over (front , tex .crop ((0 , 24 , 16 , 34 )), (0 , 4 ))
7687+ pass
7688+ elif chain == 'none' :
7689+ alpha_over (front , tex .crop ((16 , 24 , 32 , 32 )), (0 , 4 ))
7690+ pass
7691+
7692+ rear = Image .new ("RGBA" , (16 , 16 ), self .bgcolor )
7693+ alpha_over (rear , tex .crop ((16 , 0 , 32 , 16 )), (0 , 0 ))
7694+
7695+ right = Image .new ("RGBA" , (16 , 16 ), self .bgcolor )
7696+ alpha_over (right , tex .crop ((28 , 0 , 32 , 16 )), (0 , 0 ))
7697+
7698+ left = Image .new ("RGBA" , (16 , 16 ), self .bgcolor )
7699+ alpha_over (left , tex .crop ((16 , 0 , 20 , 16 )), (0 , 0 ))
7700+
7701+ top = Image .new ("RGBA" , (16 , 16 ), self .bgcolor )
7702+ alpha_over (top , tex .crop ((16 , 7 , 32 , 12 )), (0 , 0 ))
7703+
7704+ # None == front; we handle this later
7705+ sides = [left , None , right , rear ]
7706+
7707+ for i in range (direction ):
7708+ sides = sides [1 :] + sides [:1 ]
7709+ top = top .rotate (270 )
7710+
7711+ # Make the sides line up properly
7712+ if sides [2 ] is None :
7713+ sides [1 ] = sides [1 ].transpose (Image .FLIP_LEFT_RIGHT )
7714+ sides [3 ] = sides [3 ].transpose (Image .FLIP_LEFT_RIGHT )
7715+
7716+ if sides [3 ] is None :
7717+ sides [0 ] = sides [0 ].transpose (Image .FLIP_LEFT_RIGHT )
7718+ sides [2 ] = sides [2 ].transpose (Image .FLIP_LEFT_RIGHT )
7719+
7720+ block = self .build_full_block (top , sides [3 ], sides [2 ], sides [0 ], sides [1 ])
7721+
7722+ # stitch on the front in the correct place
7723+ if sides [0 ] is None :
7724+ front = self .transform_image_side (front )
7725+ alpha_over (block , front , (9 , 2 ), front )
7726+
7727+ if sides [1 ] is None :
7728+ front = self .transform_image_side (front .transpose (Image .FLIP_LEFT_RIGHT )).transpose (Image .FLIP_LEFT_RIGHT )
7729+ alpha_over (block , front , (3 , 2 ), front )
7730+
7731+ return block
7732+
76037733
76047734sprite (blockid = 11385 , imagename = BLOCKTEXTURE + "oak_sapling.png" )
76057735sprite (blockid = 11386 , imagename = BLOCKTEXTURE + "spruce_sapling.png" )
0 commit comments