CraftTweaker

CraftTweaker

151M Downloads

[1.16.5] AttributeModifiers not applying correctly

iArkant opened this issue ยท 0 comments

commented

Issue Description:

AttributeModifiers nbt's is not taking effect after the item is crafted, it shows the correct nbt but the item attributes are not modified.

What happens:

The problem occurs while trying to modify a sword attack damage, I'm using .withTag to modify the attributes of the recipe output item.

For example:
First I use a command to give a the sword with the modified attributes:

/give @p diamond_sword{AttributeModifiers:[{AttributeName:"generic.attack_damage",Name:"generic.attack_damage",Amount:9,Operation:0,UUID:[I;425257579,-1991553360,-1398660269,-1878175350],Slot:"mainhand"}]} 1 

There is no problem with this Diamond Sword - With Command

Then I get the nbt with /ct hand this is what it shows in the log:

<item:minecraft:diamond_sword>.withTag({AttributeModifiers: [{Amount: 9 as int, Slot: "mainhand" as string, AttributeName: "generic.attack_damage" as string, Operation: 0 as int, UUID: [425257579, -1991553360, -1398660269, -1878175350], Name: "generic.attack_damage" as string}]})

After that I applied to the script with no errors:

craftingTable.addShaped("sword_d", <item:minecraft:diamond_sword>.withTag({AttributeModifiers: [{Amount: 9 as int, Slot: "mainhand" as string, AttributeName: "generic.attack_damage" as string, Operation: 0 as int, UUID: [425257579, -1991553360, -1398660269, -1878175350], Name: "generic.attack_damage" as string} as IData] as IData} as IData), [[<item:minecraft:air>, <item:minecraft:diamond>, <item:minecraft:air>], [<item:minecraft:air>, <item:minecraft:diamond>, <item:minecraft:air>], [<item:minecraft:air>, <item:minecraft:diamond>, <item:minecraft:air>]]);

Diamond Sword - No Displaying Damage

When I craft the sword the damage goes to 1 instead of the amount I'm telling it, also it doesn't show any stat on the Tooltip and the nbt data is correct.

This is the /ct hand of the sword after crafted.

<item:minecraft:diamond_sword>.withTag({AttributeModifiers: [{Amount: 9 as int, Slot: "mainhand" as string, AttributeName: "generic.attack_damage" as string, Operation: 0 as int, UUID: [425257579 as int, -1991553360 as int, -1398660269 as int, -1878175350 as int], Name: "generic.attack_damage" as string}]})

What you expected to happen:

To change the item attributes damage/speed/durability...

Script

crafttweaker.log


Affected Versions

  • Minecraft: 1.16.5
  • Forge: forge-36.0.13
  • Crafttweaker: CraftTweaker-1.16.5-7.1.0.111
  • Using a server: No
  • If yes, does the client have the exact same scripts?

log