Added Overloads

This commit is contained in:
bartimaeusnek committed 2020-11-29 21:04:11 +01:00
1 parent 11c68ce42a
commit 9167cd1f1d
2 files changed
+116 -6

No files matched your search

@@ -41,7 +41,9 @@ public interface IRecipeManager {
*/
@ZenMethod
int remove(IIngredient output, @Optional boolean nbtMatch);
int remove(IIngredient output, boolean nbtMatch);
/**
* Adds a shaped recipe.
*
@@ -51,7 +53,12 @@ public interface IRecipeManager {
*/
@ZenMethod
void addShaped(IItemStack output, IIngredient[][] ingredients, @Optional IRecipeFunction function, @Optional IRecipeAction action);
void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function);
void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeAction action);
void addShaped(IItemStack output, IIngredient[][] ingredients);
/**
* Adds a mirrored shaped recipe.
*
@@ -61,7 +68,12 @@ public interface IRecipeManager {
*/
@ZenMethod
void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, @Optional IRecipeFunction function, @Optional IRecipeAction action);
void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function);
void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function);
void addShapedMirrored(IItemStack output, IIngredient[][] ingredients);
/**
* Adds a shapeless recipe.
*
@@ -71,7 +83,13 @@ public interface IRecipeManager {
*/
@ZenMethod
void addShapeless(IItemStack output, IIngredient[] ingredients, @Optional IRecipeFunction function, @Optional IRecipeAction action);
void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeFunction function);
void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeAction action);
void addShapeless(IItemStack output, IIngredient[] ingredients);
/**
* Removes shaped recipes.
*
@@ -82,7 +100,8 @@ public interface IRecipeManager {
*/
@ZenMethod
int removeShaped(IIngredient output, @Optional IIngredient[][] ingredients);
int removeShaped(IIngredient output);
/**
* Removes shapeless recipes.
*
@@ -95,7 +114,13 @@ public interface IRecipeManager {
*/
@ZenMethod
int removeShapeless(IIngredient output, @Optional IIngredient[] ingredients, @Optional boolean wildcard);
int removeShapeless(IIngredient output, boolean wildcard);
int removeShapeless(IIngredient output, IIngredient[] ingredients);
int removeShapeless(IIngredient output);
/**
* Performs a crafting with the specified ingredients. Returns null if no
* crafting recipe exists.
@@ -109,6 +109,11 @@ public final class MCRecipeManager implements IRecipeManager {
return results;
}
@Override
public int remove(IIngredient output) {
return remove(output, false);
}
@Override
public int remove(IIngredient output, @Optional boolean nbtMatch) {
if(output == null) {
@@ -119,16 +124,61 @@ public final class MCRecipeManager implements IRecipeManager {
return 1;
}
@Override
public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, null, false));
}
@Override
public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeAction action) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, action, false));
}
@Override
public void addShaped(IItemStack output, IIngredient[][] ingredients) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, null, false));
}
@Override
public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, IRecipeAction action) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, action, false));
}
@Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, null, true));
}
@Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, null, true));
}
@Override
public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeAction action) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, action, false));
}
@Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, IRecipeAction action) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, action, true));
}
@Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeAction action) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, action, true));
}
@Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, null, true));
}
@Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, null, true));
}
@Override
public void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeFunction function, IRecipeAction action) {
if(checkShapelessNulls(output, ingredients))
@@ -137,6 +187,21 @@ public final class MCRecipeManager implements IRecipeManager {
recipesToAdd.add(new ActionAddShapelessRecipe(output, ingredients, function, action));
}
@Override
public void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeFunction function){
addShapeless(output, ingredients, function, null);
}
@Override
public void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeAction action){
addShapeless(output, ingredients, null, action);
}
@Override
public void addShapeless(IItemStack output, IIngredient[] ingredients){
addShapeless(output, ingredients, null, null);
}
private boolean checkShapelessNulls(IItemStack output, IIngredient[] ingredients) {
if(output != null && Arrays.stream(ingredients).allMatch(Objects::isNull)) {
MineTweakerAPI.logError("Null not allowed in shapeless recipes! Recipe for: " + output + " not created!");
@@ -155,6 +220,11 @@ public final class MCRecipeManager implements IRecipeManager {
return 1;
}
@Override
public int removeShaped(IIngredient output, IIngredient[][] ingredients) {
return removeShaped(output, null);
}
@Override
public int removeShapeless(IIngredient output, IIngredient[] ingredients, boolean wildcard) {
if(output == null) {
@@ -165,6 +235,21 @@ public final class MCRecipeManager implements IRecipeManager {
return 1;
}
@Override
public int removeShapeless(IIngredient output, IIngredient[] ingredients) {
return removeShapeless(output, ingredients, true);
}
@Override
public int removeShapeless(IIngredient output, boolean wildcard) {
return removeShapeless(output, null, wildcard);
}
@Override
public int removeShapeless(IIngredient output) {
return removeShapeless(output, null, true);
}
@Override
public IItemStack craft(IItemStack[][] contents) {
Container container = new ContainerVirtual();