Modules

Banner showing the module composition of an item

Modular items have a set of slots which can hold modules. There are major and minor module slots, the item defines which are which. Major modules are denoted by the larger diamond shaped borders, major modules can hold improvements.

Modules have multiple variants (often based on different materials), it's the variants that provide stats and effects.

Most modules can only go in a single slot, but the modules used for the heads of double headed tools or the slots for the belt can fit into several. Data-wise those are considered as a single module but under the hood those are duplicated into different modules for each slot.

Modules can be defined in JSON files within data/tetra/modules/ in your datapack, those resources are typically structured like this: data/tetra/modules/<item>/<module>, e.g. data/tetra/modules/sword/basic_blade.json for basic blades.

Module data

Data defining a module and its variants.

Format:
replaceoptionalboolean

If set to true this resource will replace others with the same location, rather than them being merged.

slots
array[
string
Example values:
sword/blade
]

An array of slots that this module can go into, has to contain at least one value.

slotSuffixesoptional
array[
string
]

Use when modules should have different models depending on slot, setting this will effectively generate multiple modules with keys suffixed with values in this array. The suffixes are also applied to model locations for the variants of the module, and for models of any improvements applied to this module. Usable for double headed tool heads, like a pickaxe head. Likely not usable for modules that only go in one slot. Make sure the length of this matches the length of the slots array.

typestring
Example values:
tetra:basic_module
tetra:multi_module
tetra:basic_major_module
tetra:multi_major_module
tetra:toolbelt_module

Defines the type of the module. Built in types are listed as examples, but addons may add additional types.

improvements
array[
Resource location
Example values:
tetra:sword/basic_blade/
tetra:sword/shared_blade/
tetra:sword/shared/
tetra:shared/
]

An array of references to improvement resources that this module should be able to hold, only applicable for major modules. Can (and should) reference folders to allow for compatibility between addons, see structure in the examples.

renderLayeroptionalstring
Allowed values:
LOWEST
LOWER
LOW
BASE
HIGH
HIGHER
HIGHEST

Defines the layer that this module's textures should render on, default: BASE

namePriorityoptionalstring
Allowed values:
LOWEST
LOWER
LOW
BASE
HIGH
HIGHER
HIGHEST

The priority for setting the name of the item. Multiple modules may want to provide an item name e.g. hammer, or pickaxe, and this field is used to prioritize that. Default: BASE

prefixPriorityoptionalstring
Allowed values:
LOWEST
LOWER
LOW
BASE
HIGH
HIGHER
HIGHEST

The priority for setting the prefixes of the item. Multiple modules may want to provide a name prefix e.g. Iron Pickaxe, Tempered steel axe, or Serrated copper shortblade. Only two prefixes are displayed and when more than two are available, this field is used to prioritize which prefixes are used. Default: BASE

tweakKeyoptionalResource location

Reference to a tweak resource, use if this module should have variants or improvements that should have tweakable stats.

variants
array[
Module variant data
]

This describes all the variants of this module, should contain at least one value.

Example:
{
  "replace": false,
  "slots": [
    "sword/blade"
  ],
  "type": "tetra:basic_major_module",
  "improvements": [
    "tetra:sword/basic_blade/",
    "tetra:sword/shared_blade/",
    "tetra:sword/shared/",
    "tetra:shared/"
  ],
  "variants": [
    {
      "key": "example_blade/iron",
      "attributes": {
        "generic.attack_speed": -1.9,
        "generic.attack_damage": 5
      },
      "effects": {
        "sweeping": 1
      },
      "tools": {
        "cut": [
          1,
          2
        ]
      },
      "aspects": {
        "edged_weapon": 2,
        "breakable": 2
      },
      "integrity": -1,
      "durability": 200,
      "magicCapacity": 84,
      "tags": [
        "forge:swords"
      ],
      "glyph": {
        "textureX": 46,
        "textureY": 16,
        "tint": "ecafbd"
      },
      "models": [
        {
          "location": "tetra:items/module/sword/blade/example/metal"
        }
      ]
    },
    {
      "materials": [
        "tetra:wood/",
        "tetra:bone/"
      ],
      "key": "basic_blade/",
      "attributes": {
        "generic.attack_speed": -1.9
      },
      "effects": {
        "sweeping": 1
      },
      "tools": {
        "cut": [
          1,
          2
        ]
      },
      "aspects": {
        "edged_weapon": 2,
        "breakable": 2
      },
      "durability": -20,
      "tags": [
        "forge:swords"
      ],
      "extract": {
        "primaryAttributes": {
          "generic.attack_damage": 1
        },
        "durability": 0.9,
        "integrity": -1,
        "magicCapacity": 1,
        "glyph": {
          "textureX": 0
        },
        "availableTextures": [
          "metal",
          "shiny",
          "grainy",
          "crude"
        ],
        "models": [
          {
            "location": "tetra:item/module/sword/blade/basic/"
          }
        ]
      }
    }
  ]
}

