Re-did DuplicateItems, into Ore Camo Feature, better logic, and better config.
This commit is contained in:
@@ -24,6 +24,12 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
private int width = 0;
|
||||
private int height = 0;
|
||||
private boolean mirrored = true;
|
||||
private boolean disable = false;
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return !disable;
|
||||
}
|
||||
|
||||
public ShapedRecipe(ItemStack result, Object... recipe) {
|
||||
output = result.copy();
|
||||
@@ -130,6 +136,9 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world)
|
||||
{
|
||||
if ( disable )
|
||||
return false;
|
||||
|
||||
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++)
|
||||
{
|
||||
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y)
|
||||
@@ -152,6 +161,9 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror)
|
||||
{
|
||||
if ( disable )
|
||||
return false;
|
||||
|
||||
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
|
||||
{
|
||||
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
|
||||
@@ -180,14 +192,14 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
|
||||
try
|
||||
{
|
||||
for (ItemStack item : ((IIngredient) target).getItemStackSet() )
|
||||
for (ItemStack item : ((IIngredient) target).getItemStackSet())
|
||||
{
|
||||
matched = matched || checkItemEquals( item, slot );
|
||||
}
|
||||
}
|
||||
catch (RegistrationError e)
|
||||
{
|
||||
// :P
|
||||
// :P
|
||||
}
|
||||
catch (MissingIngredientError e)
|
||||
{
|
||||
@@ -266,12 +278,20 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bake() throws RegistrationError, MissingIngredientError
|
||||
public void bake() throws RegistrationError
|
||||
{
|
||||
for ( Object o : getInput() )
|
||||
try
|
||||
{
|
||||
if ( o instanceof IIngredient )
|
||||
((IIngredient)o).bake();
|
||||
disable = false;
|
||||
for (Object o : getInput())
|
||||
{
|
||||
if ( o instanceof IIngredient )
|
||||
((IIngredient) o).bake();
|
||||
}
|
||||
}
|
||||
catch (MissingIngredientError err)
|
||||
{
|
||||
disable = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,12 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
|
||||
private ItemStack output = null;
|
||||
private ArrayList<Object> input = new ArrayList<Object>();
|
||||
private boolean disable = false;
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return !disable;
|
||||
}
|
||||
|
||||
public ShapelessRecipe(ItemStack result, Object... recipe) {
|
||||
output = result.copy();
|
||||
@@ -61,6 +67,9 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting var1, World world)
|
||||
{
|
||||
if ( disable )
|
||||
return false;
|
||||
|
||||
ArrayList<Object> required = new ArrayList<Object>( input );
|
||||
|
||||
for (int x = 0; x < var1.getSizeInventory(); x++)
|
||||
@@ -82,7 +91,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
{
|
||||
try
|
||||
{
|
||||
for (ItemStack item : ((IIngredient) next).getItemStackSet() )
|
||||
for (ItemStack item : ((IIngredient) next).getItemStackSet())
|
||||
{
|
||||
match = match || checkItemEquals( item, slot );
|
||||
}
|
||||
@@ -135,10 +144,18 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
@Override
|
||||
public void bake() throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
for ( Object o : getInput() )
|
||||
try
|
||||
{
|
||||
if ( o instanceof IIngredient )
|
||||
((IIngredient)o).bake();
|
||||
disable = false;
|
||||
for (Object o : getInput())
|
||||
{
|
||||
if ( o instanceof IIngredient )
|
||||
((IIngredient) o).bake();
|
||||
}
|
||||
}
|
||||
catch (MissingIngredientError e)
|
||||
{
|
||||
disable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user