diff --git a/patches/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java.patch b/patches/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java.patch new file mode 100644 index 0000000000..b7c6c0ee2c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java ++++ ../src-work/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java +@@ -485,7 +485,7 @@ + this.field_191915_z.func_194187_a(Ingredient.func_193369_a(itemstack), (p_193951_2_.get(0)).field_75223_e, (p_193951_2_.get(0)).field_75221_f); + int i = this.field_193961_o.func_174922_i(); + int j = this.field_193961_o.func_174923_h(); +- int k = p_193951_1_ instanceof ShapedRecipes ? ((ShapedRecipes)p_193951_1_).func_192403_f() : i; ++ int k = p_193951_1_ instanceof net.minecraftforge.common.crafting.IShapedRecipe ? ((net.minecraftforge.common.crafting.IShapedRecipe)p_193951_1_).getRecipeWidth() : i; + int l = 1; + Iterator iterator = p_193951_1_.func_192400_c().iterator(); + diff --git a/patches/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeOverlay.java.patch new file mode 100644 index 0000000000..c95bd2b701 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeOverlay.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeOverlay.java ++++ ../src-work/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeOverlay.java +@@ -230,11 +230,11 @@ + int k = 3; + int l = 3; + +- if (this.field_193924_p instanceof ShapedRecipes) ++ if (this.field_193924_p instanceof net.minecraftforge.common.crafting.IShapedRecipe) + { +- ShapedRecipes shapedrecipes = (ShapedRecipes)this.field_193924_p; +- k = shapedrecipes.func_192403_f(); +- l = shapedrecipes.func_192404_g(); ++ net.minecraftforge.common.crafting.IShapedRecipe shapedrecipes = (net.minecraftforge.common.crafting.IShapedRecipe)this.field_193924_p; ++ k = shapedrecipes.getRecipeWidth(); ++ l = shapedrecipes.getRecipeHeight(); + } + + Iterator iterator = this.field_193924_p.func_192400_c().iterator(); diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch index d0891d5ee1..7bc05b4305 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch @@ -8,7 +8,7 @@ -import net.minecraftforge.fml.relauncher.SideOnly; -public class ShapedRecipes implements IRecipe -+public class ShapedRecipes extends net.minecraftforge.registries.IForgeRegistryEntry.Impl implements IRecipe ++public class ShapedRecipes extends net.minecraftforge.registries.IForgeRegistryEntry.Impl implements net.minecraftforge.common.crafting.IShapedRecipe { public final int field_77576_b; public final int field_77577_c; @@ -40,3 +40,20 @@ public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { return p_194133_1_ >= this.field_77576_b && p_194133_2_ >= this.field_77577_c; +@@ -379,4 +372,16 @@ + return new ItemStack(item, j, i); + } + } ++ ++ //================================================ FORGE START ================================================ ++ @Override ++ public int getRecipeWidth() ++ { ++ return this.func_192403_f(); ++ } ++ @Override ++ public int getRecipeHeight() ++ { ++ return this.func_192404_g(); ++ } + } diff --git a/patches/minecraft/net/minecraft/util/ServerRecipeBookHelper.java.patch b/patches/minecraft/net/minecraft/util/ServerRecipeBookHelper.java.patch new file mode 100644 index 0000000000..55545f2aa1 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/ServerRecipeBookHelper.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/util/ServerRecipeBookHelper.java ++++ ../src-work/minecraft/net/minecraft/util/ServerRecipeBookHelper.java +@@ -199,11 +199,11 @@ + int i = this.field_194336_g.func_174922_i(); + int j = this.field_194336_g.func_174923_h(); + +- if (this.field_194333_d instanceof ShapedRecipes) ++ if (this.field_194333_d instanceof net.minecraftforge.common.crafting.IShapedRecipe) + { +- ShapedRecipes shapedrecipes = (ShapedRecipes)this.field_194333_d; +- i = shapedrecipes.func_192403_f(); +- j = shapedrecipes.func_192404_g(); ++ net.minecraftforge.common.crafting.IShapedRecipe shapedrecipes = (net.minecraftforge.common.crafting.IShapedRecipe)this.field_194333_d; ++ i = shapedrecipes.getRecipeWidth(); ++ j = shapedrecipes.getRecipeHeight(); + } + + int j1 = 1; diff --git a/src/main/java/net/minecraftforge/common/crafting/IShapedRecipe.java b/src/main/java/net/minecraftforge/common/crafting/IShapedRecipe.java new file mode 100644 index 0000000000..4b7ead4ee3 --- /dev/null +++ b/src/main/java/net/minecraftforge/common/crafting/IShapedRecipe.java @@ -0,0 +1,32 @@ +/* + * Minecraft Forge + * Copyright (c) 2016. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package net.minecraftforge.common.crafting; + +import net.minecraft.item.crafting.IRecipe; + +/** + * Used to mark a recipe that shape matters so that the recipe + * book and auto crafting picks the correct shape. + * Note: These methods can't be named 'getHeight' or 'getWidth' due to obfusication issues. + */ +public interface IShapedRecipe extends IRecipe +{ + public int getRecipeWidth(); + public int getRecipeHeight(); +} diff --git a/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java b/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java index 805fd18f81..d300098dab 100644 --- a/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java +++ b/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java @@ -32,6 +32,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.common.crafting.CraftingHelper.ShapedPrimer; +import net.minecraftforge.common.crafting.IShapedRecipe; import net.minecraftforge.registries.IForgeRegistryEntry; import net.minecraftforge.common.crafting.JsonContext; @@ -49,7 +50,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; -public class ShapedOreRecipe extends IForgeRegistryEntry.Impl implements IRecipe +public class ShapedOreRecipe extends IForgeRegistryEntry.Impl implements IShapedRecipe { //Added in for future ease of change, but hard coded for now. public static final int MAX_CRAFT_GRID_WIDTH = 3; @@ -154,16 +155,30 @@ public class ShapedOreRecipe extends IForgeRegistryEntry.Impl implement return this.input; } + @Deprecated //Use IShapedRecipe.getRecipeWidth public int getWidth() { return width; } + @Override + public int getRecipeWidth() + { + return this.getWidth(); + } + + @Deprecated //Use IShapedRecipe.getRecipeHeight public int getHeight() { return height; } + @Override + public int getRecipeHeight() + { + return this.getHeight(); + } + @Override @Nonnull public String getGroup() diff --git a/src/main/resources/forge.srg b/src/main/resources/forge.srg index 38de807fe8..e8eb7d47b0 100644 --- a/src/main/resources/forge.srg +++ b/src/main/resources/forge.srg @@ -1,2 +1 @@ MD: net/minecraft/server/management/ServerConfigurationManager/initializeConnectionToPlayer (Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/network/NetHandlerPlayServer;)V net/minecraft/server/management/ServerConfigurationManager/func_72355_a (Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/network/NetHandlerPlayServer;)V -MD: net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry/getKeys ()Ljava/util/Set; net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry/getKeys ()Ljava/util/Set; diff --git a/src/test/resources/assets/forge/recipes/ore_shaped.json b/src/test/resources/assets/forge/recipes/ore_shaped.json new file mode 100644 index 0000000000..c06ac544e9 --- /dev/null +++ b/src/test/resources/assets/forge/recipes/ore_shaped.json @@ -0,0 +1,21 @@ +{ + "type": "forge:ore_shaped", + "pattern": [ + "X", + "X", + "#" + ], + "key": { + "#": { + "type": "forge:ore_dict", + "ore": "stickWood" + }, + "X": { + "item": "minecraft:beetroot" + } + }, + "result": { + "item": "minecraft:dirt", + "data": 0 + } +} \ No newline at end of file