Model Loaders


More Red uses several custom model loaders to load and bake models for certain blocks.

Wire Parts

The morered:wire_parts model loader is used to generate protruding lines and convex edges for certain wire blocks, using neoforge's model loader APIs to allow a blockstate to have one of multiple different models based on world context.

The format of a Wire Parts model json is as follows:

{
	"loader": "morered:wire_parts",
	"line": { <line-model> },
	"edge": { <edge-model> }
}

Where the "line" and "edge" objects are the model jsons to use for the line and edge models, e.g.

{
	"loader": "morered:wire_parts",
	"line": {"parent": "morered:block/red_alloy_wire_line"},
	"edge": {"parent": "morered:block/red_alloy_wire_edge"}
}

The line model should consist of a model on the down face of the block, extending from the north face to where the node model would be; the edge model should connect the west face with the down face.

Image of line and edge models as depicted in Blockbench
Line model (left) and edge model (right) as depicted in Blockbench.
Image of wire part lines
Four red alloy wire blocks, with protruding-line models generated by the wire part model loader, showing that the wires are connected to an adjacent block. All four wire blocks shown have the same blockstate.
Image of wire part lines and convex edges
Several red alloy wire blocks, with convex edges and protruding lines generated by the wire part model loader.

Wire blocks also have "node" and "elbow" baked models that are rendered using the normal baked model system; nodes, elbows, and wire parts are merged together given a blockstate and world context using vanilla multipart blockstate models.

Image of wire part lines and convex edges
Several red alloy wire blocks, with node models (left) and elbow models (right). Nodes and elbows are loaded and rendered using standard vanilla baked models.

Assuming a wire block uses the standard wire blockstate json format (consisting of all of the node and elbow models used together with a morered:wire_parts model in a multipart blockstate json), then the following rules are followed when generating the quads for a wire block at a given position in the world:

  • Node models are to be defined by the multipart blockstate json for each interior face a wire is attached to
  • Elbow models are to be defined by the multipart blockstate json for each pair of adjacent interior faces where a wire is attached to both faces
  • For each of the four neighbors orthagonally adjacent to an attached node, a line model is generated if the node is allowed to connect to that neighbor block
    • A valid connector is defined as a block that allows redstone to connect to it and has a block support shape big enough for a 2x2 pixel wire to attach to it. Redstone Dust and all of More Red's wire blocks are overridden to have different connection behavior. Mods can specify connection behaviours for additional blocks via the Ex Machina API.
  • For each of the 12 edges inside the block, an edge model is generated if neither of the interior faces have an attached wire node, but both of the blocks adjacent to the edge are the same block as the central wire, and have wire nodes on the faces that that edge would connect.
    • Wire blocks will replace air blocks with an "empty" wire block when an edge needs to be rendered in a block where no wire exists; this empty wire block will revert to air when the edge model no longer needs to exist.

The Wire Parts model loader is used by the following blocks:

Rotate Tints

The morered:rotate_tints model loader is used to ensure that red alloy wires have the correct tintindexes when rotated by the wire part loader and the blockstate json. It has the following JSON format:

{
	"loader": "morered:rotate_tints",
	"model": {
		// any model json
	}
}

Tintindexes in a rotate_tints model loader will be transformed into other tintindexes if the model is rotated; the tintindex assigned to each orientation is described in tintindexes. Currently, only red alloy wires use the Rotate Tints model loader.

History

VersionChangelog
1.21.3-7.0.0.0Rotate Tints's delegate model is now specified in a "model" field instead of in the root object
1.16.5-2.1.0.0Added Wire Parts and Rotate Tints model loaders