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

@@ -4,7 +4,7 @@ python:
- "2.7" - "2.7"
# - "3.2" # - "3.2"
env: env:
- MC_VERSION=1.12 - MC_VERSION=1.13
before_install: before_install:
- wget https://raw.githubusercontent.com/python-pillow/Pillow/master/src/libImaging/Imaging.h - wget https://raw.githubusercontent.com/python-pillow/Pillow/master/src/libImaging/Imaging.h
- wget https://raw.githubusercontent.com/python-pillow/Pillow/master/src/libImaging/ImagingUtils.h - wget https://raw.githubusercontent.com/python-pillow/Pillow/master/src/libImaging/ImagingUtils.h
@@ -15,7 +15,8 @@ install:
- python setup.py build - python setup.py build
before_script: before_script:
- git clone git://github.com/overviewer/Minecraft-Overviewer-Addons.git ~/mcoa/ - git clone git://github.com/overviewer/Minecraft-Overviewer-Addons.git ~/mcoa/
- wget -N https://s3.amazonaws.com/Minecraft.Download/versions/${MC_VERSION}/${MC_VERSION}.jar -P ~/.minecraft/versions/${MC_VERSION}/ - mkdir -p ~/.minecraft/versions/${MC_VERSION}/
- wget -N https://launcher.mojang.com/mc/game/1.13/client/c0b970952cdd279912da384cdbfc0c26e6c6090b/client.jar -O ~/.minecraft/versions/${MC_VERSION}/${MC_VERSION}.jar
script: script:
- PYTHONPATH=. python test/test_all.py - PYTHONPATH=. python test/test_all.py
- python overviewer.py ~/mcoa/exmaple ~/test-output --rendermodes=smooth-lighting -p1 - python overviewer.py ~/mcoa/exmaple ~/test-output --rendermodes=smooth-lighting -p1

View File

@@ -175,6 +175,10 @@ def handleEntities(rset, config, config_path, filters, markers):
markers[name]['raw'].append(d) markers[name]['raw'].append(d)
except nbt.CorruptChunkError: except nbt.CorruptChunkError:
logging.warning("Ignoring POIs in corrupt chunk %d,%d", x,z) logging.warning("Ignoring POIs in corrupt chunk %d,%d", x,z)
except world.ChunkDoesntExist:
# iterate_chunks() doesn't inspect chunks and filter out
# placeholder ones. It's okay for this chunk to not exist.
pass
else: else:
buckets = [[] for i in range(numbuckets)]; buckets = [[] for i in range(numbuckets)];

View File

@@ -32,6 +32,7 @@ from PIL import Image
from .util import roundrobin from .util import roundrobin
from . import nbt from . import nbt
from . import world
from .files import FileReplacer, get_fs_caps from .files import FileReplacer, get_fs_caps
from .optimizeimages import optimize_image from .optimizeimages import optimize_image
import rendermodes import rendermodes
@@ -1065,6 +1066,10 @@ class TileSet(object):
# A warning and traceback was already printed by world.py's # A warning and traceback was already printed by world.py's
# get_chunk() # get_chunk()
logging.debug("Skipping the render of corrupt chunk at %s,%s and moving on.", chunkx, chunkz) logging.debug("Skipping the render of corrupt chunk at %s,%s and moving on.", chunkx, chunkz)
except world.ChunkDoesntExist:
# Some chunks are present on disk but not fully initialized.
# This is okay.
pass
except Exception, e: except Exception, e:
logging.error("Could not render chunk %s,%s for some reason. This is likely a render primitive option error.", chunkx, chunkz) logging.error("Could not render chunk %s,%s for some reason. This is likely a render primitive option error.", chunkx, chunkz)
logging.error("Full error was:", exc_info=1) logging.error("Full error was:", exc_info=1)

View File

@@ -497,22 +497,6 @@ class RegionSet(object):
'minecraft:hopper': (154, 0), 'minecraft:hopper': (154, 0),
'minecraft:smooth_quartz': (155, 0), 'minecraft:smooth_quartz': (155, 0),
'minecraft:quartz_stairs': (156, 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:acacia_log': (162, 0),
'minecraft:dark_oak_log': (162, 1), 'minecraft:dark_oak_log': (162, 1),
'minecraft:acacia_stairs': (163, 0), 'minecraft:acacia_stairs': (163, 0),
@@ -649,6 +633,29 @@ class RegionSet(object):
'minecraft:tube_coral_wall_fan': (0, 0), '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 # Re-initialize upon unpickling
def __getstate__(self): def __getstate__(self):
return (self.regiondir, self.rel) return (self.regiondir, self.rel)
@@ -697,10 +704,10 @@ class RegionSet(object):
if p['east'] == 'true': data |= 8 if p['east'] == 'true': data |= 8
elif key.endswith('_stairs'): elif key.endswith('_stairs'):
facing = palette_entry['Properties']['facing'] facing = palette_entry['Properties']['facing']
if facing == 'north': data |= 0x20 | 0x40 if facing == 'south': data |= 0x60
elif facing == 'west': data |= 0x10 | 0x20 elif facing == 'east': data |= 0x30
elif facing == 'south': data |= 0x08 | 0x10 elif facing == 'north': data |= 0x18
elif facing == 'east': data |= 0x08 | 0x40 elif facing == 'west': data |= 0x48
elif key.endswith('_door'): elif key.endswith('_door'):
p = palette_entry['Properties'] p = palette_entry['Properties']
if p['hinge'] == 'left': data |= 0x10 if p['hinge'] == 'left': data |= 0x10
@@ -738,7 +745,7 @@ class RegionSet(object):
bits_per_value = (len(long_array) * 64) / n bits_per_value = (len(long_array) * 64) / n
if bits_per_value < 4 or 12 < bits_per_value: if bits_per_value < 4 or 12 < bits_per_value:
raise nbt.CorruptChunkError() 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: if bits_per_value == 8:
result = b.astype(numpy.uint16) result = b.astype(numpy.uint16)
else: else:
@@ -894,18 +901,27 @@ class RegionSet(object):
# no exception raised: break out of the loop # no exception raised: break out of the loop
break break
if data is None: if data is None:
raise ChunkDoesntExist("Chunk %s,%s doesn't exist" % (x,z)) raise ChunkDoesntExist("Chunk %s,%s doesn't exist" % (x,z))
level = data[1]['Level'] level = data[1]['Level']
chunk_data = 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 # Turn the Biomes array into a 16x16 numpy array
biomes = numpy.asarray(chunk_data['Biomes']) 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 chunk_data['Biomes'] = biomes