mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +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 where you could receive Archery XP from Potions
|
||||||
= Fixed bug with duping blocks via piston pushing
|
= Fixed bug with duping blocks via piston pushing
|
||||||
= Fixed bug with falling sand/gravel not being tracked
|
= 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)
|
! Changed Spout settings to be in their own config file (spout.yml)
|
||||||
|
|
||||||
Version 1.3.08
|
Version 1.3.08
|
||||||
|
@ -81,7 +81,7 @@ public class CustomArmorConfig extends ModConfigLoader{
|
|||||||
repairables.add(RepairableFactory.getRepairable(id, repairID, repairData, repairQuantity, durability));
|
repairables.add(RepairableFactory.getRepairable(id, repairID, repairData, repairQuantity, durability));
|
||||||
}
|
}
|
||||||
|
|
||||||
armor = new CustomItem(id);
|
armor = new CustomItem(id, durability);
|
||||||
|
|
||||||
idList.add(id);
|
idList.add(id);
|
||||||
customIDs.add(id);
|
customIDs.add(id);
|
||||||
|
@ -88,7 +88,7 @@ public class CustomToolsConfig extends ModConfigLoader {
|
|||||||
repairables.add(RepairableFactory.getRepairable(id, repairID, repairData, repairQuantity, durability));
|
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);
|
idList.add(id);
|
||||||
customIDs.add(id);
|
customIDs.add(id);
|
||||||
|
@ -2,9 +2,11 @@ package com.gmail.nossr50.datatypes.mods;
|
|||||||
|
|
||||||
public class CustomItem {
|
public class CustomItem {
|
||||||
protected int itemID;
|
protected int itemID;
|
||||||
|
protected short durability;
|
||||||
|
|
||||||
public CustomItem(int itemID) {
|
public CustomItem(int itemID, short durability) {
|
||||||
this.itemID = itemID;
|
this.itemID = itemID;
|
||||||
|
this.durability = durability;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemID() {
|
public int getItemID() {
|
||||||
@ -14,4 +16,12 @@ public class CustomItem {
|
|||||||
public void setItemID(int itemID) {
|
public void setItemID(int itemID) {
|
||||||
this.itemID = 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 boolean abilityEnabled;
|
||||||
private int tier;
|
private int tier;
|
||||||
|
|
||||||
public CustomTool(int tier, boolean abilityEnabled, double xpMultiplier, int itemID) {
|
public CustomTool(int tier, boolean abilityEnabled, double xpMultiplier, short durability, int itemID) {
|
||||||
super(itemID);
|
super(itemID, durability);
|
||||||
this.xpMultiplier = xpMultiplier;
|
this.xpMultiplier = xpMultiplier;
|
||||||
this.abilityEnabled = abilityEnabled;
|
this.abilityEnabled = abilityEnabled;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
|
@ -71,7 +71,19 @@ public class WoodCutting {
|
|||||||
inHand.setDurability((short) (inHand.getDurability() + durabilityLoss));
|
inHand.setDurability((short) (inHand.getDurability() + durabilityLoss));
|
||||||
|
|
||||||
/* This is to prevent using wood axes everytime you tree fell */
|
/* 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"));
|
player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFeller.Splinter"));
|
||||||
|
|
||||||
int health = player.getHealth();
|
int health = player.getHealth();
|
||||||
|
Loading…
Reference in New Issue
Block a user