Skip to content

User Defined Materials (Custom Parts)

SilentChaos512 edited this page Sep 7, 2019 · 5 revisions

This is for Minecraft 1.12.2 only! For Minecraft 1.14+, refer to this page: https://github.com/SilentChaos512/Silent-Gear/wiki/Gear-Parts

Silent Gear allows additional tool/armor materials to be defined with JSON files. Place the files in config/silentchaos512/silentgear/materials. The file name must be in the form type_name.json, where type is the part type (main, rod, tip, bowstring, etc.) and name is your choice, but try to make it unique so it does not override another part.

If you add a file with the same name as an existing material (main_iron.json, for example), you can override properties of the material. You only need to include the data you want to change when overriding. Also see the material overrides page.

Updated for 0.4.2 on Minecraft 1.12.2. If something seems off, go bug me on my Discord server (https://discord.gg/gh84eWK).

Changes: (2018-12-24) Updated info on texture suffixes, mention generic_hc and generic_lc. Add traits array to main part example (did not test in-game, but validated JSON syntax). Add chargeability stat to main part for Silent's Gems support. Add section on crafting items. Add section on display properties (includes valid name colors).

Where are the files?

Pre-defined materials from Silent Gear can be found here, or in the JAR file on the same path. Copying from GitHub is recommended, as those files will be up-to-date. Silent's Gems will have its materials in a similar location.

How Stats Work

Full list of stats and more details here: https://github.com/SilentChaos512/Silent-Gear/wiki/Stats

Stats are calculated with a modifier system (the stats array in the JSON files). Modifiers have a value and an operator. The operator is often omitted in mains, and it defaults to AVG. When an item calculates it stats, it collects all the modifiers from all its parts and applies them in the order of operations (which is a bit different than you may expect).

Operations (in order they are applied):

  • AVG - Weighted average. Used for mains, may not work correctly for other parts.
  • ADD - Adds the value to the current value
  • MUL1 - Multiplies the post-ADD value by (1+value). The multipliers are effectively added together.
  • MUL2 - Multiplies the current value by (1+value). The multipliers are effectively multiplied by one another.
  • MAX - Takes the maximum of the calculated value and the material's value

This is a bit more advanced, but you can also have more than one modifier for any given stat on a single material. Just add another line to the stats array. For example, adding a modifier with "op": "MUL1" would add a multiplier to the entire stat calculation, which affects other parts on the same item.

Crafting Items

Under the crafting_items object, you should see one or two objects, "normal" and maybe "small". The "normal" crafting item is used in gear crafting. This is the item crafted with blueprints to produce tool heads or armor. It's typically an ingot or gem, but can be anything. The "small" item is currently unused and there are no plans for it. It was added before the decision to not include decorating was made.

Each crafting item requires either the item or oredict key to be included, although you may specify both. The optional data value allows you to set the damage value (metadata) to match in 1.12.2 only.

In the case where both item and oredict are present, the given item is the "representative", but it will still match the ore dictionary as well. The representative is mostly there for internal reasons, but is also displayed in the part GUI in the crafting station. If only the oredict key is present, the representative is selected automatically. The first result is selected, so the mod the item is from may seem random.

Display Properties

The display object contains properties related to rendering and tooltips.

  • hidden - If true, the parts existence may be hidden, but can still be used for crafting.
  • texture_suffix - The texture used for the part.
  • texture_color - The color (HTML style) to use for the texture normally.
  • broken_color - The color (HTML style) to use if the part is broken.
  • name_color - The formatting for the part's name in tooltips. This is limited to Minecraft's built-in formatting options. Valid values are: black, dark_blue, dark_green, dark_aqua, dark_red, dark_purple, gold, gray, dark_gray, blue, green, aqua, red, light_purple, yellow, white, obfuscated, bold, strikethrough, underline
  • override_localization or override_translation - Needed for custom parts because the translation key will probably not exist. Examples: "Copper", "Red Garnet", etc.

Note On Textures

For custom parts, the best solution for textures is to select a white/grayscale texture, then set texture_color and broken_color to an appropriate value. Non-grayscale textures can be colored as well, but the results may not be what you expect. See the "Recommended Texture Suffixes" section below. The options vary by part type.

I have not tested this yet, but it should be possible to add unique textures for user-defined materials. A resource pack might work for this purpose. Otherwise, I guess modifying the JAR file would be the only way. But for most purposes, recoloring existing "white" textures should be fine.

Recommended Texture Suffixes

Recommended values for texture_suffix. The generic_hc is "high contrast" and tends to produces shiny-looking textures. generic_lc is "low contrast" and looks duller. iron is somewhere in between.

  • main: generic_hc, generic_lc, or iron
  • rod: generic_hc, generic_lc, or iron
  • tip: iron
  • grip: wool
  • binding: generic

Examples

Here are some simple, if slightly silly examples. In most cases, you will want to leave the structure of the file alone and just change the values.

Mains (Tool Heads and Armor)

main_red.json

{
    "type": "main",
    "stats": [
        {"name": "durability",      "value":  999},
        {"name": "armor_durability","value":   99},
        {"name": "enchantability",  "value":   30},
        {"name": "harvest_level",   "value":    1},
        {"name": "harvest_speed",   "value":   20},
        {"name": "melee_damage",    "value":    5},
        {"name": "magic_damage",    "value":    5},
        {"name": "attack_speed",    "value":  0.5},
        {"name": "armor",           "value":   10},
        {"name": "armor_toughness", "value":    2},
        {"name": "magic_armor",     "value":   10},
        {"name": "ranged_damage",   "value":    4},
        {"name": "ranged_speed",    "value":  0.5},
        {"name": "rarity",          "value":   10},
        {"name": "chargeability",   "value":  1.0}
    ],
    "traits": [
        {"name": "silentgear:soft", "level": 2}
    ],
    "crafting_items": {
        "normal": {
            "item": "minecraft:dye",
            "data": 1,
            "oredict": "dyeRed"
        }
    },
    "display": {
        "hidden": false,
        "texture_suffix": "generic_hc",
        "texture_color": "FF0000",
        "broken_color": "FF0000",
        "override_localization": "Red"
    },
    "availability": {
        "enabled": true,
        "tier": 1,
        "tool_blacklist": []
    }
}

Rods

rod_cactus.json

{
    "type": "rod",
    "stats": [
        {"name": "durability",      "value":  0.0, "op": "MUL2"},
        {"name": "enchantability",  "value":  0.2, "op": "MUL2"},
        {"name": "harvest_level",   "value":    0, "op": "ADD"},
        {"name": "harvest_speed",   "value":  0.1, "op": "MUL2"},
        {"name": "melee_damage",    "value":  0.3, "op": "MUL2"},
        {"name": "magic_damage",    "value": -0.3, "op": "MUL2"},
        {"name": "attack_speed",    "value":  0.0, "op": "ADD"},
        {"name": "ranged_damage",   "value":  0.0, "op": "MUL2"},
        {"name": "ranged_speed",    "value":  0.0, "op": "MUL2"},
        {"name": "rarity",          "value":    7}
    ],
    "crafting_items": {
        "normal": {
            "item": "minecraft:cactus"
        }
    },
    "display": {
        "hidden": false,
        "texture_suffix": "iron",
        "texture_color": "11801E",
        "broken_color": "11801E",
        "override_localization": "Cactus"
    },
    "availability": {
        "enabled": true,
        "tier": 1,
        "tool_blacklist": []
    }
}

Tips

tip_dirt.json

{
    "type": "tip",
    "stats": [
        {"name": "durability",      "value":    3, "op": "ADD"},
        {"name": "enchantability",  "value":    1, "op": "ADD"},
        {"name": "harvest_level",   "value":    0, "op": "MAX"},
        {"name": "harvest_speed",   "value": -1.0, "op": "ADD"},
        {"name": "melee_damage",    "value": -0.5, "op": "ADD"},
        {"name": "magic_damage",    "value":  0.0, "op": "ADD"},
        {"name": "attack_speed",    "value": -0.1, "op": "ADD"},
        {"name": "ranged_damage",   "value":  0.0, "op": "ADD"},
        {"name": "ranged_speed",    "value":  0.0, "op": "ADD"},
        {"name": "rarity",          "value":    0}
    ],
    "crafting_items": {
        "normal": {
            "item": "minecraft:dirt"
        }
    },
    "display": {
        "hidden": false,
        "texture_suffix": "iron",
        "texture_color": "B9855C",
        "broken_color": "B9855C",
        "name_color": "underline",
        "override_localization": "Dirt-Coated"
    },
    "availability": {
        "enabled": true,
        "tool_blacklist": []
    }
}

Others

Other part types will be more or less identical, so I won't give specific examples. Check the link under the "Where are the files?" section near the top if you need something more specific. Otherwise, just change the type field to the appropriate type, like "grip" or "binding".

Note: As of 0.2.0, there are no binding materials defined by the mod. They can only be added as custom parts. If you want to require bindings in tool recipes, see the equipment overrides page.