From b361b72515d1fddd4be0d822cb79b9e38187143c Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 1 Oct 2017 16:05:15 -0700 Subject: [PATCH] Remove limitation of Shaped crafting recipes not being used on grids larger than 3x3 --- .../item/crafting/ShapedRecipes.java.patch | 24 +++++++++++++++++++ .../oredict/ShapedOreRecipe.java | 11 +++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch index 7bc05b43058..7c43c436102 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch @@ -40,6 +40,30 @@ 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; +@@ -80,9 +73,9 @@ + + public boolean func_77569_a(InventoryCrafting p_77569_1_, World p_77569_2_) + { +- for (int i = 0; i <= 3 - this.field_77576_b; ++i) ++ for (int i = 0; i <= p_77569_1_.func_174922_i() - this.field_77576_b; ++i) + { +- for (int j = 0; j <= 3 - this.field_77577_c; ++j) ++ for (int j = 0; j <= p_77569_1_.func_174923_h() - this.field_77577_c; ++j) + { + if (this.func_77573_a(p_77569_1_, i, j, true)) + { +@@ -101,9 +94,9 @@ + + private boolean func_77573_a(InventoryCrafting p_77573_1_, int p_77573_2_, int p_77573_3_, boolean p_77573_4_) + { +- for (int i = 0; i < 3; ++i) ++ for (int i = 0; i < p_77573_1_.func_174922_i(); ++i) + { +- for (int j = 0; j < 3; ++j) ++ for (int j = 0; j < p_77573_1_.func_174923_h(); ++j) + { + int k = i - p_77573_2_; + int l = j - p_77573_3_; @@ -379,4 +372,16 @@ return new ItemStack(item, j, i); } diff --git a/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java b/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java index d300098dab1..4d9ea1379a5 100644 --- a/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java +++ b/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java @@ -52,8 +52,9 @@ public class ShapedOreRecipe extends IForgeRegistryEntry.Impl implements IShapedRecipe { - //Added in for future ease of change, but hard coded for now. + @Deprecated public static final int MAX_CRAFT_GRID_WIDTH = 3; + @Deprecated public static final int MAX_CRAFT_GRID_HEIGHT = 3; @Nonnull @@ -88,9 +89,9 @@ public ShapedOreRecipe(ResourceLocation group, @Nonnull ItemStack result, Shaped @Override public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World world) { - for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) + for (int x = 0; x <= inv.getWidth() - width; x++) { - for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) + for (int y = 0; y <= inv.getHeight() - height; ++y) { if (checkMatch(inv, x, y, false)) { @@ -112,9 +113,9 @@ public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World world) */ protected boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) { - for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) + for (int x = 0; x < inv.getWidth(); x++) { - for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) + for (int y = 0; y < inv.getHeight(); y++) { int subX = x - startX; int subY = y - startY;