mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-28 07:35:40 +00:00
- Added GregTech support for 1.6.4
- Fixed comparisons for item stacks. This is a major fix, as it enables stuck recipes to be recognized and ignored if they are unchanged upon reload.
This commit is contained in:
1 parent
fc8bf619e1
commit
3283664f4b
38 files changed
+2745
-28
No files matched your search
@@ -33,6 +33,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft item stack
|
||||
*/
|
||||
public static ItemStack getItemStack(IItemStack item) {
|
||||
if (item == null) return null;
|
||||
|
||||
Object internal = item.getInternal();
|
||||
if (internal == null || !(internal instanceof ItemStack)) {
|
||||
MineTweakerAPI.logError("Not a valid item stack: " + item);
|
||||
@@ -48,6 +50,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft item stack
|
||||
*/
|
||||
public static ItemStack getItemStack(IIngredient ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
|
||||
List<IItemStack> items = ingredient.getItems();
|
||||
if (items.size() != 1) {
|
||||
MineTweakerAPI.logError("Not an ingredient with a single item: " + ingredient);
|
||||
@@ -63,6 +67,7 @@ public class MineTweakerMC {
|
||||
*/
|
||||
public static IItemStack getIItemStack(ItemStack item) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(item);
|
||||
}
|
||||
|
||||
@@ -73,6 +78,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker stack
|
||||
*/
|
||||
public static IItemStack getIItemStackWildcardSize(ItemStack item) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(item, true);
|
||||
}
|
||||
|
||||
@@ -84,6 +91,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker stack
|
||||
*/
|
||||
public static IItemStack getIItemStackWildcardSize(Item item, int meta) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(new ItemStack(item, 1, meta), true);
|
||||
}
|
||||
|
||||
@@ -95,6 +104,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stack
|
||||
*/
|
||||
public static IItemStack getIItemStackWildcard(Item item, int amount) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
|
||||
@@ -107,6 +118,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stack
|
||||
*/
|
||||
public static IItemStack getItemStack(Item item, int amount, int damage) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(new ItemStack(item, amount, damage));
|
||||
}
|
||||
|
||||
@@ -118,6 +131,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft item stacks
|
||||
*/
|
||||
public static ItemStack[] getItemStacks(IItemStack... items) {
|
||||
if (items == null) return null;
|
||||
|
||||
ItemStack[] output = new ItemStack[items.length];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
Object internal = items[i].getInternal();
|
||||
@@ -136,6 +151,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft items
|
||||
*/
|
||||
public static ItemStack[] getItemStacks(List<IItemStack> items) {
|
||||
if (items == null) return null;
|
||||
|
||||
ItemStack[] output = new ItemStack[items.size()];
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
Object internal = items.get(i).getInternal();
|
||||
@@ -156,6 +173,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stacks
|
||||
*/
|
||||
public static IItemStack[] getIItemStacks(ItemStack... items) {
|
||||
if (items == null) return null;
|
||||
|
||||
IItemStack[] result = new IItemStack[items.length];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
result[i] = new MCItemStack(items[i]);
|
||||
@@ -171,6 +190,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stacks
|
||||
*/
|
||||
public static IItemStack[] getIItemStacks(List<ItemStack> items) {
|
||||
if (items == null) return null;
|
||||
|
||||
IItemStack[] result = new IItemStack[items.size()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = new MCItemStack(items.get(i));
|
||||
@@ -196,6 +217,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker player
|
||||
*/
|
||||
public static IPlayer getIPlayer(EntityPlayer player) {
|
||||
if (player == null) return null;
|
||||
|
||||
return new MCPlayer(player);
|
||||
}
|
||||
|
||||
@@ -206,6 +229,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft player
|
||||
*/
|
||||
public static EntityPlayer getPlayer(IPlayer player) {
|
||||
if (player == null) return null;
|
||||
|
||||
if (!(player instanceof MCPlayer)) {
|
||||
MineTweakerAPI.logError("Invalid player: " + player);
|
||||
}
|
||||
@@ -221,6 +246,8 @@ public class MineTweakerMC {
|
||||
* @return IData value
|
||||
*/
|
||||
public static IData getIData(NBTBase nbt) {
|
||||
if (nbt == null) return null;
|
||||
|
||||
return NBTConverter.from(nbt, true);
|
||||
}
|
||||
|
||||
@@ -231,6 +258,8 @@ public class MineTweakerMC {
|
||||
* @return mutable IData value
|
||||
*/
|
||||
public static IData getIDataModifyable(NBTBase nbt) {
|
||||
if (nbt == null) return null;
|
||||
|
||||
return NBTConverter.from(nbt, false);
|
||||
}
|
||||
|
||||
@@ -241,6 +270,8 @@ public class MineTweakerMC {
|
||||
* @return nbt data
|
||||
*/
|
||||
public static NBTBase getNBT(IData data) {
|
||||
if (data == null) return null;
|
||||
|
||||
return NBTConverter.from(data);
|
||||
}
|
||||
|
||||
@@ -251,6 +282,8 @@ public class MineTweakerMC {
|
||||
* @return nbt compound data
|
||||
*/
|
||||
public static NBTTagCompound getNBTCompound(IData data) {
|
||||
if (data == null) return null;
|
||||
|
||||
return (NBTTagCompound) NBTConverter.from(data);
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,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"
|
||||
};
|
||||
|
||||
@Mod.Instance(MODID)
|
||||
|
||||
@@ -253,7 +253,10 @@ public class MCItemStack implements IItemStack {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 41 * hash + (this.stack != null ? this.stack.hashCode() : 0);
|
||||
hash = 41 * hash + stack.itemID;
|
||||
hash = 41 * hash + stack.getItemDamage();
|
||||
hash = 41 * hash + stack.stackSize;
|
||||
hash = 41 * hash + (stack.stackTagCompound == null ? 0 : stack.stackTagCompound.hashCode());
|
||||
hash = 41 * hash + (this.wildcardSize ? 1 : 0);
|
||||
return hash;
|
||||
}
|
||||
@@ -267,12 +270,11 @@ public class MCItemStack implements IItemStack {
|
||||
return false;
|
||||
}
|
||||
final MCItemStack other = (MCItemStack) obj;
|
||||
if (this.stack != other.stack && (this.stack == null || !this.stack.equals(other.stack))) {
|
||||
return false;
|
||||
}
|
||||
if (this.wildcardSize != other.wildcardSize) {
|
||||
return false;
|
||||
}
|
||||
if (this.stack.itemID != other.stack.itemID) return false;
|
||||
if (this.stack.getItemDamage() != other.stack.getItemDamage()) return false;
|
||||
if (this.stack.stackSize != other.stack.stackSize) return false;
|
||||
if (this.stack.stackTagCompound != other.stack.stackTagCompound && (this.stack == null || this.stack.equals(other.stack))) return false;
|
||||
if (this.wildcardSize != other.wildcardSize) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.0-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'forge'
|
||||
minecraft{version = "1.6.4-9.11.1.964"}
|
||||
version = "1.0"
|
||||
archivesBaseName = project.projectDir.name
|
||||
|
||||
dependencies {
|
||||
compile project(':ZenScript')
|
||||
compile project(':MineTweaker3-API')
|
||||
compile project(':MineTweaker3-MC164-Main')
|
||||
compile files('libs/gregtechmod408s.jar')
|
||||
}
|
||||
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
inputDir = file('build/classes/main')
|
||||
outputDir = file('build/classes/main')
|
||||
className = 'minetweaker.mods.gregtech.ClassRegistry'
|
||||
}
|
||||
|
||||
tasks.jar.dependsOn(makeRegistry)
|
||||
Binary file not shown.
Binary file not shown.
+103
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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;
|
||||
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.AlloySmelter")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class AlloySmelter {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, duration, euPerTick));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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;
|
||||
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.Assembler")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Assembler {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, duration, euPerTick));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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;
|
||||
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.BlastFurnace")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class BlastFurnace {
|
||||
@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));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int duration, 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));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("mods.gregtech.Canner")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Canner {
|
||||
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 duration, 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));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("mods.gregtech.Centrifuge")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Centrifuge {
|
||||
public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int duration) {
|
||||
if (outputs.length < 1) {
|
||||
MineTweakerAPI.logError("centrifuge must have at least 1 output");
|
||||
} else {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, duration));
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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;
|
||||
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.ChemicalReactor")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class ChemicalReactor {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int duration) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, duration));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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;
|
||||
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.ComputerCube")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class ComputerCube {
|
||||
@ZenMethod
|
||||
public static void addDescriptionSet(IItemStack[] items, String[] text) {
|
||||
MineTweakerAPI.apply(new AddDescriptionAction(items, text));
|
||||
}
|
||||
|
||||
private static class AddDescriptionAction extends OneWayAction {
|
||||
private final IItemStack[] items;
|
||||
private final String[] text;
|
||||
|
||||
public AddDescriptionAction(IItemStack[] items, String[] text) {
|
||||
this.items = items;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
GregTech_API.sRecipeAdder.addComputercubeDescriptionSet(MineTweakerMC.getItemStacks(items), text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding computer cube descriptions";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 11 * hash + Arrays.deepHashCode(this.items);
|
||||
hash = 11 * hash + Arrays.deepHashCode(this.text);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AddDescriptionAction other = (AddDescriptionAction) obj;
|
||||
if (!Arrays.deepEquals(this.items, other.items)) {
|
||||
return false;
|
||||
}
|
||||
if (!Arrays.deepEquals(this.text, other.text)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 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;
|
||||
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.DistillationTower")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class DistillationTower {
|
||||
@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));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int duration, 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));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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;
|
||||
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.Electrolyzer")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Electrolyzer {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int duration, 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));
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("mods.gregtech.Extruder")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Extruder {
|
||||
public static void addRecipe(IItemStack output, IItemStack input, IItemStack shape, int duration, int euPerTick) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, shape, duration, euPerTick));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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;
|
||||
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.ForgeHammer")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class ForgeHammer {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, duration, euPerTick));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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;
|
||||
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.Fuels")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Fuels {
|
||||
@ZenMethod
|
||||
public static void addDieselFuel(IItemStack output, IItemStack input, int euPerMillibucket) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 0));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addGasTurbineFuel(IItemStack output, IItemStack input, int euPerMillibucket) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 1));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addThermalGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 2));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addDenseFluidFuel(IItemStack output, IItemStack input, int euPerMillibucket) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 3));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addPlasmaGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 4));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addMagicGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 5));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* 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;
|
||||
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.FusionReactor")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class FusionReactor {
|
||||
@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));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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;
|
||||
import gregtechmod.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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("mods.gregtech.Grinder")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Grinder {
|
||||
@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));
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 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;
|
||||
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.ImplosionCompressor")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class ImplosionCompressor {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int tnt) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, null, input, tnt));
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.OneWayAction;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("mods.gregtech.JackHammer")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class JackHammer {
|
||||
@ZenMethod
|
||||
public static void addMinableBlock(IItemStack item) {
|
||||
Block block = getBlock(item);
|
||||
if (block == null) {
|
||||
MineTweakerAPI.logError("Not a block: " + item);
|
||||
} else {
|
||||
MineTweakerAPI.apply(new AddBlockAction(block, false));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addDiamondMinableBlock(IItemStack item) {
|
||||
Block block = getBlock(item);
|
||||
if (block == null) {
|
||||
MineTweakerAPI.logError("Not a block: " + item);
|
||||
} else {
|
||||
MineTweakerAPI.apply(new AddBlockAction(block, true));
|
||||
}
|
||||
}
|
||||
|
||||
private static Block getBlock(IItemStack item) {
|
||||
ItemStack itemStack = MineTweakerMC.getItemStack(item);
|
||||
return itemStack.itemID > Block.blocksList.length ? null : Block.blocksList[itemStack.itemID];
|
||||
}
|
||||
|
||||
private static class AddBlockAction extends OneWayAction {
|
||||
private final Block block;
|
||||
private final boolean diamondOnly;
|
||||
|
||||
public AddBlockAction(Block block, boolean diamondOnly) {
|
||||
this.block = block;
|
||||
this.diamondOnly = diamondOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
GregTech_API.sRecipeAdder.addJackHammerMinableBlock(block, diamondOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding jackhammer mineable block " + block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 83 * hash + (this.block != null ? this.block.hashCode() : 0);
|
||||
hash = 83 * hash + (this.diamondOnly ? 1 : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AddBlockAction other = (AddBlockAction) obj;
|
||||
if (this.block != other.block) {
|
||||
return false;
|
||||
}
|
||||
if (this.diamondOnly != other.diamondOnly) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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;
|
||||
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.Lathe")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Lathe {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, null, input, duration, euPerTick));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack[] outputs, IItemStack input, int duration, 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,
|
||||
duration,
|
||||
euPerTick));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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;
|
||||
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.PlateBender")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class PlateBender {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, duration, euPerTick));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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;
|
||||
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.PlateCutter")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class PlateCutter {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, duration, euPerTick));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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;
|
||||
import gregtechmod.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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("mods.gregtech.Sawmill")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Sawmill {
|
||||
@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));
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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;
|
||||
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.Sonictron")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Sonictron {
|
||||
@ZenMethod
|
||||
public static void addSound(IItemStack itemStack, String soundName) {
|
||||
MineTweakerAPI.apply(new AddSoundAction(itemStack, soundName));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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;
|
||||
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.VacuumFreezer")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class VacuumFreezer {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int duration) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, duration));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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;
|
||||
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.Wiremill")
|
||||
@ModOnly("gregtech_addon")
|
||||
public class Wiremill {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int duration, int euPerTick) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(output, input, duration, euPerTick));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package minetweaker.mods.nei;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.NotNull;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.OneWayAction;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
||||
|
||||
/**
|
||||
* MineTweaker NEI support.
|
||||
*
|
||||
* Enables hiding NEI items as well as adding new item stacks. These item stacks
|
||||
* can then show a custom message or contain NBT data. Can be used to show
|
||||
* a custom message or lore with certain items, or to provide spawnable items
|
||||
* with specific NBT tags.
|
||||
*
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.nei.NEI")
|
||||
@ModOnly("NotEnoughItems")
|
||||
public class NEI {
|
||||
/**
|
||||
* Hides a specific item in NEI. Will take into account metadata values, if
|
||||
* any.
|
||||
*
|
||||
* @param item item to be hidden
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void hide(@NotNull IItemStack item) {
|
||||
MineTweakerAPI.apply(new NEIHideItemAction(getItemStack(item)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a NEI entry. The item stack can contain damage values and NBT tags.
|
||||
*
|
||||
* @param stack item stack to be added
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addEntry(@NotNull IItemStack stack) {
|
||||
MineTweakerAPI.apply(new NEIAddEntryAction(getItemStack(stack)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides a name in NEI. Note that this will not change the original
|
||||
* display name, but it will change the way it is displayed in NEI.
|
||||
*
|
||||
* @param item item
|
||||
* @param name item name
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void overrideName(@NotNull IItemStack item, @NotNull String name) {
|
||||
MineTweakerAPI.apply(new NEIOverrideNameAction(getItemStack(item), name));
|
||||
}
|
||||
|
||||
// #############################
|
||||
// ### Private inner classes ###
|
||||
// #############################
|
||||
|
||||
private static class NEIAddEntryAction implements IUndoableAction {
|
||||
private final ItemStack item;
|
||||
|
||||
public NEIAddEntryAction(ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
API.addNBTItem(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
API.hideItem(item.itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding " + item.getDisplayName() + " as NEI entry";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing " + item.getDisplayName() + " as NEI entry";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class NEIHideItemAction implements IUndoableAction {
|
||||
private final ItemStack stack;
|
||||
|
||||
public NEIHideItemAction(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
API.hideItem(stack.itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
API.addNBTItem(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Hiding " + stack.getUnlocalizedName() + " in NEI";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Displaying " + stack.getUnlocalizedName() + " in NEI";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class NEIOverrideNameAction extends OneWayAction {
|
||||
private final ItemStack item;
|
||||
private final String name;
|
||||
|
||||
public NEIOverrideNameAction(ItemStack item, String name) {
|
||||
this.item = item;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
API.setOverrideName(item.itemID, item.getItemDamage(), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Overriding NEI item name of " + item.getUnlocalizedName() + " to " + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ dependencies {
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
inputDir = file('build/classes/main')
|
||||
outputDir = file('build/classes/main')
|
||||
className = 'minetweaker.mc172.MineTweakerRegistry'
|
||||
className = 'minetweaker.mc1710.MineTweakerRegistry'
|
||||
}
|
||||
|
||||
tasks.jar.dependsOn(makeRegistry)
|
||||
|
||||
@@ -33,6 +33,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft item stack
|
||||
*/
|
||||
public static ItemStack getItemStack(IItemStack item) {
|
||||
if (item == null) return null;
|
||||
|
||||
Object internal = item.getInternal();
|
||||
if (internal == null || !(internal instanceof ItemStack)) {
|
||||
MineTweakerAPI.logError("Not a valid item stack: " + item);
|
||||
@@ -48,6 +50,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft item stack
|
||||
*/
|
||||
public static ItemStack getItemStack(IIngredient ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
|
||||
List<IItemStack> items = ingredient.getItems();
|
||||
if (items.size() != 1) {
|
||||
MineTweakerAPI.logError("Not an ingredient with a single item: " + ingredient);
|
||||
@@ -63,6 +67,7 @@ public class MineTweakerMC {
|
||||
*/
|
||||
public static IItemStack getIItemStack(ItemStack item) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(item);
|
||||
}
|
||||
|
||||
@@ -73,6 +78,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker stack
|
||||
*/
|
||||
public static IItemStack getIItemStackWildcardSize(ItemStack item) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(item, true);
|
||||
}
|
||||
|
||||
@@ -84,6 +91,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker stack
|
||||
*/
|
||||
public static IItemStack getIItemStackWildcardSize(Item item, int meta) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(new ItemStack(item, 1, meta), true);
|
||||
}
|
||||
|
||||
@@ -95,6 +104,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stack
|
||||
*/
|
||||
public static IItemStack getIItemStackWildcard(Item item, int amount) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
|
||||
@@ -107,6 +118,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stack
|
||||
*/
|
||||
public static IItemStack getItemStack(Item item, int amount, int damage) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(new ItemStack(item, amount, damage));
|
||||
}
|
||||
|
||||
@@ -118,6 +131,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft item stacks
|
||||
*/
|
||||
public static ItemStack[] getItemStacks(IItemStack... items) {
|
||||
if (items == null) return null;
|
||||
|
||||
ItemStack[] output = new ItemStack[items.length];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
Object internal = items[i].getInternal();
|
||||
@@ -136,6 +151,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft items
|
||||
*/
|
||||
public static ItemStack[] getItemStacks(List<IItemStack> items) {
|
||||
if (items == null) return null;
|
||||
|
||||
ItemStack[] output = new ItemStack[items.size()];
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
Object internal = items.get(i).getInternal();
|
||||
@@ -156,6 +173,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stacks
|
||||
*/
|
||||
public static IItemStack[] getIItemStacks(ItemStack... items) {
|
||||
if (items == null) return null;
|
||||
|
||||
IItemStack[] result = new IItemStack[items.length];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
result[i] = new MCItemStack(items[i]);
|
||||
@@ -171,6 +190,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stacks
|
||||
*/
|
||||
public static IItemStack[] getIItemStacks(List<ItemStack> items) {
|
||||
if (items == null) return null;
|
||||
|
||||
IItemStack[] result = new IItemStack[items.size()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = new MCItemStack(items.get(i));
|
||||
@@ -196,6 +217,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker player
|
||||
*/
|
||||
public static IPlayer getIPlayer(EntityPlayer player) {
|
||||
if (player == null) return null;
|
||||
|
||||
return new MCPlayer(player);
|
||||
}
|
||||
|
||||
@@ -206,6 +229,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft player
|
||||
*/
|
||||
public static EntityPlayer getPlayer(IPlayer player) {
|
||||
if (player == null) return null;
|
||||
|
||||
if (!(player instanceof MCPlayer)) {
|
||||
MineTweakerAPI.logError("Invalid player: " + player);
|
||||
}
|
||||
@@ -221,6 +246,8 @@ public class MineTweakerMC {
|
||||
* @return IData value
|
||||
*/
|
||||
public static IData getIData(NBTBase nbt) {
|
||||
if (nbt == null) return null;
|
||||
|
||||
return NBTConverter.from(nbt, true);
|
||||
}
|
||||
|
||||
@@ -231,6 +258,8 @@ public class MineTweakerMC {
|
||||
* @return mutable IData value
|
||||
*/
|
||||
public static IData getIDataModifyable(NBTBase nbt) {
|
||||
if (nbt == null) return null;
|
||||
|
||||
return NBTConverter.from(nbt, false);
|
||||
}
|
||||
|
||||
@@ -241,6 +270,8 @@ public class MineTweakerMC {
|
||||
* @return nbt data
|
||||
*/
|
||||
public static NBTBase getNBT(IData data) {
|
||||
if (data == null) return null;
|
||||
|
||||
return NBTConverter.from(data);
|
||||
}
|
||||
|
||||
@@ -251,6 +282,8 @@ public class MineTweakerMC {
|
||||
* @return nbt compound data
|
||||
*/
|
||||
public static NBTTagCompound getNBTCompound(IData data) {
|
||||
if (data == null) return null;
|
||||
|
||||
return (NBTTagCompound) NBTConverter.from(data);
|
||||
}
|
||||
}
|
||||
@@ -252,7 +252,10 @@ public class MCItemStack implements IItemStack {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 41 * hash + (this.stack != null ? this.stack.hashCode() : 0);
|
||||
hash = 41 * hash + stack.getItem().hashCode();
|
||||
hash = 41 * hash + stack.getItemDamage();
|
||||
hash = 41 * hash + stack.stackSize;
|
||||
hash = 41 * hash + (stack.stackTagCompound == null ? 0 : stack.stackTagCompound.hashCode());
|
||||
hash = 41 * hash + (this.wildcardSize ? 1 : 0);
|
||||
return hash;
|
||||
}
|
||||
@@ -266,12 +269,11 @@ public class MCItemStack implements IItemStack {
|
||||
return false;
|
||||
}
|
||||
final MCItemStack other = (MCItemStack) obj;
|
||||
if (this.stack != other.stack && (this.stack == null || !this.stack.equals(other.stack))) {
|
||||
return false;
|
||||
}
|
||||
if (this.wildcardSize != other.wildcardSize) {
|
||||
return false;
|
||||
}
|
||||
if (this.stack.getItem() != other.stack.getItem()) return false;
|
||||
if (this.stack.getItemDamage() != other.stack.getItemDamage()) return false;
|
||||
if (this.stack.stackSize != other.stack.stackSize) return false;
|
||||
if (this.stack.stackTagCompound != other.stack.stackTagCompound && (this.stack == null || this.stack.equals(other.stack))) return false;
|
||||
if (this.wildcardSize != other.wildcardSize) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft item stack
|
||||
*/
|
||||
public static ItemStack getItemStack(IItemStack item) {
|
||||
if (item == null) return null;
|
||||
|
||||
Object internal = item.getInternal();
|
||||
if (internal == null || !(internal instanceof ItemStack)) {
|
||||
MineTweakerAPI.logError("Not a valid item stack: " + item);
|
||||
@@ -48,6 +50,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft item stack
|
||||
*/
|
||||
public static ItemStack getItemStack(IIngredient ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
|
||||
List<IItemStack> items = ingredient.getItems();
|
||||
if (items.size() != 1) {
|
||||
MineTweakerAPI.logError("Not an ingredient with a single item: " + ingredient);
|
||||
@@ -64,6 +68,7 @@ public class MineTweakerMC {
|
||||
*/
|
||||
public static IItemStack getIItemStack(ItemStack item) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(item);
|
||||
}
|
||||
|
||||
@@ -74,6 +79,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker stack
|
||||
*/
|
||||
public static IItemStack getIItemStackWildcardSize(ItemStack item) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(item, true);
|
||||
}
|
||||
|
||||
@@ -85,6 +92,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker stack
|
||||
*/
|
||||
public static IItemStack getIItemStackWildcardSize(Item item, int meta) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(new ItemStack(item, 1, meta), true);
|
||||
}
|
||||
|
||||
@@ -96,6 +105,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stack
|
||||
*/
|
||||
public static IItemStack getIItemStackWildcard(Item item, int amount) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
|
||||
@@ -108,6 +119,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stack
|
||||
*/
|
||||
public static IItemStack getItemStack(Item item, int amount, int damage) {
|
||||
if (item == null) return null;
|
||||
|
||||
return new MCItemStack(new ItemStack(item, amount, damage));
|
||||
}
|
||||
|
||||
@@ -119,6 +132,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft item stacks
|
||||
*/
|
||||
public static ItemStack[] getItemStacks(IItemStack... items) {
|
||||
if (items == null) return null;
|
||||
|
||||
ItemStack[] output = new ItemStack[items.length];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
Object internal = items[i].getInternal();
|
||||
@@ -137,6 +152,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft items
|
||||
*/
|
||||
public static ItemStack[] getItemStacks(List<IItemStack> items) {
|
||||
if (items == null) return null;
|
||||
|
||||
ItemStack[] output = new ItemStack[items.size()];
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
Object internal = items.get(i).getInternal();
|
||||
@@ -157,6 +174,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stacks
|
||||
*/
|
||||
public static IItemStack[] getIItemStacks(ItemStack... items) {
|
||||
if (items == null) return null;
|
||||
|
||||
IItemStack[] result = new IItemStack[items.length];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
result[i] = new MCItemStack(items[i]);
|
||||
@@ -172,6 +191,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker item stacks
|
||||
*/
|
||||
public static IItemStack[] getIItemStacks(List<ItemStack> items) {
|
||||
if (items == null) return null;
|
||||
|
||||
IItemStack[] result = new IItemStack[items.size()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = new MCItemStack(items.get(i));
|
||||
@@ -197,6 +218,8 @@ public class MineTweakerMC {
|
||||
* @return minetweaker player
|
||||
*/
|
||||
public static IPlayer getIPlayer(EntityPlayer player) {
|
||||
if (player == null) return null;
|
||||
|
||||
return new MCPlayer(player);
|
||||
}
|
||||
|
||||
@@ -207,6 +230,8 @@ public class MineTweakerMC {
|
||||
* @return minecraft player
|
||||
*/
|
||||
public static EntityPlayer getPlayer(IPlayer player) {
|
||||
if (player == null) return null;
|
||||
|
||||
if (!(player instanceof MCPlayer)) {
|
||||
MineTweakerAPI.logError("Invalid player: " + player);
|
||||
}
|
||||
@@ -222,6 +247,8 @@ public class MineTweakerMC {
|
||||
* @return IData value
|
||||
*/
|
||||
public static IData getIData(NBTBase nbt) {
|
||||
if (nbt == null) return null;
|
||||
|
||||
return NBTConverter.from(nbt, true);
|
||||
}
|
||||
|
||||
@@ -232,6 +259,8 @@ public class MineTweakerMC {
|
||||
* @return mutable IData value
|
||||
*/
|
||||
public static IData getIDataModifyable(NBTBase nbt) {
|
||||
if (nbt == null) return null;
|
||||
|
||||
return NBTConverter.from(nbt, false);
|
||||
}
|
||||
|
||||
@@ -242,6 +271,8 @@ public class MineTweakerMC {
|
||||
* @return nbt data
|
||||
*/
|
||||
public static NBTBase getNBT(IData data) {
|
||||
if (data == null) return null;
|
||||
|
||||
return NBTConverter.from(data);
|
||||
}
|
||||
|
||||
@@ -252,6 +283,8 @@ public class MineTweakerMC {
|
||||
* @return nbt compound data
|
||||
*/
|
||||
public static NBTTagCompound getNBTCompound(IData data) {
|
||||
if (data == null) return null;
|
||||
|
||||
return (NBTTagCompound) NBTConverter.from(data);
|
||||
}
|
||||
}
|
||||
@@ -252,7 +252,10 @@ public class MCItemStack implements IItemStack {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 41 * hash + (this.stack != null ? this.stack.hashCode() : 0);
|
||||
hash = 41 * hash + stack.getItem().hashCode();
|
||||
hash = 41 * hash + stack.getItemDamage();
|
||||
hash = 41 * hash + stack.stackSize;
|
||||
hash = 41 * hash + (stack.stackTagCompound == null ? 0 : stack.stackTagCompound.hashCode());
|
||||
hash = 41 * hash + (this.wildcardSize ? 1 : 0);
|
||||
return hash;
|
||||
}
|
||||
@@ -266,12 +269,11 @@ public class MCItemStack implements IItemStack {
|
||||
return false;
|
||||
}
|
||||
final MCItemStack other = (MCItemStack) obj;
|
||||
if (this.stack != other.stack && (this.stack == null || !this.stack.equals(other.stack))) {
|
||||
return false;
|
||||
}
|
||||
if (this.wildcardSize != other.wildcardSize) {
|
||||
return false;
|
||||
}
|
||||
if (this.stack.getItem() != other.stack.getItem()) return false;
|
||||
if (this.stack.getItemDamage() != other.stack.getItemDamage()) return false;
|
||||
if (this.stack.stackSize != other.stack.stackSize) return false;
|
||||
if (this.stack.stackTagCompound != other.stack.stackTagCompound && (this.stack == null || this.stack.equals(other.stack))) return false;
|
||||
if (this.wildcardSize != other.wildcardSize) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,9 +95,9 @@
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>Downloads</h2>
|
||||
<p><a href="/download/MineTweaker3-1.6.4-3.0.2.jar"><i class="glyphicon glyphicon-download-alt"></i> 1.6.4 - 3.0.2</a></p>
|
||||
<p><a href="/download/MineTweaker3-1.7.2-3.0.2.jar"><i class="glyphicon glyphicon-download-alt"></i> 1.7.2 - 3.0.2</a></p>
|
||||
<p><a href="/download/MineTweaker3-1.7.10-3.0.2.jar"><i class="glyphicon glyphicon-download-alt"></i> 1.7.10 - 3.0.2</a></p>
|
||||
<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>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>GitHub</h2>
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ZenTypeDouble extends ZenType {
|
||||
|
||||
@Override
|
||||
public boolean canCastImplicit(ZenType type, IEnvironmentGlobal environment) {
|
||||
return (type.getNumberType() != 0 && type.getNumberType() == NUM_DOUBLE)
|
||||
return (type.getNumberType() != 0 && type.getNumberType() >= NUM_FLOAT)
|
||||
|| type == STRING
|
||||
|| canCastExpansion(environment, type);
|
||||
}
|
||||
|
||||
+3
-1
@@ -56,10 +56,12 @@ task assembleMC164(type: Jar, dependsOn: [\
|
||||
':MineTweaker3-API:build',
|
||||
':MineTweaker3-MC164-Main:build',
|
||||
':MineTweaker3-MC164-Mod-IC2:build',
|
||||
':MineTweaker3-MC164-Mod-NEI:build']) {
|
||||
':MineTweaker3-MC164-Mod-NEI:build',
|
||||
':MineTweaker3-MC164-Mod-GregTech:build']) {
|
||||
from zipTree(project(":ZenScript").jar.archivePath)
|
||||
from zipTree(project(':MineTweaker3-API').jar.archivePath)
|
||||
from zipTree(project(':MineTweaker3-MC164-Main').jar.archivePath)
|
||||
from zipTree(project(':MineTweaker3-MC164-Mod-IC2').jar.archivePath)
|
||||
from zipTree(project(':MineTweaker3-MC164-Mod-NEI').jar.archivePath)
|
||||
from zipTree(project(':MineTweaker3-MC164-Mod-GregTech').jar.archivePath)
|
||||
}
|
||||
Reference in new issue
Block a user