ItemModel class

An item's look, built: the voxels its ItemShape paints in its colours, the point it is held by (origin), how (grip) and the metres of a voxel (scale). Built once a look (of): two items that look alike are one model, so whatever is made from it (a mesh, an icon) is made once for both.

Constructors

ItemModel.of(ItemType item, BlockRegistry<BlockType> blocks, ItemRegistry<ItemType> items)
The model of item, whose block (if it places one) is in blocks and whose bucket's items (if it is one) are in items: the same object for every item of the same look. Throws ArgumentError for ItemShape.block on an item that places no block.
factory

Properties

grip → ItemGrip
How it is held.
final
hashCode → int
The hash code for this object.
no setterinherited
origin → Vector3
The voxel-space point the model's node sits on: where it is held, on the floor of the model.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scale → double
Metres a voxel.
final
voxels → Map<IVec3, Vector3>
{voxel: colour}.
final

Methods

bounds() → Aabb3
The model's bounds in metres, in its node's space.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

shapeOf(ItemType item) → ItemShape
The shape item is drawn as: its own ItemType.shape, or else one read off its row. Throws ArgumentError for a tool the kit has no shape for, which must declare its own.