Commits
md_5 authored 901c5327f80
1 1 | --- a/net/minecraft/server/RecipesFurnace.java |
2 2 | +++ b/net/minecraft/server/RecipesFurnace.java |
3 3 | |
4 4 | |
5 5 | private static final RecipesFurnace a = new RecipesFurnace(); |
6 6 | public Map<ItemStack, ItemStack> recipes = Maps.newHashMap(); |
7 7 | - private Map<ItemStack, Float> c = Maps.newHashMap(); |
8 8 | + private Map<ItemStack, Float> c = Maps.newHashMap(); // PAIL: rename |
9 - | + public Map customRecipes = Maps.newHashMap(); // CraftBukkit - add field |
10 - | + public Map customExperience = Maps.newHashMap(); // CraftBukkit - add field |
9 + | + public Map<ItemStack,ItemStack> customRecipes = Maps.newHashMap(); // CraftBukkit - add field |
10 + | + public Map<ItemStack,Float> customExperience = Maps.newHashMap(); // CraftBukkit - add field |
11 11 | |
12 12 | public static RecipesFurnace getInstance() { |
13 13 | return RecipesFurnace.a; |
14 14 | |
15 15 | this.registerRecipe(Blocks.QUARTZ_ORE, new ItemStack(Items.QUARTZ), 0.2F); |
16 16 | } |
17 17 | |
18 18 | + // CraftBukkit start - add method |
19 19 | + public void registerRecipe(ItemStack itemstack, ItemStack itemstack1, float f) { |
20 20 | + this.customRecipes.put(itemstack, itemstack1); |
24 24 | public void registerRecipe(Block block, ItemStack itemstack, float f) { |
25 25 | this.a(Item.getItemOf(block), itemstack, f); |
26 26 | } |
27 27 | |
28 28 | |
29 29 | @Nullable |
30 30 | public ItemStack getResult(ItemStack itemstack) { |
31 31 | - Iterator iterator = this.recipes.entrySet().iterator(); |
32 32 | + // CraftBukkit start - initialize to customRecipes |
33 33 | + boolean vanilla = false; |
34 - | + Iterator iterator = this.customRecipes.entrySet().iterator(); |
34 + | + Iterator<Entry<ItemStack, ItemStack>> iterator = this.customRecipes.entrySet().iterator(); |
35 35 | + // CraftBukkit end |
36 36 | |
37 37 | Entry entry; |
38 38 | |
39 39 | do { |
40 40 | if (!iterator.hasNext()) { |
41 41 | - return null; |
42 42 | + // CraftBukkit start - fall back to vanilla recipes |
43 43 | + if (!vanilla && !this.recipes.isEmpty()) { |
44 44 | + iterator = this.recipes.entrySet().iterator(); |
50 50 | } |
51 51 | |
52 52 | entry = (Entry) iterator.next(); |
53 53 | |
54 54 | } |
55 55 | |
56 56 | public float b(ItemStack itemstack) { |
57 57 | - Iterator iterator = this.c.entrySet().iterator(); |
58 58 | + // CraftBukkit start - initialize to customRecipes |
59 59 | + boolean vanilla = false; |
60 - | + Iterator iterator = this.customRecipes.entrySet().iterator(); |
60 + | + Iterator<Entry<ItemStack, Float>> iterator = this.customExperience.entrySet().iterator(); |
61 61 | + // CraftBukkit end |
62 62 | |
63 63 | Entry entry; |
64 64 | |
65 65 | do { |
66 66 | if (!iterator.hasNext()) { |
67 67 | - return 0.0F; |
68 68 | + // CraftBukkit start - fall back to vanilla recipes |
69 69 | + if (!vanilla && !this.c.isEmpty()) { |
70 70 | + iterator = this.c.entrySet().iterator(); |