From 5f0ac9729aa3568b0987c373dfa862bc4bc7e1bc Mon Sep 17 00:00:00 2001 From: Jared Date: Fri, 20 Jul 2018 01:25:38 +0200 Subject: [PATCH] Added dynamo support, Close #656 --- .../dynamos/CompressionDynamo.java | 71 ++++++++++ .../dynamos/EnervationDynamo.java | 71 ++++++++++ .../dynamos/MagmaticDynamo.java | 71 ++++++++++ .../dynamos/NumisticDynamo.java | 122 ++++++++++++++++ .../dynamos/ReactantDynamo.java | 131 ++++++++++++++++++ .../thermalexpansion/dynamos/SteamDynamo.java | 71 ++++++++++ 6 files changed, 537 insertions(+) create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/dynamos/CompressionDynamo.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/dynamos/EnervationDynamo.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/dynamos/MagmaticDynamo.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/dynamos/NumisticDynamo.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/dynamos/ReactantDynamo.java create mode 100644 src/main/java/com/blamejared/compat/thermalexpansion/dynamos/SteamDynamo.java diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/CompressionDynamo.java b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/CompressionDynamo.java new file mode 100644 index 0000000..1fcf7fe --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/CompressionDynamo.java @@ -0,0 +1,71 @@ +package com.blamejared.compat.thermalexpansion.dynamos; + +import cofh.thermalexpansion.util.managers.dynamo.CompressionManager; +import com.blamejared.ModTweaker; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseAction; +import crafttweaker.annotations.*; +import crafttweaker.api.liquid.ILiquidStack; +import net.minecraftforge.fluids.FluidStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.CompressionDynamo") +@ModOnly("thermalexpansion") +@ZenRegister +public class CompressionDynamo { + + @ZenMethod + public static void addFuel(ILiquidStack stack, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toFluid(stack), energy)); + } + + @ZenMethod + public static void removeFuel(ILiquidStack stack) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toFluid(stack))); + } + + + private static class Add extends BaseAction { + + private FluidStack stack; + private int energy; + + protected Add(FluidStack stack, int energy) { + super("CompressionDynamo"); + this.stack = stack; + this.energy = energy; + } + + @Override + public void apply() { + CompressionManager.addFuel(stack.getFluid().getName(), energy); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + private static class Remove extends BaseAction { + + private FluidStack stack; + + protected Remove(FluidStack stack) { + super("CompressionDynamo"); + this.stack = stack; + } + + @Override + public void apply() { + CompressionManager.removeFuel(stack.getFluid().getName()); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/EnervationDynamo.java b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/EnervationDynamo.java new file mode 100644 index 0000000..6f81e87 --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/EnervationDynamo.java @@ -0,0 +1,71 @@ +package com.blamejared.compat.thermalexpansion.dynamos; + +import cofh.thermalexpansion.util.managers.dynamo.EnervationManager; +import com.blamejared.ModTweaker; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseAction; +import crafttweaker.annotations.*; +import crafttweaker.api.item.IItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.EnervationDynamo") +@ModOnly("thermalexpansion") +@ZenRegister +public class EnervationDynamo { + + @ZenMethod + public static void addFuel(IItemStack stack, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(stack), energy)); + } + + @ZenMethod + public static void removeFuel(IItemStack stack) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(stack))); + } + + + private static class Add extends BaseAction { + + private ItemStack stack; + private int energy; + + protected Add(ItemStack stack, int energy) { + super("EnervationDynamo"); + this.stack = stack; + this.energy = energy; + } + + @Override + public void apply() { + EnervationManager.addFuel(stack, energy); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + private static class Remove extends BaseAction { + + private ItemStack stack; + + protected Remove(ItemStack stack) { + super("EnervationDynamo"); + this.stack = stack; + } + + @Override + public void apply() { + EnervationManager.removeFuel(stack); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/MagmaticDynamo.java b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/MagmaticDynamo.java new file mode 100644 index 0000000..06a019a --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/MagmaticDynamo.java @@ -0,0 +1,71 @@ +package com.blamejared.compat.thermalexpansion.dynamos; + +import cofh.thermalexpansion.util.managers.dynamo.*; +import com.blamejared.ModTweaker; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseAction; +import crafttweaker.annotations.*; +import crafttweaker.api.liquid.ILiquidStack; +import net.minecraftforge.fluids.FluidStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.MagmaticDynamo") +@ModOnly("thermalexpansion") +@ZenRegister +public class MagmaticDynamo { + + @ZenMethod + public static void addFuel(ILiquidStack stack, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toFluid(stack), energy)); + } + + @ZenMethod + public static void removeFuel(ILiquidStack stack) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toFluid(stack))); + } + + + private static class Add extends BaseAction { + + private FluidStack stack; + private int energy; + + protected Add(FluidStack stack, int energy) { + super("MagmaticDynamo"); + this.stack = stack; + this.energy = energy; + } + + @Override + public void apply() { + MagmaticManager.addFuel(stack.getFluid().getName(), energy); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + private static class Remove extends BaseAction { + + private FluidStack stack; + + protected Remove(FluidStack stack) { + super("MagmaticDynamo"); + this.stack = stack; + } + + @Override + public void apply() { + MagmaticManager.removeFuel(stack.getFluid().getName()); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/NumisticDynamo.java b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/NumisticDynamo.java new file mode 100644 index 0000000..af9edb9 --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/NumisticDynamo.java @@ -0,0 +1,122 @@ +package com.blamejared.compat.thermalexpansion.dynamos; + +import cofh.thermalexpansion.util.managers.dynamo.NumismaticManager; +import com.blamejared.ModTweaker; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseAction; +import crafttweaker.annotations.*; +import crafttweaker.api.item.IItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.NumisticDynamo") +@ModOnly("thermalexpansion") +@ZenRegister +public class NumisticDynamo { + + @ZenMethod + public static void addFuel(IItemStack stack, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(stack), energy)); + } + + @ZenMethod + public static void removeFuel(IItemStack stack) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(stack))); + } + + @ZenMethod + public static void addGemFuel(IItemStack stack, int energy) { + ModTweaker.LATE_ADDITIONS.add(new AddGem(InputHelper.toStack(stack), energy)); + } + + @ZenMethod + public static void removeGemFuel(IItemStack stack) { + ModTweaker.LATE_REMOVALS.add(new RemoveGem(InputHelper.toStack(stack))); + } + + + private static class Add extends BaseAction { + + private ItemStack stack; + private int energy; + + protected Add(ItemStack stack, int energy) { + super("NumisticDynamo"); + this.stack = stack; + this.energy = energy; + } + + @Override + public void apply() { + NumismaticManager.addFuel(stack, energy); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + private static class Remove extends BaseAction { + + private ItemStack stack; + + protected Remove(ItemStack stack) { + super("NumisticDynamo"); + this.stack = stack; + } + + @Override + public void apply() { + NumismaticManager.removeFuel(stack); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + private static class AddGem extends BaseAction { + + private ItemStack stack; + private int energy; + + protected AddGem(ItemStack stack, int energy) { + super("NumisticDynamoGem"); + this.stack = stack; + this.energy = energy; + } + + @Override + public void apply() { + NumismaticManager.addGemFuel(stack, energy); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + private static class RemoveGem extends BaseAction { + + private ItemStack stack; + + protected RemoveGem(ItemStack stack) { + super("NumisticDynamoGem"); + this.stack = stack; + } + + @Override + public void apply() { + NumismaticManager.removeGemFuel(stack); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/ReactantDynamo.java b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/ReactantDynamo.java new file mode 100644 index 0000000..37e91f5 --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/ReactantDynamo.java @@ -0,0 +1,131 @@ +package com.blamejared.compat.thermalexpansion.dynamos; + +import cofh.thermalexpansion.util.managers.dynamo.ReactantManager; +import com.blamejared.ModTweaker; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseAction; +import crafttweaker.annotations.*; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.liquid.ILiquidStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.ReactantDynamo") +@ModOnly("thermalexpansion") +@ZenRegister +public class ReactantDynamo { + + @ZenMethod + public static void addReaction(IItemStack stack, ILiquidStack fluid, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(stack), InputHelper.toFluid(fluid).getFluid(), energy)); + } + + @ZenMethod + public static void addReactionElemental(IItemStack stack, ILiquidStack fluid, int energy) { + ModTweaker.LATE_ADDITIONS.add(new AddElemental(InputHelper.toStack(stack), InputHelper.toFluid(fluid).getFluid(), energy)); + } + + @ZenMethod + public static void removeReaction(IItemStack stack, ILiquidStack fluid) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(stack), InputHelper.toFluid(fluid).getFluid())); + } + + @ZenMethod + public static void removeReactionElemental(IItemStack stack, ILiquidStack fluid) { + ModTweaker.LATE_REMOVALS.add(new RemoveElemental(InputHelper.toStack(stack), InputHelper.toFluid(fluid).getFluid())); + } + + private static class Add extends BaseAction { + + private ItemStack stack; + private Fluid fluid; + private int energy; + + protected Add(ItemStack stack, Fluid fluid, int energy) { + super("ReactantDynamo"); + this.stack = stack; + this.fluid = fluid; + this.energy = energy; + } + + @Override + public void apply() { + ReactantManager.addReaction(stack, fluid, energy); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack) + " " + LogHelper.getStackDescription(fluid); + } + } + + private static class Remove extends BaseAction { + + private ItemStack stack; + private Fluid fluid; + + protected Remove(ItemStack stack, Fluid fluid) { + super("ReactantDynamo"); + this.stack = stack; + this.fluid = fluid; + } + + @Override + public void apply() { + ReactantManager.removeReaction(stack, fluid); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack) + " " + LogHelper.getStackDescription(fluid); + } + } + + private static class AddElemental extends BaseAction { + + private ItemStack stack; + private Fluid fluid; + private int energy; + + protected AddElemental(ItemStack stack, Fluid fluid, int energy) { + super("ReactantDynamoElemental"); + this.stack = stack; + this.fluid = fluid; + this.energy = energy; + } + + @Override + public void apply() { + ReactantManager.addElementalReaction(stack, fluid, energy); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack) + " " + LogHelper.getStackDescription(fluid); + } + } + + private static class RemoveElemental extends BaseAction { + + private ItemStack stack; + private Fluid fluid; + + protected RemoveElemental(ItemStack stack, Fluid fluid) { + super("ReactantDynamo"); + this.stack = stack; + this.fluid = fluid; + } + + @Override + public void apply() { + ReactantManager.removeElementalReaction(stack, fluid); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack) + " " + LogHelper.getStackDescription(fluid); + } + } + +} diff --git a/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/SteamDynamo.java b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/SteamDynamo.java new file mode 100644 index 0000000..6f51a51 --- /dev/null +++ b/src/main/java/com/blamejared/compat/thermalexpansion/dynamos/SteamDynamo.java @@ -0,0 +1,71 @@ +package com.blamejared.compat.thermalexpansion.dynamos; + +import cofh.thermalexpansion.util.managers.dynamo.SteamManager; +import com.blamejared.ModTweaker; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.BaseAction; +import crafttweaker.annotations.*; +import crafttweaker.api.item.IItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.*; + +@ZenClass("mods.thermalexpansion.SteamDynamo") +@ModOnly("thermalexpansion") +@ZenRegister +public class SteamDynamo { + + @ZenMethod + public static void addFuel(IItemStack stack, int energy) { + ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(stack), energy)); + } + + @ZenMethod + public static void removeFuel(IItemStack stack) { + ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(stack))); + } + + + private static class Add extends BaseAction { + + private ItemStack stack; + private int energy; + + protected Add(ItemStack stack, int energy) { + super("SteamDynamo"); + this.stack = stack; + this.energy = energy; + } + + @Override + public void apply() { + SteamManager.addFuel(stack, energy); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + private static class Remove extends BaseAction { + + private ItemStack stack; + + protected Remove(ItemStack stack) { + super("SteamDynamo"); + this.stack = stack; + } + + @Override + public void apply() { + SteamManager.removeFuel(stack); + } + + @Override + protected String getRecipeInfo() { + return LogHelper.getStackDescription(stack); + } + } + + +}