This commit is contained in:
EnderProyects committed 2023-03-06 23:23:19 +01:00
1 parent 17454c4993
commit 8e0818be4a
150 files changed
+13246 -12429

No files matched your search

@@ -1,98 +1,109 @@
package ab.common.minetweaker;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAdvancedPlate;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAdvancedPlate;
@ZenClass("mods.advBotany.AdvancedPlate")
public class AdvancedPlateMT {
@ZenMethod
public static void addRecipe(IItemStack output, String rgb, IItemStack input1, IItemStack input2, IItemStack input3, int mana) {
MineTweakerAPI.apply(new Add(new RecipeAdvancedPlate(MineTweakerMC.getItemStack(output), mana, Integer.decode(rgb), MineTweakerMC.getItemStack(input1), MineTweakerMC.getItemStack(input2), MineTweakerMC.getItemStack(input3))));
}
private static class Add implements IUndoableAction {
private RecipeAdvancedPlate recipe;
public Add(RecipeAdvancedPlate recipe) {
this.recipe = recipe;
}
public void apply() {
AdvancedBotanyAPI.advancedPlateRecipes.add(recipe);
}
public boolean canUndo() {
return true;
}
public void undo() {
AdvancedBotanyAPI.advancedPlateRecipes.remove(recipe);
}
public String describe() {
return "Adding Advanced Plate Recipe for " + recipe.getOutput().getDisplayName();
}
public String describeUndo() {
return "Removing Advanced Plate Recipe for " + recipe.getOutput().getDisplayName();
}
public Object getOverrideKey() {
return null;
}
}
@ZenMethod
public static void remove(IItemStack output) {
MineTweakerAPI.apply(new Remove(MineTweakerMC.getItemStack(output)));
}
private static class Remove implements IUndoableAction {
private ItemStack output;
private RecipeAdvancedPlate recipe;
public Remove(ItemStack output) {
this.output = output;
}
public void apply() {
for(RecipeAdvancedPlate r : AdvancedBotanyAPI.advancedPlateRecipes) {
if(r.getOutput() != null && r.getOutput().isItemEqual(output)) {
AdvancedBotanyAPI.advancedPlateRecipes.remove(r);
recipe = r;
break;
}
}
}
public boolean canUndo() {
return true;
}
public void undo() {
AdvancedBotanyAPI.advancedPlateRecipes.add(recipe);
}
public String describe() {
return "Removing Advanced Plate Recipe for " + output.getDisplayName();
}
public String describeUndo() {
return "Restoring Advanced Plate Recipe for " + output.getDisplayName();
}
public Object getOverrideKey() {
return null;
}
}
}
@ZenMethod
public static void addRecipe(IItemStack output, String rgb, IItemStack input1, IItemStack input2, IItemStack input3,
int mana) {
MineTweakerAPI.apply(
new Add(
new RecipeAdvancedPlate(
MineTweakerMC.getItemStack(output),
mana,
Integer.decode(rgb),
MineTweakerMC.getItemStack(input1),
MineTweakerMC.getItemStack(input2),
MineTweakerMC.getItemStack(input3))));
}
private static class Add implements IUndoableAction {
private RecipeAdvancedPlate recipe;
public Add(RecipeAdvancedPlate recipe) {
this.recipe = recipe;
}
public void apply() {
AdvancedBotanyAPI.advancedPlateRecipes.add(recipe);
}
public boolean canUndo() {
return true;
}
public void undo() {
AdvancedBotanyAPI.advancedPlateRecipes.remove(recipe);
}
public String describe() {
return "Adding Advanced Plate Recipe for " + recipe.getOutput().getDisplayName();
}
public String describeUndo() {
return "Removing Advanced Plate Recipe for " + recipe.getOutput().getDisplayName();
}
public Object getOverrideKey() {
return null;
}
}
@ZenMethod
public static void remove(IItemStack output) {
MineTweakerAPI.apply(new Remove(MineTweakerMC.getItemStack(output)));
}
private static class Remove implements IUndoableAction {
private ItemStack output;
private RecipeAdvancedPlate recipe;
public Remove(ItemStack output) {
this.output = output;
}
public void apply() {
for (RecipeAdvancedPlate r : AdvancedBotanyAPI.advancedPlateRecipes) {
if (r.getOutput() != null && r.getOutput().isItemEqual(output)) {
AdvancedBotanyAPI.advancedPlateRecipes.remove(r);
recipe = r;
break;
}
}
}
public boolean canUndo() {
return true;
}
public void undo() {
AdvancedBotanyAPI.advancedPlateRecipes.add(recipe);
}
public String describe() {
return "Removing Advanced Plate Recipe for " + output.getDisplayName();
}
public String describeUndo() {
return "Restoring Advanced Plate Recipe for " + output.getDisplayName();
}
public Object getOverrideKey() {
return null;
}
}
}