@@ -497,22 +497,6 @@ def __init__(self, regiondir, rel):
497497 'minecraft:hopper' : (154 , 0 ),
498498 'minecraft:smooth_quartz' : (155 , 0 ),
499499 'minecraft:quartz_stairs' : (156 , 0 ),
500- 'minecraft:white_terracotta' : (159 , 0 ),
501- 'minecraft:orange_terracotta' : (159 , 1 ),
502- 'minecraft:magenta_terracotta' : (159 , 2 ),
503- 'minecraft:light_blue_terracotta' : (159 , 3 ),
504- 'minecraft:yellow_terracotta' : (159 , 4 ),
505- 'minecraft:lime_terracotta' : (159 , 5 ),
506- 'minecraft:pink_terracotta' : (159 , 6 ),
507- 'minecraft:gray_terracotta' : (159 , 7 ),
508- 'minecraft:light_gray_terracotta' : (159 , 8 ),
509- 'minecraft:cyan_terracotta' : (159 , 9 ),
510- 'minecraft:purple_terracotta' : (159 , 10 ),
511- 'minecraft:blue_terracotta' : (159 , 11 ),
512- 'minecraft:brown_terracotta' : (159 , 12 ),
513- 'minecraft:green_terracotta' : (159 , 13 ),
514- 'minecraft:red_terracotta' : (159 , 14 ),
515- 'minecraft:black_terracotta' : (159 , 15 ),
516500 'minecraft:acacia_log' : (162 , 0 ),
517501 'minecraft:dark_oak_log' : (162 , 1 ),
518502 'minecraft:acacia_stairs' : (163 , 0 ),
@@ -649,6 +633,29 @@ def __init__(self, regiondir, rel):
649633 'minecraft:tube_coral_wall_fan' : (0 , 0 ),
650634 }
651635
636+
637+ # The following blocks are underwater and are not yet rendered.
638+ # To avoid spurious warnings, we'll treat them as water for now.
639+ treat_as_water = [
640+ 'brain_coral' , 'brain_coral_block' , 'brain_coral_fan' , 'brain_coral_wall_fan' ,
641+ 'bubble_coral' , 'bubble_coral_block' , 'bubble_coral_fan' , 'bubble_coral_wall_fan' ,
642+ 'fire_coral' , 'fire_coral_block' , 'fire_coral_fan' , 'fire_coral_wall_fan' ,
643+ 'horn_coral' , 'horn_coral_block' , 'horn_coral_fan' , 'horn_coral_wall_fan' ,
644+ 'tube_coral' , 'tube_coral_block' , 'tube_coral_fan' , 'tube_coral_wall_fan' ,
645+ 'kelp' , 'kelp_plant' , 'sea_pickle' , 'seagrass' , 'tall_seagrass' ,
646+ 'bubble_column' ,
647+ ]
648+ for t in treat_as_water :
649+ self ._blockmap ['minecraft:%s' % t ] = (8 , 0 )
650+
651+ colors = [ 'white' , 'orange' , 'magenta' , 'light_blue' ,
652+ 'yellow' , 'lime' , 'pink' , 'gray' ,
653+ 'light_gray' , 'cyan' , 'purple' , 'blue' ,
654+ 'brown' , 'green' , 'red' , 'black' ]
655+ for i in range (len (colors )):
656+ self ._blockmap ['minecraft:%s_terracotta' % colors [i ]] = (159 , i )
657+ self ._blockmap ['minecraft:%s_concrete' % colors [i ]] = (251 , i )
658+
652659 # Re-initialize upon unpickling
653660 def __getstate__ (self ):
654661 return (self .regiondir , self .rel )
@@ -697,10 +704,10 @@ def _get_block(self, palette_entry):
697704 if p ['east' ] == 'true' : data |= 8
698705 elif key .endswith ('_stairs' ):
699706 facing = palette_entry ['Properties' ]['facing' ]
700- if facing == 'north ' : data |= 0x20 | 0x40
701- elif facing == 'west ' : data |= 0x10 | 0x20
702- elif facing == 'south ' : data |= 0x08 | 0x10
703- elif facing == 'east ' : data |= 0x08 | 0x40
707+ if facing == 'south ' : data |= 0x60
708+ elif facing == 'east ' : data |= 0x30
709+ elif facing == 'north ' : data |= 0x18
710+ elif facing == 'west ' : data |= 0x48
704711 elif key .endswith ('_door' ):
705712 p = palette_entry ['Properties' ]
706713 if p ['hinge' ] == 'left' : data |= 0x10
@@ -738,7 +745,7 @@ def _packed_longarray_to_shorts(self, long_array, n):
738745 bits_per_value = (len (long_array ) * 64 ) / n
739746 if bits_per_value < 4 or 12 < bits_per_value :
740747 raise nbt .CorruptChunkError ()
741- b = numpy .frombuffer (numpy .asarray (long_array ), dtype = numpy .uint8 )
748+ b = numpy .frombuffer (numpy .asarray (long_array , dtype = numpy . uint64 ), dtype = numpy .uint8 )
742749 if bits_per_value == 8 :
743750 result = b .astype (numpy .uint16 )
744751 else :
@@ -894,19 +901,28 @@ def get_chunk(self, x, z):
894901 # no exception raised: break out of the loop
895902 break
896903
897-
898904 if data is None :
899905 raise ChunkDoesntExist ("Chunk %s,%s doesn't exist" % (x ,z ))
900906
901907 level = data [1 ]['Level' ]
902908 chunk_data = level
903909
910+ # From the interior of a map to the edge, a chunk's status may be one of:
911+ # - postprocessed (interior, or next to fullchunk)
912+ # - fullchunk (next to decorated)
913+ # - decorated (next to liquid_carved)
914+ # - liquid_carved (next to carved)
915+ # - carved (edge of world)
916+ # - empty
917+ # Empty is self-explanatory, and liquid_carved and carved seem to correspond
918+ # to SkyLight not being calculated, which results in mostly-black chunks,
919+ # so we'll just pretend they aren't there.
920+ if chunk_data ['Status' ] in ("empty" , "carved" , "liquid_carved" , "decorated" ):
921+ raise ChunkDoesntExist ("Chunk %s,%s doesn't exist" % (x ,z ))
922+
904923 # Turn the Biomes array into a 16x16 numpy array
905924 biomes = numpy .asarray (chunk_data ['Biomes' ])
906- if len (biomes ) == 0 :
907- biomes = numpy .zeros ((16 , 16 ), dtype = numpy .uint8 )
908- else :
909- biomes = biomes .reshape ((16 ,16 ))
925+ biomes = biomes .reshape ((16 ,16 ))
910926 chunk_data ['Biomes' ] = biomes
911927
912928 unrecognized_block_types = {}
0 commit comments