mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Hehe, you were soo right. This is MUCH cleaner to look at. :)
This commit is contained in:
@ -36,8 +36,8 @@ public class Salvage {
|
||||
final float currentdura = inHand.getDurability();
|
||||
|
||||
if (currentdura == 0) {
|
||||
final int salvagedAmount = ItemChecks.getSalvagedAmount(inHand);
|
||||
final int itemID = ItemChecks.getSalvagedItemID(inHand);
|
||||
final int salvagedAmount = getSalvagedAmount(inHand);
|
||||
final int itemID = getSalvagedItemID(inHand);
|
||||
|
||||
player.setItemInHand(new ItemStack(0));
|
||||
location.setY(location.getY() + 1);
|
||||
@ -75,6 +75,28 @@ public class Salvage {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getSalvagedItemID(final ItemStack inHand) {
|
||||
int salvagedItem = 0;
|
||||
if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) { salvagedItem = 264; }
|
||||
else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) { salvagedItem = 266; }
|
||||
else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand)){ salvagedItem = 265; }
|
||||
else if (ItemChecks.isStoneTool(inHand)){ salvagedItem = 4; }
|
||||
else if (ItemChecks.isWoodTool(inHand)){ salvagedItem = 5; }
|
||||
else if ( ItemChecks.isLeatherArmor(inHand)){ salvagedItem = 334; }
|
||||
return salvagedItem;
|
||||
}
|
||||
|
||||
public static int getSalvagedAmount(final ItemStack inHand) {
|
||||
int salvagedAmount = 0;
|
||||
if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand)) { salvagedAmount = 3; }
|
||||
else if (ItemChecks.isShovel(inHand)) { salvagedAmount = 1; }
|
||||
else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand)) { salvagedAmount = 2; }
|
||||
else if (ItemChecks.isHelmet(inHand)) { salvagedAmount = 5; }
|
||||
else if (ItemChecks.isChestplate(inHand)) { salvagedAmount = 8; }
|
||||
else if (ItemChecks.isPants(inHand)) { salvagedAmount = 7; }
|
||||
else if (ItemChecks.isBoots(inHand)) { salvagedAmount = 4; }
|
||||
return salvagedAmount;
|
||||
}
|
||||
/**
|
||||
* Checks if the item is salvageable.
|
||||
*
|
||||
|
Reference in New Issue
Block a user