From 28e1eab00769710bbc787ca05a4bb13088e102a2 Mon Sep 17 00:00:00 2001 From: trinsdar <30245301+Trinsdar@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:40:43 -0500 Subject: [PATCH] made BlockBasicSlab use custom slab models in order to support color --- .../antimatter/block/BlockBasicSlab.java | 4 ++-- .../assets/antimatter/models/block/slab.json | 18 ++++++++++++++++++ .../antimatter/models/block/slab_top.json | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 common/src/main/resources/assets/antimatter/models/block/slab.json create mode 100644 common/src/main/resources/assets/antimatter/models/block/slab_top.json diff --git a/common/src/main/java/muramasa/antimatter/block/BlockBasicSlab.java b/common/src/main/java/muramasa/antimatter/block/BlockBasicSlab.java index 42afb166b..3d028561f 100644 --- a/common/src/main/java/muramasa/antimatter/block/BlockBasicSlab.java +++ b/common/src/main/java/muramasa/antimatter/block/BlockBasicSlab.java @@ -49,8 +49,8 @@ public Texture[] getTextures() { public void onBlockModelBuild(Block block, AntimatterBlockStateProvider prov) { Texture texture = getTextures()[0]; ResourceLocation both = prov.existing(this.getDomain(), "block/" + this.getId().replace("_slab", "")); - AntimatterBlockModelBuilder top = prov.models().getBuilder(getId() + "_top").parent(prov.existing("minecraft", "block/slab_top")).texture("bottom", texture).texture("top", texture).texture("side", texture); - AntimatterBlockModelBuilder bottom = prov.models().getBuilder(getId()).parent(prov.existing("minecraft", "block/slab")).texture("bottom", texture).texture("top", texture).texture("side", texture); + AntimatterBlockModelBuilder top = prov.models().getBuilder(getId() + "_top").parent(prov.existing(Ref.ID, "block/slab_top")).texture("bottom", texture).texture("top", texture).texture("side", texture); + AntimatterBlockModelBuilder bottom = prov.models().getBuilder(getId()).parent(prov.existing(Ref.ID, "block/slab")).texture("bottom", texture).texture("top", texture).texture("side", texture); ResourceLocation finalBoth = both; prov.getVariantBuilder(block).forAllStates(s -> { if (s.getValue(TYPE) == SlabType.DOUBLE) { diff --git a/common/src/main/resources/assets/antimatter/models/block/slab.json b/common/src/main/resources/assets/antimatter/models/block/slab.json new file mode 100644 index 000000000..d020c6d71 --- /dev/null +++ b/common/src/main/resources/assets/antimatter/models/block/slab.json @@ -0,0 +1,18 @@ +{ "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { "from": [ 0, 0, 0 ], + "to": [ 16, 8, 16 ], + "faces": { + "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down", "tintindex": 0 }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "tintindex": 0 }, + "north": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "north", "tintindex": 0 }, + "south": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "south", "tintindex": 0 }, + "west": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "west", "tintindex": 0 }, + "east": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "east", "tintindex": 0 } + } + } + ] +} diff --git a/common/src/main/resources/assets/antimatter/models/block/slab_top.json b/common/src/main/resources/assets/antimatter/models/block/slab_top.json new file mode 100644 index 000000000..92632ba23 --- /dev/null +++ b/common/src/main/resources/assets/antimatter/models/block/slab_top.json @@ -0,0 +1,18 @@ +{ + "textures": { + "particle": "#side" + }, + "elements": [ + { "from": [ 0, 8, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "tintindex": 0 }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "up", "tintindex": 0 }, + "north": { "uv": [ 0, 0, 16, 8 ], "texture": "#side", "cullface": "north", "tintindex": 0 }, + "south": { "uv": [ 0, 0, 16, 8 ], "texture": "#side", "cullface": "south", "tintindex": 0 }, + "west": { "uv": [ 0, 0, 16, 8 ], "texture": "#side", "cullface": "west", "tintindex": 0 }, + "east": { "uv": [ 0, 0, 16, 8 ], "texture": "#side", "cullface": "east", "tintindex": 0 } + } + } + ] +}