mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Fix Tree Feller not working with custom axes
This commit is contained in:
parent
3699d26e5d
commit
c2fb57fce9
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user