Custom Model Predicates
Custom Model Predicates is a Forge mod that allows resource pack makers and mod devs to specify custom models for items based on name, nbt, stack sizes and more.
How it works
To start, this mod uses model replacement in a similar way to how resource packs work, but with a few key differences.
First, the json file must have `"loader": "custommodelpredicates:custommodelpredicates"` in order for it to be read by this mod
Second, every json requires a base model that's used when none of the predicates match.
Third, this mod does not use the overrides array, but instead uses a new array called "predicates".
This array is checked BEFORE the "overrides" block that's seen in vanilla jsons.
This array can hold as many predicates as required although it's recommended to keep the count low to reduce lag.
Each predicate in the array is checked every time the model is rendered and returns the first one that matches.
Order Matters!
Predicates
a predicate is composed of the type of predicate it is, the requirements for matching it, and the model to return if it matches. This list of supported predicates will be periodically updated as the mod matures
Supported predicates:
Name: the name predicate is used to match when an item has a specific name, example:
{
"type": "name",
"name": "aw man",
"model" : {"parent" :"item/gunpowder"}
}
Count: The count predicate is used to match whenever an item has more than, less than, or equal to a specific number.
Examples:
Greater: This predicate matches when the stack size of the target is greater than the specified number
{
"type": "count",
"count": ">2",
"model" : {"parent" :"custommodelpredicates:item/three_gold_ingots"}
}
Lesser: This predicate matches when the stack size of the target is less than the specified count
{
"type": "count",
"count": "<3",
"model" : {"parent" :"custommodelpredicates:item/two_gold_ingots"}
}
Equal: This predicate matches when the stack size of the target is equal to the specified count
{
"type": "count",
"count": "2",
"model" : {"parent" :"custommodelpredicates:item/two_gold_ingots"}
}
nbt: The nbt predicate is used to match whenever an item has a specific nbt tag of a specific value or range.
There are multiple types of nbt tags, the ones this mod is currently capable of matching are boolean, byte, short, int, long, float, double, and string.
All nbt types except for boolean and string support < and > range matches. All nbt types support exact matches. Use caution with floats/doubles when exact matching
In order for an nbt predicate to match, the item has to have the tag specified, and it needs to be within the range set.
Example:
This tag matches whenever the itemstack has the "test_number" tag of the type int, and that value is equal to 1.
{
"type": "nbt",
"tag_name" : "test_number",
"tag_type": "int",
"require" : "=1",
"model" : {"parent" :"item/diamond"}
}<br /><br /><br />
modid: The modid predicate is used to test whenever the specified mod is loaded.
Example:
{
"type": "modid",
"modid": "examplemod",
"model" : {"parent" :"item/iron_ingot"}
}
There's some basic examples included on github (wip).
FAQ:
Q: Can you port this to (insert any version below 1.16.5?)
A: No.
Q: Can this work client side only?
A: Yes, it even works on vanilla servers.
Q: Can this load CIT resource packs?
A: No, but when this mod is mature it should be able to have an equivalent for all of Optifine's predicates.
Q: Can this be used in modpacks?
A: Absolutely, no matter where.
Contact info
Need a custom mod for a reasonable fee? Just want to chat? Have a complex issue needing additional discussion? Join the Discord:
![]()
Want to help support this mod and others? donate to my Patreon in the link below