diff --git a/MineTweaker3-API/build.gradle b/MineTweaker3-API/build.gradle index b98ca70..b66de55 100644 --- a/MineTweaker3-API/build.gradle +++ b/MineTweaker3-API/build.gradle @@ -22,12 +22,3 @@ dependencies { compile project(':ZenScript') } } - -/*task zendoc(type: Javadoc) { - source = sourceSets.main.allJava - destinationDir = reporting.file("zendocs") - // classpath = files(project.sourceSets*.main*.compileClasspath) - //options.docletpath = configurations.main.files.asType(List) - options.doclet = 'stanhebben.zenscript.docs.ZenScriptDoclet' - options.classpath sourceSets.main.classes -}*/ diff --git a/MineTweaker3-API/src/main/java/minetweaker/api/item/IItemStack.java b/MineTweaker3-API/src/main/java/minetweaker/api/item/IItemStack.java index 730da75..a4d55c7 100644 --- a/MineTweaker3-API/src/main/java/minetweaker/api/item/IItemStack.java +++ b/MineTweaker3-API/src/main/java/minetweaker/api/item/IItemStack.java @@ -13,6 +13,15 @@ import stanhebben.zenscript.annotations.ZenSetter; * Contains an item stack. An item stack consists of an item definition, * a meta or damage value and NBT data. * + * Item stacks can be retrieved using its name (or ID, in 1.6.4) with the bracket + * syntax. When using the bracket syntax, by default, the item stack will match + * any size when used as ingredient. Item stacks can be multiplied with an integer + * to create a stack of different size. + * + * Item stacks are immutable. You can, however, easily create modified stacks using + * the helper methods. Adding conditions and transformations will turn the item + * stack into an ingredients. + * * @author Stan Hebben */ @ZenClass("minetweaker.item.IItemStack") diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java index 822d42b..592d4ae 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,31 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provider access to the Alloy Smelter recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.AlloySmelter") @ModOnly("gregtech_addon") public class AlloySmelter { + /** + * Adds an alloy smelter recipe. + * + * @param output alloy smelter output + * @param input1 primary input + * @param input2 secondary input + * @param durationTicks smelting time, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input1; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java index c1ff6f0..e6b4753 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,31 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the assembler recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Assembler") @ModOnly("gregtech_addon") public class Assembler { + /** + * Adds an assemble recipe. + * + * @param output recipe output + * @param input1 primary input + * @param input2 secondary input (optional, can be null) + * @param durationTicks assembling duration, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input1; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java index e45ed39..c36d794 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,26 +10,51 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Blast Furnace recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.BlastFurnace") @ModOnly("gregtech_addon") public class BlastFurnace { + /** + * Adds a recipe with a single output. + * + * @param output recipe output + * @param input1 primary input + * @param input2 secondary input (optional, can be null) + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + * @param heat required heat capacity + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick, int heat) { - MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output, null, duration, euPerTick, heat)); + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { + MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output, null, durationTicks, euPerTick, heat)); } + /** + * Adds a recipe with multiple outputs. + * + * @param output array with 1 or 2 outputs + * @param input1 primary input + * @param input2 secondary input (optional, can be null) + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + * @param heat required heat capacity + */ @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int duration, int euPerTick, int heat) { + public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { if (output.length == 0) { MineTweakerAPI.logError("Blast furnace recipe requires at least 1 input"); } else { - MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output[0], output.length > 1 ? output[1] : null, duration, euPerTick, heat)); + MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output[0], output.length > 1 ? output[1] : null, durationTicks, euPerTick, heat)); } } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack input1; private final IItemStack input2; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java new file mode 100644 index 0000000..bdf32ef --- /dev/null +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java @@ -0,0 +1,103 @@ +package minetweaker.mods.gregtech.machines; + +import gregtechmod.api.GregTech_API; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the CNC recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.CNC") +@ModOnly("gregtech_addon") +public class CNC { + /** + * Adds a CNC recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { + this.output = output; + this.input = input; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addCNCRecipe( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(output), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding CNC recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 53 * hash + this.duration; + hash = 53 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java index a6a666c..add6029 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,26 +10,49 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provider access to the Canner recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Canner") @ModOnly("gregtech_addon") public class Canner { + /** + * Adds a canner recipe with a single output. + * + * @param output crafting output + * @param input1 primary input + * @param input2 secondary input (optional + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input1, input2, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, null, input1, input2, durationTicks, euPerTick)); } + /** + * Adds a canner recipe with multiple outputs. + * + * @param output array with 1 or 2 outputs + * @param input1 primary input + * @param input2 secondary input (optional, can be null) + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { + public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { if (output.length == 0) { MineTweakerAPI.logError("canner requires at least 1 output"); } else { - MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input1, input2, duration, euPerTick)); + MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input1, input2, durationTicks, euPerTick)); } } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output1; private final IItemStack output2; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java index 0154f6e..00bdd8c 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -23,15 +17,30 @@ import stanhebben.zenscript.annotations.ZenMethod; @ZenClass("mods.gregtech.Centrifuge") @ModOnly("gregtech_addon") public class Centrifuge { + /** + * Adds a centrifuge recipe. + * + * @param outputs array with 1-4 outputs + * @param input recipe input + * @param cells number of cells required, can be 0 + * @param durationTicks centrifuging time, in ticks + */ @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int duration) { + public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks) { if (outputs.length < 1) { MineTweakerAPI.logError("centrifuge must have at least 1 output"); } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, duration)); + MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks)); } } + /** + * Adds a centrifuge recipe taking a fuel can as container. + * + * @param outputs array with 1-4 outputs + * @param input recipe input + * @param duration centrifuging time, in ticks + */ @ZenMethod public static void addRecipeFuelCan(IItemStack[] outputs, IItemStack input, int duration) { if (outputs.length < 1) { @@ -41,6 +50,10 @@ public class Centrifuge { } } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack[] output; private final IItemStack input; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java index dcdeded..584600a 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,30 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Chemical Reactor recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.ChemicalReactor") @ModOnly("gregtech_addon") public class ChemicalReactor { + /** + * Adds a Chemical Reactor recipe. + * + * @param output recipe output + * @param input1 primary input + * @param input2 secondary input + * @param durationTicks reaction time, in ticks + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int duration) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, duration)); + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks) { + MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input1; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ComputerCube.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ComputerCube.java index 5c2482c..d831d8f 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ComputerCube.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ComputerCube.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -17,17 +11,28 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the computer cube descriptions. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.ComputerCube") @ModOnly("gregtech_addon") public class ComputerCube { + /** + * Adds a description entry to the computer cube. + * + * @param items items to be displayed + * @param text text to be displayed + */ @ZenMethod public static void addDescriptionSet(IItemStack[] items, String[] text) { MineTweakerAPI.apply(new AddDescriptionAction(items, text)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddDescriptionAction extends OneWayAction { private final IItemStack[] items; private final String[] text; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java index adb664a..2c9f276 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -17,26 +11,49 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the distillation tower recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.DistillationTower") @ModOnly("gregtech_addon") public class DistillationTower { + /** + * Adds a distillation tower recipe with a single output. + * + * @param output recipe output + * @param input recipe input + * @param cells number of cells required (can be 0) + * @param durationTicks distillation time, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int cells, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input, cells, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input, int cells, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input, cells, durationTicks, euPerTick)); } + /** + * Adds a distillation tower recipe with multiple outputs. + * + * @param outputs array with 1-4 outputs + * @param input recipe input + * @param cells number of cells required (can be 0) + * @param durationTicks distillation time, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int duration, int euPerTick) { + public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { if (outputs.length == 0) { MineTweakerAPI.logError("Distillation tower recipe requires at least 1 output"); } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, duration, euPerTick)); + MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); } } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack[] outputs; private final IItemStack input; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java index 0b3608f..06809ae 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -17,21 +11,35 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Electrolyzer recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Electrolyzer") @ModOnly("gregtech_addon") public class Electrolyzer { + /** + * Adds an electrolyzer recipe. + * + * @param outputs array with 1-4 outputs + * @param input recipe input + * @param cells number of cells required (can be 0) + * @param durationTicks electrolyzing duration, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int duration, int euPerTick) { + public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { if (outputs.length < 1) { MineTweakerAPI.logError("Electrolyzer recipe requires at least 1 output"); } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, duration, euPerTick)); + MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); } } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack[] output; private final IItemStack input; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java index 7f673d0..9efd74a 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,31 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the extruder recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Extruder") @ModOnly("gregtech_addon") public class Extruder { + /** + * Adds an extruder recipe. + * + * @param output recipe output + * @param input recipe input + * @param shape shape (set stack size to 0 to prevent the shape from being consumed) + * @param durationTicks extruding time, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, IItemStack shape, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, shape, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input, IItemStack shape, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, shape, durationTicks, euPerTick)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java index 4735647..059f2b4 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,30 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Forge Hammer recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.ForgeHammer") @ModOnly("gregtech_addon") public class ForgeHammer { + /** + * Add a Forge Hammer recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks forging duration, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java index 6644af1..129f403 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,42 +10,95 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the fuels used by the various generators. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Fuels") @ModOnly("gregtech_addon") public class Fuels { + /** + * Adds a Diesel Engine fuel. If the given item does not contain any liquid, + * it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ @ZenMethod public static void addDieselFuel(IItemStack output, IItemStack input, int euPerMillibucket) { MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 0)); } + /** + * Adds a Gas Turbine fuel. If the given item does not contain any liquid, + * it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ @ZenMethod public static void addGasTurbineFuel(IItemStack output, IItemStack input, int euPerMillibucket) { MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 1)); } + /** + * Adds a Thermal Generator fuel. If the given item does not contain any + * liquid, it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ @ZenMethod public static void addThermalGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 2)); } + /** + * Adds a Dense Fluid Generator fuel. If the given item does not contain any + * liquid, it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ @ZenMethod public static void addDenseFluidFuel(IItemStack output, IItemStack input, int euPerMillibucket) { MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 3)); } + /** + * Adds a Plasma Generator fuel. If the given item does not contain any + * liquid, it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ @ZenMethod public static void addPlasmaGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 4)); } + /** + * Adds a Magic Generator fuel. If the given item does not contain any liquid, + * it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ @ZenMethod public static void addMagicGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 5)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private static final String[] GENERATORS = { "diesel", diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java index f0aa57e..e3c33b5 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,32 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the fusion reactor recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.FusionReactor") @ModOnly("gregtech_addon") public class FusionReactor { + /** + * Adds a Fusion Reactor recipe. + * + * @param output reactor output + * @param input1 primary input + * @param input2 secondary input + * @param durationTicks fusion duration, in ticks + * @param energyPerTick eu consumption per tick + * @param startEnergy starting energy + */ @ZenMethod public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int energyPerTick, int startEnergy) { MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, energyPerTick, startEnergy)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input1; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java index 15cb245..358f23f 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -19,24 +13,43 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Grinder recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Grinder") @ModOnly("gregtech_addon") public class Grinder { + /** + * Adds a recipe with a single output. + * + * @param output grinder output + * @param input1 grinder primary input + * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) + */ @ZenMethod public static void addRecipe(IItemStack output, IItemStack input1, @Optional IItemStack input2) { if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input1, input2)); } + /** + * Adds a recipe with multiple outputs. + * + * @param outputs array with 1-4 outputs + * @param input1 grinder primary input + * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) + */ @ZenMethod public static void addRecipe(IItemStack[] outputs, IItemStack input1, @Optional IItemStack input2) { if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); MineTweakerAPI.apply(new AddRecipeAction(outputs, input1, input2)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack[] outputs; private final IItemStack input1; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java index 3e8b3eb..0cfc199 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,32 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Implosion Compressor recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.ImplosionCompressor") @ModOnly("gregtech_addon") public class ImplosionCompressor { + /** + * Adds an implosion compressor recipe with a single output. + * + * @param output recipe output + * @param input primary input + * @param tnt amount of TNT needed + */ @ZenMethod public static void addRecipe(IItemStack output, IItemStack input, int tnt) { MineTweakerAPI.apply(new AddRecipeAction(output, null, input, tnt)); } + /** + * Adds an implosion compressor recipe with one or two outputs. + * + * @param output array with 1-2 outputs + * @param input primary input + * @param tnt amount of TNT needed + */ @ZenMethod public static void addRecipe(IItemStack[] output, IItemStack input, int tnt) { if (output.length == 0) { @@ -36,6 +45,10 @@ public class ImplosionCompressor { } } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output1; private final IItemStack output2; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/JackHammer.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/JackHammer.java index 49153c1..78e4dc0 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/JackHammer.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/JackHammer.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -18,12 +12,18 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Access point to jack hammer whitelist. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.JackHammer") @ModOnly("gregtech_addon") public class JackHammer { + /** + * Adds a block to be minable. The given item must be a block. + * + * @param item block + */ @ZenMethod public static void addMinableBlock(IItemStack item) { Block block = getBlock(item); @@ -34,6 +34,12 @@ public class JackHammer { } } + /** + * Adds a block to be minable, but only with the diamond tools. The given + * item must be a block. + * + * @param item block + */ @ZenMethod public static void addDiamondMinableBlock(IItemStack item) { Block block = getBlock(item); @@ -44,11 +50,19 @@ public class JackHammer { } } + // ####################### + // ### Private Methods ### + // ####################### + private static Block getBlock(IItemStack item) { ItemStack itemStack = MineTweakerMC.getItemStack(item); return itemStack.itemID > Block.blocksList.length ? null : Block.blocksList[itemStack.itemID]; } + // ###################### + // ### Action classes ### + // ###################### + private static class AddBlockAction extends OneWayAction { private final Block block; private final boolean diamondOnly; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java index b97608c..81d1257 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,19 +10,36 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Access point for Lathe recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Lathe") @ModOnly("gregtech_addon") public class Lathe { + /** + * Adds a lathe recipe with a single output. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, null, input, durationTicks, euPerTick)); } + /** + * Adds a lathe recipe with 1 or 2 outputs. + * + * @param outputs array with 1-2 outputs + * @param input recipe input + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int duration, int euPerTick) { + public static void addRecipe(IItemStack[] outputs, IItemStack input, int durationTicks, int euPerTick) { if (outputs.length == 0) { MineTweakerAPI.logError("Lathe recipe requires at least 1 input"); } else { @@ -36,11 +47,15 @@ public class Lathe { outputs[0], outputs.length > 1 ? outputs[1] : null, input, - duration, + durationTicks, euPerTick)); } } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output1; private final IItemStack output2; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java index ba7ac9c..883684d 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,30 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Access point to Plate Bender recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.PlateBender") @ModOnly("gregtech_addon") public class PlateBender { + /** + * Adds a plate bender recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks bending time, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java index 268324e..6a87eff 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,30 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Plate Cutter recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.PlateCutter") @ModOnly("gregtech_addon") public class PlateCutter { + /** + * Adds a plate cutter recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks cutting time, in ticks + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java index 51f8791..29cd620 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -18,18 +12,33 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Sawmill recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Sawmill") @ModOnly("gregtech_addon") public class Sawmill { + /** + * Adds a new sawmill recipe. + * + * @param output recipe output + * @param input1 primary input + * @param input2 secondary input (optional, if set to null will use a water cell) + */ @ZenMethod public static void addRecipe(IItemStack output, IItemStack input1, @Optional IItemStack input2) { if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); MineTweakerAPI.apply(new AddRecipeAction(output, null, null, input1, input2)); } + /** + * Adds a new sawmill recipe with 1-3 outputs. + * + * @param outputs array with 1-3 outputs + * @param input1 primary input + * @param input2 secondary input (optional, if set to null will use a water cell) + */ @ZenMethod public static void addRecipe(IItemStack[] outputs, IItemStack input1, @Optional IItemStack input2) { if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); @@ -41,6 +50,10 @@ public class Sawmill { input2)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output1; private final IItemStack output2; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java index 1b2e9f1..17d9d5b 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,28 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the sonictron. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Sonictron") @ModOnly("gregtech_addon") public class Sonictron { + /** + * Adds a sonictron sound. + * + * @param itemStack item you want to display for this sound + * @param soundName name of the Sound in the resources/newsound-folder like Vanillasounds + */ @ZenMethod public static void addSound(IItemStack itemStack, String soundName) { MineTweakerAPI.apply(new AddSoundAction(itemStack, soundName)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddSoundAction extends OneWayAction { private final IItemStack itemStack; private final String soundName; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java index b7607b8..ab61a7e 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,29 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Vacuum Freezer recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.VacuumFreezer") @ModOnly("gregtech_addon") public class VacuumFreezer { + /** + * Adds a vacuum freezer recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks freezing duration, in ticks + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int duration) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, duration)); + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input; diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java index 2abc010..b5e6834 100644 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java +++ b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java @@ -1,9 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - package minetweaker.mods.gregtech.machines; import gregtechmod.api.GregTech_API; @@ -16,17 +10,30 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * - * @author Stan + * Provides access to the Wiremill recipes. + * + * @author Stan Hebben */ @ZenClass("mods.gregtech.Wiremill") @ModOnly("gregtech_addon") public class Wiremill { + /** + * Adds a Wiremill recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks processing time + * @param euPerTick eu consumption per tick + */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, duration, euPerTick)); + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); } + // ###################### + // ### Action classes ### + // ###################### + private static class AddRecipeAction extends OneWayAction { private final IItemStack output; private final IItemStack input; diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java index 646735f..24bd1a6 100644 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java +++ b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java @@ -60,7 +60,7 @@ public class Compressor { public static IItemStack getOutput( @NotNull IItemStack input) { RecipeOutput output = Recipes.compressor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) { + if (output == null || output.items.isEmpty()) { System.out.println("No output"); return null; } diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java index 90b71cb..f83590a 100644 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java +++ b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java @@ -65,7 +65,7 @@ public class Extractor { public static IItemStack getOutput( @NotNull IItemStack input) { RecipeOutput output = Recipes.extractor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } } diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java index 772baee..d985d16 100644 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java +++ b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java @@ -60,7 +60,7 @@ public class Macerator { public static IItemStack getOutput( @NotNull IItemStack input) { RecipeOutput output = Recipes.macerator.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } } diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java index 6bb83c2..774f081 100644 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java +++ b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java @@ -52,7 +52,7 @@ public class MetalFormer { @ZenMethod public static IItemStack getExtrudingOutput(IItemStack input) { RecipeOutput output = Recipes.metalformerExtruding.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } @@ -81,7 +81,7 @@ public class MetalFormer { @ZenMethod public static IItemStack getRollingOutput(IItemStack input) { RecipeOutput output = Recipes.metalformerRolling.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } /** @@ -109,7 +109,7 @@ public class MetalFormer { @ZenMethod public static IItemStack getCuttingOutput(IItemStack input) { RecipeOutput output = Recipes.metalformerCutting.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } } diff --git a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java index 646735f..24bd1a6 100644 --- a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java +++ b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java @@ -60,7 +60,7 @@ public class Compressor { public static IItemStack getOutput( @NotNull IItemStack input) { RecipeOutput output = Recipes.compressor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) { + if (output == null || output.items.isEmpty()) { System.out.println("No output"); return null; } diff --git a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java index 90b71cb..f83590a 100644 --- a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java +++ b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java @@ -65,7 +65,7 @@ public class Extractor { public static IItemStack getOutput( @NotNull IItemStack input) { RecipeOutput output = Recipes.extractor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } } diff --git a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java index 772baee..d985d16 100644 --- a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java +++ b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java @@ -60,7 +60,7 @@ public class Macerator { public static IItemStack getOutput( @NotNull IItemStack input) { RecipeOutput output = Recipes.macerator.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } } diff --git a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java index 6bb83c2..774f081 100644 --- a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java +++ b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java @@ -52,7 +52,7 @@ public class MetalFormer { @ZenMethod public static IItemStack getExtrudingOutput(IItemStack input) { RecipeOutput output = Recipes.metalformerExtruding.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } @@ -81,7 +81,7 @@ public class MetalFormer { @ZenMethod public static IItemStack getRollingOutput(IItemStack input) { RecipeOutput output = Recipes.metalformerRolling.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } /** @@ -109,7 +109,7 @@ public class MetalFormer { @ZenMethod public static IItemStack getCuttingOutput(IItemStack input) { RecipeOutput output = Recipes.metalformerCutting.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } } diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerMod.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerMod.java index 98f314d..b822d8a 100644 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerMod.java +++ b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerMod.java @@ -53,7 +53,8 @@ public class MineTweakerMod { private static final String[] REGISTRIES = { "minetweaker.mods.ic2.ClassRegistry", - "minetweaker.mods.nei.ClassRegistry" + "minetweaker.mods.nei.ClassRegistry", + "minetweaker.mods.gregtech.ClassRegistry" }; static { diff --git a/MineTweaker3-MC172-Mod-GregTech/build.gradle b/MineTweaker3-MC172-Mod-GregTech/build.gradle new file mode 100644 index 0000000..ae3e15d --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/build.gradle @@ -0,0 +1,38 @@ +import minetweaker.tasks.RegisterZenClassesTask; + +buildscript { + repositories { + mavenCentral() + maven { + name = "forge" + url = "http://files.minecraftforge.net/maven" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + } +} + +apply plugin: 'forge' +minecraft{version = "1.7.2-10.12.2.1121"} +version = "1.0" +archivesBaseName = project.projectDir.name + +dependencies { + compile project(':ZenScript') + compile project(':MineTweaker3-API') + compile project(':MineTweaker3-MC172-Main') + compile files('libs/gregtech-1.7-api.jar') +} + +task makeRegistry(type: RegisterZenClassesTask) { + inputDir = file('build/classes/main') + outputDir = file('build/classes/main') + className = 'minetweaker.mods.gregtech.ClassRegistry' +} + +tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-api.jar b/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-api.jar new file mode 100644 index 0000000..e351d4e Binary files /dev/null and b/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-api.jar differ diff --git a/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-dev.jar b/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-dev.jar new file mode 100644 index 0000000..ce91455 Binary files /dev/null and b/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-dev.jar differ diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java new file mode 100644 index 0000000..267a92b --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java @@ -0,0 +1,112 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provider access to the Alloy Smelter recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.AlloySmelter") +@ModOnly(MOD_ID) +public class AlloySmelter { + /** + * Adds an alloy smelter recipe. + * + * @param output alloy smelter output + * @param input1 primary input + * @param input2 secondary input + * @param durationTicks smelting time, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input1; + private final IItemStack input2; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { + this.output = output; + this.input1 = input1; + this.input2 = input2; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addAlloySmelterRecipe( + MineTweakerMC.getItemStack(input1), + MineTweakerMC.getItemStack(input2), + MineTweakerMC.getItemStack(output), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding alloy smelter recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 53 * hash + (this.input1 != null ? this.input1.hashCode() : 0); + hash = 53 * hash + (this.input2 != null ? this.input2.hashCode() : 0); + hash = 53 * hash + this.duration; + hash = 53 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { + return false; + } + if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Amplifabricator.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Amplifabricator.java new file mode 100644 index 0000000..f450228 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Amplifabricator.java @@ -0,0 +1,89 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the amplifabricator. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Amplifabricator") +@ModOnly(MOD_ID) +public class Amplifabricator { + @ZenMethod + public static void addAmplifier(IItemStack item, int durationTicks, int amount) { + MineTweakerAPI.apply(new AddAmplifierAction(item, durationTicks, amount)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddAmplifierAction extends OneWayAction { + private final IItemStack item; + private final int duration; + private final int amount; + + public AddAmplifierAction(IItemStack item, int duration, int amount) { + this.item = item; + this.duration = duration; + this.amount = amount; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addAmplifier( + MineTweakerMC.getItemStack(item), + duration, + amount); + } + + @Override + public String describe() { + return "Adding amplifier " + item; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 59 * hash + (this.item != null ? this.item.hashCode() : 0); + hash = 59 * hash + this.duration; + hash = 59 * hash + this.amount; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddAmplifierAction other = (AddAmplifierAction) obj; + if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.amount != other.amount) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java new file mode 100644 index 0000000..d0ad251 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java @@ -0,0 +1,112 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the assembler recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Assembler") +@ModOnly(MOD_ID) +public class Assembler { + /** + * Adds an assemble recipe. + * + * @param output recipe output + * @param input1 primary input + * @param input2 secondary input (optional, can be null) + * @param durationTicks assembling duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input1; + private final IItemStack input2; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { + this.output = output; + this.input1 = input1; + this.input2 = input2; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addAssemblerRecipe( + MineTweakerMC.getItemStack(input1), + MineTweakerMC.getItemStack(input2), + MineTweakerMC.getItemStack(output), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding assembler recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 79 * hash + (this.input1 != null ? this.input1.hashCode() : 0); + hash = 79 * hash + (this.input2 != null ? this.input2.hashCode() : 0); + hash = 79 * hash + this.duration; + hash = 79 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { + return false; + } + if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java new file mode 100644 index 0000000..abbb5d1 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java @@ -0,0 +1,146 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Blast Furnace recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.BlastFurnace") +@ModOnly(MOD_ID) +public class BlastFurnace { + /** + * Adds a recipe with a single output. + * + * @param output recipe output + * @param input1 primary input + * @param input2 secondary input (optional, can be null) + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + * @param heat required heat capacity + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { + MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output, null, durationTicks, euPerTick, heat)); + } + + /** + * Adds a recipe with multiple outputs. + * + * @param output array with 1 or 2 outputs + * @param input1 primary input + * @param input2 secondary input (optional, can be null) + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + * @param heat required heat capacity + */ + @ZenMethod + public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { + if (output.length == 0) { + MineTweakerAPI.logError("Blast furnace recipe requires at least 1 input"); + } else { + MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output[0], output.length > 1 ? output[1] : null, durationTicks, euPerTick, heat)); + } + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack input1; + private final IItemStack input2; + private final IItemStack output1; + private final IItemStack output2; + private final int duration; + private final int euPerTick; + private final int heat; + + public AddRecipeAction(IItemStack input1, IItemStack input2, IItemStack output1, IItemStack output2, int duration, int euPerTick, int heat) { + this.input1 = input1; + this.input2 = input2; + this.output1 = output1; + this.output2 = output2; + this.duration = duration; + this.euPerTick = euPerTick; + this.heat = heat; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addBlastRecipe( + MineTweakerMC.getItemStack(input1), + MineTweakerMC.getItemStack(input2), + MineTweakerMC.getItemStack(output1), + MineTweakerMC.getItemStack(output2), + duration, + euPerTick, + heat); + } + + @Override + public String describe() { + return "Adding blast furnace recipe for " + output1; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 89 * hash + (this.input1 != null ? this.input1.hashCode() : 0); + hash = 89 * hash + (this.input2 != null ? this.input2.hashCode() : 0); + hash = 89 * hash + (this.output1 != null ? this.output1.hashCode() : 0); + hash = 89 * hash + (this.output2 != null ? this.output2.hashCode() : 0); + hash = 89 * hash + this.duration; + hash = 89 * hash + this.euPerTick; + hash = 89 * hash + this.heat; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { + return false; + } + if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { + return false; + } + if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { + return false; + } + if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + if (this.heat != other.heat) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Boxing.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Boxing.java new file mode 100644 index 0000000..eb7a56d --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Boxing.java @@ -0,0 +1,200 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provider access to the boxing and unboxing recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Boxing") +@ModOnly(MOD_ID) +public class Boxing { + /** + * Adds a boxing recipe. + * + * @param fullBox the full box + * @param item the item to be packed + * @param emptyBox empty box + * @param durationTicks boxing duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addBoxingRecipe(IItemStack fullBox, IItemStack item, IItemStack emptyBox, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddBoxingAction(fullBox, item, emptyBox, durationTicks, euPerTick)); + } + + /** + * Adds an unboxing recipe. + * + * @param item the item after unpacking + * @param emptyBox the empty box after unpacking + * @param fullBox full box + * @param durationTicks unboxing duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addUnboxingRecipe(IItemStack item, IItemStack emptyBox, IItemStack fullBox, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddUnboxingAction(item, emptyBox, fullBox, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddBoxingAction extends OneWayAction { + private final IItemStack fullBox; + private final IItemStack item; + private final IItemStack emptyBox; + private final int duration; + private final int euPerTick; + + public AddBoxingAction(IItemStack fullBox, IItemStack item, IItemStack emptyBox, int duration, int euPerTick) { + this.fullBox = fullBox; + this.item = item; + this.emptyBox = emptyBox; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addBoxingRecipe( + MineTweakerMC.getItemStack(item), + MineTweakerMC.getItemStack(emptyBox), + MineTweakerMC.getItemStack(fullBox), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding boxing recipe to pack " + item + " in " + emptyBox; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 89 * hash + (this.fullBox != null ? this.fullBox.hashCode() : 0); + hash = 89 * hash + (this.item != null ? this.item.hashCode() : 0); + hash = 89 * hash + (this.emptyBox != null ? this.emptyBox.hashCode() : 0); + hash = 89 * hash + this.duration; + hash = 89 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddBoxingAction other = (AddBoxingAction) obj; + if (this.fullBox != other.fullBox && (this.fullBox == null || !this.fullBox.equals(other.fullBox))) { + return false; + } + if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { + return false; + } + if (this.emptyBox != other.emptyBox && (this.emptyBox == null || !this.emptyBox.equals(other.emptyBox))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } + + private static class AddUnboxingAction extends OneWayAction { + private final IItemStack item; + private final IItemStack emptyBox; + private final IItemStack fullBox; + private final int duration; + private final int euPerTick; + + public AddUnboxingAction(IItemStack item, IItemStack emptyBox, IItemStack fullBox, int duration, int euPerTick) { + this.item = item; + this.emptyBox = emptyBox; + this.fullBox = fullBox; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addUnboxingRecipe( + MineTweakerMC.getItemStack(fullBox), + MineTweakerMC.getItemStack(item), + MineTweakerMC.getItemStack(emptyBox), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding unboxing recipe to unbox " + fullBox; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 83 * hash + (this.item != null ? this.item.hashCode() : 0); + hash = 83 * hash + (this.emptyBox != null ? this.emptyBox.hashCode() : 0); + hash = 83 * hash + (this.fullBox != null ? this.fullBox.hashCode() : 0); + hash = 83 * hash + this.duration; + hash = 83 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddUnboxingAction other = (AddUnboxingAction) obj; + if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { + return false; + } + if (this.emptyBox != other.emptyBox && (this.emptyBox == null || !this.emptyBox.equals(other.emptyBox))) { + return false; + } + if (this.fullBox != other.fullBox && (this.fullBox == null || !this.fullBox.equals(other.fullBox))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java new file mode 100644 index 0000000..3fa4b6d --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java @@ -0,0 +1,104 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the CNC recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.CNC") +@ModOnly(MOD_ID) +public class CNC { + /** + * Adds a CNC recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { + this.output = output; + this.input = input; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addCNCRecipe( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(output), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding CNC recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 53 * hash + this.duration; + hash = 53 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java new file mode 100644 index 0000000..53f54fb --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java @@ -0,0 +1,137 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provider access to the Canner recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Canner") +@ModOnly(MOD_ID) +public class Canner { + /** + * Adds a canner recipe with a single output. + * + * @param output crafting output + * @param input1 primary input + * @param input2 secondary input (optional + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, null, input1, input2, durationTicks, euPerTick)); + } + + /** + * Adds a canner recipe with multiple outputs. + * + * @param output array with 1 or 2 outputs + * @param input1 primary input + * @param input2 secondary input (optional, can be null) + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { + if (output.length == 0) { + MineTweakerAPI.logError("canner requires at least 1 output"); + } else { + MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input1, input2, durationTicks, euPerTick)); + } + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output1; + private final IItemStack output2; + private final IItemStack input1; + private final IItemStack input2; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input1, IItemStack input2, int duration, int euPerTick) { + this.output1 = output1; + this.output2 = output2; + this.input1 = input1; + this.input2 = input2; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addCannerRecipe( + MineTweakerMC.getItemStack(input1), + MineTweakerMC.getItemStack(input2), + MineTweakerMC.getItemStack(output1), + MineTweakerMC.getItemStack(output2), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding canner recipe for " + output1; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + (this.output1 != null ? this.output1.hashCode() : 0); + hash = 79 * hash + (this.output2 != null ? this.output2.hashCode() : 0); + hash = 79 * hash + (this.input1 != null ? this.input1.hashCode() : 0); + hash = 79 * hash + (this.input2 != null ? this.input2.hashCode() : 0); + hash = 79 * hash + this.duration; + hash = 79 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { + return false; + } + if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { + return false; + } + if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { + return false; + } + if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java new file mode 100644 index 0000000..e58240b --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java @@ -0,0 +1,129 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import java.util.Arrays; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * + * @author Stan + */ +@ZenClass("mods.gregtech.Centrifuge") +@ModOnly(MOD_ID) +public class Centrifuge { + /** + * Adds a centrifuge recipe. + * + * @param outputs array with 1-6 outputs + * @param input recipe input + * @param cells number of cells required, can be 0 + * @param durationTicks centrifuging time, in ticks + */ + @ZenMethod + public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks) { + if (outputs.length < 1) { + MineTweakerAPI.logError("centrifuge must have at least 1 output"); + } else { + MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks)); + } + } + + /** + * Adds a centrifuge recipe taking a fuel can as container. + * + * @param outputs array with 1-6 outputs + * @param input recipe input + * @param duration centrifuging time, in ticks + */ + @ZenMethod + public static void addRecipeFuelCan(IItemStack[] outputs, IItemStack input, int duration) { + if (outputs.length < 1) { + MineTweakerAPI.logError("centrifuge must have at least 1 output"); + } else { + MineTweakerAPI.apply(new AddRecipeAction(outputs, input, -1, duration)); + } + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack[] output; + private final IItemStack input; + private final int cells; + private final int duration; + + public AddRecipeAction(IItemStack[] output, IItemStack input, int cells, int duration) { + this.output = output; + this.input = input; + this.cells = cells; + this.duration = duration; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addCentrifugeRecipe( + MineTweakerMC.getItemStack(input), + cells, + MineTweakerMC.getItemStack(output[0]), + output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, + output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, + output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, + output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, + output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, + duration); + } + + @Override + public String describe() { + return "Adding centrifuge recipe with input " + input; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 59 * hash + Arrays.deepHashCode(this.output); + hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 59 * hash + this.cells; + hash = 59 * hash + this.duration; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (!Arrays.deepEquals(this.output, other.output)) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.cells != other.cells) { + return false; + } + if (this.duration != other.duration) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java new file mode 100644 index 0000000..2e26609 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java @@ -0,0 +1,104 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Chemical Reactor recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.ChemicalReactor") +@ModOnly(MOD_ID) +public class ChemicalReactor { + /** + * Adds a Chemical Reactor recipe. + * + * @param output recipe output + * @param input1 primary input + * @param input2 secondary input + * @param durationTicks reaction time, in ticks + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks) { + MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input1; + private final IItemStack input2; + private final int duration; + + public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration) { + this.output = output; + this.input1 = input1; + this.input2 = input2; + this.duration = duration; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addChemicalRecipe( + MineTweakerMC.getItemStack(input1), + MineTweakerMC.getItemStack(input2), + MineTweakerMC.getItemStack(output), + duration); + } + + @Override + public String describe() { + return "Adding chemical reactor recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 11 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 11 * hash + (this.input1 != null ? this.input1.hashCode() : 0); + hash = 11 * hash + (this.input2 != null ? this.input2.hashCode() : 0); + hash = 11 * hash + this.duration; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { + return false; + } + if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java new file mode 100644 index 0000000..4bebe07 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java @@ -0,0 +1,133 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import java.util.Arrays; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the distillation tower recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.DistillationTower") +@ModOnly(MOD_ID) +public class DistillationTower { + /** + * Adds a distillation tower recipe with a single output. + * + * @param output recipe output + * @param input recipe input + * @param cells number of cells required (can be 0) + * @param durationTicks distillation time, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int cells, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input, cells, durationTicks, euPerTick)); + } + + /** + * Adds a distillation tower recipe with multiple outputs. + * + * @param outputs array with 1-4 outputs + * @param input recipe input + * @param cells number of cells required (can be 0) + * @param durationTicks distillation time, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { + if (outputs.length == 0) { + MineTweakerAPI.logError("Distillation tower recipe requires at least 1 output"); + } else { + MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); + } + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack[] outputs; + private final IItemStack input; + private final int cells; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack[] outputs, IItemStack input, int cells, int duration, int euPerTick) { + this.outputs = outputs; + this.input = input; + this.cells = cells; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addDistillationRecipe( + MineTweakerMC.getItemStack(input), + cells, + MineTweakerMC.getItemStack(outputs[0]), + outputs.length > 1 ? MineTweakerMC.getItemStack(outputs[1]) : null, + outputs.length > 2 ? MineTweakerMC.getItemStack(outputs[2]) : null, + outputs.length > 3 ? MineTweakerMC.getItemStack(outputs[3]) : null, + duration, euPerTick); + } + + @Override + public String describe() { + return "Adding Distillation tower recipe for " + outputs[0]; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 41 * hash + Arrays.deepHashCode(this.outputs); + hash = 41 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 41 * hash + this.cells; + hash = 41 * hash + this.duration; + hash = 41 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (!Arrays.deepEquals(this.outputs, other.outputs)) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.cells != other.cells) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java new file mode 100644 index 0000000..43e53f6 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java @@ -0,0 +1,122 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import java.util.Arrays; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Electrolyzer recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Electrolyzer") +@ModOnly(MOD_ID) +public class Electrolyzer { + /** + * Adds an electrolyzer recipe. + * + * @param outputs array with 1-6 outputs + * @param input recipe input + * @param cells number of cells required (can be 0) + * @param durationTicks electrolyzing duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { + if (outputs.length < 1) { + MineTweakerAPI.logError("Electrolyzer recipe requires at least 1 output"); + } else { + MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); + } + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack[] output; + private final IItemStack input; + private final int cells; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack[] output, IItemStack input, int cells, int duration, int euPerTick) { + this.output = output; + this.input = input; + this.cells = cells; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addElectrolyzerRecipe( + MineTweakerMC.getItemStack(input), + cells, + MineTweakerMC.getItemStack(output[0]), + output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, + output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, + output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, + output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, + output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, + duration, + cells); + } + + @Override + public String describe() { + return "Adding electrolyzer recipe with input " + input; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + Arrays.deepHashCode(this.output); + hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 97 * hash + this.cells; + hash = 97 * hash + this.duration; + hash = 97 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (!Arrays.deepEquals(this.output, other.output)) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.cells != other.cells) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java new file mode 100644 index 0000000..2d8bcd9 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java @@ -0,0 +1,112 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the extruder recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Extruder") +@ModOnly(MOD_ID) +public class Extruder { + /** + * Adds an extruder recipe. + * + * @param output recipe output + * @param input recipe input + * @param shape shape (set stack size to 0 to prevent the shape from being consumed) + * @param durationTicks extruding time, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, IItemStack shape, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, shape, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input; + private final IItemStack shape; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output, IItemStack input, IItemStack shape, int duration, int euPerTick) { + this.output = output; + this.input = input; + this.shape = shape; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addExtruderRecipe( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(shape), + MineTweakerMC.getItemStack(output), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding extruder recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 67 * hash + (this.shape != null ? this.shape.hashCode() : 0); + hash = 67 * hash + this.duration; + hash = 67 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.shape != other.shape && (this.shape == null || !this.shape.equals(other.shape))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java new file mode 100644 index 0000000..4ce7ba5 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java @@ -0,0 +1,104 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Forge Hammer recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.ForgeHammer") +@ModOnly(MOD_ID) +public class ForgeHammer { + /** + * Add a Forge Hammer recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks forging duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { + this.output = output; + this.input = input; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addForgeHammerRecipe( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(output), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding forge hammer recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 97 * hash + this.duration; + hash = 97 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java new file mode 100644 index 0000000..3d92219 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java @@ -0,0 +1,178 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the fuels used by the various generators. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Fuels") +@ModOnly(MOD_ID) +public class Fuels { + /** + * Adds a Diesel Engine fuel. If the given item does not contain any liquid, + * it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ + @ZenMethod + public static void addDieselFuel(IItemStack output, IItemStack input, int euPerMillibucket) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 0)); + } + + /** + * Adds a Gas Turbine fuel. If the given item does not contain any liquid, + * it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ + @ZenMethod + public static void addGasTurbineFuel(IItemStack output, IItemStack input, int euPerMillibucket) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 1)); + } + + /** + * Adds a Thermal Generator fuel. If the given item does not contain any + * liquid, it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ + @ZenMethod + public static void addThermalGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 2)); + } + + /** + * Adds a Dense Fluid Generator fuel. If the given item does not contain any + * liquid, it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ + @ZenMethod + public static void addDenseFluidFuel(IItemStack output, IItemStack input, int euPerMillibucket) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 3)); + } + + /** + * Adds a Plasma Generator fuel. If the given item does not contain any + * liquid, it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ + @ZenMethod + public static void addPlasmaGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 4)); + } + + /** + * Adds a Magic Generator fuel. If the given item does not contain any liquid, + * it will generate the equivalent of 1000 millibuckets. + * + * @param output output item (optional, can be null) + * @param input input item + * @param euPerMillibucket eu production per millibucket + */ + @ZenMethod + public static void addMagicGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 5)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private static final String[] GENERATORS = { + "diesel", + "gas turbine", + "thermal", + "dense fluid", + "plasma", + "magic" + }; + + private final IItemStack output; + private final IItemStack input; + private final int euPerMillibucket; + private final int type; + + public AddRecipeAction(IItemStack output, IItemStack input, int euPerMillibucket, int type) { + this.output = output; + this.input = input; + this.euPerMillibucket = euPerMillibucket; + this.type = type; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addFuel( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(output), + euPerMillibucket, + type); + } + + @Override + public String describe() { + return "Adding " + GENERATORS[type] + " fuel " + input; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 59 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 59 * hash + this.euPerMillibucket; + hash = 59 * hash + this.type; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.euPerMillibucket != other.euPerMillibucket) { + return false; + } + if (this.type != other.type) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java new file mode 100644 index 0000000..3f07eb7 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java @@ -0,0 +1,126 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the fusion reactor recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.FusionReactor") +@ModOnly(MOD_ID) +public class FusionReactor { + /** + * Adds a Fusion Reactor recipe. + * + * @param output reactor output + * @param input1 primary input + * @param input2 secondary input + * @param durationTicks fusion duration, in ticks + * @param energyPerTick eu consumption per tick + * @param startEnergy starting energy + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int energyPerTick, int startEnergy) { + MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, energyPerTick, startEnergy)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input1; + private final IItemStack input2; + private final int durationTicks; + private final int energyPerTick; + private final int startEnergy; + + public AddRecipeAction( + IItemStack output, + IItemStack input1, + IItemStack input2, + int durationTicks, + int energyPerTick, + int startEnergy) { + this.output = output; + this.input1 = input1; + this.input2 = input2; + this.durationTicks = durationTicks; + this.energyPerTick = energyPerTick; + this.startEnergy = startEnergy; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addFusionReactorRecipe( + MineTweakerMC.getItemStack(input1), + MineTweakerMC.getItemStack(input2), + MineTweakerMC.getItemStack(output), + durationTicks, + energyPerTick, + startEnergy); + } + + @Override + public String describe() { + return "Adding fusion reactor recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 97 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 97 * hash + (this.input1 != null ? this.input1.hashCode() : 0); + hash = 97 * hash + (this.input2 != null ? this.input2.hashCode() : 0); + hash = 97 * hash + this.durationTicks; + hash = 97 * hash + this.energyPerTick; + hash = 97 * hash + this.startEnergy; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { + return false; + } + if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { + return false; + } + if (this.durationTicks != other.durationTicks) { + return false; + } + if (this.energyPerTick != other.energyPerTick) { + return false; + } + if (this.startEnergy != other.startEnergy) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java new file mode 100644 index 0000000..631d2ec --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java @@ -0,0 +1,116 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import gregtech.api.util.GT_ModHandler; +import java.util.Arrays; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Grinder recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Grinder") +@ModOnly(MOD_ID) +public class Grinder { + /** + * Adds a recipe with a single output. + * + * @param output grinder output + * @param input1 grinder primary input + * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input1, @Optional IItemStack input2) { + if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); + MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input1, input2)); + } + + /** + * Adds a recipe with multiple outputs. + * + * @param outputs array with 1-4 outputs + * @param input1 grinder primary input + * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) + */ + @ZenMethod + public static void addRecipe(IItemStack[] outputs, IItemStack input1, @Optional IItemStack input2) { + if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); + MineTweakerAPI.apply(new AddRecipeAction(outputs, input1, input2)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack[] outputs; + private final IItemStack input1; + private final IItemStack input2; + + private AddRecipeAction(IItemStack[] outputs, IItemStack input1, IItemStack input2) { + this.outputs = outputs; + this.input1 = input1; + this.input2 = input2; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addGrinderRecipe( + MineTweakerMC.getItemStack(input1), + MineTweakerMC.getItemStack(input2), + MineTweakerMC.getItemStack(outputs[0]), + outputs.length > 1 ? MineTweakerMC.getItemStack(outputs[1]) : null, + outputs.length > 2 ? MineTweakerMC.getItemStack(outputs[2]) : null, + outputs.length > 3 ? MineTweakerMC.getItemStack(outputs[3]) : null); + } + + @Override + public String describe() { + return "Adding grinder recipe for " + outputs[0]; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 89 * hash + Arrays.deepHashCode(this.outputs); + hash = 89 * hash + (this.input1 != null ? this.input1.hashCode() : 0); + hash = 89 * hash + (this.input2 != null ? this.input2.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (!Arrays.deepEquals(this.outputs, other.outputs)) { + return false; + } + if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { + return false; + } + if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java new file mode 100644 index 0000000..01e4caa --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java @@ -0,0 +1,119 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Implosion Compressor recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.ImplosionCompressor") +@ModOnly(MOD_ID) +public class ImplosionCompressor { + /** + * Adds an implosion compressor recipe with a single output. + * + * @param output recipe output + * @param input primary input + * @param tnt amount of TNT needed + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int tnt) { + MineTweakerAPI.apply(new AddRecipeAction(output, null, input, tnt)); + } + + /** + * Adds an implosion compressor recipe with one or two outputs. + * + * @param output array with 1-2 outputs + * @param input primary input + * @param tnt amount of TNT needed + */ + @ZenMethod + public static void addRecipe(IItemStack[] output, IItemStack input, int tnt) { + if (output.length == 0) { + MineTweakerAPI.logError("Implosion compressor recipe requires at least 1 output"); + } else { + MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input, tnt)); + } + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output1; + private final IItemStack output2; + private final IItemStack input1; + private final int tnt; + + public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input1, int tnt) { + this.output1 = output1; + this.output2 = output2; + this.input1 = input1; + this.tnt = tnt; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addImplosionRecipe( + MineTweakerMC.getItemStack(input1), + tnt, + MineTweakerMC.getItemStack(output1), + MineTweakerMC.getItemStack(output2)); + } + + @Override + public String describe() { + return "Adding Implosion compressor recipe for " + output1; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.output1 != null ? this.output1.hashCode() : 0); + hash = 97 * hash + (this.output2 != null ? this.output2.hashCode() : 0); + hash = 97 * hash + (this.input1 != null ? this.input1.hashCode() : 0); + hash = 97 * hash + this.tnt; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { + return false; + } + if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { + return false; + } + if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { + return false; + } + if (this.tnt != other.tnt) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java new file mode 100644 index 0000000..3e96030 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java @@ -0,0 +1,133 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Access point for Lathe recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Lathe") +@ModOnly(MOD_ID) +public class Lathe { + /** + * Adds a lathe recipe with a single output. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, null, input, durationTicks, euPerTick)); + } + + /** + * Adds a lathe recipe with 1 or 2 outputs. + * + * @param outputs array with 1-2 outputs + * @param input recipe input + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack[] outputs, IItemStack input, int durationTicks, int euPerTick) { + if (outputs.length == 0) { + MineTweakerAPI.logError("Lathe recipe requires at least 1 input"); + } else { + MineTweakerAPI.apply(new AddRecipeAction( + outputs[0], + outputs.length > 1 ? outputs[1] : null, + input, + durationTicks, + euPerTick)); + } + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output1; + private final IItemStack output2; + private final IItemStack input; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input, int duration, int euPerTick) { + this.output1 = output1; + this.output2 = output2; + this.input = input; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addLatheRecipe( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(output1), + MineTweakerMC.getItemStack(output2), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding lathe recipe for " + output1; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 53 * hash + (this.output1 != null ? this.output1.hashCode() : 0); + hash = 53 * hash + (this.output2 != null ? this.output2.hashCode() : 0); + hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 53 * hash + this.duration; + hash = 53 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { + return false; + } + if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java new file mode 100644 index 0000000..baaada2 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java @@ -0,0 +1,104 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Access point to Plate Bender recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.PlateBender") +@ModOnly(MOD_ID) +public class PlateBender { + /** + * Adds a plate bender recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks bending time, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { + this.output = output; + this.input = input; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addBenderRecipe( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(output), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding plate bender recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 79 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 79 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 79 * hash + this.duration; + hash = 79 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java new file mode 100644 index 0000000..6a8c7bb --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java @@ -0,0 +1,104 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Plate Cutter recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.PlateCutter") +@ModOnly(MOD_ID) +public class PlateCutter { + /** + * Adds a plate cutter recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks cutting time, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { + this.output = output; + this.input = input; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addCutterRecipe( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(output), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding plate cutter recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 17 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 17 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 17 * hash + this.duration; + hash = 17 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java new file mode 100644 index 0000000..995a745 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java @@ -0,0 +1,131 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import gregtech.api.util.GT_ModHandler; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Sawmill recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Sawmill") +@ModOnly(MOD_ID) +public class Sawmill { + /** + * Adds a new sawmill recipe. + * + * @param output recipe output + * @param input1 primary input + * @param input2 secondary input (optional, if set to null will use a water cell) + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input1, @Optional IItemStack input2) { + if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); + MineTweakerAPI.apply(new AddRecipeAction(output, null, null, input1, input2)); + } + + /** + * Adds a new sawmill recipe with 1-3 outputs. + * + * @param outputs array with 1-3 outputs + * @param input1 primary input + * @param input2 secondary input (optional, if set to null will use a water cell) + */ + @ZenMethod + public static void addRecipe(IItemStack[] outputs, IItemStack input1, @Optional IItemStack input2) { + if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); + MineTweakerAPI.apply(new AddRecipeAction( + outputs[0], + outputs.length > 1 ? outputs[1] : null, + outputs.length > 2 ? outputs[2] : null, + input1, + input2)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output1; + private final IItemStack output2; + private final IItemStack output3; + private final IItemStack input1; + private final IItemStack input2; + + public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack input1, IItemStack input2) { + this.output1 = output1; + this.output2 = output2; + this.output3 = output3; + this.input1 = input1; + this.input2 = input2; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addSawmillRecipe( + MineTweakerMC.getItemStack(input1), + MineTweakerMC.getItemStack(input2), + MineTweakerMC.getItemStack(output1), + MineTweakerMC.getItemStack(output2), + MineTweakerMC.getItemStack(output3)); + } + + @Override + public String describe() { + return "Adding Sawmill recipe for " + output1; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 23 * hash + (this.output1 != null ? this.output1.hashCode() : 0); + hash = 23 * hash + (this.output2 != null ? this.output2.hashCode() : 0); + hash = 23 * hash + (this.output3 != null ? this.output3.hashCode() : 0); + hash = 23 * hash + (this.input1 != null ? this.input1.hashCode() : 0); + hash = 23 * hash + (this.input2 != null ? this.input2.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { + return false; + } + if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { + return false; + } + if (this.output3 != other.output3 && (this.output3 == null || !this.output3.equals(other.output3))) { + return false; + } + if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { + return false; + } + if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java new file mode 100644 index 0000000..e94c81c --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java @@ -0,0 +1,88 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the sonictron. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Sonictron") +@ModOnly(MOD_ID) +public class Sonictron { + /** + * Adds a sonictron sound. + * + * @param itemStack item you want to display for this sound + * @param soundName name of the Sound in the resources/newsound-folder like Vanillasounds + */ + @ZenMethod + public static void addSound(IItemStack itemStack, String soundName) { + MineTweakerAPI.apply(new AddSoundAction(itemStack, soundName)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddSoundAction extends OneWayAction { + private final IItemStack itemStack; + private final String soundName; + + public AddSoundAction(IItemStack itemStack, String soundName) { + this.itemStack = itemStack; + this.soundName = soundName; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addSonictronSound( + MineTweakerMC.getItemStack(itemStack), + soundName); + } + + @Override + public String describe() { + return "Adding sonictron sound " + soundName; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + (this.itemStack != null ? this.itemStack.hashCode() : 0); + hash = 79 * hash + (this.soundName != null ? this.soundName.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddSoundAction other = (AddSoundAction) obj; + if (this.itemStack != other.itemStack && (this.itemStack == null || !this.itemStack.equals(other.itemStack))) { + return false; + } + if ((this.soundName == null) ? (other.soundName != null) : !this.soundName.equals(other.soundName)) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java new file mode 100644 index 0000000..c92f222 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java @@ -0,0 +1,96 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Vacuum Freezer recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.VacuumFreezer") +@ModOnly(MOD_ID) +public class VacuumFreezer { + /** + * Adds a vacuum freezer recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks freezing duration, in ticks + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input; + private final int duration; + + public AddRecipeAction(IItemStack output, IItemStack input, int duration) { + this.output = output; + this.input = input; + this.duration = duration; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addVacuumFreezerRecipe( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(output), + duration); + } + + @Override + public String describe() { + return "Adding vacuum freezer recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 67 * hash + this.duration; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java new file mode 100644 index 0000000..18e2059 --- /dev/null +++ b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java @@ -0,0 +1,104 @@ +package minetweaker.mods.gregtech.machines; + +import gregtech.api.GregTech_API; +import static gregtech.api.GregTech_API.MOD_ID; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the Wiremill recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.gregtech.Wiremill") +@ModOnly(MOD_ID) +public class Wiremill { + /** + * Adds a Wiremill recipe. + * + * @param output recipe output + * @param input recipe input + * @param durationTicks processing time + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); + } + + // ###################### + // ### Action classes ### + // ###################### + + private static class AddRecipeAction extends OneWayAction { + private final IItemStack output; + private final IItemStack input; + private final int duration; + private final int euPerTick; + + public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { + this.output = output; + this.input = input; + this.duration = duration; + this.euPerTick = euPerTick; + } + + @Override + public void apply() { + GregTech_API.sRecipeAdder.addWiremillRecipe( + MineTweakerMC.getItemStack(input), + MineTweakerMC.getItemStack(output), + duration, + euPerTick); + } + + @Override + public String describe() { + return "Adding wiremill recipe for " + output; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 37 * hash + (this.output != null ? this.output.hashCode() : 0); + hash = 37 * hash + (this.input != null ? this.input.hashCode() : 0); + hash = 37 * hash + this.duration; + hash = 37 * hash + this.euPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddRecipeAction other = (AddRecipeAction) obj; + if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { + return false; + } + if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { + return false; + } + if (this.duration != other.duration) { + return false; + } + if (this.euPerTick != other.euPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java index 646735f..24bd1a6 100644 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java +++ b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java @@ -60,7 +60,7 @@ public class Compressor { public static IItemStack getOutput( @NotNull IItemStack input) { RecipeOutput output = Recipes.compressor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) { + if (output == null || output.items.isEmpty()) { System.out.println("No output"); return null; } diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java index 90b71cb..f83590a 100644 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java +++ b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java @@ -65,7 +65,7 @@ public class Extractor { public static IItemStack getOutput( @NotNull IItemStack input) { RecipeOutput output = Recipes.extractor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } } diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java index 772baee..d985d16 100644 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java +++ b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java @@ -60,7 +60,7 @@ public class Macerator { public static IItemStack getOutput( @NotNull IItemStack input) { RecipeOutput output = Recipes.macerator.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } } diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java index 6bb83c2..774f081 100644 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java +++ b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java @@ -52,7 +52,7 @@ public class MetalFormer { @ZenMethod public static IItemStack getExtrudingOutput(IItemStack input) { RecipeOutput output = Recipes.metalformerExtruding.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } @@ -81,7 +81,7 @@ public class MetalFormer { @ZenMethod public static IItemStack getRollingOutput(IItemStack input) { RecipeOutput output = Recipes.metalformerRolling.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } /** @@ -109,7 +109,7 @@ public class MetalFormer { @ZenMethod public static IItemStack getCuttingOutput(IItemStack input) { RecipeOutput output = Recipes.metalformerCutting.getOutputFor(getItemStack(input), false); - if (output == null || output.items.size() > 0) return null; + if (output == null || output.items.isEmpty()) return null; return getIItemStack(output.items.get(0)); } } diff --git a/MineTweaker3-Web/index.html b/MineTweaker3-Web/index.html index 89d799f..e966c71 100644 --- a/MineTweaker3-Web/index.html +++ b/MineTweaker3-Web/index.html @@ -95,9 +95,9 @@