Loading...
Beta Modpages Unclaimed

Custom Model Predicates

A forge mod that allows changing models based on stack size, nbt and other factors similat to Custom Item Textures (CIT)

0 Likes
755 Downloads
Created by tfarecnim

Description

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

 


AD Become Premium to remove Ads!

What means Verified?

  • Compatibility: The mod should be compatible with the latest version of Minecraft and be clearly labeled with its supported versions.
  • Functionality: The mod should work as advertised and not cause any game-breaking bugs or crashes.
  • Security: The mod should not contain any malicious code or attempts to steal personal information.
  • Performance: The mod should not cause a significant decrease in the game's performance, such as by causing lag or reducing frame rates.
  • Originality: The mod should be original and not a copy of someone else's work.
  • Up-to-date: The mod should be regularly updated to fix bugs, improve performance, and maintain compatibility with the latest version of Minecraft.
  • Support: The mod should have an active developer who provides support and troubleshooting assistance to users.
  • License: The mod should be released under a clear and open source license that allows others to use, modify, and redistribute the code.
  • Documentation: The mod should come with clear and detailed documentation on how to install and use it.

AD Become Premium to remove Ads!

How to Install

1

Download Forge & Java

Download Forge from the offical Site or here. If you dont have Java installed then install it now from here. After Downloading Forge you can run the file with Java.

2

Prepare

Lounch Minecraft and select your Forge istallation as Version this will create a Folder called Mods.

3

Add Mods

Type Win+R and type %appdata% and open the .minecraft Folder. There will you find your Folder called Mods. Place all Mods you want to play in this Folder

4

Enjoy

You are now Ready. Re-start your Game and start Playing.

More Mods like this

Quark

A Quark is a very small thing. This mod is a collection of small things that improve the vanilla minecraft experience.

Chisel

A builder's best friend.

Better Advancements

Successor to BetterAchievements for the new advancements system in minecraft 1.12+

Cosmetic Armor Reworked

This mod allows you to wear two sets of armor, one for display, one for function.

Macaw's Doors

Adds vanila doors with every wood color and new unique doors!

MalisisDoors

New animations for doors. You can build you own doors with millions of possibilities!

Macaw's Roofs

Build roofs with actual roofs instead of stairs!