Module variant data

Variant data for modules, there are two different types of variants: standard and material variants. Material variants can inherit properties from a material.

Standard module variant data

Directly defines a single module variant.

Format:
keyoptionalstring

Identifier for the variant, should be unique.

categoryoptionalstring

The category is used when grouping variants in the holosphere UI, the localization key used for the displayed value is 'tetra.variant_category.<value>.label'.

durabilityoptionalnumber

The durability that the module provides, called item damage in vanilla minecraft. A higher value makes the item last longer before it needs repairs. Swords lose one point of durability when hitting entities and two points when destroying blocks, for tools it's the opposite.

durabilityMultiplieroptionalnumber

Multiplies the durability of the item. A value of 2.0 would double the durability of the item, a value of 1.0 would cause no change.

integrityoptionalnumber

Integrity is used for balancing and acts as a capacity for how many modules and improvements an item can hold. Some modules provide integrity while some have an integrity cost, if an upgrade would cause the cost to exceed the available integrity the upgrade would not be possible. A negative value represents an integrity cost while positive values cause the module to provide integrity.

magicCapacityoptionalnumber

The magic capacity determines how many enchantments a module can hold before it starts to suffer from destabilization effects. A higher value is better. Only relevant for major modules since those are the only ones that can hold enchantments.

attributesoptional
map[
string
:
number
]

A map of attributes, used to add damage, armor, toughness, attack speed or reach/range to an item.

toolsoptionalTiered data
Example values:
{
  "hammer": 1,
  "cut": [
    "minecraft:iron",
    20
  ]
}

Adds tool capabilities for the item. Efficiency is optional, a single number can be passed instead of an array when omitting the efficiency.

effectsoptionalTiered data
Example values:
{
  "stun": [
    20,
    1.5
  ]
}

Adds item effects for the item. Efficiency is optional, a single number can be passed instead of an array when omitting the efficiency.

aspectsoptionalTiered data
Example values:
{
  "edged_weapon": 1
}

Aspects determine how a module can be modified by improvements and enchantments. Schematics may require an aspect to be present or to be of a specific level for it to be applicable for a module. Vanilla enchantment categories match against a set of aspects. For enchantment aspects level 1 allows the enchantment to be applied using books and level 2 allows the enchantment to be applied using an enchanting table.

tagsoptional
array[
Resource location
]

Hacky solution to allow modules to apply tags to an item, possibly useful for mod compat. Works in cases where the functionality uses ItemStack.is to check for tags.

rarityoptionalstring
Example values:
COMMON
UNCOMMON
RARE
EPIC

The rarity of the item is determined by the module or improvement with the highest rarity value. Vanilla values listed as examples, but other mods may add more.

glyphoptionalGlyph

This glyph is displayed in the workbench UI when an item has a module with this variant, and in the variant list in the holosphere UI.

prefixPriorityoptionalstring
Allowed values:
LOWEST
LOWER
LOW
BASE
HIGH
HIGHER
HIGHEST

The priority for setting the prefixes of the item. Multiple modules may want to provide a name prefix e.g. Iron Pickaxe, Tempered steel axe, or Serrated copper shortblade. Only two prefixes are displayed and when more than two are available, this field is used to prioritize which prefixes are used. Default: BASE

modelsoptional
array[
Module model
]

A set of models that this module should add to the item. The order in which the models are listed here affects how they are layered during rendering, but any 'renderLayer' fields present on the models will take precedence over this order.

Material module variant data

Expands into several module variants based on the referenced materials. Stats can be based on material properties, and some material properties are inherited by the expanded variants. Mostly has the same fields as a standard module variant, the values of those fields are merged with what is extracted from the material.

Format:
materialsoptional
array[
Resource location
]

Can reference material folders or specific materials, referencing folders makes for improved compatability with addons.

durabilityoptionalnumber

The durability that the module provides, called item damage in vanilla minecraft. A higher value makes the item last longer before it needs repairs. Swords lose one point of durability when hitting entities and two points when destroying blocks, for tools it's the opposite.

durabilityMultiplieroptionalnumber

Multiplies the durability of the item. A value of 2.0 would double the durability of the item, a value of 1.0 would cause no change.

integrityoptionalnumber

Integrity is used for balancing and acts as a capacity for how many modules and improvements an item can hold. Some modules provide integrity while some have an integrity cost, if an upgrade would cause the cost to exceed the available integrity the upgrade would not be possible. A negative value represents an integrity cost while positive values cause the module to provide integrity.

magicCapacityoptionalnumber

The magic capacity determines how many enchantments a module can hold before it starts to suffer from destabilization effects. A higher value is better. Only relevant for major modules since those are the only ones that can hold enchantments.

attributesoptional
map[
string
:
number
]

A map of attributes, used to add damage, armor, toughness, attack speed or reach/range to an item.

