4

I'm doing a RPG in minecraft with some friends but we don't know how to modify the sword damage with commands, we have already tried this command...

/give @p minecraft:diamond_sword{AttributeModifiers:[{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:10,Operation:0,UUIDLeast:724099,UUIDMost:439684,Slot:"mainhand"}],Unbreakable:1}

...but it didn't work. If possible, show us how to do it in 1.16.1 .

5
  • The first thing I'd check is are you using the UUID fields correctly? I thought some of that had changed in the last few versions.
    – MBraedley
    Jul 29, 2020 at 13:19
  • Looking at the wiki, your NBT data isn't correct, specifically the UUID.
    – MBraedley
    Jul 29, 2020 at 13:26
  • which are the new ones?
    – LPA 3227
    Jul 29, 2020 at 14:11
  • would a sharpness enchant work? in that case, the command /give @p diamond_sword{Enchantments:[{id:"sharpness", lvl:20}]} would give you a sword that does ~27 damage. Jul 29, 2020 at 14:38
  • Thanks for the idea, but we have another commands that depend on an enchantment pattern.
    – LPA 3227
    Jul 29, 2020 at 14:48

1 Answer 1

4

First of all, in 1.16, the attribute modifiers have been renamed. Therefore, generic.attackDamage is now generic.attack_damage.

Then, you must get the UUID correct. The UUID is now stored as an TAG_Int_Array instead of two TAG_Longs. So instead of:

UUIDLeast:1234,UUIDMost:5678 --> UUID:[I;12,34,56,78]

Therefore, here is the replacement for your UUID:

UUIDLeast:724099,UUIDMost:439684 --> UUID:[I;439,684,724,099]

But there's another quirk about the system. Apparently, TAG_Strings don't need to be quote-surrounded if they don't contain spaces and special characters. This means you can make a string tag like this:

MyString:HelloWorld

But this also means that any items that aren't valid numbers are treated like strings, and numbers with prefixed zeros are considered invalid and are treated as strings. So 99 is a TAG_Integer, but 099 is a TAG_String, even if there are no quotes around it.

Fixed command:

/give @p netherite_sword{Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.attack_damage",Name:"generic.attack_damage",Amount:10,Operation:0,UUID:[I;439,684,724,99]}]} 1
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .