From bc56346badb15602fb3d33ab6a5444ad31fee04c Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Thu, 25 Jun 2020 22:49:06 +0200 Subject: [PATCH] Initial 1.16 block work - Add ancient debris - Add basalt - Add polished basalt - Add soul campfire --- .travis.yml | 2 +- docs/running.rst | 6 +++--- overviewer.py | 3 +++ overviewer_core/src/mc_id.h | 6 ++++++ overviewer_core/src/overviewer.h | 2 +- overviewer_core/textures.py | 32 +++++++++++++++++++++++++++----- overviewer_core/world.py | 13 +++++++++++-- 7 files changed, 52 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f02d23..a5eee75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ python: - "3.7" - "3.8" env: - - MC_VERSION=1.15 + - MC_VERSION=1.16.1 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 diff --git a/docs/running.rst b/docs/running.rst index ddeaa07..373cf48 100644 --- a/docs/running.rst +++ b/docs/running.rst @@ -273,14 +273,14 @@ If you want or need to provide your own textures, you have several options: :: - VERSION=1.15 + VERSION=1.16.1 mkdir -p ~/.minecraft/versions/${VERSION}/ wget https://overviewer.org/textures/${VERSION} -O ~/.minecraft/versions/${VERSION}/${VERSION}.jar If that's too confusing for you, then just take this single line and paste it into - a terminal to get 1.15 textures:: + a terminal to get 1.16 textures:: - wget https://overviewer.org/textures/1.15 -O ~/.minecraft/versions/1.15/1.15.jar + wget https://overviewer.org/textures/1.16.1 -O ~/.minecraft/versions/1.16.1/1.16.1.jar * You can also just run the launcher to install the client. diff --git a/overviewer.py b/overviewer.py index d4f30c8..29123af 100755 --- a/overviewer.py +++ b/overviewer.py @@ -239,6 +239,9 @@ def main(): f = tex.find_file("assets/minecraft/textures/block/grass_block_top.png", verbose=True) f = tex.find_file("assets/minecraft/textures/block/diamond_ore.png", verbose=True) f = tex.find_file("assets/minecraft/textures/block/acacia_planks.png", verbose=True) + # 1.16 + f = tex.find_file("assets/minecraft/textures/block/ancient_debris_top.png", + verbose=True) except IOError: logging.error("Could not find any texture files.") return 1 diff --git a/overviewer_core/src/mc_id.h b/overviewer_core/src/mc_id.h index 6637e2f..4ae570d 100644 --- a/overviewer_core/src/mc_id.h +++ b/overviewer_core/src/mc_id.h @@ -260,6 +260,12 @@ enum mc_block_id { block_structure_block = 255, block_jigsaw = 256, block_shulker_box = 257, + // 1.16 stuff + block_ancient_debris = 1000, + block_basalt = 1001, + block_polished_basalt = 1002, + block_soul_campfire = 1003, + block_prismarine_stairs = 11337, block_dark_prismarine_stairs = 11338, block_prismarine_brick_stairs = 11339, diff --git a/overviewer_core/src/overviewer.h b/overviewer_core/src/overviewer.h index b2f6190..a7da8d7 100644 --- a/overviewer_core/src/overviewer.h +++ b/overviewer_core/src/overviewer.h @@ -31,7 +31,7 @@ // increment this value if you've made a change to the c extension // and want to force users to rebuild -#define OVERVIEWER_EXTENSION_VERSION 86 +#define OVERVIEWER_EXTENSION_VERSION 87 #include #include diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 25dd1eb..bb9994c 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -324,7 +324,7 @@ class Textures(object): if verbose: logging.info("Found %s in '%s'", filename, path) return open(path, mode) - raise TextureException("Could not find the textures while searching for '{0}'. Try specifying the 'texturepath' option in your config file.\nSet it to the path to a Minecraft Resource pack.\nAlternately, install the Minecraft client (which includes textures)\nAlso see \n(Remember, this version of Overviewer requires a 1.15-compatible resource pack)\n(Also note that I won't automatically use snapshots; you'll have to use the texturepath option to use a snapshot jar)".format(filename)) + raise TextureException("Could not find the textures while searching for '{0}'. Try specifying the 'texturepath' option in your config file.\nSet it to the path to a Minecraft Resource pack.\nAlternately, install the Minecraft client (which includes textures)\nAlso see \n(Remember, this version of Overviewer requires a 1.16-compatible resource pack)\n(Also note that I won't automatically use snapshots; you'll have to use the texturepath option to use a snapshot jar)".format(filename)) def load_image_texture(self, filename): # Textures may be animated or in a different resolution than 16x16. @@ -5459,18 +5459,21 @@ def barrel(self, blockid, data): return self.build_full_block(t_side.rotate(90), None, None, t_top, t_side.rotate(270)) -# Campfire -@material(blockid=11506, data=list(range(8)), solid=True, transparent=True, nospawn=True) +# Campfire (11506) and soul campfire (1003) +@material(blockid=[11506, 1003], data=list(range(8)), solid=True, transparent=True, nospawn=True) def campfire(self, blockid, data): # Do rotation, mask to not clobber lit data data = data & 0b100 | ((self.rotation + (data & 0b11)) % 4) + block_name = "campfire" if blockid == 11506 else "soul_campfire" # Load textures # Fire & lit log textures contain multiple tiles, since both are # 16px wide rely on load_image_texture() to crop appropriately - fire_raw_t = self.load_image_texture("assets/minecraft/textures/block/campfire_fire.png") + fire_raw_t = self.load_image_texture("assets/minecraft/textures/block/" + block_name + + "_fire.png") log_raw_t = self.load_image_texture("assets/minecraft/textures/block/campfire_log.png") - log_lit_raw_t = self.load_image_texture("assets/minecraft/textures/block/campfire_log_lit.png") + log_lit_raw_t = self.load_image_texture("assets/minecraft/textures/block/" + block_name + + "_log_lit.png") def create_tile(img_src, coord_crop, coord_paste, rot): # Takes an image, crops a region, optionally rotates the @@ -5683,3 +5686,22 @@ def bell(self, blockid, data): alpha_over(img, post_front_t, (0, 0), post_front_t) return img + + +# Ancient Debris +block(blockid=[1000], top_image="assets/minecraft/textures/block/ancient_debris_top.png", + side_image="assets/minecraft/textures/block/ancient_debris_side.png") + + +# Basalt +@material(blockid=[1001, 1002], data=list(range(3)), solid=True) +def basalt(self, blockid, data): + block_name = "polished_basalt" if blockid == 1002 else "basalt" + top = self.load_image_texture("assets/minecraft/textures/block/" + block_name + "_top.png") + side = self.load_image_texture("assets/minecraft/textures/block/" + block_name + "_side.png") + if data == 0: + return self.build_block(top, side) + elif data == 1: # east-west orientation + return self.build_full_block(side.rotate(90), None, None, top, side.rotate(90)) + elif data == 2: # north-south orientation + return self.build_full_block(side, None, None, side.rotate(270), top) diff --git a/overviewer_core/world.py b/overviewer_core/world.py index 5dcecad..e2535eb 100644 --- a/overviewer_core/world.py +++ b/overviewer_core/world.py @@ -686,6 +686,12 @@ class RegionSet(object): 'minecraft:tube_coral_fan': (8, 0), 'minecraft:tube_coral_wall_fan': (8, 0), + # Some 1.16 stuff that I'll arbitrarily shove in here due to ID bloat + 'minecraft:ancient_debris': (1000, 0), + 'minecraft:basalt': (1001, 0), + 'minecraft:polished_basalt': (1002, 0), + 'minecraft:soul_campfire': (1003, 0), + # New blocks 'minecraft:carved_pumpkin': (11300, 0), 'minecraft:spruce_pressure_plate': (11301, 0), @@ -1029,6 +1035,9 @@ class RegionSet(object): data = 3 if axis == 'z': data = 4 + elif key == 'minecraft:basalt' or key == 'minecraft:polished_basalt': + axis = palette_entry['Properties']['axis'] + data = {'y': 0, 'x': 1, 'z': 2}[axis] elif key in ['minecraft:redstone_torch','minecraft:redstone_wall_torch','minecraft:wall_torch']: if key.startswith('minecraft:redstone_') and palette_entry['Properties']['lit'] == 'true': block += 1 @@ -1141,7 +1150,7 @@ class RegionSet(object): # A moisture level of 7 has a different texture from other farmland data = 1 if palette_entry['Properties'].get('moisture', '0') == '7' else 0 elif key in ['minecraft:grindstone', 'minecraft:lectern', 'minecraft:campfire', - 'minecraft:bell']: + 'minecraft:bell', 'minecraft:soul_campfire']: p = palette_entry['Properties'] data = {'south': 0, 'west': 1, 'north': 2, 'east': 3}[p['facing']] if key == 'minecraft:grindstone': @@ -1149,7 +1158,7 @@ class RegionSet(object): elif key == 'minecraft:lectern': if p['has_book'] == 'true': data |= 4 - elif key == 'minecraft:campfire': + elif key == 'minecraft:campfire' or key == 'minecraft:soul_campfire': if p['lit'] == 'true': data |= 4 elif key == 'minecraft:bell':