Skip to content

Commit

Permalink
Fixed flowering leaves model
Browse files Browse the repository at this point in the history
  • Loading branch information
Adubbz committed Dec 21, 2024
1 parent a64312b commit 31b87d1
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.4 2024-12-20T10:26:33.0485094 Model Definitions
// 1.21.4 2024-12-21T11:59:26.1507387 Model Definitions
3670b788e3f8e8154db2b0cb2a4eec8d1d92ce02 assets/biomesoplenty/blockstates/black_sandstone.json
b7e71e9e2c45918de279dba69073d21fc4da8c34 assets/biomesoplenty/blockstates/black_sandstone_slab.json
99a0b068818dd6a10909ea477064d05f752ddcfb assets/biomesoplenty/blockstates/black_sandstone_stairs.json
Expand Down Expand Up @@ -71,6 +71,7 @@ d1586a89b3a26729e7d2ba2e0bd2b3c046ebba66 assets/biomesoplenty/blockstates/fir_sl
18bb4164769be58e2e0f1cbe574cb46d40d8b105 assets/biomesoplenty/blockstates/fir_wall_hanging_sign.json
53f3d6f7ce4c4bced3be85684d555b52db071a7f assets/biomesoplenty/blockstates/fir_wall_sign.json
3d56ee6c5c469557925befa353c4babab765cf60 assets/biomesoplenty/blockstates/fir_wood.json
0f53db4fc5fc9f80c1fbe519b49ca967863676e8 assets/biomesoplenty/blockstates/flowering_oak_leaves.json
097ac8280db734a2be5459e0ea94b799c6f4009d assets/biomesoplenty/blockstates/flowering_oak_sapling.json
49548ae1e7d24e7b11bbab05f9f2ea1b0f9564f8 assets/biomesoplenty/blockstates/glowshroom_block.json
b82f79199f3213ff338d21fb3547cc33d8a56ba4 assets/biomesoplenty/blockstates/hellbark_button.json
Expand Down Expand Up @@ -893,6 +894,7 @@ bea9b67a151540be3755f99266a33259015e8822 assets/biomesoplenty/models/block/fir_t
da2a5e7ad73626e40ede156bcb1b642aad791748 assets/biomesoplenty/models/block/fir_trapdoor_open.json
549077112dd906a448700944d39d175c93c01d68 assets/biomesoplenty/models/block/fir_trapdoor_top.json
2fe51aac3e6442c8ad1b52acb206fb7bd8b9ce54 assets/biomesoplenty/models/block/fir_wood.json
09bf33f18dc12df9e4aa410bb718bddb718fbffb assets/biomesoplenty/models/block/flowering_oak_leaves.json
dba135910215d4b1ad8a817809e3c2aabcfe45eb assets/biomesoplenty/models/block/flowering_oak_sapling.json
71fc73d25b64d804d364f8b93b5c45dcaf9b6122 assets/biomesoplenty/models/block/glowshroom_block.json
aacba1f9cac6eb67b97cf22f1cd4f5412854ef20 assets/biomesoplenty/models/block/glowshroom_block_inventory.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "biomesoplenty:block/flowering_oak_leaves"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "biomesoplenty:block/leaves_overlay",
"textures": {
"layer0": "biomesoplenty:block/flowering_oak_leaves",
"layer1": "biomesoplenty:block/flowering_oak_leaves_overlay"
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"parent": "block/block",
"textures": {
"particle": "#leaves"
"particle": "#layer0"
},
"elements": [
{ "from": [ 0, 0, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "cullface": "up" },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "cullface": "north" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "cullface": "south" },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "cullface": "west" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "cullface": "east" }
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "cullface": "up" },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "cullface": "north" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "cullface": "south" },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "cullface": "west" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "cullface": "east" }
}
},
{ "from": [ 0, 0, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaves", "tintindex": 1, "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaves", "tintindex": 1, "cullface": "up" },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaves", "tintindex": 1, "cullface": "north" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaves", "tintindex": 1, "cullface": "south" },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaves", "tintindex": 1, "cullface": "west" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaves", "tintindex": 1, "cullface": "east" }
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "up" },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "north" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "south" },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "west" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "east" }
}
}
]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
import net.minecraft.client.data.models.model.*;
import net.minecraft.data.BlockFamily;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.FoliageColor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;

