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 .

  • 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 at 13:19
  • Looking at the wiki, your NBT data isn't correct, specifically the UUID. – MBraedley Jul 29 at 13:26
  • which are the new ones? – LPA 3227 Jul 29 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. – 12 rhombi in grid w no corners Jul 29 at 14:38
  • Thanks for the idea, but we have another commands that depend on an enchantment pattern. – LPA 3227 Jul 29 at 14:48

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:


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
| improve this answer | |
  • Thank you, it worked very well. – LPA 3227 Jul 29 at 18:36
  • This returned the error: "Can't insert TAG_string into list of TAG_int at position 170" for me. – 12 rhombi in grid w no corners 2 days ago
  • @12rhombiingridwnocorners I found the error! Follow this post, I'll edit it to provide the correct answer. – ExpertCoder14 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.