#(Dangles) Modifying Item Attributes

29 messages · Page 1 of 1 (latest)

hard flower
#

I am looking to include some custom item scripts. I am running into some misunderstanding potentially with how accomplish a couple goals. Namely is modifying things like attack speed and to an extent, damage.

I have reviewed the documentation on item scripts, and understand to an extent that adding a attribute modifier to a weapon isn't actually changing the weapons damage, but changing the players base damage in essence. Same with attack speed. I noticed this when I would set a stone axe to have slightly faster attack speed, realizing it was using my players base weapon speed.

Is there anyway to modify base item attributes?

Thanks!

cyan solsticeBOT
#

(Dangles) Modifying Item Attributes

cyan solsticeBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

wet tendon
#

!l attribute modifier

dim yachtBOT
# wet tendon !l attribute modifier

In minecraft, the "attributes" system defined certain core numerical values on entities, such as max health or attack damage.
The value of an "attribute" is determined by its "base value" modified mathematically by each of its "attribute modififers".
"Attribute modifiers" can be added either directly to the entity, or onto items - when on an item, an entity can equip it into the correct slot to automatically apply the modifier.

These can be read via such tags as !tag EntityTag.attribute_modifiers, !tag ItemTag.attribute_modifiers,
!tag EntityTag.has_attribute, !tag EntityTag.attribute_value, !tag EntityTag.attribute_base_value, !tag EntityTag.attribute_default_value, ...

These can be modified by such mechanisms as <@link mechanism EntityTag.attri...

Group

Properties

wet tendon
#
Operation names are based on the Bukkit enum.
ADD_NUMBER corresponds to Mojang "ADDITION" - adds on top of the base value.
ADD_SCALAR corresponds to Mojang "MULTIPLY_BASE" - adds to the total, multiplied by the base value.
MULTIPLY_SCALAR_1 corresponds to Mojang "MULTIPLY_TOTAL", multiplies the final value (after both "add_number" and "add_scaler") by the amount given plus one.
#

so its your base attributes + equipment attributes

hard flower
#

Is that how vanilla items work as well, E.g. a stone axe just adds 9 damage?

wet tendon
#

yes

#

you can do this similarly in vanilla

#

by adding additional or changing the weapon's attribute

#

when you "wear" them

#

those attributes are added to the entity's attribute

#

on in our case

#

the player

hard flower
#

so the fluff text in the vanilla items is just "lore"

wet tendon
#

not exactly, it should change too iirc

azure vergeBOT
wet tendon
#
/give @a stone_sword[attribute_modifiers=[{type:armor,amount:10,id:"10",operation:add_value},{type:max_health,amount:20,id:"2",operation:add_value}]]
#

now that you've mentioned it. weird the damage and attack speed doesn't seem to reflect after adding customized attributes

#

probably minecraft replaces it with the attribute modifiers

#

in lore

hard flower
#

Yes, that is what I was getting at lol

hard flower
#

Is there a simple way to change an items max durability? I know you can set durability in the script, but it seems to just subtract from the max durability, and the field sadly does not accept negative numbers.

#

I know you can - adjust <item> durability:X but perhaps seeing if there exists a solution for doing it as a base property of the item

hard flower
#

resolved