Add failsafes to Salvageables

This commit is contained in:
nossr50 2019-05-10 12:16:26 -07:00
parent cc1eae150a
commit 06bf814fcf

View File

@ -30,11 +30,11 @@ public class Salvageable {
this.salvagedItemMaterial = salvagedItemMaterial; this.salvagedItemMaterial = salvagedItemMaterial;
this.salvageItemType = ItemUtils.determineItemType(itemMaterial); this.salvageItemType = ItemUtils.determineItemType(itemMaterial);
this.salvageItemMaterialCategory = ItemUtils.determineMaterialType(salvagedItemMaterial); this.salvageItemMaterialCategory = ItemUtils.determineMaterialType(salvagedItemMaterial);
this.minimumLevel = minimumLevel; this.minimumLevel = Math.max(0, minimumLevel);
this.maximumQuantity = maximumQuantity; this.maximumQuantity = Math.max(1, maximumQuantity);
this.maximumDurability = itemMaterial.getMaxDurability(); this.maximumDurability = itemMaterial.getMaxDurability();
this.baseSalvageDurability = (short) (maximumDurability / maximumQuantity); this.baseSalvageDurability = (short) (maximumDurability / maximumQuantity);
this.xpMultiplier = 1.0D; this.xpMultiplier = Math.max(0, 1.0D);
} }
public Material getItemMaterial() { public Material getItemMaterial() {