diff --git a/MineTweaker3-MC1710-Mod-IC2/build.gradle b/MineTweaker3-MC1710-Mod-IC2/build.gradle index c7beddf..59ff741 100644 --- a/MineTweaker3-MC1710-Mod-IC2/build.gradle +++ b/MineTweaker3-MC1710-Mod-IC2/build.gradle @@ -30,7 +30,7 @@ dependencies { compile project(':ZenScript') compile project(':MineTweaker3-API') compile project(':MineTweaker3-MC1710-Main') - compile files('libs/industrialcraft-2-2.2.491-experimental-api.jar') + compile files('libs/industrialcraft-2-2.2.756-experimental-api.jar') } task makeRegistry(type: RegisterZenClassesTask) { diff --git a/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.491-experimental-api.jar b/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.491-experimental-api.jar deleted file mode 100644 index e638b56..0000000 Binary files a/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.491-experimental-api.jar and /dev/null differ diff --git a/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.756-experimental-api.jar b/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.756-experimental-api.jar new file mode 100644 index 0000000..d579f0e Binary files /dev/null and b/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.756-experimental-api.jar differ diff --git a/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.491-experimental-dev.jar b/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.756-experimental-dev.jar similarity index 59% rename from MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.491-experimental-dev.jar rename to MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.756-experimental-dev.jar index 6b11947..f5f9880 100644 Binary files a/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.491-experimental-dev.jar and b/MineTweaker3-MC1710-Mod-IC2/libs/industrialcraft-2-2.2.756-experimental-dev.jar differ diff --git a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/BlastFurnace.java b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/BlastFurnace.java new file mode 100644 index 0000000..ce6b8a6 --- /dev/null +++ b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/BlastFurnace.java @@ -0,0 +1,71 @@ +/* + * 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.ic2.machines; + +import ic2.api.recipe.RecipeOutput; +import ic2.api.recipe.Recipes; +import minetweaker.MineTweakerAPI; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; +import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; +import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; +import minetweaker.mods.ic2.IC2RecipeInput; +import minetweaker.mods.ic2.MachineAddRecipeAction; +import stanhebben.zenscript.annotations.NotNull; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the IC2 Blast Furnace recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.ic2.BlastFurnace") +@ModOnly("IC2") +public class BlastFurnace { + /** + * Adds a new recipe to the blast furnace. + * + * The recipe input can be any pattern, as long as the stack size is determined. + * The output can be any item stack. + * + * @param output recipe output + * @param ingredient recipe input + */ + @ZenMethod + public static void addRecipe( + @NotNull IItemStack output, + @NotNull IIngredient ingredient) { + if (ingredient.getAmount() < 0) { + MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); + } else { + MineTweakerAPI.apply(new MachineAddRecipeAction( + "blast furnace", + Recipes.blastfurance, + getItemStacks(output), + null, + new IC2RecipeInput(ingredient))); + } + } + + /** + * Determines the recipe output for the given input. Will return the output + * of a single item, even if the stack contains multiple items. + * + * @param input recipe input + * @return recipe output + */ + @ZenMethod + public static IItemStack getOutput( + @NotNull IItemStack input) { + RecipeOutput output = Recipes.blastfurance.getOutputFor(getItemStack(input), false); + if (output == null || output.items.isEmpty()) return null; + return getIItemStack(output.items.get(0)); + } +} diff --git a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/BlockCutter.java b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/BlockCutter.java new file mode 100644 index 0000000..06231fd --- /dev/null +++ b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/BlockCutter.java @@ -0,0 +1,71 @@ +/* + * 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.ic2.machines; + +import ic2.api.recipe.RecipeOutput; +import ic2.api.recipe.Recipes; +import minetweaker.MineTweakerAPI; +import minetweaker.annotations.ModOnly; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; +import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; +import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; +import minetweaker.mods.ic2.IC2RecipeInput; +import minetweaker.mods.ic2.MachineAddRecipeAction; +import stanhebben.zenscript.annotations.NotNull; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Provides access to the IC2 Block Cutter recipes. + * + * @author Stan Hebben + */ +@ZenClass("mods.ic2.BlockCutter") +@ModOnly("IC2") +public class BlockCutter { + /** + * Adds a new recipe to the block cutter. + * + * The recipe input can be any pattern, as long as the stack size is determined. + * The output can be any item stack. + * + * @param output recipe output + * @param ingredient recipe input + */ + @ZenMethod + public static void addRecipe( + @NotNull IItemStack output, + @NotNull IIngredient ingredient) { + if (ingredient.getAmount() < 0) { + MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); + } else { + MineTweakerAPI.apply(new MachineAddRecipeAction( + "block cutter", + Recipes.blockcutter, + getItemStacks(output), + null, + new IC2RecipeInput(ingredient))); + } + } + + /** + * Determines the recipe output for the given input. Will return the output + * of a single item, even if the stack contains multiple items. + * + * @param input recipe input + * @return recipe output + */ + @ZenMethod + public static IItemStack getOutput( + @NotNull IItemStack input) { + RecipeOutput output = Recipes.blockcutter.getOutputFor(getItemStack(input), false); + if (output == null || output.items.isEmpty()) return null; + return getIItemStack(output.items.get(0)); + } +} diff --git a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/FluidHeatGenerator.java b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/FluidHeatGenerator.java new file mode 100644 index 0000000..e061463 --- /dev/null +++ b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/FluidHeatGenerator.java @@ -0,0 +1,91 @@ +/* + * 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.ic2.machines; + +import ic2.api.recipe.Recipes; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.annotations.ModOnly; +import minetweaker.api.liquid.ILiquidStack; +import net.minecraftforge.fluids.FluidRegistry; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +/** + * Add a fluid to the fluid heat generator + * @author Stan + */ +@ZenClass("mods.ic2.FluidHeatGenerator") +@ModOnly("IC2") +public class FluidHeatGenerator { + @ZenMethod + public static void addFluid(ILiquidStack liquidPerTick, int heatPerTick) { + MineTweakerAPI.apply(new AddFluidAction(liquidPerTick.getName(), liquidPerTick.getAmount(), heatPerTick)); + } + + @ZenMethod + public static boolean accepts(ILiquidStack liquid) { + return Recipes.FluidHeatGenerator.acceptsFluid(FluidRegistry.getFluid(liquid.getName())); + } + + private static class AddFluidAction extends OneWayAction { + private final String name; + private final int liquidPerTick; + private final int heatPerTick; + + public AddFluidAction(String name, int liquidPerTick, int heatPerTick) { + this.name = name; + this.liquidPerTick = liquidPerTick; + this.heatPerTick = heatPerTick; + } + + @Override + public void apply() { + Recipes.FluidHeatGenerator.addFluid(name, liquidPerTick, heatPerTick); + } + + @Override + public String describe() { + return "Adding liquid " + name + " as fluid heat generator fuel"; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0); + hash = 47 * hash + this.liquidPerTick; + hash = 47 * hash + this.heatPerTick; + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AddFluidAction other = (AddFluidAction) obj; + if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { + return false; + } + if (this.liquidPerTick != other.liquidPerTick) { + return false; + } + if (this.heatPerTick != other.heatPerTick) { + return false; + } + return true; + } + } +} diff --git a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java index c1bfe9f..348713c 100644 --- a/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java +++ b/MineTweaker3-MC1710-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java @@ -16,7 +16,7 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; /** - * + * Add a fluid to the semi-fluid generator * @author Stan */ @ZenClass("mods.ic2.SemiFluidGenerator")