improvements - mickelus/tetra GitHub Wiki

screenshot of improvements in UI

Major modules can hold improvements which change the stats of the item. Improvements have a level, and the stats are defined separately for each level of the improvement. Major modules reference the improvement resources that should be available for that module.

Example data

This would add two improvements, "example/grip_tape" and "example/waxed". The grip tape has two levels which provide different amounts of attack speed and damage. The grip tape has a model, the wax does not.

[
    {
        "key": "example/grip_tape",
        "level": 1,
        "group": "wrap",
        "integrity": -1,
        "attributes": {
            "generic.attack_speed": 0.05,
            "**generic.attack_damage": 0.1
        },
        "models": [{
            "location": "tetra:items/module/double/handle/basic/improvements/wrap_alt",
            "tint": "eebbaf"
        }]
    },
    {
        "key": "example/grip_tape",
        "level": 2,
        "group": "wrap",
        "integrity": -2,
        "attributes": {
            "generic.attack_speed": 0.1,
            "**generic.attack_damage": 0.15
        },
        "models": [{
            "location": "tetra:items/module/double/handle/basic/improvements/wrap_alt",
            "tint": "eebbaf"
        }]
    },
    {
        "key": "example/waxed",
        "group": "wrap",
        "durability": 200,
        "effects": {
            "criticalStrike": 15
        }
    }

Data format

Improvement resources contain an array of improvement data, the format for the objects in that array is described below. Contains mostly the same fields as module variant data, but adds a few that are unique for improvements.

key required

Identifier for the improvement, should be unique

level

Several improvements with the same key may exist as long as they are of different levels. The level field also matters when converting non-modular items into modular items, enchantments that have a matching improvement with the same level will be added to the modular item. No level label is displayed when the level is set to 0.

Default value: 0

enchantment

If set to true the item will render with the enchantment glint and it will be removed when the item is placed in a grindstone.

Default value: false

group

Improvements in the same group cannot be present for a slot at the same time. Adding an improvement with a specified group will remove any other improvement on that slot which has a matching group.

durability

The durability that the improvement 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.

Default value: 0

durabilityMultiplier

Multiplies the durability of the item.

Default value: 1

integrity

Integrity is tetras way of balancing items. Some improvements 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 improvement to provide integrity.

Default value: 0

magicCapacity

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

Default value: 0

attributes

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

The iron blade variant in this example would add 5 damage and reduce attack speed by 0.2

{
    "key": "basic_blade/iron",
    "attributes": {
        "generic.attack_damage": 5,
        "generic.attack_speed": -0.2
    }
}

Attributes prefixed with ** or * will act as multipliers, it works like this:

  • ** multiplies the attribute for the wielding entity (attributes gained from the item plus attributes gained from other sources such as armor or potions), stacks multiplicatively
  • *multiplies the attribute for the improvement (improvement, improvements and tweaks), stacks additively This is the multiply_base and multiply behaviour for attributes in vanilla minecraft (read more here), but tetra captures all modifiers with the multiply_base operation to multiply add modifiers internally before passing them on to the wielding entity.

The improvement in this example would increase the damage of the improvement it's added to by 10% and reduce the attack speed of the wielder by 20%

{
    "key": "blade/jagged",
    "level": 1,
    "attributes": {
        "*generic.attack_damage": 0.1,
        "**generic.attack_speed": -0.2
    }
}

Tetra passes on all attributes for handheld items (swords, double headed, single headed and shields) to the wielding entity when the item is held in the mainhand or the offhand, except for generic.attack_damage which is only passed from the mainhand item.

tools

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

This example would add level 1 hammering capabilities and level 1 cutting capabilities with an efficiency of 20.

{
    "key": "precision_axe/iron",
    "tools": {
        "hammer": 1,
        "cut": [1, 20]
    }
}

effects

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

This example would give a 20% chance to stun for 1.5 seconds when attacking with the item.

{
    "key": "precision_axe/iron",
    "effects": {
        "stun": [20, 1.5]
    }
}

glyph

An object that contains a single field: "tint"

tint

A hexadecimal string used to tint the UI indicator for the improvement

Default value: "ffffff" (white/untinted)

models