CraftTweaker

CraftTweaker

151M Downloads

Changed item attributes only stay when item is not damaged

BurgBoi opened this issue ยท 1 comments

commented

Issue description

I recently tried to change some attributes like generic_armor and tested it. However, the changed attribute only stays when the armor is not damaged. For example, if you set the armor attribute for the diamond chestplate to be 100, once you get damaged, the chestplate's armor attribute will return to 3, which is its default value. I think this may be a bug.

Steps to reproduce

Just use the function addGlobalAttributeModifier on an item.
I did this to modify diamond boots:
<item:minecraft:diamond_boots>.addGlobalAttributeModifier(<attribute:minecraft:generic.armor>, "845DB27C-C624-495F-8C9F-6020A9A58B6B", "armor", 10000, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:feet>]);

Script used

https://pastebin.com/G1MrbFfG

The crafttweaker.log file

https://pastebin.com/iVbQpxCx

Minecraft version

1.18

Modloader

Fabric

Modloader version

0.14.5

CraftTweaker version

9.1.137

Other relevant information

No response

The latest.log file

https://pastebin.com/tG3kvz0x

commented

You want to be doing:

<item:minecraft:diamond_boots>.anyDamage().addGlobalAttributeModifier(<attribute:minecraft:generic.armor>, "845DB27C-C624-495F-8C9F-6020A9A58B6B", "armor", 10000, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:feet>]);