diff options
author | hibo98 <hibo98.niklas@gmail.com> | 2016-03-01 08:30:03 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-03-01 08:30:03 +1100 |
commit | f042873c1d8f71dd22bd75f6a708971afea25d26 (patch) | |
tree | 8a90fa397102d54ab6c04a83e57595bcace90f9a /src | |
parent | f16cc648404ac87f5292ab67641395c818a477ab (diff) | |
download | bukkit-f042873c1d8f71dd22bd75f6a708971afea25d26.tar bukkit-f042873c1d8f71dd22bd75f6a708971afea25d26.tar.gz bukkit-f042873c1d8f71dd22bd75f6a708971afea25d26.tar.lz bukkit-f042873c1d8f71dd22bd75f6a708971afea25d26.tar.xz bukkit-f042873c1d8f71dd22bd75f6a708971afea25d26.zip |
Add custom experience levels for FurnaceRecipes.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/inventory/FurnaceRecipe.java | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java index 80753238..b1774d6d 100644 --- a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java +++ b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java @@ -9,6 +9,7 @@ import org.bukkit.material.MaterialData; public class FurnaceRecipe implements Recipe { private ItemStack output; private ItemStack ingredient; + private float experience; /** * Create a furnace recipe to craft the specified ItemStack. @@ -17,7 +18,7 @@ public class FurnaceRecipe implements Recipe { * @param source The input material. */ public FurnaceRecipe(ItemStack result, Material source) { - this(result, source, 0); + this(result, source, 0, 0); } /** @@ -27,7 +28,18 @@ public class FurnaceRecipe implements Recipe { * @param source The input material. */ public FurnaceRecipe(ItemStack result, MaterialData source) { - this(result, source.getItemType(), source.getData()); + this(result, source.getItemType(), source.getData(), 0); + } + + /** + * Create a furnace recipe to craft the specified ItemStack. + * + * @param result The item you want the recipe to create. + * @param source The input material. + * @param experience The experience given by this recipe + */ + public FurnaceRecipe(ItemStack result, MaterialData source, float experience) { + this(result, source.getItemType(), source.getData(), experience); } /** @@ -41,8 +53,24 @@ public class FurnaceRecipe implements Recipe { */ @Deprecated public FurnaceRecipe(ItemStack result, Material source, int data) { + this(result, source, data, 0); + } + + /** + * Create a furnace recipe to craft the specified ItemStack. + * + * @param result The item you want the recipe to create. + * @param source The input material. + * @param data The data value. (Note: This is currently ignored by the + * CraftBukkit server.) + * @param experience The experience given by this recipe + * @deprecated Magic value + */ + @Deprecated + public FurnaceRecipe(ItemStack result, Material source, int data, float experience) { this.output = new ItemStack(result); this.ingredient = new ItemStack(source, 1, (short) data); + this.experience = experience; } /** @@ -97,4 +125,22 @@ public class FurnaceRecipe implements Recipe { public ItemStack getResult() { return output.clone(); } + + /** + * Sets the experience given by this recipe. + * + * @param experience the experience level + */ + public void setExperience(float experience) { + this.experience = experience; + } + + /** + * Get the experience given by this recipe. + * + * @return experience level + */ + public float getExperience() { + return experience; + } } |