Skip to content

Commit

Permalink
Merge branch 'minecraft113' of https://github.com/gmcnew/Minecraft-Ov…
Browse files Browse the repository at this point in the history
…erviewer into minecraft113
  • Loading branch information
softer committed Aug 8, 2018
2 parents 58db16a + 28dd058 commit bf9a39a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 28 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ python:
- "2.7"
# - "3.2"
env:
- MC_VERSION=1.12
- MC_VERSION=1.13
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/ImagingUtils.h
Expand All @@ -15,7 +15,8 @@ install:
- python setup.py build
before_script:
- 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:
- PYTHONPATH=. python test/test_all.py
- python overviewer.py ~/mcoa/exmaple ~/test-output --rendermodes=smooth-lighting -p1
Expand Down
4 changes: 4 additions & 0 deletions overviewer_core/aux_files/genPOI.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ def handleEntities(rset, config, config_path, filters, markers):
markers[name]['raw'].append(d)
except nbt.CorruptChunkError:
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:
buckets = [[] for i in range(numbuckets)];
Expand Down
5 changes: 5 additions & 0 deletions overviewer_core/tileset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from .util import roundrobin
from . import nbt
from . import world
from .files import FileReplacer, get_fs_caps
from .optimizeimages import optimize_image
import rendermodes
Expand Down Expand Up @@ -1065,6 +1066,10 @@ def _render_rendertile(self, tile):
# A warning and traceback was already printed by world.py's
# get_chunk()
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:
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)
Expand Down
68 changes: 42 additions & 26 deletions overviewer_core/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,22 +497,6 @@ def __init__(self, regiondir, rel):
'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),
Expand Down Expand Up @@ -649,6 +633,29 @@ def __init__(self, regiondir, rel):
'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)
Expand Down Expand Up @@ -697,10 +704,10 @@ def _get_block(self, palette_entry):
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
Expand Down Expand Up @@ -738,7 +745,7 @@ def _packed_longarray_to_shorts(self, long_array, n):
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:
Expand Down Expand Up @@ -894,19 +901,28 @@ def get_chunk(self, x, z):
# 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 = {}
Expand Down

0 comments on commit bf9a39a

Please sign in to comment.