diff options
author | t00thpick1 <t00thpick1dirko@gmail.com> | 2013-12-20 18:44:13 -0500 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2013-12-20 23:37:58 -0600 |
commit | 1ecc59d4d915938f6ed8e59e87a43ede50715410 (patch) | |
tree | 150678f03d1af1464ff8087ffdc245333d6a9991 /src/main/java/net | |
parent | 3c209a9884389184134c6c3bb31d5ab8c8842831 (diff) | |
download | craftbukkit-1ecc59d4d915938f6ed8e59e87a43ede50715410.tar craftbukkit-1ecc59d4d915938f6ed8e59e87a43ede50715410.tar.gz craftbukkit-1ecc59d4d915938f6ed8e59e87a43ede50715410.tar.lz craftbukkit-1ecc59d4d915938f6ed8e59e87a43ede50715410.tar.xz craftbukkit-1ecc59d4d915938f6ed8e59e87a43ede50715410.zip |
[Bleeding] Handle custom furnace recipes separately. Fixes BUKKIT-1657, BUKKIT-3846
Due to vanilla blanket comparing data values, and the unspecified
order of hashmap iterators, we need to run through custom recipes
first, and therefore separately, to ensure that they are actually
used. By not adding the custom results to the experience table, we do
not override the experience gains from vanilla smelting recipes.
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/RecipesFurnace.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/RecipesFurnace.java b/src/main/java/net/minecraft/server/RecipesFurnace.java index 85d76095..44a621db 100644 --- a/src/main/java/net/minecraft/server/RecipesFurnace.java +++ b/src/main/java/net/minecraft/server/RecipesFurnace.java @@ -10,6 +10,7 @@ public class RecipesFurnace { private static final RecipesFurnace a = new RecipesFurnace(); public Map recipes = new HashMap(); // CraftBukkit - private -> public private Map c = new HashMap(); + public Map customRecipes = new HashMap(); // CraftBukkit public static RecipesFurnace getInstance() { return a; @@ -62,14 +63,30 @@ public class RecipesFurnace { this.c.put(itemstack1, Float.valueOf(f)); } + // CraftBukkit start + public void registerRecipe(ItemStack itemstack, ItemStack itemstack1) { + this.customRecipes.put(itemstack, itemstack1); + } + // CraftBukkit end + public ItemStack getResult(ItemStack itemstack) { - Iterator iterator = this.recipes.entrySet().iterator(); + // CraftBukkit start + boolean vanilla = false; + Iterator iterator = this.customRecipes.entrySet().iterator(); + // CraftBukkit end Entry entry; do { if (!iterator.hasNext()) { - return null; + // CraftBukkit start + if (!vanilla) { + iterator = this.recipes.entrySet().iterator(); + vanilla = true; + } else { + return null; + } + // CraftBukkit end } entry = (Entry) iterator.next(); |