0

Merge branch 'minecraft113' of https://github.com/gmcnew/Minecraft-Overviewer into minecraft113

This commit is contained in:
Softer
2018-08-08 14:51:26 +03:00
4 changed files with 54 additions and 28 deletions

View File

@@ -497,22 +497,6 @@ class RegionSet(object):
'minecraft:hopper': (154, 0),
'minecraft:smooth_quartz': (155, 0),
'minecraft:quartz_stairs': (156, 0),
'minecraft:white_terracotta': (159, 0),
'minecraft:orange_terracotta': (159, 1),
'minecraft:magenta_terracotta': (159, 2),
'minecraft:light_blue_terracotta': (159, 3),
'minecraft:yellow_terracotta': (159, 4),
'minecraft:lime_terracotta': (159, 5),
'minecraft:pink_terracotta': (159, 6),
'minecraft:gray_terracotta': (159, 7),
'minecraft:light_gray_terracotta': (159, 8),
'minecraft:cyan_terracotta': (159, 9),
'minecraft:purple_terracotta': (159, 10),
'minecraft:blue_terracotta': (159, 11),
'minecraft:brown_terracotta': (159, 12),
'minecraft:green_terracotta': (159, 13),
'minecraft:red_terracotta': (159, 14),
'minecraft:black_terracotta': (159, 15),
'minecraft:acacia_log': (162, 0),
'minecraft:dark_oak_log': (162, 1),
'minecraft:acacia_stairs': (163, 0),
@@ -649,6 +633,29 @@ class RegionSet(object):
'minecraft:tube_coral_wall_fan': (0, 0),
}
# The following blocks are underwater and are not yet rendered.
# To avoid spurious warnings, we'll treat them as water for now.
treat_as_water = [
'brain_coral', 'brain_coral_block', 'brain_coral_fan', 'brain_coral_wall_fan',
'bubble_coral', 'bubble_coral_block', 'bubble_coral_fan', 'bubble_coral_wall_fan',
'fire_coral', 'fire_coral_block', 'fire_coral_fan', 'fire_coral_wall_fan',
'horn_coral', 'horn_coral_block', 'horn_coral_fan', 'horn_coral_wall_fan',
'tube_coral', 'tube_coral_block', 'tube_coral_fan', 'tube_coral_wall_fan',
'kelp', 'kelp_plant', 'sea_pickle', 'seagrass', 'tall_seagrass',
'bubble_column',
]
for t in treat_as_water:
self._blockmap['minecraft:%s' % t] = (8, 0)
colors = [ 'white', 'orange', 'magenta', 'light_blue',
'yellow', 'lime', 'pink', 'gray',
'light_gray', 'cyan', 'purple', 'blue',
'brown', 'green', 'red', 'black']
for i in range(len(colors)):
self._blockmap['minecraft:%s_terracotta' % colors[i]] = (159, i)
self._blockmap['minecraft:%s_concrete' % colors[i]] = (251, i)
# Re-initialize upon unpickling
def __getstate__(self):
return (self.regiondir, self.rel)
@@ -697,10 +704,10 @@ class RegionSet(object):
if p['east'] == 'true': data |= 8
elif key.endswith('_stairs'):
facing = palette_entry['Properties']['facing']
if facing == 'north': data |= 0x20 | 0x40
elif facing == 'west': data |= 0x10 | 0x20
elif facing == 'south': data |= 0x08 | 0x10
elif facing == 'east': data |= 0x08 | 0x40
if facing == 'south': data |= 0x60
elif facing == 'east': data |= 0x30
elif facing == 'north': data |= 0x18
elif facing == 'west': data |= 0x48
elif key.endswith('_door'):
p = palette_entry['Properties']
if p['hinge'] == 'left': data |= 0x10
@@ -738,7 +745,7 @@ class RegionSet(object):
bits_per_value = (len(long_array) * 64) / n
if bits_per_value < 4 or 12 < bits_per_value:
raise nbt.CorruptChunkError()
b = numpy.frombuffer(numpy.asarray(long_array), dtype=numpy.uint8)
b = numpy.frombuffer(numpy.asarray(long_array, dtype=numpy.uint64), dtype=numpy.uint8)
if bits_per_value == 8:
result = b.astype(numpy.uint16)
else:
@@ -894,19 +901,28 @@ class RegionSet(object):
# no exception raised: break out of the loop
break
if data is None:
raise ChunkDoesntExist("Chunk %s,%s doesn't exist" % (x,z))
level = data[1]['Level']
chunk_data = level
# From the interior of a map to the edge, a chunk's status may be one of:
# - postprocessed (interior, or next to fullchunk)
# - fullchunk (next to decorated)
# - decorated (next to liquid_carved)
# - liquid_carved (next to carved)
# - carved (edge of world)
# - empty
# Empty is self-explanatory, and liquid_carved and carved seem to correspond
# to SkyLight not being calculated, which results in mostly-black chunks,
# so we'll just pretend they aren't there.
if chunk_data['Status'] in ("empty", "carved", "liquid_carved", "decorated"):
raise ChunkDoesntExist("Chunk %s,%s doesn't exist" % (x,z))
# Turn the Biomes array into a 16x16 numpy array
biomes = numpy.asarray(chunk_data['Biomes'])
if len(biomes) == 0:
biomes = numpy.zeros((16, 16), dtype=numpy.uint8)
else:
biomes = biomes.reshape((16,16))
biomes = biomes.reshape((16,16))
chunk_data['Biomes'] = biomes
unrecognized_block_types = {}