Skip to content

Commit

Permalink
Fix sculk vein rendering
Browse files Browse the repository at this point in the history
Change-Id: I9e4880d68982b5a6de565861b5e969948d00f06f
  • Loading branch information
stwalkerster committed Nov 3, 2024
1 parent 129b2a5 commit 8a80ab6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
32 changes: 29 additions & 3 deletions overviewer_core/textures.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License along
# with the Overviewer. If not, see <http://www.gnu.org/licenses/>.

from collections import OrderedDict
from collections import OrderedDict, deque
import sys
import imp
import os
Expand Down Expand Up @@ -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):

Expand Down Expand Up @@ -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",

Expand Down Expand Up @@ -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):
Expand Down
13 changes: 13 additions & 0 deletions overviewer_core/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 8a80ab6

Please sign in to comment.