Browse Source

Fix crafting with items received from Salvage

Only set metadata on Salvage items when it’s not set to -1
Fixes #2078

And cleanup some javadocs in Salvageable
TfT_02 11 years ago
parent
commit
8e474170e4

+ 2 - 2
src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java

@@ -84,8 +84,6 @@ public class SalvageManager extends SkillManager {
             return;
             return;
         }
         }
 
 
-        byte salvageMaterialMetadata = salvageable.getSalvageMaterialMetadata();
-
         int salvageableAmount = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
         int salvageableAmount = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
 
 
         if (salvageableAmount == 0) {
         if (salvageableAmount == 0) {
@@ -108,6 +106,8 @@ public class SalvageManager extends SkillManager {
             }
             }
         }
         }
 
 
+        byte salvageMaterialMetadata = (salvageable.getSalvageMaterialMetadata() != (byte) -1) ? salvageable.getSalvageMaterialMetadata() : 0;
+
         Misc.dropItems(location, new MaterialData(salvageable.getSalvageMaterial(), salvageMaterialMetadata).toItemStack(salvageableAmount), 1);
         Misc.dropItems(location, new MaterialData(salvageable.getSalvageMaterial(), salvageMaterialMetadata).toItemStack(salvageableAmount), 1);
 
 
         // BWONG BWONG BWONG - CLUNK!
         // BWONG BWONG BWONG - CLUNK!

+ 16 - 16
src/main/java/com/gmail/nossr50/skills/salvage/salvageables/Salvageable.java

@@ -7,37 +7,37 @@ import com.gmail.nossr50.datatypes.skills.MaterialType;
 
 
 public interface Salvageable {
 public interface Salvageable {
     /**
     /**
-     * Gets the type of this repairable item
+     * Gets the type of this salvageable item
      *
      *
-     * @return the type of this repairable
+     * @return the type of this salvageable
      */
      */
     public Material getItemMaterial();
     public Material getItemMaterial();
 
 
     /**
     /**
-     * Gets the id of the material used to repair this item
+     * Gets the material of the items dropped when salvaging this item
      *
      *
-     * @return the id of the repair material
+     * @return the material of the salvage drop
      */
      */
     public Material getSalvageMaterial();
     public Material getSalvageMaterial();
 
 
     /**
     /**
-     * Gets the metadata byte value of the material used to repair this item
+     * Gets the metadata byte value of the items dropped when salvaging this item
      *
      *
-     * @return the byte metadata of the repair material
+     * @return the byte metadata of the salvage drop
      */
      */
     public byte getSalvageMaterialMetadata();
     public byte getSalvageMaterialMetadata();
 
 
     /**
     /**
-     * Gets the RepairItemType value for this repairable item
+     * Gets the ItemType value for this salvageable item
      *
      *
-     * @return the RepairItemType for this repairable
+     * @return the ItemType for this salvageable
      */
      */
     public ItemType getSalvageItemType();
     public ItemType getSalvageItemType();
 
 
     /**
     /**
-     * Gets the RepairMaterialType value for this repairable item
+     * Gets the MaterialType value for this salvageable item
      *
      *
-     * @return the RepairMaterialType for this repairable
+     * @return the MaterialType for this salvageable
      */
      */
     public MaterialType getSalvageMaterialType();
     public MaterialType getSalvageMaterialType();
 
 
@@ -58,25 +58,25 @@ public interface Salvageable {
     public short getMaximumDurability();
     public short getMaximumDurability();
 
 
     /**
     /**
-     * Gets the base repair durability on which to calculate bonuses.
+     * Gets the base salvage durability on which to calculate bonuses.
      *
      *
      * This is actually the maximum durability divided by the minimum quantity
      * This is actually the maximum durability divided by the minimum quantity
      *
      *
-     * @return the base repair durability
+     * @return the base salvage durability
      */
      */
     public short getBaseSalvageDurability();
     public short getBaseSalvageDurability();
 
 
     /**
     /**
-     * Gets the minimum repair level needed to repair this item
+     * Gets the minimum salvage level needed to salvage this item
      *
      *
-     * @return the minimum level to repair this item, or 0 for no minimum
+     * @return the minimum level to salvage this item, or 0 for no minimum
      */
      */
     public int getMinimumLevel();
     public int getMinimumLevel();
 
 
     /**
     /**
-     * Gets the xpMultiplier for this repairable
+     * Gets the xpMultiplier for this salvageable
      *
      *
-     * @return the xpMultiplier of this repairable
+     * @return the xpMultiplier of this salvageable
      */
      */
     public double getXpMultiplier();
     public double getXpMultiplier();
 }
 }