Skip to content

Commit

Permalink
Remove limitation of Shaped crafting recipes not being used on grids …
Browse files Browse the repository at this point in the history
…larger than 3x3
  • Loading branch information
LexManos committed Oct 1, 2017
1 parent a93f3ab commit b361b72
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Expand Up @@ -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);
}
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java
Expand Up @@ -52,8 +52,9 @@

public class ShapedOreRecipe extends IForgeRegistryEntry.Impl<IRecipe> 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
Expand Down Expand Up @@ -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))
{
Expand All @@ -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;
Expand Down

0 comments on commit b361b72

Please sign in to comment.