https://mods.vintagestory.at/attributer
Basically wherever the code says "get parent object attribute" it instead "get object attribute if exists first".
Requirements:
- None.
Incompatibilities:
- None?
Mods requiring this:
New Attributes:
- maxdurability.
Supported Attributes:
- defaultProtLoss
- protectionModifiers
- protectionTier
- highDamageTierResistant
- flatDamageReduction
- relativeProtection
- statModifiers
- healingeffectiveness
- hungerrate
- rangedWeaponsAcc
- rangedWeaponsSpeed
- walkSpeed
- damage
- attackpower
- attackrange
- miningspeed
- miningtier
- health
- clothescategory
- breakChanceOnImpact
- requiresAnvilTier
- workableTemperature
- Please note, some attributes are enabled by the api by default and do not need this mod.
- Search the official API and official survival mod github repositorys to check.
Attribute Exceptions:
- perTierFlatDamageReductionLoss
- perTierRelativeProtectionLoss
These aren't mirrored as other attributes are, as arrays aren't supported by the API.
Instead, they should be TreeAttributes, with the float values of "0" and "1" placed into them.
This is a workaround until the API updates.
How to use (For developers):
- Set an attribute on an item.
- Example (Set an items attack power):
- itemstack.Attributes.SetFloat("attackpower", 12f);
- itemstack.Attributes.SetFloat("attackpower", 12f);
- Example (Set an items flat damage reduction):
- itemstack.Attributes.GetTreeAttribute("protectionModifiers").SetFloat("flatDamageReduction", 8f);
- itemstack.Attributes.GetTreeAttribute("protectionModifiers").SetFloat("flatDamageReduction", 8f);
- Example (Set an items attack power):
- That's it. It should work if the attribute is supported.
How to use (Standalone):
- Use an command that supports or sets attributes.
- Example (Set the weapon in your hand's attack power.):
- /debug heldstattr attackpower float 1000000
- /debug heldstattr attackpower float 1000000
- Example (Set the weapon in your hand's attack power.):
- That should do it.
Please note you must mirror attributes exactly, including trees, to how the parent item is.