- Fixed IC2 derps when checking if output is empty

- Added GregTech 1.7.2 support
- Added doc comments to the GregTech classes
- Fixed a couple GregTech functions
This commit is contained in:
Stan Hebben committed 2014-07-09 22:50:15 +02:00
1 parent 7390f94404
commit 52f92dcfd4
70 files changed
+3649 -270

No files matched your search

@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}
@@ -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;
}
}
}