Skip to content

Addon Development: Value Types

Ruben Taelman edited this page Apr 4, 2021 · 1 revision

Value types in Integrated Dynamics indicate types for values, such as integers and booleans.

Creation

All value types must implement the IValueType interface.

Value types are like blocks in Minecraft. They are only created once, and do not keep state by themselves. The values (generic type V) they refer to are instantiated multiple times.

The easiest way to get started, is by extending from the abstract ValueTypeBase class. If you want to use this class, your main mod class MUST extend from ModBase and you must override getMod in your value type to refer to your mod instance.

A simple value type example you can take inspiration from is ValueTypeBoolean. More examples can be found here.

Models and Localization

When extending from ValueTypeBase, your assets must be structured as follows:

Model

Each aspect must have a variable item overlay model defined at the path assets/<mod-id>/models/valuetype/<valuetype-name>.json.

In the case of the boolean value type, the file assets/integrateddynamics/models/assets/valuetype/boolean.json could contain the following:

{
  "parent": "item/generated",
  "textures": {
    "layer0": "integrateddynamics:valuetype/boolean"
  }
}

Localization

Your language file must contain your part name as valuetype.<mod-id>.<valuetype-name>.

For example:

"valuetype.integrateddynamics.boolean": "Boolean",