-
Notifications
You must be signed in to change notification settings - Fork 10
Item Model Modifiers
Item model modifiers are a new concept added by Fusion. Currently, item model modifiers allow using a different model depending on some item predicates. Below is an explanation of how to use item model modifiers and which item predicates are available.
Similar to most resource pack features, item model modifiers use json files. The files should be located at assets/<namespace>/fusion/model_modifiers/items/. The name of the file is not significant.
Each item model modifier file can target a number of items specified under the targets key.
The models key then specifies an array of objects consisting of a model location and conditions. The model location from the first object for which all conditions hold is used to render the item.
The default_model key can specify a model to be used when there's no object in the models array for which all conditions hold. If no default_model is specified, the original item model will be used as a fallback.
Here is an example of a model modifier targeting the stick item which makes the item use a different model depending on how many items are in the stack:
{
"targets": [
"stick"
],
"default_model": "item/single_stick",
"models": [
{
"model": "item/many_sticks",
"conditions": [
{
"type": "count",
"min": 32
}
]
},
{
"model": "item/some_sticks",
"conditions": [
{
"type": "count",
"min": 2
}
]
}
]
}As shown in the previous section, which model is used in an item model modifier can depend on item predicates. There are 7 types of item predicates:
-
count: holds if the number of items in the stack are between the minimum and maximum values given-
min: the minimum number of items -
min_percentage: the minimum number of items as a percentage of the maximum stack size, value between 0 and 1 -
max: the maximum number of items -
max_percentage: the maximum number of items as a percentage of the maximum stack size, value between 0 and 1
-
-
durability: holds if the durability of an item is between the minimum and maximum values given-
min: the minimum durability value -
min_percentage: the minimum durability value as a percentage of the total durability of the item, value between 0 and 1 -
max: the maximum durability value -
max_percentage: the maximum durability as a percentage of the total durability of the item, value between 0 and 1
-
-
enchantment: holds when the item's level of the given enchantment is between the values given-
enchantment: the enchantment to be matched -
min_level: the minimum level of the enchantment -
max_level: the maximum level of the enchantment
-
-
potion: holds if the item has a given potion type-
potion: the type of the potion
-
-
and: holds if all given predicates are satisfied-
predicates: predicates which all need to be satisfied
-
-
or: holds if at least one of the given predicates is satisfied-
predicates: predicates of which one needs to be satisfied
-
-
not: holds only if the given predicate is not satisfied-
predicate: predicate of which the inverse will be taken
-
Tip
A list of vanilla potion types can be found at the Minecraft wiki.