From 5da667261c69e119629286d0731b7a1e5a0d250c Mon Sep 17 00:00:00 2001 From: Aleksey Date: Thu, 27 May 2021 21:47:44 +0300 Subject: [PATCH] Path model fix --- gradle.properties | 2 +- src/main/java/ru/bclib/blocks/BasePathBlock.java | 7 +++++++ src/main/resources/assets/bclib/patterns/block/path.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 29d49516..7b238974 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ yarn_mappings=6 loader_version=0.11.3 # Mod Properties -mod_version = 0.1.8 +mod_version = 0.1.9 maven_group = ru.bclib archives_base_name = bclib diff --git a/src/main/java/ru/bclib/blocks/BasePathBlock.java b/src/main/java/ru/bclib/blocks/BasePathBlock.java index 99737ea5..a6cb716d 100644 --- a/src/main/java/ru/bclib/blocks/BasePathBlock.java +++ b/src/main/java/ru/bclib/blocks/BasePathBlock.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import net.minecraft.core.Registry; import org.jetbrains.annotations.Nullable; import com.google.common.collect.Maps; @@ -32,8 +33,11 @@ import ru.bclib.client.models.PatternsHelper; public class BasePathBlock extends BaseBlockNotFull { private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 15, 16); + private final Block base; + public BasePathBlock(Block source) { super(FabricBlockSettings.copyOf(source).isValidSpawn((state, world, pos, type) -> { return false; })); + this.base = source; if (source instanceof BaseTerrainBlock) { BaseTerrainBlock terrain = (BaseTerrainBlock) source; terrain.setPathBlock(this); @@ -67,10 +71,13 @@ public class BasePathBlock extends BaseBlockNotFull { @Override public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) { String name = resourceLocation.getPath(); + ResourceLocation baseId = Registry.BLOCK.getKey(base); + String bottom = baseId.getNamespace() + ":block/" + baseId.getPath(); Map textures = Maps.newHashMap(); textures.put("%modid%", resourceLocation.getNamespace()); textures.put("%top%", name + "_top"); textures.put("%side%", name.replace("_path", "") + "_side"); + textures.put("%bottom%", bottom); Optional pattern = PatternsHelper.createJson(BasePatterns.BLOCK_PATH, textures); return ModelsHelper.fromPattern(pattern); } diff --git a/src/main/resources/assets/bclib/patterns/block/path.json b/src/main/resources/assets/bclib/patterns/block/path.json index 780986a2..347121bb 100644 --- a/src/main/resources/assets/bclib/patterns/block/path.json +++ b/src/main/resources/assets/bclib/patterns/block/path.json @@ -2,6 +2,6 @@ "textures": { "top": "%modid%:block/%top%", "side": "%modid%:block/%side%", - "bottom": "%modid%:block/%bottom%" + "bottom": "%bottom%" } }