CraftTweaker

CraftTweaker

151M Downloads

Set Attribute as Opposed to Add / Multiply

ereese99 opened this issue ยท 1 comments

commented

Describe the feature you'd like

Specifically when it comes to swords, it's much more aesthetically pleasing to have all the attributes in green as opposed to blue (using addGlobalAttributeModifier to adjust the damage values of the weapons)

Describe alternatives you've considered

Have looked into the docs and have found nothing

Additional context

Although it functionally works, having a blue +6 attack damage below your 2 pre-set sword attack speed and attack range just looks unsightly

Minecraft version

1.19

Modloader

Fabric

commented

This is already a thing, the way it is meant to be done is like so:

import crafttweaker.api.item.IItemStack;

<item:minecraft:iron_sword>.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, IItemStack.BASE_ATTACK_DAMAGE_UUID, "Extra Power", 100, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:mainhand>]);

The default UUID types are listed here:
https://docs.blamejared.com/1.19/en/vanilla/api/item/IItemStack#static-properties
and this is using the version of addGlobalAttributeModifier that takes in a UUID, which lets you override another modifier.