toolsoptionalTiered data
Example values:
{
  "hammer": 1,
  "cut": [
    "minecraft:iron",
    20
  ]
}

Adds tool capabilities for the item. Efficiency is optional, a single number can be passed instead of an array when omitting the efficiency.

effectsoptionalTiered data
Example values:
{
  "stun": [
    20,
    1.5
  ]
}

Adds item effects for the item. Efficiency is optional, a single number can be passed instead of an array when omitting the efficiency.

aspectsoptionalTiered data
Example values:
{
  "edged_weapon": 1
}

Aspects determine how a module can be modified by improvements and enchantments. Schematics may require an aspect to be present or to be of a specific level for it to be applicable for a module. Vanilla enchantment categories match against a set of aspects. For enchantment aspects level 1 allows the enchantment to be applied using books and level 2 allows the enchantment to be applied using an enchanting table.

tagsoptional
array[
Resource location
]

Hacky solution to allow modules to apply tags to an item, possibly useful for mod compat. Works in cases where the functionality uses ItemStack.is to check for tags.

rarityoptionalstring
Example values:
COMMON
UNCOMMON
RARE
EPIC

Determines the rarity of the module, if the material has a higher rarity than this value then that value will be used instead.

modelsoptional
array[
Module model
]

These models are added straight up to the resulting module variant without being tinted or affected by the material.

extractoptional
primaryAttributesoptional
map[
string
:
number
]

A map of attributes, will be multiplied by the material's primary multiplier.

secondaryAttributesoptional
map[
string
:
number
]

A map of attributes, will be multiplied by the material's secondary multiplier.

tertiaryAttributesoptional
map[
string
:
number
]

A map of attributes, will be multiplied by the material's tertiary multiplier.

primaryEffectsoptionalTiered data

Effects that will be multiplied (both level and efficiency) by the material's primary multiplier.

secondaryEffectsoptionalTiered data

Effects that will be multiplied (both level and efficiency) by the material's secondary multiplier.

tertiaryEffectsoptionalTiered data

Effects that will be multiplied (both level and efficiency) by the material's tertiary multiplier.

durabilityoptionalnumber

The material's durabililty will be multiplied by this value and the product is added to the resulting module variant.

durabilityMultiplieroptionalnumber

The material's durabililty will be multiplied by this value the result is added to the durabilityModifier field of the resulting module variant, this can get a bit wonky as material durability varies significantly.

integrityoptionalnumber

Defines integrity gain/cost that should be based on the material's integrity factor. Decimal value are allowed, the result will be rounded off to the nearest integer.

magicCapacityoptionalnumber

The material's magic capacity will be multiplied by this value and the product is added to the resulting module variant. You'd often want to set this to 1 for modules that can hold enchantments, otherwise leave it unset.

toolsoptionalTiered data

Tools that should be based the level/efficiency on the material, e.g. pickaxe for pickaxes.

glyphoptionalGlyph

The glyph for the module, the tint from the material will be used.

modelsoptional
array[
Module model
]

Module models that should be tinted and suffixed based on the material.

availableTexturesoptionalunknown

Texture suffixes available for model textures, the first material texture that matches one of the textures listed here will be used, if none matches the first of the available textures will be used.

Module types

The following module types are available in base tetra:

  • tetra:basic_module: Used by most minor modules, e.g. sword guards or bow risers
  • tetra:multi_module: Used by most major modules, e.g. sword blades or bowstrings
  • tetra:basic_major_module: Used for minor modules that can go in multiple slots, no current uses
  • tetra:multi_major_module: Used for major modules that can go in multiple slots, e.g. double headed tool heads
  • tetra:toolbelt_module: Used for belt attachment modules

Relevant localization keys

Keys used for localization entries related to modules and module variants:

  • tetra.module.<module_path>.name: The name of the module, used in synergy tooltips
  • tetra.module.<module_path>.description: Shown in the module details view in the workbench and in the description tooltip in the holosphere
  • tetra.module.<module_path>.item_name: (Optional) Changes the name of the item when this module is present
  • tetra.module.<module_path>.prefix: (Optional) Adds a prefix for the item name when this module is present, items will show the 2 highest priority prefixes. For modules using only material variants this can contain a '%s' which will be replaced with the material name
  • tetra.module.<module_path>.material_name: Used to determine the variant name for modules with material variants, should contain a '%s' which will be replaced with the material name
  • tetra.variant.<variant_key>: The name of the variant, used as label for the module in the workbench, the module detail view, in synergy tooltips and in the holosphere variant detail view
  • tetra.variant.<variant_key>.item_name: (Optional) Changes the name of the item when this variant is present
  • tetra.variant.<variant_key>.prefix: (Optional) Adds a prefix for the item name when this variant is present, items will show the 2 highest priority prefixes.
  • tetra.variant.<variant_key>.description: (Optional) Shown in the module details view in the workbench, used instead of the module description if present
  • tetra.variant_category.<category>.label: The label for the variant category, used in the holosphere