TransWikia.com

How to change an item's attack damage?

Arqade Asked on December 22, 2020

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 .

One Answer

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

Correct answer by ExpertCoder14 on December 22, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP