Skip to content

Advanced Components

­Sollace edited this page May 3, 2020 · 5 revisions

The following are slightly more advanced components. They have their own page here because they require a little more space to fully explain.

Slot (mson:slot)

Nameable

A slot is a special component that you can use to embed an entire other model's data at its position in your model's structure. Where you place it can depend on what kind of implementation the slot is configured to provide, but in most cases they can fit in anywhere you would place a parent component.

Aliases (Modders)

There is no equivalent to this in vanilla or blockbench, sorry.

Attributes

Attribute Name Attribute Type Default Value Supports Variables Description
implementation text {required} No The fully-qualified class name of the component this slot implements. An instance of this type will be generated and inserted into the tree at this slot's position.
content text/object {required} No The content to use when generating this slot. Can either be a reference to another model file, similar to a model's parent, or the same format embedded directly within the slot.
name text {required} No The name of this component.
texture texture [0, 0, 0, 0] No Defines the texture u, v, w, and h for this component. #see Textures for more details.
locals object {} No An object defining all the variables declared by this file. #See Variables for more details.

A Note On Locals

Unlike other components, slots have their own local space distinct from the model they were declared in. They cannot reference outside variables, however they can declare their own variables and override the ones inherited from the model defined in their content attribute.

Quads (mson:quads)

This is an experimental component. Use at your own risk!

Quads allows you to define a model shape manually by specifying the position and texture of each individual vertex.

Aliases (Modders)

There is no equivalent to this in vanilla or blockbench, sorry.

Attributes

Attribute Name Attribute Type Default Value Supports Variables Description
u number {required} No #see Textures for more details.
v number {required} No #see Textures for more details.
vertices vertex[] {required} No The set of vertices used by this component.
faces face[] {required} No The set of faces, built from vertices, used by this component.

Vertex

Represents a unique point in 3D space.

A vertex is defined with the following forms:

{ x: 0, y: 0, z: 0, u: 0, v: 0 }

[ x, y, z, u, v ]

Face

A face is defined with the following form:

{ x: 0, y: 0, w: 0, h: 0, vertices: [] }

Attribute Name Attribute Type Default Value Supports Variables Description
x number {required} No #see Textures for more details.
y number {required} No #see Textures for more details.
w number {required} No #see Textures for more details.
h number {required} No #see Textures for more details.
vertices number[] {required} No List of vertex indices used for this face. Each vertex will be looked up from the vertices definition in the parent component.