Minecraft Commands Guide: How to use weapon item component

     Ready to turn your boring stick into a battle tool or make your sword shatter shields like a boss? Minecraft lets you do that with a sneaky little thing called the weapon component. It’s hidden inside SNBT magic, and when used right, it gives your item powerful combat properties like durability loss per hit and even makes shields useless for a few seconds.

 

Give yourself a feather that acts like a fragile weapon

 

 

What is the weapon

 

     The minecraft:weapon tag turns any item into a weapon that behaves like a combat tool. This tag is an NBT compound, which means it has a pair of values you can tweak and play with. These two values are item_damage_per_attack and disable_blocking_for_seconds, and they’re where the fun begins. When this tag is present on an item, Minecraft will also increment the "Item Used" stat every time you attack with it, which is cool for tracking usage.

 

Combine durability damage and shield disable for full control.

 

 

How item_damage_per_attack works

 

     This value is a simple integer. It tells Minecraft how much to reduce the item’s durability every time you attack. The default is 1, so if you don’t set it, that’s what you’ll get. But you can crank it up to make a weapon break faster if that’s your thing. Want a super fragile sword that’s powerful but burns out fast? This is the setting you mess with. Setting it to 0 means the item won’t lose durability at all from attacking, unless you’ve got other durability modifiers elsewhere.

 

Disable enemy shields with a powerful iron sword.

 

 

How disable_blocking_for_seconds works

 

     This one’s a float, which means it can be a number like 2.5 or 5.0. When you hit someone using a shield, this setting determines how long their shield will be disabled. A value of 0 means no shield disable at all. Anything above that turns your weapon into a temporary shield breaker. Perfect for pvp or giving skeletons a rough time. This effect only kicks in if the attack lands while the target is blocking, and only if the number is above zero.

 

Try out high-damage weapons with quick durability drain.

 

 

How to format the SNBT right

 

     You’ve got to be super careful with how you type it. The format for these values is always inside a compound. Here’s the basic idea:

 

     /give @p iron_sword[minecraft:weapon={item_damage_per_attack:10,disable_blocking_for_seconds:5}]

 

     That command gives you a sword that takes 10 damage to itself every time you swing it and disables shields for 5 seconds. Everything inside the curly braces belongs to the weapon component, and you’ve got to make sure numbers are unquoted. Don’t wrap numbers in quotes or Minecraft will freak out. If you want just a basic weapon setup, you can use an empty compound like this:

 

Make a sword that breaks after just a few hits.

 

 

Bonus adding attack damage

 

     Want the weapon to actually hit harder? The weapon tag doesn’t handle that. For real attack power, you need attribute_modifiers. Combine it with weapon and you’re in business.

 

Use attribute_modifiers to boost actual attack damage.

 

     /give @p minecraft:feather[minecraft:weapon={disable_blocking_for_seconds:3,item_damage_per_attack:2},minecraft:attribute_modifiers=[{type:"minecraft:attack_damage",amount:6,operation:"add_value",slot:"mainhand",id:"0000"}]]

 

     That makes a feather that deals +6 attack damage, disables shields for 3 seconds, and takes 2 durability with each strike. Always remember: weapon controls behavior, not stats. Attribute_modifiers control your real damage.

 

 

Common mistakes

 

     Don’t forget the braces after weapon. weapon is not the same as weapon={}. Leaving it blank without the compound won’t work. Also, don’t try to use strings like "10" or "5.0" for your numbers. They need to be typed as plain numbers. Negative values? Nope. Minecraft won’t accept that. Just stick to positive integers and floats, and you’ll be good to go.

 

Use the proper format of the component.

 

 

Use component in quests and adventures

 

     Imagine you're building a dungeon where players must defeat a boss who can only be damaged by a special enchanted blade. You could give the player a fragile quest item  -  like an ancient sword  -  that has limited durability and disables the boss’s shield for just a few seconds. For example, you could spawn a sword with item_damage_per_attack:5 and disable_blocking_for_seconds:2 to create tension. Every swing counts, and if the player wastes hits, the weapon breaks. This forces players to strategize, not just spam-click. You could even combine it with a scoreboard to detect when the special weapon is used, advancing the quest only if that item delivered the final blow.

 

     Now that you know how to bend the rules with the minecraft:weapon component, your survival world or custom map just got way more exciting. Just stay sharp with your SNBT syntax and you’ll be crafting command magic in no time.

 

Build your world together. Get your own Minecraft server ready in 2 minutes. Free with code WELCOME
Create serverStart hosting your server now
Knowledge Base