1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
--- a/net/minecraft/server/RecipesFurnace.java
+++ b/net/minecraft/server/RecipesFurnace.java
@@ -8,8 +8,10 @@
public class RecipesFurnace {
private static final RecipesFurnace a = new RecipesFurnace();
- public final Map<ItemStack, ItemStack> recipes = Maps.newHashMap();
+ public Map<ItemStack, ItemStack> recipes = Maps.newHashMap();
private final Map<ItemStack, Float> experience = Maps.newHashMap();
+ public Map<ItemStack,ItemStack> customRecipes = Maps.newHashMap(); // CraftBukkit - add field
+ public Map<ItemStack,Float> customExperience = Maps.newHashMap(); // CraftBukkit - add field
public static RecipesFurnace getInstance() {
return RecipesFurnace.a;
@@ -78,6 +80,12 @@
this.a(Items.GOLDEN_HORSE_ARMOR, new ItemStack(Items.GOLD_NUGGET), 0.1F);
}
+ // CraftBukkit start - add method
+ public void registerRecipe(ItemStack itemstack, ItemStack itemstack1, float f) {
+ this.customRecipes.put(itemstack, itemstack1);
+ }
+ // CraftBukkit end
+
public void registerRecipe(Block block, ItemStack itemstack, float f) {
this.a(Item.getItemOf(block), itemstack, f);
}
@@ -92,13 +100,23 @@
}
public ItemStack getResult(ItemStack itemstack) {
- Iterator iterator = this.recipes.entrySet().iterator();
+ // CraftBukkit start - initialize to customRecipes
+ boolean vanilla = false;
+ Iterator<Entry<ItemStack, ItemStack>> iterator = this.customRecipes.entrySet().iterator();
+ // CraftBukkit end
Entry entry;
do {
if (!iterator.hasNext()) {
- return ItemStack.a;
+ // CraftBukkit start - fall back to vanilla recipes
+ if (!vanilla && !this.recipes.isEmpty()) {
+ iterator = this.recipes.entrySet().iterator();
+ vanilla = true;
+ } else {
+ return ItemStack.a;
+ }
+ // CraftBukkit end
}
entry = (Entry) iterator.next();
@@ -116,13 +134,23 @@
}
public float b(ItemStack itemstack) {
- Iterator iterator = this.experience.entrySet().iterator();
+ // CraftBukkit start - initialize to customRecipes
+ boolean vanilla = false;
+ Iterator<Entry<ItemStack, Float>> iterator = this.customExperience.entrySet().iterator();
+ // CraftBukkit end
Entry entry;
do {
if (!iterator.hasNext()) {
- return 0.0F;
+ // CraftBukkit start - fall back to vanilla recipes
+ if (!vanilla && !this.experience.isEmpty()) {
+ iterator = this.experience.entrySet().iterator();
+ vanilla = true;
+ } else {
+ return 0.0F;
+ }
+ // CraftBukkit end
}
entry = (Entry) iterator.next();
|