Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs
The Bug:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Swords can be used to mine bamboo saplings, bamboo, and cobwebs much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a bamboo sapling, bamboo, or a cobweb.
- Give yourself a sword that has two durability by using the command provided below.
/give @s minecraft:netherite_sword{Damage:2029} - Destroy the bamboo sapling, bamboo, or cobweb using the sword and as you do this, pay close attention to the sword's durability.
- Take note as to whether or not swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo saplings, bamboo, or cobwebs.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
public class SwordItem extends TieredItem implements Vanishable { ... public boolean mineBlock(ItemStack itemStack, Level level, BlockState blockState, BlockPos blockPos, LivingEntity livingEntity) { if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } return true; } ...
If we look at the above class, we can see that there is only one check that is carried out before allowing the durability of a sword to decrease when using this item to destroy a block. This check is to see if the said block can be instantly destroyed, and if it can, the sword doesn't consume durability, but if it can't, the sword will consume double durability. The game doesn't check if the said block is a bamboo sapling, bamboo, or a cobweb, before allowing the sword to consume double durability, therefore resulting in this problem occurring.
Fix:
Simply altering the existing "if" statement to check if the said block is a bamboo sapling, bamboo, or a cobweb, and adding an "if else" statement to then check if the said block can be instantly destroyed before allowing the sword to consume double durability, will resolve this problem.
if (blockState.getDestroySpeed(level, blockPos) != 0.0F) {
itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> {
livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND);
});
}
if (blockState.getBlock() instanceof BambooSaplingBlock || blockState.getBlock() instanceof BambooBlock || blockState.getBlock() instanceof WebBlock) { itemStack.hurtAndBreak(1, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } else if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }
Linked Issues
is duplicated by2
- Unresolved
[Mod] Avoma
bugsbugsbugs- 25
- 8
- Confirmed
Normal
- Gameplay
- Items
- bamboo bamboo_sapling cobweb sword
1.16.1 - 1.21.4
1.16.1 20w29a 20w30a 1.16.2-pre1 1.16.2-pre2 1.16.2-pre3 1.16.2-rc1 1.16.2-rc2 1.16.2 1.16.3-rc1 1.16.3 1.16.4-pre1 1.16.4-pre2 1.16.4-rc1 1.16.4 20w45a 20w46a 20w48a 20w49a 20w51a 21w03a 21w05a 21w05b 21w06a 21w07a 21w08a 21w08b 21w10a 21w11a 21w13a 21w14a 21w15a 21w16a 21w17a 21w18a 1.17 1.17.1 21w40a 21w41a 21w42a 21w43a 1.18-rc3 1.18 1.18.1 22w03a 22w05a 22w06a 22w07a 1.18.2-pre2 1.18.2 22w17a 1.19 1.19.2 22w43a 1.19.3 1.19.4 1.20 1.20.1 24w11a 1.21 24w33a 1.21.3 1.21.4
Created Issue:
Sword loses two durability when mining bamboo
The bug
When you mine bamboo with a sword, the sword will lose two durability points instead of one even though you insta mine it, which is faster than normal speed.
How to reproduce:
- Run this command: /give @p netherite_sword {Damage:2029}
1
- Mine bamboo with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo with a sword, the sword will lose two durability points instead of one even though you insta mine it, which is faster than normal speed.
How to reproduce:
- Run this command:
/give @p netherite_sword {Damage:2029}1
- Mine bamboo with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo with a sword, the sword will lose two durability points instead of one even though you insta mine it, which is faster than normal speed.
How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1- Mine bamboo with the sword
It broke, but it had 2 durability.
Sword loses two durability when mining cobwebs and bamboo
The bug
When you mine bamboo with a sword, the sword will lose two durability points instead of one even though you insta mine it, which is faster than normal speed.
How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1- Mine bamboo with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo or cobwebs with a sword, the sword will lose two durability points instead of one even though you insta mine it, which is faster than normal speed.
How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1
- Mine bamboo or cobwebs with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo or cobwebs with a sword, the sword will lose two durability points instead of one even though you
instamine it, which is faster than normal speed.How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1
- Mine bamboo or cobwebs with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo or cobwebs with a sword, the sword will lose two durability points instead of one even though you mine it faster. Bamboo even get insta mined with the sword.
How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1
- Mine bamboo or cobwebs with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo
orcobwebs with a sword, the sword will lose two durability points instead of one even though you mine it faster. Bamboo even get insta mined with the sword.How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1
- Mine bamboo
orcobwebs with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo, cobwebs or leaves with a sword, the sword will lose two durability points instead of one even though you mine it faster. Bamboo even get insta mined with the sword.
How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1
- Mine bamboo, cobwebs or leaves with the sword
It broke, but it had 2 durability.
Sword loses two durability when mining cobwebsandbambooSword loses two durability when mining cobwebs, bamboo or leaves
The bug
When you mine bamboo
,cobwebsor leaveswith a sword, the sword will lose two durability points instead of one even though you mine it faster. Bamboo even get insta mined with the sword.How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1
- Mine bamboo, cobwebs or leaves with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo or cobwebs with a sword, the sword will lose two durability points instead of one even though you mine it faster. Bamboo even get insta mined with the sword.
How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1
- Mine bamboo, cobwebs or leaves with the sword
It broke, but it had 2 durability.
Sword loses two durability when mining cobwebs,bambooor leavesSword loses two durability when mining cobwebs or bamboo
The bug
When you mine bamboo or cobwebs with a sword, the sword will lose two durability points instead of one even though you mine it faster. Bamboo even get insta mined with the sword.
How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1
- Mine bamboo, cobwebs or leaves with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo or cobwebs with a sword, the sword will lose two durability points instead of one even though you mine it faster. Bamboo even get insta mined with the sword.
How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1- Mine bamboo, cobwebs or leaves with the sword
It broke, but it had 2 durability.
The bug
When you mine bamboo or cobwebs with a sword, the sword will lose two durability points instead of one even though you mine it faster. Bamboo even get insta mined with the sword.How to reproduce:
- Run this command:
/give @p netherite_sword{Damage:2029} 1- Mine bamboo, cobwebs or leaves with the sword
It broke, but it had 2 durability.
The Bug:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Swords can be used to mine cobwebs and bamboo much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a cobweb or some bamboo.
- Obtain a sword that has two durability.
/give @s minecraft:netherite_sword{Damage:2029}
- Destroy the cobweb or bamboo using the sword and as you do this, take note as to whether or not the sword consumes one durability or two durability.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo or cobwebs.
Swordloses two durability when mining cobwebs or bambooSwords consume double durability than they normally would when destroying bamboo or cobwebs
is duplicated by
The Bug:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Swords can be used to mine cobwebs and bamboo much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a cobweb or some bamboo.
- Obtain a sword that has two durability.
/give @s minecraft:netherite_sword{Damage:2029}
- Destroy the cobweb or bamboo using the sword and as you do this,
take note as to whether or not the sword consumes one durability ortwo durability.Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo or cobwebs.
The Bug:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Swords can be used to mine cobwebs and bamboo much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a cobweb or some bamboo.
- Obtain a sword that has two durability.
/give @s minecraft:netherite_sword{Damage:2029}
- Destroy the cobweb or bamboo using the sword and as you do this, pay close attention to the durability of the sword.
- Take note as to whether or not swords consume double durability than they normally would when destroying bamboo or cobwebs.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo or cobwebs.
The Bug:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Swords can be used to mine cobwebs and bamboo much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a cobweb or some bamboo.
- Obtain a sword that has two durability.
/give @s minecraft:netherite_sword{Damage:2029}
- Destroy the cobweb or bamboo using the sword and as you do this, pay close attention to the durability of the sword.
- Take note as to whether or not swords consume double durability than they normally would when destroying bamboo or cobwebs.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo or cobwebs.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
net.minecraft.world.item.SwordItem.javapublic class SwordItem extends TieredItem implements Vanishable { ... public boolean mineBlock(ItemStack $is, Level $l, BlockState $bs, BlockPos $bp, LivingEntity $le) { if ($bs.getDestroySpeed($l, $bp) != 0.0F) { $is.hurtAndBreak(2, $le, (p_43276_) -> { p_43276_.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } return true; } ...When a block is mined whilst holding a sword in your hand, the mineBlock() method is called. This method is simply coded to consume double durability of the held tool when any block is mined using a sword. This is evident through the following line of code:
$is.hurtAndBreak(2, $le, (p_43276_) -> {If we look at the above class, we can see that no checks are carried out to see whether or not a cobweb or bamboo block is mined whilst holding a sword, before decreasing its durability of it by a value of 2, ultimately resulting in this problem occurring.
The Bug:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Swords can be used to mine
cobwebs and bamboomuch faster so it doesn't make much sense that they consumedouble durability than they normally would when destroying these blocks.Steps to Reproduce:
- Place down a
cobweb or some bamboo.- Obtain a sword that has two durability.
/give @s minecraft:netherite_sword{Damage:2029}
- Destroy the
cobweb or bamboousing the sword and as you do this, pay close attention to the durabilityof the sword.- Take note as to whether or not swords consume double durability than they normally would when destroying bamboo or cobwebs.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo or cobwebs.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.1
8.1using MCP-Reborn.net.minecraft.world.item.SwordItem.javapublic class SwordItem extends TieredItem implements Vanishable { ... public boolean mineBlock(ItemStack$is, Level$l, BlockState$bs, BlockPos$bp, LivingEntity$le) { if ($bs.getDestroySpeed($l, $bp) != 0.0F) {$is.hurtAndBreak(2,$le, (p_43276_) -> {p_43276_.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } return true; } ...When a block is mined whilst holding a sword in your hand, the mineBlock() method is called. This method is simply coded to consume double durability of the held tool when any block is mined using a sword. This is evident through the following line of code:
$is.hurtAndBreak(2, $le, (p_43276_) -> {If we look at the above class, we can see that no checks are carried out to see whether or not a cobweb or bamboo block is mined whilst holding a sword, before decreasing its durability of it by a value of 2, ultimately resulting in this problem occurring.
The Bug:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Swords can be used to mine bamboo saplings, bamboo, and cobwebs much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a bamboo sapling, bamboo, or a cobweb.
- Obtain a sword that has two durability.
/give @s minecraft:netherite_sword{Damage:2029}
- Destroy the bamboo sapling, bamboo, or cobweb using the sword and as you do this, pay close attention to the sword's durability.
- Take note as to whether or not swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo saplings, bamboo, or cobwebs.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
net.minecraft.world.item.SwordItem.javapublic class SwordItem extends TieredItem implements Vanishable { ... public boolean mineBlock(ItemStack itemStack, Level level, BlockState blockState, BlockPos blockPos, LivingEntity livingEntity) { if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } return true; } ...If we look at the above class, we can see that there is only one check that is carried out before allowing the durability of a sword to decrease when using this item to destroy a block. This check is to see if the said block can be instantly destroyed, and if it can, the sword doesn't consume durability, but if it can't, the sword will consume double durability. The game doesn't check if the said block is a bamboo sapling, bamboo, or a cobweb, before allowing the sword to consume double durability, therefore resulting in this problem occurring.
Fix:
Simply altering the existing "if" statement to check if the said block is a bamboo sapling, bamboo, or a cobweb before allowing the sword to consume double durability, and adding an "if else" statement to then check if the said block can be instantly destroyed, will resolve this problem.
Current "if" statement:if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }Fixed "if" statement:if (blockState.getBlock() instanceof BambooSaplingBlock || blockState.getBlock() instanceof BambooBlock || blockState.getBlock() instanceof WebBlock) { itemStack.hurtAndBreak(1, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } else if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs
The Bug:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Swords can be used to mine bamboo saplings, bamboo, and cobwebs much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a bamboo sapling, bamboo, or a cobweb.
- Obtain a sword that has two durability.
/give @s minecraft:netherite_sword{Damage:2029}
- Destroy the bamboo sapling, bamboo, or cobweb using the sword and as you do this, pay close attention to the sword's durability.
- Take note as to whether or not swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo saplings, bamboo, or cobwebs.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
net.minecraft.world.item.SwordItem.javapublic class SwordItem extends TieredItem implements Vanishable { ... public boolean mineBlock(ItemStack itemStack, Level level, BlockState blockState, BlockPos blockPos, LivingEntity livingEntity) { if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } return true; } ...If we look at the above class, we can see that there is only one check that is carried out before allowing the durability of a sword to decrease when using this item to destroy a block. This check is to see if the said block can be instantly destroyed, and if it can, the sword doesn't consume durability, but if it can't, the sword will consume double durability. The game doesn't check if the said block is a bamboo sapling, bamboo, or a cobweb, before allowing the sword to consume double durability, therefore resulting in this problem occurring.
Fix:
Simply altering the existing "if" statement to check if the said block is a bamboo sapling, bamboo, or a cobweb
before allowing the sword to consume double durability, and adding an "if else" statement to then check if the said block can be instantly destroyed, will resolve this problem.Current "if" statement:if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }Fixed "if" statement:if (blockState.getBlock() instanceof BambooSaplingBlock || blockState.getBlock() instanceof BambooBlock || blockState.getBlock() instanceof WebBlock) { itemStack.hurtAndBreak(1, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } else if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }The Bug:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Swords can be used to mine bamboo saplings, bamboo, and cobwebs much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a bamboo sapling, bamboo, or a cobweb.
- Obtain a sword that has two durability.
/give @s minecraft:netherite_sword{Damage:2029}
- Destroy the bamboo sapling, bamboo, or cobweb using the sword and as you do this, pay close attention to the sword's durability.
- Take note as to whether or not swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo saplings, bamboo, or cobwebs.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
net.minecraft.world.item.SwordItem.javapublic class SwordItem extends TieredItem implements Vanishable { ... public boolean mineBlock(ItemStack itemStack, Level level, BlockState blockState, BlockPos blockPos, LivingEntity livingEntity) { if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } return true; } ...If we look at the above class, we can see that there is only one check that is carried out before allowing the durability of a sword to decrease when using this item to destroy a block. This check is to see if the said block can be instantly destroyed, and if it can, the sword doesn't consume durability, but if it can't, the sword will consume double durability. The game doesn't check if the said block is a bamboo sapling, bamboo, or a cobweb, before allowing the sword to consume double durability, therefore resulting in this problem occurring.
Fix:
Simply altering the existing "if" statement to check if the said block is a bamboo sapling, bamboo, or a cobweb, and adding an "if else" statement to then check if the said block can be instantly destroyed before allowing the sword to consume double durability, will resolve this problem.
Current "if" statement:if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }Fixed "if" statement:if (blockState.getBlock() instanceof BambooSaplingBlock || blockState.getBlock() instanceof BambooBlock || blockState.getBlock() instanceof WebBlock) { itemStack.hurtAndBreak(1, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } else if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }
The Bug:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Swords can be used to mine bamboo saplings, bamboo, and cobwebs much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a bamboo sapling, bamboo, or a cobweb.
- Obtain a sword that has two durability.
/give @s minecraft:netherite_sword{Damage:2029}
- Destroy the bamboo sapling, bamboo, or cobweb using the sword and as you do this, pay close attention to the sword's durability.
- Take note as to whether or not swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo saplings, bamboo, or cobwebs.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
net.minecraft.world.item.SwordItem.javapublic class SwordItem extends TieredItem implements Vanishable { ... public boolean mineBlock(ItemStack itemStack, Level level, BlockState blockState, BlockPos blockPos, LivingEntity livingEntity) { if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } return true; } ...If we look at the above class, we can see that there is only one check that is carried out before allowing the durability of a sword to decrease when using this item to destroy a block. This check is to see if the said block can be instantly destroyed, and if it can, the sword doesn't consume durability, but if it can't, the sword will consume double durability. The game doesn't check if the said block is a bamboo sapling, bamboo, or a cobweb, before allowing the sword to consume double durability, therefore resulting in this problem occurring.
Fix:
Simply altering the existing "if" statement to check if the said block is a bamboo sapling, bamboo, or a cobweb, and adding an "if else" statement to then check if the said block can be instantly destroyed before allowing the sword to consume double durability, will resolve this problem.
Current "if" statement:if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }Fixed "if" statement:if (blockState.getBlock() instanceof BambooSaplingBlock || blockState.getBlock() instanceof BambooBlock || blockState.getBlock() instanceof WebBlock) { itemStack.hurtAndBreak(1, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } else if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }The Bug:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Swords can be used to mine bamboo saplings, bamboo, and cobwebs much faster so it doesn't make much sense that they consume double durability than they normally would when destroying these blocks.
Steps to Reproduce:
- Place down a bamboo sapling, bamboo, or a cobweb.
- Give yourself a sword that has two durability by using the command provided below.
/give @s minecraft:netherite_sword{Damage:2029}- Destroy the bamboo sapling, bamboo, or cobweb using the sword and as you do this, pay close attention to the sword's durability.
- Take note as to whether or not swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Observed Behavior:
Swords consume double durability than they normally would when destroying bamboo saplings, bamboo, or cobwebs.
Expected Behavior:
Swords would consume one durability when destroying bamboo saplings, bamboo, or cobwebs.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
net.minecraft.world.item.SwordItem.javapublic class SwordItem extends TieredItem implements Vanishable { ... public boolean mineBlock(ItemStack itemStack, Level level, BlockState blockState, BlockPos blockPos, LivingEntity livingEntity) { if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } return true; } ...If we look at the above class, we can see that there is only one check that is carried out before allowing the durability of a sword to decrease when using this item to destroy a block. This check is to see if the said block can be instantly destroyed, and if it can, the sword doesn't consume durability, but if it can't, the sword will consume double durability. The game doesn't check if the said block is a bamboo sapling, bamboo, or a cobweb, before allowing the sword to consume double durability, therefore resulting in this problem occurring.
Fix:
Simply altering the existing "if" statement to check if the said block is a bamboo sapling, bamboo, or a cobweb, and adding an "if else" statement to then check if the said block can be instantly destroyed before allowing the sword to consume double durability, will resolve this problem.
Current "if" statement:if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }Fixed "if" statement:if (blockState.getBlock() instanceof BambooSaplingBlock || blockState.getBlock() instanceof BambooBlock || blockState.getBlock() instanceof WebBlock) { itemStack.hurtAndBreak(1, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); } else if (blockState.getDestroySpeed(level, blockPos) != 0.0F) { itemStack.hurtAndBreak(2, livingEntity, (livingEntity1) -> { livingEntity1.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); }
is duplicated by
relates to
Duplicate of MC-195168
Thank you for your report!
We're tracking this issue in MC-195168, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
This is being tracked in MC-195168 ![]()
Blocks which are mined quicker with a sword should not take 2 durability points when broken with a sword (per MC-195168 being a valid bug). However, certain blocks like leaves are in the #sword_efficient tag, whilst still being broken faster with a sword, still reduce the durability of the sword by 2.
Affected blocks
- All Leaves
- Big Dripleaf and Dripleaf stems
- Carved Pumpkins
- Chorus Flowers & Plants
- Cocoa Pods
- Glow Lichen
- Jack o Lanterns
- Melons
- Pumpkins
- Vines
Steps to reproduce
- Look at leaves and with the debug screen observe that they are in the #sword_efficient tag
- Break them with a sword in survival mode
- Notice the sword takes double durability damage

Expected results
Swords would take double durability damage only when breaking inappropriate blocks like dirt
Observed results
Swords take double durability damage even when breaking blocks like leaves which are in the #sword_efficient tag and thus swords are an appropriate tool for breaking




Cobweb should also be added to this.
I also added leaves
Why leaves? Sword does not break leaves any faster
I now removed them, I thought, they would mine them faster.
It seems like swords only break leaves on bedrock faster, but not on java.
In java the hoe and the shears are the things that breaks faster the leaves.
Can confirm in 1.16.5 and 1.17 Release Candidate 1.
Can confirm in 1.17.
can confirm for 1.17.1
Can confirm in 21w40a. The expected behavior here would be that swords consume 1 durability when mining cobwebs or bamboo.
No aceplante, Fastest tool to mine cobweb and bamboo is sword
Following on from my code analysis, I've double-checked my proposed fix and I can confidently confirm that it's fully functioning and works as expected, so I've attached two screenshots to this report, one of which shows the current code and the other that shows the fixed code. I feel this information may be quite insightful hence my reasoning for providing it.
MC-195168 - Current Code.png

MC-195168 - Fixed Code.png
Can confirm in 1.20
Of all updates to fix this for, the one that add bamboo blocks is a great time to do it.
Swords actually take 2 durability to mine any block, which I'm not sure is intended. All other tools only use one durability mining any material, but the sword takes two for some reason. I think this feature is alright for using a sword on random materials like dirt, since that would tarnish a sharp sword, but taking 2 durability to break bamboo which it's the correct tool for seems inappropriate.
I always thought this was intended, just like how axes use two durability when you attack something. You're using the tool for something other than its intended purpose: swords are made for attacking, not mining; axes are made for cutting wood, not zombies.
That being said, it seems like a rather unintuitive and unnecessary game mechanic, especially now that we have blocks like bamboo that are intended to be mined with a sword. I wouldn't go so far as to call it a bug, but it should still be reviewed and possibly removed or reworked.