schematics - mickelus/tetra GitHub Wiki

screenshot of schematics in UI

Schematics define how modules are crafted, and how existing major modules can be improved.

Example data

This schematic would be applicable for the two heads slots of double headed tools, it would allow the player to input either an item tagged as obsidian or two netherite ingot to craft one of two types of hammer heads. The obsidian hammer head would also have the "arrested" improvement applied (if it's available) and they would require a tier 6 hammer (for obsidian) or a tier 7 hammer (for netherite).

{
    "slots": ["double/head_left", "double/head_right"],
    "keySuffixes": ["_left", "_right"],
    "materialSlotCount": 1,
    "glyph": {
        "textureX": 64,
        "textureY": 0
    },
    "displayType": "major",
    "outcomes": [
        {
            "material": {
                "tag": "forge:obsidian"
            },
            "requiredTools": {
                "hammer": 6
            },
            "moduleKey": "double/basic_hammer",
            "moduleVariant": "basic_hammer/obsidian",
            "improvements": {
                "arrested": 0
            }
        },
        {
            "material": {
                "item": "minecraft:netherite_ingot",
                "count": 2
            },
            "requiredTools": {
                "hammer": 7
            },
            "moduleKey": "double/basic_hammer",
            "moduleVariant": "basic_hammer/netherite"
        }
    ]
}

Schematic data format

replace

Marks if this should replace or merge with existing entries (if any) for this schematic definition. The default behaviour for upgrade schematics added by other mods and datapacks is to merge values set by those into the existing entry (if any). By setting replace to true it's possible to completely replace schematics registered by tetra, which can be useful when one wants to remove something.

localizationKey

The key used for localized human readable strings such as name and description. If this is not available the key field is used for picking up localized strings instead, which is preferable in most cases. This field is useful when multiple schematics should use the same name, description etc.

slots required

An array of slots which this schematic is applicable for.

keySuffixes

Suffixes, used when crafted modules should have different keys depending on slot (e.g. pickaxe head keys end with "_left" or "_right" so that different textures can be used depending on the slot. Optional, but if provided it has to have the same length as the slots field.

materialSlotCount

The number of material that can be used when crafting with this schematic, currently only a value 0 or 1 is supported.

Default: 0

repair

States if a repair schematic should also be generated based on this schematic. Useful when the crafted module is repaired using the same materials and tools as if it was crafted.

Default: true

hone

Defines if this schematic should only be applicable when the player has a honing attempt available for the item.

Default: false

requirement

An item predicate which has to be met for this schematic to be applicable. Will not show up in the schematic list if this is not met. Optional, allows all items by default (as long as they have the required slots)

Default: A predicate that matches any item

locked

If true this schematic will only be visible if it is unlocked, either by the workbench or by a nearby block.

Default: false

materialRevealSlot

If set this schematic will only be visible if the player carries at least one itemstack that will produce an outcome if placed in the slot at the provided index.

displayType

Defines the outline around the schematic glyph, visible in most views where players interact with the schematic somehow. Has four possible values: "minor", "major", "improvement", "other". Minor and major display a similar outline as minor and major modules, "improvement" looks like a major module outline with a plus, "other" has no outline and the outline can instead be part of the glyph.

Default: "other"

rarity

The rarity of a schematic affects how it is rendered. Colors and effects are used to differentiate between effects.

Available values: "temporary", "hone", "basic"
Default: "basic"

glyph

The glyph displayed for this schematic, preferably the same as the module it will be used to craft but with no tint. A map that defines which glyph that will display for this schematic, preferably the same as the module it will be used to craft but with no tint. Has four fields:

  • textureX: x coordinate within the texture sheet, default: 0
  • textureY: y coordinate within the texture sheet, default: 0
  • textureLocation: a resource location pointing to the texture sheet that the glyph is to be taken from, has to include .png in the end since it's a gui texture :o, default: "tetra:textures/gui/glyphs.png"
  • tint**: A hexadecimal string used to tint the glyph, default: ffffff (white/untinted)

Some example data reference hardcoded tint values (e.g. "iron_glyph"), those will be removed so use hex values instead.

outcomes required

An array of all potential outcomes of this schematic.

material

The required itemstack required for for the outcome, basically an item predicate. Only required if the schematic which contains this outcome has 1 or more material slots.

materialSlot

The slot in which to look for the material, currently only supports a value of 0.

Default: 0

experienceCost

The experience cost for the craft.

Default: 0

requiredTools

Defines which tools (and which level of each tool) are required for this outcome. If no tools are required this field can be omitted.

Json format:

{
    "toolA": level,
    "toolB": level
}

moduleKey

A key referring to a module. Optional, but the schematic should then apply improvements or the outcome with be nothing.

moduleVariant

A module variant, has to be a variant for the module specified by the moduleKey field. Optional, but has to be set if the moduleKey field is set.

improvements

An object describing which improvements to for this outcome, where the key is the improvement identifier and the value is the improvement level. Optional, this can be used both with and without the moduleKey being set.

Json format:

{
    "improvementA": level,
    "improvementB": level
}

Material outcomes

It's possible to dynamically add schematic outcomes based on material data, how that works is described in more detail on the materials page.