Repository navigation
Block Model Modifiers
Block model modifiers are a new concept added by Fusion. They allow overwriting the default model used for a block and allow adding additional models to a block.
Similar to most resource pack features, block model modifiers also use json files. The files should be located at assets/<namespace>/fusion/model_modifiers/blocks/. The name of the file is only relevant for ordering.
Here is an overview of the properties of a block model modifier:
| key | values | default | description |
|---|---|---|---|
targets |
array of blocks | None | Blocks that the model modifier is applied to |
ignore_missing_targets |
true or false
|
false |
Whether to ignore missing targets, useful for modded blocks |
priority |
integer | 100 |
Priority used to determine the order in which modifiers are applied, a lower priority is applied first |
default_model_overrides |
array of model entries | None | Overwrites for the default model used for the target blocks |
append_models |
array of model entries | None | Models that are added to the target blocks |
pane_culling_fix |
true or false
|
false |
Whether to cull edges for neighboring pane blocks like iron bars or glass panes |
| key | values | default | description |
|---|---|---|---|
model |
model data or location of a model |
None | Model to use |
conditions |
model predicate or array of model predicates |
true |
Conditions for using the model |
show_breaking_overlay |
true or false
|
true |
Whether to show the breaking overlay on the model |
random_offset |
random offset type (see section below) | none |
Random offset to apply to the model |
Each block model modifier file can target a number of blocks and specific block states.
Here is an example of a model modifier targeting Red Concrete:
{
"targets": [
"red_concrete"
]
}To target specific block states, you can specify a properties map where each key the name of a properties and the value is an array of allowed values.
Here is an example of model modifier targeting a lit Redstone Torch:
{
"targets": [
{
"block": "redstone_torch",
"properties": {
"lit": [
"true"
]
}
}
]
}Default model overwrites can be used to overwrite the model that is used for targeted blocks. Here is an example of a model modifier that changes the model for the Iron Lantern to that of the Soul Lantern:
{
"targets": [
"lantern"
],
"default_model_overrides": [
"block/soul_lantern"
]
}Default model overwrites entries can also have conditions. The conditions can be any block model predicates. The first model in default_model_overrides for which its conditions are met is the model that is used.
Here is an example of a model modifier that changes the model for the Torch to that of the Soul Torch when there is a Soul Soil block under it:
{
"targets": [
"lantern"
],
"default_model_overrides": [
{
"model": "block/soul_lantern",
"conditions": {
"type": "match_block",
"offset": [0,-1,0],
"block": "soul_soil"
}
}
]
}Block model modifiers can add models to targets through the append_models property. Similar to default model overwrites, the appended models can also have conditions.
The property can contain either individual model entries or an array of model entries. For an array of model entries, the first entry for which its condition is met is used.
In following example:
- the model for cobblestone is always added
- the model for gravel is added if the dimension is the nether
- the model for sand is added if the biome is a desert
- the model for dirt is added if the model is above y=50 and the biome is not a desert
{
"targets": [
"diorite"
],
"append_models": [
"block/cobblestone",
{
"model": "block/gravel",
"conditions": {
"type": "dimension",
"dimension": "the_nether"
}
},
[
{
"model": "block/sand",
"conditions": {
"type": "biome",
"biome": "desert"
}
},
{
"model": "block/dirt",
"conditions": {
"type": "altitude",
"min_height": 50
}
}
]
]
}When overlaying multiple quads, it may result in stacked breaking overlay textures which amplifies the transparent parts of the breaking overlay. To avoid this, the show_breaking_overlay option can be used to only apply the breaking
overlay to the original model and not any appended models.
A block model modifier that disables the breaking overlay for an appended model would look as follows:
{
"targets": [
"diamond_ore"
],
"append_models": [
{
"model": "block/diamond_ore_overlay",
"show_breaking_overlay": false
}
]
}Each block has a hardcoded random offset function that is applied to its model. Fusion allows overwriting this random offset.
This is done through the random_offset property for model entries.
There are 3 types of random offset types to pick from: none will apply no random offset to the model and is the default value, match_block will apply the hardcoded random offset of the block, and xyz allows for a random offset with a range for each axis.
The xyz type has the following properties:
| key | values | default | description |
|---|---|---|---|
seed |
integer | None | Seed used to generate the random offset |
x |
array of two integers | [0,0] |
Range for the random offset on the x-axis in 1/16th of a block |
y |
array of two integers | [0,0] |
Range for the random offset on the y-axis in 1/16th of a block |
z |
array of two integers | [0,0] |
Range for the random offset on the z-axis in 1/16th of a block |
Here is an example that uses each of the random offset types:
{
"targets": [
"oxeye_daisy"
],
"append_models": [
{
"model": "block/short_grass",
"random_offset": "match_block"
},
{
"model": "block/snow_layer",
"random_offset": "none"
},
{
"model": "block/torch",
"random_offset": {
"type": "xyz",
"x": [-14, -2],
"z": [2, 14]
}
}
]
}When placing pane blocks like glass panes or iron bars on top of each other, the top and bottom faces are not culled. This may become apparent when using connecting textures.
The pane_culling_fix option in block model modifiers will ensure that the top and bottom quads of these panes are culled whenever another pane is placed above or below.
A block model modifier for regular glass panes with the pane_culling_fix option would look as follows:
{
"targets": [
"glass_pane"
],
"pane_culling_fix": true
}Here is what this looks like in game:
|
|
|
|
|