浏览代码

Don't damage the tool more than it's max durability

TfT_02 12 年之前
父节点
当前提交
cc18794a93
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java

+ 2 - 1
src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java

@@ -97,7 +97,8 @@ public class WoodCutting {
         }
         }
 
 
         /* Damage the tool */
         /* Damage the tool */
-        inHand.setDurability((short) (inHand.getDurability() + durabilityLoss));
+        if (inHand.getDurability() + durabilityLoss > inHand.getType().getMaxDurability()) inHand.setDurability((short) (inHand.getType().getMaxDurability()));
+        else inHand.setDurability((short) (inHand.getDurability() + durabilityLoss));
 
 
         //Prepare ItemStacks
         //Prepare ItemStacks
         ItemStack item = null;
         ItemStack item = null;