--- a/net/minecraft/server/RecipesFurnace.java +++ b/net/minecraft/server/RecipesFurnace.java @@ -8,14 +8,15 @@ public class RecipesFurnace { private static final RecipesFurnace a = new RecipesFurnace(); - private Map recipes = Maps.newHashMap(); + public Map recipes = Maps.newHashMap(); // CraftBukkit - public private Map c = Maps.newHashMap(); + public Map customRecipes = Maps.newHashMap(); // CraftBukkit - add field public static RecipesFurnace getInstance() { return RecipesFurnace.a; } - private RecipesFurnace() { + public RecipesFurnace() { // CraftBukkit - public this.registerRecipe(Blocks.IRON_ORE, new ItemStack(Items.IRON_INGOT), 0.7F); this.registerRecipe(Blocks.GOLD_ORE, new ItemStack(Items.GOLD_INGOT), 1.0F); this.registerRecipe(Blocks.DIAMOND_ORE, new ItemStack(Items.DIAMOND), 1.0F); @@ -53,6 +54,12 @@ this.registerRecipe(Blocks.QUARTZ_ORE, new ItemStack(Items.QUARTZ), 0.2F); } + // CraftBukkit start - add method + public void registerRecipe(ItemStack itemstack, ItemStack itemstack1) { + this.customRecipes.put(itemstack, itemstack1); + } + // CraftBukkit end + public void registerRecipe(Block block, ItemStack itemstack, float f) { this.a(Item.getItemOf(block), itemstack, f); } @@ -67,13 +74,23 @@ } public ItemStack getResult(ItemStack itemstack) { - Iterator iterator = this.recipes.entrySet().iterator(); + // CraftBukkit start - initialize to customRecipes + boolean vanilla = false; + Iterator iterator = this.customRecipes.entrySet().iterator(); + // CraftBukkit end Entry entry; do { if (!iterator.hasNext()) { - return null; + // CraftBukkit start - fall back to vanilla recipes + if (!vanilla && !recipes.isEmpty()) { + iterator = this.recipes.entrySet().iterator(); + vanilla = true; + } else { + return null; + } + // CraftBukkit end } entry = (Entry) iterator.next();