From 8a80ab6927a01dbc61d13e98f3c0321ccee49e13 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Sun, 20 Oct 2024 19:46:20 +0100 Subject: [PATCH] Fix sculk vein rendering Change-Id: I9e4880d68982b5a6de565861b5e969948d00f06f --- overviewer_core/textures.py | 32 +++++++++++++++++++++++++++++--- overviewer_core/world.py | 13 +++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 85fcf228..61cdae0c 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License along # with the Overviewer. If not, see . -from collections import OrderedDict +from collections import OrderedDict, deque import sys import imp import os @@ -4641,7 +4641,7 @@ def build_torch(active): # trapdoor # the trapdoor is looks like a sprite when opened, that's not good -@material(blockid=[96,167,11332,11333,11334,11335,11336,12501,12502, 1198, 1207, 1218, 1223, 1230, 1231, 12658, 12659, 12660, 12661], +@material(blockid=[96,167,11332,11333,11334,11335,11336,12501,12502, 1198, 1207, 1218, 1230, 1231, 12658, 12659, 12660, 12661], data=list(range(16)), transparent=True, nospawn=True) def trapdoor(self, blockid, data): @@ -4677,7 +4677,6 @@ def trapdoor(self, blockid, data): 1198:BLOCKTEXTURE + "mangrove_trapdoor.png", 1207:BLOCKTEXTURE + "cherry_trapdoor.png", 1218:BLOCKTEXTURE + "bamboo_trapdoor.png", - 1223:BLOCKTEXTURE + "sculk_vein.png", 1230:BLOCKTEXTURE + "pink_petals.png", 1231:BLOCKTEXTURE + "frogspawn.png", @@ -4712,6 +4711,33 @@ def trapdoor(self, blockid, data): return img + +@material(blockid=1223, data=list(range(0b11_1111 + 1)), transparent=True) +def sculk_vein(self, _, data): + # data bits! + # +------ south + # |+----- north + # || +---- west + # || |+--- east + # || ||+-- up + # || |||+- down + # 0b00_0000 + + tex = self.load_image_texture(BLOCKTEXTURE + "sculk_vein.png") + + south = tex if data & 0b10_0000 > 0 else None + north = tex if data & 0b01_0000 > 0 else None + west = tex if data & 0b00_1000 > 0 else None + east = tex if data & 0b00_0100 > 0 else None + up = tex if data & 0b00_0010 > 0 else None + down = tex if data & 0b00_0001 > 0 else None + + faces = deque([north, east, south, west]) + faces.rotate(self.rotation) + + return self.build_full_block(up, faces[0], faces[1], faces[3], faces[2], down) + + # block with hidden silverfish (stone, cobblestone and stone brick) @material(blockid=97, data=list(range(3)), solid=True) def hidden_silverfish(self, blockid, data): diff --git a/overviewer_core/world.py b/overviewer_core/world.py index 59511f15..93bdce4e 100644 --- a/overviewer_core/world.py +++ b/overviewer_core/world.py @@ -1902,6 +1902,19 @@ def _get_block(self, palette_entry): if p['hatch'] == 2: data = 2 + elif key == 'minecraft:sculk_vein': + p = palette_entry['Properties'] + + if p['waterlogged'] == 'true': + block = 8 + else: + data = 0 + data |= 0b00_0001 if p['down'] == 'true' else 0 + data |= 0b00_0010 if p['up'] == 'true' else 0 + data |= 0b00_0100 if p['east'] == 'true' else 0 + data |= 0b00_1000 if p['west'] == 'true' else 0 + data |= 0b01_0000 if p['north'] == 'true' else 0 + data |= 0b10_0000 if p['south'] == 'true' else 0 return (block, data)