Fix error stacks

This commit is contained in:
kuba6000 committed 2023-05-07 20:15:22 +02:00
1 parent 65e1f469ae
commit e7cd5e602d
2 files changed
+14 -5

No files matched your search

@@ -109,6 +109,13 @@ public class MineTweakerAPI {
else return "ERRORSTACK";
}
public static String convertStackOrOre(IIngredient ingredient) {
Object internal = ingredient.getInternal();
if (internal instanceof ItemStack) return convertStack((ItemStack) internal);
else if (internal instanceof String) return (String) internal;
else return "ERRORSTACK";
}
public static String convertArrayInLine(Object[] arr) {
StringBuilder arrayString = new StringBuilder();
for (int i = 0, arrLength = arr.length; i < arrLength; i++) {
@@ -318,7 +318,9 @@ public final class MCRecipeManager implements IRecipeManager {
removeRecipes(toRemove);
for (Pair<IIngredient, Boolean> output : outputs) {
MineTweakerAPI.info(
if (output.getKey().getInternal() instanceof String) MineTweakerAPI
.info("removeRecipeByOreOutputDelayed(\"" + ((String) output.getKey().getInternal()) + "\")");
else MineTweakerAPI.info(
"GT_ModHandler.removeRecipeByOutputDelayed(" + MineTweakerAPI.convertStack(output.getKey())
+ ", "
+ (output.getValue() ? "false" : "true")
@@ -451,9 +453,9 @@ public final class MCRecipeManager implements IRecipeManager {
super.removeRecipes(toRemove);
if (ingredients == null || ingredients.length == 0)
MineTweakerAPI.info("removeRecipeShapeless(" + MineTweakerAPI.convertStack(output) + ");");
MineTweakerAPI.info("removeRecipeShapeless(" + MineTweakerAPI.convertStackOrOre(output) + ");");
else MineTweakerAPI.info(
"removeRecipeShapeless(" + MineTweakerAPI.convertStack(output)
"removeRecipeShapeless(" + MineTweakerAPI.convertStackOrOre(output)
+ ", "
+ MineTweakerAPI.convertArrayInLine(ingredients)
+ ");");
@@ -573,9 +575,9 @@ public final class MCRecipeManager implements IRecipeManager {
super.removeRecipes(toRemove);
if (ingredients == null || ingredients.length == 0)
MineTweakerAPI.info("removeRecipeShaped(" + MineTweakerAPI.convertStack(output) + ");");
MineTweakerAPI.info("removeRecipeShaped(" + MineTweakerAPI.convertStackOrOre(output) + ");");
else MineTweakerAPI.info(
"removeRecipeShaped(" + MineTweakerAPI.convertStack(output)
"removeRecipeShaped(" + MineTweakerAPI.convertStackOrOre(output)
+ ", "
+ MineTweakerAPI.convertArrayInLine(ingredients)
+ ");");