From 4c7e599bf38164a972c61dfacec1d97cfd0f526c Mon Sep 17 00:00:00 2001 From: Jared Date: Thu, 20 Jul 2017 20:53:58 +0200 Subject: [PATCH] Thermal Expansion support --- .../compat/thermalexpansion/Compactor.java | 92 +++++++++++++++++++ .../compat/thermalexpansion/Crucible.java | 71 ++++++++++++++ .../thermalexpansion/InductionSmelter.java | 76 +++++++++++++++ .../compat/thermalexpansion/Insolator.java | 75 +++++++++++++++ .../compat/thermalexpansion/Pulverizer.java | 73 +++++++++++++++ .../compat/thermalexpansion/Refinery.java | 72 +++++++++++++++ .../compat/thermalexpansion/SawMill.java | 73 +++++++++++++++ 7 files changed, 532 insertions(+) create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/Compactor.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/Crucible.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/InductionSmelter.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/Insolator.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/Pulverizer.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/Refinery.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/SawMill.java diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/Compactor.java b/src/main/java/com/blamejared/compat/thermalexpansion/Compactor.java new file mode 100644 index 0000000..075319f --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/Compactor.java @@ -0,0 +1,92 @@ +package com.blamejared.compat.thermalexpansion; + +import cofh.thermalexpansion.util.managers.machine.CompactorManager; +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.Handler; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseUndoable; +import crafttweaker.api.item.IItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.Compactor") +@Handler("thermalexpansion") +public class Compactor { + + @ZenMethod + public static void addMintRecipe(IItemStack output, IItemStack input, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(output), InputHelper.toStack(input), energy, CompactorManager.Mode.MINT)); + } + + @ZenMethod + public static void addPressRecipe(IItemStack output, IItemStack input, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(output), InputHelper.toStack(input), energy, CompactorManager.Mode.PRESS)); + } + + @ZenMethod + public static void addStorageRecipe(IItemStack output, IItemStack input, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(output), InputHelper.toStack(input), energy, CompactorManager.Mode.STORAGE)); + } + + @ZenMethod + public static void removeMintRecipe(IItemStack input) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(input), CompactorManager.Mode.MINT)); + } + + @ZenMethod + public static void removePressRecipe(IItemStack input) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(input), CompactorManager.Mode.PRESS)); + } + + @ZenMethod + public static void removeStorageRecipe(IItemStack input) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(input), CompactorManager.Mode.STORAGE)); + } + + private static class Add extends BaseUndoable { + + private ItemStack output, input; + private int energy; + private CompactorManager.Mode mode; + + public Add(ItemStack output, ItemStack input, int energy, CompactorManager.Mode mode) { + super("Compactor"); + this.output = output; + this.input = input; + this.energy = energy; + this.mode = mode; + } + + @Override + public void apply() { + CompactorManager.addRecipe(energy, input, output, mode); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(output) + " in mode: " + mode; + } + } + + private static class Remove extends BaseUndoable { + + private ItemStack input; + private CompactorManager.Mode mode; + + public Remove(ItemStack input, CompactorManager.Mode mode) { + super("Compactor"); + this.input = input; + this.mode = mode; + } + + @Override + public void apply() { + CompactorManager.removeRecipe(input, mode); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(input) + " in mode: " + mode; + } + } +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/Crucible.java b/src/main/java/com/blamejared/compat/thermalexpansion/Crucible.java new file mode 100644 index 0000000..6e70d9e --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/Crucible.java @@ -0,0 +1,71 @@ +package com.blamejared.compat.thermalexpansion; + +import cofh.thermalexpansion.util.managers.machine.*; +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.Handler; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseUndoable; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.liquid.ILiquidStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.Crucible") +@Handler("thermalexpansion") +public class Crucible { + + @ZenMethod + public static void addRecipe(ILiquidStack output, IItemStack input, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toFluid(output), InputHelper.toStack(input), energy)); + } + + @ZenMethod + public static void removeRecipe(IItemStack input) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(input))); + } + + private static class Add extends BaseUndoable { + + private FluidStack output; + private ItemStack input; + private int energy; + + public Add(FluidStack output, ItemStack input, int energy) { + super("Crucible"); + this.output = output; + this.input = input; + this.energy = energy; + } + + @Override + public void apply() { + CrucibleManager.addRecipe(energy, input, output); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(output); + } + } + + private static class Remove extends BaseUndoable { + + private ItemStack input; + + public Remove(ItemStack input) { + super("Crucible"); + this.input = input; + } + + @Override + public void apply() { + CrucibleManager.removeRecipe(input); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(input); + } + } +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/InductionSmelter.java b/src/main/java/com/blamejared/compat/thermalexpansion/InductionSmelter.java new file mode 100644 index 0000000..869833c --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/InductionSmelter.java @@ -0,0 +1,76 @@ +package com.blamejared.compat.thermalexpansion; + +import cofh.thermalexpansion.util.managers.machine.*; +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.Handler; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseUndoable; +import crafttweaker.api.item.IItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.*; +import stanhebben.zenscript.parser.expression.ParsedExpression; + +@ZenClass("mods.thermalexpansion.InductionSmelter") +@Handler("thermalexpansion") +public class InductionSmelter { + + @ZenMethod + public static void addRecipe(IItemStack primaryOutput, IItemStack primaryInput, IItemStack secondaryInput, int energy, @Optional IItemStack secondaryOutput, @Optional int secondaryChance) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(primaryOutput), InputHelper.toStack(primaryInput), InputHelper.toStack(secondaryInput), energy, InputHelper.toStack(secondaryOutput), secondaryChance)); + } + + @ZenMethod + public static void removeRecipe(IItemStack primaryInput, IItemStack secondaryInput) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(primaryInput), InputHelper.toStack(secondaryInput))); + } + + private static class Add extends BaseUndoable { + + private ItemStack primaryOutput, primaryInput, secondaryInput, secondaryOutput; + private int energy, secondaryChance; + + public Add(ItemStack primaryOutput, ItemStack primaryInput, ItemStack secondaryInput, int energy, ItemStack secondaryOutput, int secondaryChance) { + super("InductionSmelter"); + this.primaryOutput = primaryOutput; + this.primaryInput = primaryInput; + this.secondaryInput = secondaryInput; + this.secondaryOutput = secondaryOutput; + this.energy = energy; + this.secondaryChance = secondaryChance; + if(!secondaryOutput.isEmpty() && secondaryChance <= 0) { + this.secondaryChance = 100; + } + } + + @Override + public void apply() { + SmelterManager.addRecipe(energy, primaryInput, secondaryInput, primaryOutput, secondaryOutput, secondaryChance); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(primaryOutput); + } + } + + private static class Remove extends BaseUndoable { + + private ItemStack primaryInput, secondaryInput; + + public Remove(ItemStack primaryInput, ItemStack secondaryInput) { + super("InductionSmelter"); + this.primaryInput = primaryInput; + this.secondaryInput = secondaryInput; + } + + @Override + public void apply() { + SmelterManager.removeRecipe(primaryInput, secondaryInput); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(primaryInput) + " and " + LogHelper.getStackDescription(secondaryInput); + } + } +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/Insolator.java b/src/main/java/com/blamejared/compat/thermalexpansion/Insolator.java new file mode 100644 index 0000000..a79b3d7 --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/Insolator.java @@ -0,0 +1,75 @@ +package com.blamejared.compat.thermalexpansion; + +import cofh.thermalexpansion.util.managers.machine.*; +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.Handler; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseUndoable; +import crafttweaker.api.item.IItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.Insolator") +@Handler("thermalexpansion") +public class Insolator { + + @ZenMethod + public static void addRecipe(IItemStack primaryOutput, IItemStack primaryInput, IItemStack secondaryInput, int energy, @Optional IItemStack secondaryOutput, @Optional int secondaryChance) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(primaryOutput), InputHelper.toStack(primaryInput), InputHelper.toStack(secondaryInput), energy, InputHelper.toStack(secondaryOutput), secondaryChance)); + } + + @ZenMethod + public static void removeRecipe(IItemStack primaryInput, IItemStack secondaryInput) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(primaryInput), InputHelper.toStack(secondaryInput))); + } + + private static class Add extends BaseUndoable { + + private ItemStack primaryOutput, primaryInput, secondaryInput, secondaryOutput; + private int energy, secondaryChance; + + public Add(ItemStack primaryOutput, ItemStack primaryInput, ItemStack secondaryInput, int energy, ItemStack secondaryOutput, int secondaryChance) { + super("PhytogenicInsolator"); + this.primaryOutput = primaryOutput; + this.primaryInput = primaryInput; + this.secondaryInput = secondaryInput; + this.secondaryOutput = secondaryOutput; + this.energy = energy; + this.secondaryChance = secondaryChance; + if(!secondaryOutput.isEmpty() && secondaryChance <= 0) { + this.secondaryChance = 100; + } + } + + @Override + public void apply() { + InsolatorManager.addRecipe(energy, primaryInput, secondaryInput, primaryOutput, secondaryOutput, secondaryChance); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(primaryOutput); + } + } + + private static class Remove extends BaseUndoable { + + private ItemStack primaryInput, secondaryInput; + + public Remove(ItemStack primaryInput, ItemStack secondaryInput) { + super("PhytogenicInsolator"); + this.primaryInput = primaryInput; + this.secondaryInput = secondaryInput; + } + + @Override + public void apply() { + InsolatorManager.removeRecipe(primaryInput, secondaryInput); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(primaryInput) + " and " + LogHelper.getStackDescription(secondaryInput); + } + } +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/Pulverizer.java b/src/main/java/com/blamejared/compat/thermalexpansion/Pulverizer.java new file mode 100644 index 0000000..2f44804 --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/Pulverizer.java @@ -0,0 +1,73 @@ +package com.blamejared.compat.thermalexpansion; + +import cofh.thermalexpansion.util.managers.machine.*; +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.Handler; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseUndoable; +import crafttweaker.api.item.IItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.Pulverizer") +@Handler("thermalexpansion") +public class Pulverizer { + + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int energy, @Optional IItemStack secondaryOutput, @Optional int secondaryChance) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(output), InputHelper.toStack(input), energy, InputHelper.toStack(secondaryOutput), secondaryChance)); + } + + @ZenMethod + public static void removeRecipe(IItemStack input) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(input))); + } + + private static class Add extends BaseUndoable { + + private ItemStack output, input, secondaryOutput; + private int energy, secondaryChance; + + public Add(ItemStack output, ItemStack input, int energy, ItemStack secondaryOutput, int secondaryChance) { + super("Pulverizer"); + this.output = output; + this.input = input; + this.secondaryOutput = secondaryOutput; + this.energy = energy; + this.secondaryChance = secondaryChance; + if(!secondaryOutput.isEmpty() && secondaryChance <= 0) { + this.secondaryChance = 100; + } + } + + @Override + public void apply() { + PulverizerManager.addRecipe(energy, input, output, secondaryOutput, secondaryChance); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(output); + } + } + + private static class Remove extends BaseUndoable { + + private ItemStack input; + + public Remove(ItemStack input) { + super("Pulverizer"); + this.input = input; + } + + @Override + public void apply() { + PulverizerManager.removeRecipe(input); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(input); + } + } +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/Refinery.java b/src/main/java/com/blamejared/compat/thermalexpansion/Refinery.java new file mode 100644 index 0000000..e594091 --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/Refinery.java @@ -0,0 +1,72 @@ +package com.blamejared.compat.thermalexpansion; + +import cofh.thermalexpansion.util.managers.machine.*; +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.Handler; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseUndoable; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.liquid.ILiquidStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.Refinery") +@Handler("thermalexpansion") +public class Refinery { + + @ZenMethod + public static void addRecipe(ILiquidStack output, IItemStack outputItem, ILiquidStack input, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toFluid(output), InputHelper.toFluid(input), InputHelper.toStack(outputItem), energy)); + } + + @ZenMethod + public static void removeRecipe(ILiquidStack input) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toFluid(input))); + } + + private static class Add extends BaseUndoable { + + private FluidStack output, input; + private ItemStack outputItem; + private int energy; + + public Add(FluidStack output, FluidStack input, ItemStack outputItem, int energy) { + super("Refinery"); + this.output = output; + this.input = input; + this.outputItem = outputItem; + this.energy = energy; + } + + @Override + public void apply() { + RefineryManager.addRecipe(energy, input, output, outputItem); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(output); + } + } + + private static class Remove extends BaseUndoable { + + private FluidStack input; + + public Remove(FluidStack input) { + super("Refinery"); + this.input = input; + } + + @Override + public void apply() { + RefineryManager.removeRecipe(input); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(input); + } + } +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/SawMill.java b/src/main/java/com/blamejared/compat/thermalexpansion/SawMill.java new file mode 100644 index 0000000..0d73272 --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/SawMill.java @@ -0,0 +1,73 @@ +package com.blamejared.compat.thermalexpansion; + +import cofh.thermalexpansion.util.managers.machine.SawmillManager; +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.Handler; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseUndoable; +import crafttweaker.api.item.IItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.Sawmill") +@Handler("thermalexpansion") +public class SawMill { + + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int energy, @Optional IItemStack secondaryOutput, @Optional int secondaryChance) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(output), InputHelper.toStack(input), energy, InputHelper.toStack(secondaryOutput), secondaryChance)); + } + + @ZenMethod + public static void removeRecipe(IItemStack input) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(input))); + } + + private static class Add extends BaseUndoable { + + private ItemStack output, input, secondaryOutput; + private int energy, secondaryChance; + + public Add(ItemStack output, ItemStack input, int energy, ItemStack secondaryOutput, int secondaryChance) { + super("Sawmill"); + this.output = output; + this.input = input; + this.secondaryOutput = secondaryOutput; + this.energy = energy; + this.secondaryChance = secondaryChance; + if(!secondaryOutput.isEmpty() && secondaryChance <= 0) { + this.secondaryChance = 100; + } + } + + @Override + public void apply() { + SawmillManager.addRecipe(energy, input, output, secondaryOutput, secondaryChance); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(output); + } + } + + private static class Remove extends BaseUndoable { + + private ItemStack input; + + public Remove(ItemStack input) { + super("Sawmill"); + this.input = input; + } + + @Override + public void apply() { + SawmillManager.removeRecipe(input); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(input); + } + } +}