- 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

-9
View File
@@ -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
}*/
@@ -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")
@@ -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;
@@ -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;
@@ -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;
@@ -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;
}
}
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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",
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
}
@@ -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));
}
}
@@ -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));
}
}
@@ -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));
}
}
@@ -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;
}
@@ -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));
}
}
@@ -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));
}
}
@@ -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));
}
}
@@ -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 {
@@ -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)
@@ -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;
}
}
}
@@ -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;
}
@@ -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));
}
}
@@ -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));
}
}
@@ -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));
}
}
+3 -3
View File
@@ -95,9 +95,9 @@
</div>
<div class="col-md-4">
<h2>Downloads</h2>
<p><a href="/download/MineTweaker3-1.6.4-3.0.3.jar"><i class="glyphicon glyphicon-download-alt"></i> 1.6.4 - 3.0.3</a></p>
<p><a href="/download/MineTweaker3-1.7.2-3.0.3.jar"><i class="glyphicon glyphicon-download-alt"></i> 1.7.2 - 3.0.3</a></p>
<p><a href="/download/MineTweaker3-1.7.10-3.0.3B.jar"><i class="glyphicon glyphicon-download-alt"></i> 1.7.10 - 3.0.3B</a></p>
<p><a href="/download/MineTweaker3-1.6.4-3.0.4.jar"><i class="glyphicon glyphicon-download-alt"></i> 1.6.4 - 3.0.4</a></p>
<p><a href="/download/MineTweaker3-1.7.2-3.0.4.jar"><i class="glyphicon glyphicon-download-alt"></i> 1.7.2 - 3.0.4</a></p>
<p><a href="/download/MineTweaker3-1.7.10-3.0.4.jar"><i class="glyphicon glyphicon-download-alt"></i> 1.7.10 - 3.0.4</a></p>
</div>
<div class="col-md-4">
<h2>GitHub</h2>
+3 -1
View File
@@ -43,12 +43,14 @@ task assembleMC172(type: Jar, dependsOn: [\
':MineTweaker3-API:build',
':MineTweaker3-MC172-Main:build',
':MineTweaker3-MC172-Mod-IC2:build',
':MineTweaker3-MC172-Mod-NEI:build']) {
':MineTweaker3-MC172-Mod-NEI:build',
':MineTweaker3-MC172-Mod-GregTech:build']) {
from zipTree(project(":ZenScript").jar.archivePath)
from zipTree(project(':MineTweaker3-API').jar.archivePath)
from zipTree(project(':MineTweaker3-MC172-Main').jar.archivePath)
from zipTree(project(':MineTweaker3-MC172-Mod-IC2').jar.archivePath)
from zipTree(project(':MineTweaker3-MC172-Mod-NEI').jar.archivePath)
from zipTree(project(':MineTweaker3-MC172-Mod-GregTech').jar.archivePath)
}
task assembleMC164(type: Jar, dependsOn: [\
@@ -7,6 +7,7 @@
package stanhebben.zenscript.docs;
import com.sun.javadoc.MethodDoc;
import com.sun.javadoc.Type;
import java.util.HashMap;
import java.util.Map;
import static stanhebben.zenscript.docs.ZenOperatorDocType.*;
@@ -20,31 +21,49 @@ public class ZenOperatorDoc {
static {
TYPES = new HashMap<String, ZenOperatorDocType>();
TYPES.put("stanhebben.zenscript.annotations.OperatorType.ADD", ADD);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.SUB", SUB);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MUL", MUL);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.DIV", DIV);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MOD", MOD);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.CAT", CAT);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.OR", OR);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.AND", AND);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.XOR", XOR);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.NEG", NEG);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.NOT", NOT);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.INDEXSET", INDEXSET);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.INDEXGET", INDEXGET);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.RANGE", RANGE);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.CONTAINS", CONTAINS);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.COMPARE", COMPARE);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MEMBERGETTER", MEMBERGETTER);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.MEMBERSETTER", MEMBERSETTER);
TYPES.put("stanhebben.zenscript.annotations.OperatorType.EQUALS", EQUALS);
}
private final String operator;
private final MethodDoc method;
private final Type[] types;
public ZenOperatorDoc(String operator, MethodDoc method) {
public ZenOperatorDoc(String operator, MethodDoc method, Type[] types) {
this.operator = operator;
this.method = method;
this.types = types;
}
public String getOperator() {
return operator;
}
public Type[] getTypes() {
return types;
}
public ZenOperatorDocType getOperatorType() {
return TYPES.get(operator);
}
public MethodDoc getMethod() {
return method;
}
@@ -6,8 +6,6 @@ package stanhebben.zenscript.docs;
* and open the template in the editor.
*/
import com.sun.javadoc.AnnotationDesc;
import com.sun.javadoc.ClassDoc;
import com.sun.javadoc.DocErrorReporter;
@@ -306,7 +304,11 @@ public class ZenScriptDoclet extends Standard {
}
} else if (fullName.equals("stanhebben.zenscript.annotations.ZenOperator")) {
String operator = annotation.elementValues()[0].value().value().toString();
operators.add(new ZenOperatorDoc(operator, method));
Type[] parameterTypes = new Type[method.parameters().length];
for (int i = 0; i < method.parameters().length; i++) {
parameterTypes[i] = method.parameters()[i].type();
}
operators.add(new ZenOperatorDoc(operator, method, parameterTypes));
} else if (fullName.equals("stanhebben.zenscript.annotations.ZenCaster")) {
casters.add(new ZenCasterDoc(method));
}
@@ -408,7 +410,11 @@ public class ZenScriptDoclet extends Standard {
}
} else if (fullName.equals("stanhebben.zenscript.annotations.ZenOperator")) {
String operator = annotation.elementValues()[0].value().value().toString();
operators.add(new ZenOperatorDoc(operator, method));
Type[] parameterTypes = new Type[method.parameters().length - 1];
for (int i = 1; i < method.parameters().length; i++) {
parameterTypes[i - 1] = method.parameters()[i].type();
}
operators.add(new ZenOperatorDoc(operator, method, parameterTypes));
} else if (fullName.equals("stanhebben.zenscript.annotations.ZenCaster")) {
casters.add(new ZenCasterDoc(method));
}
@@ -578,7 +584,7 @@ public class ZenScriptDoclet extends Standard {
if (!operators.isEmpty()) {
writer.append("<div class=\"panel panel-info panel-memberlist\">");
writer.append("<div class=\"panel-heading\">Casters</div>");
writer.append("<div class=\"panel-heading\">Operators</div>");
writer.append("<div class=\"panel-body\">");
writer.append("<table class=\"table table-properties table-bordered\"><tbody>");
@@ -589,8 +595,12 @@ public class ZenScriptDoclet extends Standard {
/*writer.append("as <a href=\"#property-staticvalue\">");
outputTypeRaw(writer, caster.getMethod().returnType(), classesByJavaName);
writer.append("</a></div>");*/
writer.append(operator.getOperator());
String[] types = new String[operator.getTypes().length];
for (int i = 0; i < types.length; i++) {
types[i] = outputTypeString(operator.getTypes()[i], classesByJavaName, baseUrl);
}
writer.append(operator.getOperatorType().fill(types));
String[] comment = StringUtil.splitParagraphs(operator.getMethod().commentText());
if (comment.length > 0) {
@@ -788,6 +798,36 @@ public class ZenScriptDoclet extends Standard {
output.append(type.dimension());
}
private static String outputTypeString(Type type, Map<String, ZenClassDoc> javaClasses, String baseUrl) throws IOException {
StringBuilder result = new StringBuilder();
if (javaClasses.containsKey(type.qualifiedTypeName())) {
ZenClassDoc doc = javaClasses.get(type.qualifiedTypeName());
result.append("<a href=\"");
result.append(makeLink(doc.getName(), baseUrl));
result.append("\">");
result.append(doc.getName().substring(doc.getName().lastIndexOf('.') + 1));
result.append("</a>");
} else if (type.qualifiedTypeName().equals("java.util.List")) {
Type base = type.asParameterizedType().typeArguments()[0];
result.append(outputTypeString(base, javaClasses, baseUrl));
result.append("[]");
} else if (type.qualifiedTypeName().equals("java.util.Map")) {
Type key = type.asParameterizedType().typeArguments()[0];
Type value = type.asParameterizedType().typeArguments()[1];
result.append(outputTypeString(value, javaClasses, baseUrl));
result.append('[');
result.append(outputTypeString(key, javaClasses, baseUrl));
result.append(']');
} else if (type.qualifiedTypeName().equals("java.lang.String")) {
result.append("string");
} else {
result.append(type.qualifiedTypeName());
}
result.append(type.dimension());
return result.toString();
}
private static void outputTypeRaw(Writer output, Type type, Map<String, ZenClassDoc> javaClasses) throws IOException {
if (javaClasses.containsKey(type.qualifiedTypeName())) {
ZenClassDoc doc = javaClasses.get(type.qualifiedTypeName());