Create a Custom Material with Context-Specific Bonuses
Set Up Your Material JSON
Create a new material file in your data pack's tetra/materials/ folder. Define the base stats (primary, secondary, tertiary, durability, toolLevel, etc.) as you normally would.
Add Context Fields
Inside your material JSON, add a contexts object at the root level. Each context key you create can hold its own attributes and effects objects:
`json
"contexts": {
"your_context_name": {
"attributes": {
"generic.attack_speed": 2.5,
"generic.attack_damage": 1.2
},
"effects": {
"effect_name": [duration, amplifier]
}
}
}
`
Link to Modules
In your module JSON files (e.g., sword blades, axe heads), add the context name to the contexts array within each variant:
`json
"contexts": ["your_context_name"]
`
When a player crafts gear using that material and module combination, the bonuses from your context will apply only to that specific part and slot. This lets you fine-tune attack speed or damage for particular weapon types without affecting tools or other gear.