Remove limitation of Shaped crafting recipes not being used on grids larger than 3x3

This commit is contained in:
LexManos 2017-10-01 16:05:15 -07:00
parent a93f3ab61e
commit b361b72515
2 changed files with 30 additions and 5 deletions

View File

@ -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);
}

View File

@ -52,8 +52,9 @@ import com.google.gson.JsonSyntaxException;
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
@ -88,9 +89,9 @@ public class ShapedOreRecipe extends IForgeRegistryEntry.Impl<IRecipe> implement
@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 class ShapedOreRecipe extends IForgeRegistryEntry.Impl<IRecipe> implement
*/
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;