import java.util.Map;
Expand Down Expand Up @@ -188,7 +185,8 @@ public void run()
this.createGlowshroomBlock(BOPBlocks.GLOWSHROOM_BLOCK);

this.registerSimpleTintedItemModel(BOPBlocks.MOSSY_BLACK_SAND, ModelLocationUtils.getModelLocation(BOPBlocks.MOSSY_BLACK_SAND), new GrassColorSource());
this.registerSimpleTintedItemModel(BOPBlocks.FLOWERING_OAK_LEAVES, ModelLocationUtils.getModelLocation(BOPBlocks.FLOWERING_OAK_LEAVES), ItemModelUtils.constantTint(-12012264));

this.createLeavesOverlay(BOPBlocks.FLOWERING_OAK_LEAVES, FoliageColor.FOLIAGE_DEFAULT);
this.createWillowVine();

//
Expand Down Expand Up @@ -274,6 +272,14 @@ public void run()
this.createTintedBlockItemModel(BOPBlocks.HUGE_LILY_PAD, ItemModelUtils.constantTint(-9321636));
}

public void createLeavesOverlay(Block block, int tint)
{
TextureMapping textureMapping = BOPTextureMapping.leavesOverlay(block);
ResourceLocation model = BOPModelTemplates.LEAVES_OVERLAY.create(block, textureMapping, this.modelOutput);
this.blockStateOutput.accept(createSimpleBlock(block, model));
this.registerSimpleTintedItemModel(block, model, ItemModelUtils.constantTint(tint));
}

@Override
public BlockModelGenerators.BlockFamilyProvider family(Block block)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright 2024, the Glitchfiend Team.
* All rights reserved.
******************************************************************************/
package biomesoplenty.neoforge.datagen.model;

import biomesoplenty.core.BiomesOPlenty;
import net.minecraft.client.data.models.model.ModelTemplate;
import net.minecraft.client.data.models.model.TextureSlot;
import net.minecraft.resources.ResourceLocation;

import java.util.Optional;

public class BOPModelTemplates
{
public static final ModelTemplate LEAVES_OVERLAY = create("leaves_overlay", TextureSlot.LAYER0, TextureSlot.LAYER1);

private static ModelTemplate create(TextureSlot... p_386690_) {
return new ModelTemplate(Optional.empty(), Optional.empty(), p_386690_);
}

private static ModelTemplate create(String name, TextureSlot... p_388561_) {
return new ModelTemplate(Optional.of(ResourceLocation.fromNamespaceAndPath(BiomesOPlenty.MOD_ID, "block/" + name)), Optional.empty(), p_388561_);
}

private static ModelTemplate createItem(String p_388248_, TextureSlot... p_386756_) {
return new ModelTemplate(Optional.of(ResourceLocation.fromNamespaceAndPath(BiomesOPlenty.MOD_ID, "item/" + p_388248_)), Optional.empty(), p_386756_);
}

private static ModelTemplate createItem(String p_386727_, String p_387707_, TextureSlot... p_387856_) {
return new ModelTemplate(Optional.of(ResourceLocation.fromNamespaceAndPath(BiomesOPlenty.MOD_ID, "item/" + p_386727_)), Optional.of(p_387707_), p_387856_);
}

private static ModelTemplate create(String p_386833_, String p_386662_, TextureSlot... p_387086_) {
return new ModelTemplate(Optional.of(ResourceLocation.fromNamespaceAndPath(BiomesOPlenty.MOD_ID, "block/" + p_386833_)), Optional.of(p_386662_), p_387086_);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright 2024, the Glitchfiend Team.
* All rights reserved.
******************************************************************************/
package biomesoplenty.neoforge.datagen.model;

import net.minecraft.client.data.models.model.TextureMapping;
import net.minecraft.client.data.models.model.TextureSlot;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;

import static net.minecraft.client.data.models.model.TextureMapping.getBlockTexture;

public class BOPTextureMapping
{
public static TextureMapping leavesOverlay(Block block)
{
return new TextureMapping()
.put(TextureSlot.LAYER1, getBlockTexture(block, "_overlay"))
.put(TextureSlot.LAYER0, getBlockTexture(block));
}
}

0 comments on commit 31b87d1

Please sign in to comment.