0

textures: fix various small nitpicks

- don't redundantly declare a side image when it's the same as top
- change wood blocks to get textures from a dict
This commit is contained in:
Nicolas F
2020-08-05 18:52:21 +02:00
parent ba173698f3
commit 0776bf0a93

View File

@@ -30,6 +30,8 @@ import functools
from . import util from . import util
BLOCKTEX = "assets/minecraft/textures/block/"
# global variables to collate information in @material decorators # global variables to collate information in @material decorators
blockmap_generators = {} blockmap_generators = {}
@@ -1090,125 +1092,67 @@ def wood(self, blockid, data):
if wood_orientation == 4: wood_orientation = 8 if wood_orientation == 4: wood_orientation = 8
elif wood_orientation == 8: wood_orientation = 4 elif wood_orientation == 8: wood_orientation = 4
# choose textures # dictionary of blockid : { wood_type : (top, side) }
if blockid == 17: # regular wood: wood_tex = {
if wood_type == 0: # normal 17: {
top = self.load_image_texture("assets/minecraft/textures/block/oak_log_top.png") 0: ("oak_log_top.png", "oak_log.png"),
side = self.load_image_texture("assets/minecraft/textures/block/oak_log.png") 1: ("spruce_log_top.png", "spruce_log.png"),
if wood_type == 1: # spruce 2: ("birch_log_top.png", "birch_log.png"),
top = self.load_image_texture("assets/minecraft/textures/block/spruce_log_top.png") 3: ("jungle_log_top.png", "jungle_log.png"),
side = self.load_image_texture("assets/minecraft/textures/block/spruce_log.png") },
if wood_type == 2: # birch 162: {
top = self.load_image_texture("assets/minecraft/textures/block/birch_log_top.png") 0: ("acacia_log_top.png", "acacia_log.png"),
side = self.load_image_texture("assets/minecraft/textures/block/birch_log.png") 1: ("dark_oak_log_top.png", "dark_oak_log.png"),
if wood_type == 3: # jungle wood },
top = self.load_image_texture("assets/minecraft/textures/block/jungle_log_top.png") 11306: {
side = self.load_image_texture("assets/minecraft/textures/block/jungle_log.png") 0: ("stripped_oak_log_top.png", "stripped_oak_log.png"),
elif blockid == 162: # acacia/dark wood: 1: ("stripped_spruce_log_top.png", "stripped_spruce_log.png"),
if wood_type == 0: # acacia 2: ("stripped_birch_log_top.png", "stripped_birch_log.png"),
top = self.load_image_texture("assets/minecraft/textures/block/acacia_log_top.png") 3: ("stripped_jungle_log_top.png", "stripped_jungle_log.png"),
side = self.load_image_texture("assets/minecraft/textures/block/acacia_log.png") },
elif wood_type == 1: # dark oak 11307: {
top = self.load_image_texture("assets/minecraft/textures/block/dark_oak_log_top.png") 0: ("stripped_acacia_log_top.png", "stripped_acacia_log.png"),
side = self.load_image_texture("assets/minecraft/textures/block/dark_oak_log.png") 1: ("stripped_dark_oak_log_top.png", "stripped_dark_oak_log.png"),
else: },
top = self.load_image_texture("assets/minecraft/textures/block/acacia_log_top.png") 11308: {
side = self.load_image_texture("assets/minecraft/textures/block/acacia_log.png") 0: ("oak_log.png", None),
if blockid == 11306: # stripped regular wood: 1: ("spruce_log.png", None),
if wood_type == 0: # normal 2: ("birch_log.png", None),
top = self.load_image_texture("assets/minecraft/textures/block/stripped_oak_log_top.png") 3: ("jungle_log.png", None),
side = self.load_image_texture("assets/minecraft/textures/block/stripped_oak_log.png") },
if wood_type == 1: # spruce 11309: {
top = self.load_image_texture("assets/minecraft/textures/block/stripped_spruce_log_top.png") 0: ("acacia_log.png", None),
side = self.load_image_texture("assets/minecraft/textures/block/stripped_spruce_log.png") 1: ("dark_oak_log.png", None),
if wood_type == 2: # birch },
top = self.load_image_texture("assets/minecraft/textures/block/stripped_birch_log_top.png") 11310: {
side = self.load_image_texture("assets/minecraft/textures/block/stripped_birch_log.png") 0: ("stripped_oak_log.png", None),
if wood_type == 3: # jungle wood 1: ("stripped_spruce_log.png", None),
top = self.load_image_texture("assets/minecraft/textures/block/stripped_jungle_log_top.png") 2: ("stripped_birch_log.png", None),
side = self.load_image_texture("assets/minecraft/textures/block/stripped_jungle_log.png") 3: ("stripped_jungle_log.png", None),
elif blockid == 11307: # stripped acacia/dark wood: },
if wood_type == 0: # acacia 11311: {
top = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log_top.png") 0: ("stripped_acacia_log.png", None),
side = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log.png") 1: ("stripped_dark_oak_log.png", None),
elif wood_type == 1: # dark oak },
top = self.load_image_texture("assets/minecraft/textures/block/stripped_dark_oak_log_top.png") 1008: {
side = self.load_image_texture("assets/minecraft/textures/block/stripped_dark_oak_log.png") 0: ("warped_stem_top.png", "warped_stem.png"),
else: 1: ("warped_stem_top.png", "stripped_warped_stem.png"),
top = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log_top.png") 2: ("crimson_stem_top.png", "crimson_stem.png"),
side = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log.png") 3: ("crimson_stem_top.png", "stripped_crimson_stem.png"),
if blockid == 11308: # regular bark: },
if wood_type == 0: # normal 1009: {
top = self.load_image_texture("assets/minecraft/textures/block/oak_log.png") 0: ("warped_stem.png", None),
side = top 1: ("stripped_warped_stem.png", None),
if wood_type == 1: # spruce 2: ("crimson_stem.png", None),
top = self.load_image_texture("assets/minecraft/textures/block/spruce_log.png") 3: ("stripped_crimson_stem.png", None),
side = top }
if wood_type == 2: # birch }
top = self.load_image_texture("assets/minecraft/textures/block/birch_log.png")
side = top top_f, side_f = wood_tex[blockid].get(wood_type, wood_tex[blockid][0])
if wood_type == 3: # jungle wood if not side_f:
top = self.load_image_texture("assets/minecraft/textures/block/jungle_log.png") side_f = top_f
side = top top = self.load_image_texture(BLOCKTEX + top_f)
elif blockid == 11309: # acacia/dark bark: side = self.load_image_texture(BLOCKTEX + side_f)
if wood_type == 0: # acacia
top = self.load_image_texture("assets/minecraft/textures/block/acacia_log.png")
side = top
elif wood_type == 1: # dark oak
top = self.load_image_texture("assets/minecraft/textures/block/dark_oak_log.png")
side = top
else:
top = self.load_image_texture("assets/minecraft/textures/block/acacia_log.png")
side = top
if blockid == 11310: # stripped regular wood:
if wood_type == 0: # normal
top = self.load_image_texture("assets/minecraft/textures/block/stripped_oak_log.png")
side = top
if wood_type == 1: # spruce
top = self.load_image_texture("assets/minecraft/textures/block/stripped_spruce_log.png")
side = top
if wood_type == 2: # birch
top = self.load_image_texture("assets/minecraft/textures/block/stripped_birch_log.png")
side = top
if wood_type == 3: # jungle wood
top = self.load_image_texture("assets/minecraft/textures/block/stripped_jungle_log.png")
side = top
if blockid == 1008: # nether logs aka stem
if wood_type == 0: # warped_stem
top = self.load_image_texture("assets/minecraft/textures/block/warped_stem_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/warped_stem.png")
if wood_type == 1: # stripped_warped_stem
top = self.load_image_texture("assets/minecraft/textures/block/warped_stem_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/stripped_warped_stem.png")
if wood_type == 2: # crimson_stem
top = self.load_image_texture("assets/minecraft/textures/block/crimson_stem_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/crimson_stem.png")
if wood_type == 3: # crimson_stem
top = self.load_image_texture("assets/minecraft/textures/block/crimson_stem_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/stripped_crimson_stem.png")
if blockid == 1009: # nether hyphae
if wood_type == 0: # warped_hyphae
top = self.load_image_texture("assets/minecraft/textures/block/warped_stem.png")
side = top
if wood_type == 1: # stripped_warped_hyphae
top = self.load_image_texture("assets/minecraft/textures/block/stripped_warped_stem.png")
side = top
if wood_type == 2: # crimson_hyphae
top = self.load_image_texture("assets/minecraft/textures/block/crimson_stem.png")
side = top
if wood_type == 3: # stripped_crimson_hyphae
top = self.load_image_texture("assets/minecraft/textures/block/stripped_crimson_stem.png")
side = top
elif blockid == 11311: # stripped acacia/dark wood:
if wood_type == 0: # acacia
top = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log.png")
side = top
elif wood_type == 1: # dark oak
top = self.load_image_texture("assets/minecraft/textures/block/stripped_dark_oak_log.png")
side = top
else:
top = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log.png")
side = top
# choose orientation and paste textures # choose orientation and paste textures
if wood_orientation == 0: if wood_orientation == 0:
@@ -4278,7 +4222,6 @@ def vines(self, blockid, data):
# 1 UNWSE # 1 UNWSE
# 2 UWSEN # 2 UWSEN
# 3 USENW # 3 USENW
if self.rotation in [1, 2, 3]: if self.rotation in [1, 2, 3]:
bit_map = {1: [5, 3, 2, 1, 4], bit_map = {1: [5, 3, 2, 1, 4],
2: [5, 2, 1, 4, 3], 2: [5, 2, 1, 4, 3],
@@ -4408,11 +4351,9 @@ block(blockid=110, top_image="assets/minecraft/textures/block/mycelium_top.png",
block(blockid=1006, top_image="assets/minecraft/textures/block/warped_nylium.png", side_image="assets/minecraft/textures/block/warped_nylium_side.png") block(blockid=1006, top_image="assets/minecraft/textures/block/warped_nylium.png", side_image="assets/minecraft/textures/block/warped_nylium_side.png")
block(blockid=1007, top_image="assets/minecraft/textures/block/crimson_nylium.png", side_image="assets/minecraft/textures/block/crimson_nylium_side.png") block(blockid=1007, top_image="assets/minecraft/textures/block/crimson_nylium.png", side_image="assets/minecraft/textures/block/crimson_nylium_side.png")
# soul soil # soul soil
soul_soil_texture="assets/minecraft/textures/block/soul_soil.png" block(blockid=1020, top_image="assets/minecraft/textures/block/soul_soil.png")
block(blockid=1020, top_image=soul_soil_texture, side_image=soul_soil_texture)
# nether gold ore # nether gold ore
nether_gold_texture="assets/minecraft/textures/block/nether_gold_ore.png" block(blockid=1021, top_image="assets/minecraft/textures/block/nether_gold_ore.png")
block(blockid=1021, top_image=nether_gold_texture, side_image=nether_gold_texture)
# lilypad # lilypad
# At the moment of writing this lilypads has no ancil data and their # At the moment of writing this lilypads has no ancil data and their