diff --git a/Changelog.txt b/Changelog.txt index 47d132160..d52450b6d 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -12,6 +12,7 @@ Version 1.3.09 = Fixed bug where you could receive Archery XP from Potions = Fixed bug with duping blocks via piston pushing = Fixed bug with falling sand/gravel not being tracked + = Fixed bug with Tree Feller not working with custom axes ! Changed Spout settings to be in their own config file (spout.yml) Version 1.3.08 diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java index 965d6da01..783a25e83 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java @@ -81,7 +81,7 @@ public class CustomArmorConfig extends ModConfigLoader{ repairables.add(RepairableFactory.getRepairable(id, repairID, repairData, repairQuantity, durability)); } - armor = new CustomItem(id); + armor = new CustomItem(id, durability); idList.add(id); customIDs.add(id); diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java index f878d8fa5..cfcab287a 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java @@ -88,7 +88,7 @@ public class CustomToolsConfig extends ModConfigLoader { repairables.add(RepairableFactory.getRepairable(id, repairID, repairData, repairQuantity, durability)); } - tool = new CustomTool(tier, abilityEnabled, multiplier, id); + tool = new CustomTool(tier, abilityEnabled, multiplier, durability, id); idList.add(id); customIDs.add(id); diff --git a/src/main/java/com/gmail/nossr50/datatypes/mods/CustomItem.java b/src/main/java/com/gmail/nossr50/datatypes/mods/CustomItem.java index 389f16826..19a4663a2 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/mods/CustomItem.java +++ b/src/main/java/com/gmail/nossr50/datatypes/mods/CustomItem.java @@ -2,9 +2,11 @@ package com.gmail.nossr50.datatypes.mods; public class CustomItem { protected int itemID; + protected short durability; - public CustomItem(int itemID) { + public CustomItem(int itemID, short durability) { this.itemID = itemID; + this.durability = durability; } public int getItemID() { @@ -14,4 +16,12 @@ public class CustomItem { public void setItemID(int itemID) { this.itemID = itemID; } + + public short getDurability() { + return durability; + } + + public void setDurability(short durability) { + this.durability = durability; + } } diff --git a/src/main/java/com/gmail/nossr50/datatypes/mods/CustomTool.java b/src/main/java/com/gmail/nossr50/datatypes/mods/CustomTool.java index d865f66a1..f2d98b157 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/mods/CustomTool.java +++ b/src/main/java/com/gmail/nossr50/datatypes/mods/CustomTool.java @@ -5,8 +5,8 @@ public class CustomTool extends CustomItem { private boolean abilityEnabled; private int tier; - public CustomTool(int tier, boolean abilityEnabled, double xpMultiplier, int itemID) { - super(itemID); + public CustomTool(int tier, boolean abilityEnabled, double xpMultiplier, short durability, int itemID) { + super(itemID, durability); this.xpMultiplier = xpMultiplier; this.abilityEnabled = abilityEnabled; this.tier = tier; diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index 5b91d41d7..1fe357dfc 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -71,7 +71,19 @@ public class WoodCutting { inHand.setDurability((short) (inHand.getDurability() + durabilityLoss)); /* This is to prevent using wood axes everytime you tree fell */ - if ((inHand.getDurability() + durabilityLoss >= inHand.getType().getMaxDurability()) || inHand.getType().equals(Material.AIR)) { + if (ModChecks.isCustomTool(inHand)) { + if (inHand.getDurability() + durabilityLoss >= ModChecks.getToolFromItemStack(inHand).getDurability()) { + player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFeller.Splinter")); + + int health = player.getHealth(); + + if (health >= 2) { + Combat.dealDamage(player, random.nextInt(health - 1)); + } + return; + } + } + else if ((inHand.getDurability() + durabilityLoss >= inHand.getType().getMaxDurability()) || inHand.getType().equals(Material.AIR)) { player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFeller.Splinter")); int health = player.getHealth();