2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/RecipesFurnace.java
|
|
|
|
+++ b/net/minecraft/server/RecipesFurnace.java
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -8,8 +8,10 @@
|
2016-06-09 03:43:49 +02:00
|
|
|
public class RecipesFurnace {
|
2016-02-29 22:32:46 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
private static final RecipesFurnace a = new RecipesFurnace();
|
2016-06-09 03:43:49 +02:00
|
|
|
- public final Map<ItemStack, ItemStack> recipes = Maps.newHashMap();
|
|
|
|
+ public Map<ItemStack, ItemStack> recipes = Maps.newHashMap();
|
|
|
|
private final Map<ItemStack, Float> experience = Maps.newHashMap();
|
2016-05-12 04:07:58 +02:00
|
|
|
+ public Map<ItemStack,ItemStack> customRecipes = Maps.newHashMap(); // CraftBukkit - add field
|
|
|
|
+ public Map<ItemStack,Float> customExperience = Maps.newHashMap(); // CraftBukkit - add field
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
public static RecipesFurnace getInstance() {
|
|
|
|
return RecipesFurnace.a;
|
2017-05-14 04:00:00 +02:00
|
|
|
@@ -94,6 +96,13 @@
|
|
|
|
this.a(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, EnumColor.BLACK.getColorIndex()), new ItemStack(Blocks.dQ), 0.1F);
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start - add method
|
2016-02-29 22:32:46 +01:00
|
|
|
+ public void registerRecipe(ItemStack itemstack, ItemStack itemstack1, float f) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ this.customRecipes.put(itemstack, itemstack1);
|
2017-04-03 01:06:42 +02:00
|
|
|
+ this.customExperience.put(itemstack, f);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
public void registerRecipe(Block block, ItemStack itemstack, float f) {
|
|
|
|
this.a(Item.getItemOf(block), itemstack, f);
|
2015-02-26 23:41:06 +01:00
|
|
|
}
|
2017-05-14 04:00:00 +02:00
|
|
|
@@ -108,13 +117,23 @@
|
2016-11-17 02:41:03 +01:00
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
public ItemStack getResult(ItemStack itemstack) {
|
|
|
|
- Iterator iterator = this.recipes.entrySet().iterator();
|
|
|
|
+ // CraftBukkit start - initialize to customRecipes
|
|
|
|
+ boolean vanilla = false;
|
2016-05-12 04:07:58 +02:00
|
|
|
+ Iterator<Entry<ItemStack, ItemStack>> iterator = this.customRecipes.entrySet().iterator();
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit end
|
|
|
|
|
|
|
|
Entry entry;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (!iterator.hasNext()) {
|
2016-11-17 02:41:03 +01:00
|
|
|
- return ItemStack.a;
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start - fall back to vanilla recipes
|
2016-02-29 22:32:46 +01:00
|
|
|
+ if (!vanilla && !this.recipes.isEmpty()) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ iterator = this.recipes.entrySet().iterator();
|
|
|
|
+ vanilla = true;
|
|
|
|
+ } else {
|
2016-11-17 02:41:03 +01:00
|
|
|
+ return ItemStack.a;
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
entry = (Entry) iterator.next();
|
2017-05-14 04:00:00 +02:00
|
|
|
@@ -132,13 +151,23 @@
|
2016-02-29 22:32:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public float b(ItemStack itemstack) {
|
2016-06-09 03:43:49 +02:00
|
|
|
- Iterator iterator = this.experience.entrySet().iterator();
|
2016-02-29 22:32:46 +01:00
|
|
|
+ // CraftBukkit start - initialize to customRecipes
|
|
|
|
+ boolean vanilla = false;
|
2016-05-12 04:07:58 +02:00
|
|
|
+ Iterator<Entry<ItemStack, Float>> iterator = this.customExperience.entrySet().iterator();
|
2016-02-29 22:32:46 +01:00
|
|
|
+ // CraftBukkit end
|
|
|
|
|
|
|
|
Entry entry;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (!iterator.hasNext()) {
|
|
|
|
- return 0.0F;
|
|
|
|
+ // CraftBukkit start - fall back to vanilla recipes
|
2016-06-09 03:43:49 +02:00
|
|
|
+ if (!vanilla && !this.experience.isEmpty()) {
|
|
|
|
+ iterator = this.experience.entrySet().iterator();
|
2016-02-29 22:32:46 +01:00
|
|
|
+ vanilla = true;
|
|
|
|
+ } else {
|
|
|
|
+ return 0.0F;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
entry = (Entry) iterator.next();
|