mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-13 22:25:31 +01:00
48 lines
1.7 KiB
Diff
48 lines
1.7 KiB
Diff
|
@@ -10,6 +10,7 @@
|
||
|
private static final RecipesFurnace a = new RecipesFurnace();
|
||
|
public Map recipes = Maps.newHashMap();
|
||
|
private Map c = Maps.newHashMap();
|
||
|
+ public Map customRecipes = Maps.newHashMap(); // CraftBukkit - add field
|
||
|
|
||
|
public static RecipesFurnace getInstance() {
|
||
|
return RecipesFurnace.a;
|
||
|
@@ -52,6 +53,12 @@
|
||
|
this.registerRecipe(Blocks.LAPIS_ORE, new ItemStack(Items.DYE, 1, EnumColor.BLUE.getInvColorIndex()), 0.2F);
|
||
|
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();
|