Skip to content

Commit

Permalink
made BlockBasicSlab use custom slab models in order to support color
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Dec 13, 2023
1 parent e9f2c1f commit 28e1eab
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 18 additions & 0 deletions common/src/main/resources/assets/antimatter/models/block/slab.json
Original file line number Diff line number Diff line change
@@ -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 }
}
}
]
}
Original file line number Diff line number Diff line change
@@ -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 }
}
}
]
}

0 comments on commit 28e1eab

Please sign in to comment.