Model predicates

This commit is contained in:
Vos
2025-11-10 22:46:58 -06:00
parent d413a716ea
commit 20bba740db
6 changed files with 36 additions and 2 deletions
@@ -1,6 +1,7 @@
package com.acethewildfire.acesbs;
import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.util.ModModelPredicates;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.client.render.RenderLayer;
@@ -10,5 +11,7 @@ public class AcesBSClient implements ClientModInitializer {
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.LEMONWOOD_DOOR, RenderLayer.getTranslucent());
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.LEMONWOOD_TRAPDOOR, RenderLayer.getTranslucent());
ModModelPredicates.registerModelPredicates();
}
}
@@ -53,7 +53,7 @@ public class ModModelProvider extends FabricModelProvider {
itemModelGenerator.register(ModItems.ORACLE_LEMON, Models.GENERATED);
itemModelGenerator.register(ModItems.GREEN_BRICKS, Models.GENERATED);
itemModelGenerator.register(ModItems.STABLE_ENTROPY, Models.GENERATED);
itemModelGenerator.register(ModItems.WAND, Models.HANDHELD_ROD);
// itemModelGenerator.register(ModItems.WAND, Models.HANDHELD_ROD);
itemModelGenerator.register(ModItems.PRISMA_STEEL, Models.GENERATED);
itemModelGenerator.register(ModItems.PRISMA_SMITHING_TEMPLATE, Models.GENERATED);
@@ -0,0 +1,17 @@
package com.acethewildfire.acesbs.util;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.component.ModDataComponentTypes;
import com.acethewildfire.acesbs.item.ModItems;
import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.util.Identifier;
public class ModModelPredicates {
public static void registerModelPredicates () {
ModelPredicateProviderRegistry.register(ModItems.WAND, Identifier.of(AcesBS.MOD_ID, "used"),
(stack, world, entity, seed) -> stack.get(ModDataComponentTypes.COORDINATES) != null ? 1f : 0f);
}
}
@@ -0,0 +1,14 @@
{
"parent": "minecraft:item/handheld_rod",
"textures": {
"layer0": "acesbs:item/wand"
},
"overrides": [
{
"predicate": {
"acesbs:used": 1
},
"model": "acesbs:item/wand_used"
}
]
}
@@ -1,6 +1,6 @@
{
"parent": "minecraft:item/handheld_rod",
"textures": {
"layer0": "acesbs:item/wand"
"layer0": "acesbs:item/wand_used"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB