Thermal Expansion support

This commit is contained in:
Jared 2017-07-20 20:53:58 +02:00
parent 3134119637
commit 4c7e599bf3
7 changed files with 532 additions and 0 deletions

View file

@ -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;
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}