Add metadata value for repair material

This commit is contained in:
NuclearW 2012-05-17 09:03:28 -04:00
parent e1ca2c0b98
commit 87cf5cb932
3 changed files with 17 additions and 3 deletions

View File

@ -15,6 +15,13 @@ public interface Repairable {
*/ */
public int getRepairMaterialId(); public int getRepairMaterialId();
/**
* Gets the metadata byte value of the material used to repair this item
*
* @return the byte metadata of the repair material
*/
public byte getRepairMaterialMetadata();
/** /**
* Gets the minimum quantity of repair materials ignoring all other repair bonuses * Gets the minimum quantity of repair materials ignoring all other repair bonuses
* *

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.skills.repair; package com.gmail.nossr50.skills.repair;
public class RepairableFactory { public class RepairableFactory {
public static Repairable getRepairable(int itemId, int repairMaterialId, int minimumLevel, int minimumQuantity, short maximumDurability) { public static Repairable getRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability) {
// TODO: Add in loading from config what type of manager we want. // TODO: Add in loading from config what type of manager we want.
return new SimpleRepairable(itemId, repairMaterialId, minimumLevel, minimumQuantity, maximumDurability); return new SimpleRepairable(itemId, repairMaterialId, repairMetadata, minimumLevel, minimumQuantity, maximumDurability);
} }
} }

View File

@ -3,10 +3,12 @@ package com.gmail.nossr50.skills.repair;
public class SimpleRepairable implements Repairable { public class SimpleRepairable implements Repairable {
private final int itemId, repairMaterialId, minimumQuantity, minimumLevel; private final int itemId, repairMaterialId, minimumQuantity, minimumLevel;
private final short maximumDurability, baseRepairDurability; private final short maximumDurability, baseRepairDurability;
private final byte repairMetadata;
protected SimpleRepairable(int itemId, int repairMaterialId, int minimumLevel, int minimumQuantity, short maximumDurability) { protected SimpleRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability) {
this.itemId = itemId; this.itemId = itemId;
this.repairMaterialId = repairMaterialId; this.repairMaterialId = repairMaterialId;
this.repairMetadata = repairMetadata;
this.minimumLevel = minimumLevel; this.minimumLevel = minimumLevel;
this.minimumQuantity = minimumQuantity; this.minimumQuantity = minimumQuantity;
this.maximumDurability = maximumDurability; this.maximumDurability = maximumDurability;
@ -23,6 +25,11 @@ public class SimpleRepairable implements Repairable {
return repairMaterialId; return repairMaterialId;
} }
@Override
public byte getRepairMaterialMetadata() {
return repairMetadata;
}
@Override @Override
public int getMinimumQuantity() { public int getMinimumQuantity() {
return minimumQuantity; return minimumQuantity;