Loot Table Stuff - SilentChaos512/Silent-Gear GitHub Wiki

Silent Gear adds some conditions and functions you can use in loot tables. For example, you can modify the drops of a block if the tool being used has certain traits.

Important Note

Loot tables are loaded before materials, parts, and traits. This means Silent Gear cannot warn you if a part/trait ID you entered does not exist.

Where to Find IDs?

Conditions

has_trait

Checks if a tool has a particular trait. Can also check the level of the trait. This evaluates to false if the trait does not exist.

Format

  • trait - The trait ID
  • level - The level or range of levels to match. Can be int or object. If omitted, matches level 1 and higher. The min or max property can be omitted.
    • min - The smallest level to match (defaults to 1)
    • max - The highest level to match (defaults to Integer.MAX_VALUE)

Example

{
    "condition": "silentgear:has_trait",
    "trait": "silentgear:magmatic",
    "level": {
        "min": "1",
        "max": "1"
    }
}

Functions

select_tier

When applied to a gear item, this will randomize its parts, with the main parts being of the given tier.

Format

  • tier - The tier of main parts to select (defaults to 2)

Example

{
    "function": "silentgear:select_tier",
    "tier": 3
}

set_parts

This format applies only to the updated function in version 3.2.0 for Minecraft 1.19.2

Allows specific parts to be set on a gear item. You can set the materials, as well as modifiers such as grade and starcharged. Remember that grades only apply to materials on main parts.

Format

  • parts (array of objects) - The part list.
    • part (string) - The part ID (required). If the part does not exist, it will be ignored.
    • item (string) - The item ID of the part (required). As parts are not loaded when loot tables are, this must be manually specified. It is frequently the same as the part ID.
    • materials (array of objects or strings) - The material list for the part (required). If strings are used in place of objects, the string is considered to be the material ID and the material will have no modifiers. Different materials can be freely mixed (regardless of the legacy mixing config)
      • material (string) - Material ID (required)
      • modifiers (array of objects) - Material modifiers (optional)
        • type (string) - Modifier type ID (required)
        • Other properties depend on the type

Example

{
    "function": "silentgear:set_parts",
    "parts": [
        {
            "part": "silentgear:hammer_head",
            "item": "silentgear:hammer_head",
            "materials": [
                {
                    "material": "silentgear:diamond",
                    "modifiers": [
                        {
                            "type": "silentgear:grade",
                            "grade": "S"
                        },
                        {
                            "type": "silentgear:starcharged",
                            "level": 1
                        }
                    ]
                },
                {
                    "material": "silentgear:diamond",
                    "modifiers": [
                        {
                            "type": "silentgear:grade",
                            "grade": "S"
                        },
                        {
                            "type": "silentgear:starcharged",
                            "level": 1
                        }
                    ]
                },
                {
                    "material": "silentgear:diamond",
                    "modifiers": [
                        {
                            "type": "silentgear:grade",
                            "grade": "S"
                        },
                        {
                            "type": "silentgear:starcharged",
                            "level": 1
                        }
                    ]
                },
                {
                    "material": "silentgear:diamond",
                    "modifiers": [
                        {
                            "type": "silentgear:grade",
                            "grade": "S"
                        },
                        {
                            "type": "silentgear:starcharged",
                            "level": 1
                        }
                    ]
                },
                {
                    "material": "silentgear:emerald",
                    "modifiers": [
                        {
                            "type": "silentgear:grade",
                            "grade": "S"
                        },
                        {
                            "type": "silentgear:starcharged",
                            "level": 1
                        }
                    ]
                },
                {
                    "material": "silentgear:emerald",
                    "modifiers": [
                        {
                            "type": "silentgear:grade",
                            "grade": "S"
                        },
                        {
                            "type": "silentgear:starcharged",
                            "level": 1
                        }
                    ]
                }
            ]
        },
        {
            "part": "silentgear:rod",
            "item": "silentgear:rod",
            "materials": [
                "silentgear:blaze_gold"
            ]
        },
        {
            "part": "silentgear:tip",
            "item": "silentgear:tip",
            "materials": [
                "silentgear:redstone"
            ]
        },
        {
            "part": "silentgear:coating",
            "item": "silentgear:coating",
            "materials": [
                "silentgear:netherite"
            ]
        }
    ]
}