mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Merge pull request #4641 from thommy101/feature-crafttweaker
This commit is contained in:
commit
c08e96c743
36 files changed
+2640
-9
No files matched your search
@@ -817,12 +817,11 @@ public class Mekanism
|
||||
{
|
||||
logger.info("Fake player readout: UUID = " + gameProfile.getId().toString() + ", name = " + gameProfile.getName());
|
||||
|
||||
OreDictManager.init();
|
||||
hooks.hook();
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new BoxBlacklistEvent());
|
||||
|
||||
OreDictManager.init();
|
||||
|
||||
logger.info("Hooking complete.");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import mekanism.common.Resource;
|
||||
import mekanism.common.block.states.BlockStateTransmitter.TransmitterType;
|
||||
import mekanism.common.integration.computer.CCPeripheral;
|
||||
import mekanism.common.integration.computer.OCDriver;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -91,6 +92,11 @@ public final class MekanismHooks
|
||||
{
|
||||
loadCCPeripheralProviders();
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("crafttweaker"))
|
||||
{
|
||||
CrafttweakerIntegration.applyRecipeChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@Method(modid = MekanismHooks.IC2_MOD_ID)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package mekanism.common.integration.crafttweaker;
|
||||
|
||||
import crafttweaker.CraftTweakerAPI;
|
||||
import crafttweaker.IAction;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class CrafttweakerIntegration
|
||||
{
|
||||
public static final List<IAction> LATE_REMOVALS = new LinkedList<>();
|
||||
public static final List<IAction> LATE_ADDITIONS = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* Apply after (machine)recipes have been applied, but before the FMLLoadCompleteEvent is fired.
|
||||
* Preferbly in (post)init.
|
||||
*
|
||||
* Applying to early causes remove to mallfunction as no recipes have been registered.
|
||||
* Applying to late causes JEI to not pickup the changes.
|
||||
*/
|
||||
public static void applyRecipeChanges()
|
||||
{
|
||||
LATE_REMOVALS.forEach(CraftTweakerAPI::apply);
|
||||
LATE_ADDITIONS.forEach(CraftTweakerAPI::apply);
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package mekanism.common.integration.crafttweaker.gas;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
|
||||
public class CraftTweakerGasDefinition implements IGasDefinition
|
||||
{
|
||||
private final Gas gas;
|
||||
|
||||
public CraftTweakerGasDefinition(Gas gas)
|
||||
{
|
||||
this.gas = gas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGasStack asStack(int millibuckets)
|
||||
{
|
||||
return new CraftTweakerGasStack(new GasStack(gas, millibuckets));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return gas.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
return gas.getLocalizedName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package mekanism.common.integration.crafttweaker.gas;
|
||||
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemCondition;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IItemTransformer;
|
||||
import crafttweaker.api.liquid.ILiquidStack;
|
||||
import crafttweaker.api.player.IPlayer;
|
||||
import mekanism.api.gas.GasStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CraftTweakerGasStack implements IGasStack
|
||||
{
|
||||
private final GasStack stack;
|
||||
|
||||
public CraftTweakerGasStack(GasStack stack)
|
||||
{
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IGasDefinition getDefinition()
|
||||
{
|
||||
return new CraftTweakerGasDefinition(stack.getGas());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return stack.getGas().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
return stack.getGas().getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMark()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount()
|
||||
{
|
||||
return stack.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IItemStack> getItems()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemStack[] getItemArray()
|
||||
{
|
||||
return new IItemStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ILiquidStack> getLiquids()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIngredient amount(int amount)
|
||||
{
|
||||
return withAmount(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIngredient or(IIngredient iIngredient)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIngredient transform(IItemTransformer iItemTransformer)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIngredient only(IItemCondition iItemCondition)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIngredient marked(String s)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(IItemStack iItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesExact(IItemStack iItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ILiquidStack iLiquidStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(IIngredient iIngredient)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemStack applyTransform(IItemStack iItemStack, IPlayer iPlayer)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTransformers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGasStack withAmount(int amount)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInternal()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "<gas:" + stack.getGas().getName() + ">";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package mekanism.common.integration.crafttweaker.gas;
|
||||
|
||||
import crafttweaker.CraftTweakerAPI;
|
||||
import crafttweaker.annotations.BracketHandler;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import crafttweaker.zenscript.IBracketHandler;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import stanhebben.zenscript.compiler.IEnvironmentGlobal;
|
||||
import stanhebben.zenscript.expression.ExpressionCallStatic;
|
||||
import stanhebben.zenscript.expression.ExpressionString;
|
||||
import stanhebben.zenscript.expression.partial.IPartialExpression;
|
||||
import stanhebben.zenscript.parser.Token;
|
||||
import stanhebben.zenscript.symbols.IZenSymbol;
|
||||
import stanhebben.zenscript.type.natives.IJavaMethod;
|
||||
import stanhebben.zenscript.util.ZenPosition;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@BracketHandler(priority = 100)
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class GasBracketHandler implements IBracketHandler
|
||||
{
|
||||
private final IZenSymbol symbolAny;
|
||||
private final IJavaMethod method;
|
||||
|
||||
public GasBracketHandler()
|
||||
{
|
||||
this.symbolAny = CraftTweakerAPI.getJavaStaticFieldSymbol(IngredientAny.class, "INSTANCE");
|
||||
this.method = CraftTweakerAPI.getJavaMethod(GasBracketHandler.class, "getGas", String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IZenSymbol resolve(IEnvironmentGlobal environment, List<Token> tokens)
|
||||
{
|
||||
if (tokens.size() == 1 && tokens.get(0).getValue().equals("*"))
|
||||
{
|
||||
return symbolAny;
|
||||
}
|
||||
|
||||
if (tokens.size() > 2)
|
||||
{
|
||||
if (tokens.get(0).getValue().equals("gas") && tokens.get(1).getValue().equals(":"))
|
||||
{
|
||||
return find(environment, tokens, 2, tokens.size());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private IZenSymbol find(IEnvironmentGlobal environment, List<Token> tokens, int startIndex, int endIndex)
|
||||
{
|
||||
StringBuilder valueBuilder = new StringBuilder();
|
||||
for (int i = startIndex; i < endIndex; i++)
|
||||
{
|
||||
Token token = tokens.get(i);
|
||||
valueBuilder.append(token.getValue());
|
||||
}
|
||||
|
||||
Gas gas = GasRegistry.getGas(valueBuilder.toString());
|
||||
if (gas != null)
|
||||
{
|
||||
return new GasReferenceSymbol(environment, valueBuilder.toString());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private class GasReferenceSymbol implements IZenSymbol
|
||||
{
|
||||
private final IEnvironmentGlobal environment;
|
||||
private final String name;
|
||||
|
||||
public GasReferenceSymbol(IEnvironmentGlobal environment, String name)
|
||||
{
|
||||
this.environment = environment;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartialExpression instance(ZenPosition zenPosition)
|
||||
{
|
||||
return new ExpressionCallStatic(zenPosition, environment, method, new ExpressionString(zenPosition, name));
|
||||
}
|
||||
}
|
||||
|
||||
public static IGasStack getGas(String name)
|
||||
{
|
||||
Gas gas = GasRegistry.getGas(name);
|
||||
if (gas != null)
|
||||
{
|
||||
return new CraftTweakerGasStack(new GasStack(gas, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package mekanism.common.integration.crafttweaker.gas;
|
||||
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import stanhebben.zenscript.annotations.OperatorType;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenOperator;
|
||||
|
||||
@ZenClass("mod.mekanism.gas.IGasDefinition")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public interface IGasDefinition
|
||||
{
|
||||
@ZenOperator(OperatorType.MUL)
|
||||
IGasStack asStack(int millibuckets);
|
||||
|
||||
@ZenGetter("NAME")
|
||||
String getName();
|
||||
|
||||
@ZenGetter("displayName")
|
||||
String getDisplayName();
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package mekanism.common.integration.crafttweaker.gas;
|
||||
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import stanhebben.zenscript.annotations.OperatorType;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import stanhebben.zenscript.annotations.ZenOperator;
|
||||
|
||||
@ZenClass("mod.mekanism.gas.IGasStack")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public interface IGasStack extends IIngredient
|
||||
{
|
||||
@ZenGetter("definition")
|
||||
IGasDefinition getDefinition();
|
||||
|
||||
@ZenGetter("NAME")
|
||||
String getName();
|
||||
|
||||
@ZenGetter("displayName")
|
||||
String getDisplayName();
|
||||
|
||||
@ZenGetter("amount")
|
||||
int getAmount();
|
||||
|
||||
@ZenOperator(OperatorType.MUL)
|
||||
@ZenMethod
|
||||
IGasStack withAmount(int amount);
|
||||
|
||||
Object getInternal();
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.GasInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.CrystallizerRecipe;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.chemical.crystallizer")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class ChemicalCrystallizer
|
||||
{
|
||||
public static final String NAME = "Mekanism Chemical Crystallizer";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IGasStack gasInput, IItemStack itemOutput)
|
||||
{
|
||||
if (gasInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
CrystallizerRecipe recipe = new CrystallizerRecipe(GasHelper.toGas(gasInput), InputHelper.toStack(itemOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.CHEMICAL_CRYSTALLIZER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient gasInput)
|
||||
{
|
||||
if (itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (gasInput == null)
|
||||
gasInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.CHEMICAL_CRYSTALLIZER.get(), itemOutput, gasInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient gasInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemOutput, IIngredient gasInput)
|
||||
{
|
||||
super(name, map);
|
||||
this.itemOutput = itemOutput;
|
||||
this.gasInput = gasInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<GasInput, CrystallizerRecipe> entry : ((Map<GasInput, CrystallizerRecipe>) RecipeHandler.Recipe.CHEMICAL_CRYSTALLIZER.get()).entrySet())
|
||||
{
|
||||
IGasStack inputGas = new CraftTweakerGasStack(entry.getKey().ingredient);
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasInput, inputGas))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, gasInput.toString(), itemOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.DissolutionRecipe;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.chemical.dissolution")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class ChemicalDissolution
|
||||
{
|
||||
public static final String NAME = "Mekanism Chemical Dissolution Chamber";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasOutput)
|
||||
{
|
||||
if (itemInput == null || gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
DissolutionRecipe recipe = new DissolutionRecipe(InputHelper.toStack(itemInput), GasHelper.toGas(gasOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient itemInput)
|
||||
{
|
||||
if (gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemInput == null)
|
||||
itemInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), gasOutput, itemInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient gasOutput;
|
||||
private IIngredient itemInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient gasOutput, IIngredient itemInput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.gasOutput = gasOutput;
|
||||
this.itemInput = itemInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<ItemStackInput, DissolutionRecipe> entry : ((Map<ItemStackInput, DissolutionRecipe>) RecipeHandler.Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient);
|
||||
IGasStack outputGas = new CraftTweakerGasStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!GasHelper.matches(gasOutput, outputGas))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, gasOutput.toString(), itemInput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.ChemicalPairInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.ChemicalInfuserRecipe;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.chemical.infuser")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class ChemicalInfuser
|
||||
{
|
||||
public static final String NAME = "Mekanism Chemical Infuser";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IGasStack leftGasInput, IGasStack rightGasInput, IGasStack gasOutput)
|
||||
{
|
||||
if (leftGasInput == null || rightGasInput == null || gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
ChemicalInfuserRecipe recipe = new ChemicalInfuserRecipe(GasHelper.toGas(leftGasInput), GasHelper.toGas(rightGasInput), GasHelper.toGas(gasOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.CHEMICAL_INFUSER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient leftGasInput, @Optional IIngredient rightGasInput)
|
||||
{
|
||||
if (gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (leftGasInput == null)
|
||||
leftGasInput = IngredientAny.INSTANCE;
|
||||
if (rightGasInput == null)
|
||||
rightGasInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.CHEMICAL_INFUSER.get(), gasOutput, leftGasInput, rightGasInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient gasOutput;
|
||||
private IIngredient leftGasInput;
|
||||
private IIngredient rightGasInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient gasOutput, IIngredient leftGasInput, IIngredient rightGasInput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.gasOutput = gasOutput;
|
||||
this.leftGasInput = leftGasInput;
|
||||
this.rightGasInput = rightGasInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<ChemicalPairInput, ChemicalInfuserRecipe> entry : ((Map<ChemicalPairInput, ChemicalInfuserRecipe>) RecipeHandler.Recipe.CHEMICAL_INFUSER.get()).entrySet())
|
||||
{
|
||||
IGasStack inputGasLeft = new CraftTweakerGasStack(entry.getKey().leftGas);
|
||||
IGasStack inputGasRight = new CraftTweakerGasStack(entry.getKey().rightGas);
|
||||
IGasStack outputGas = new CraftTweakerGasStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!GasHelper.matches(gasOutput, outputGas))
|
||||
continue;
|
||||
if (!GasHelper.matches(leftGasInput, inputGasLeft))
|
||||
continue;
|
||||
if (!GasHelper.matches(rightGasInput, inputGasRight))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", NAME, gasOutput.toString(), leftGasInput.toString(), rightGasInput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.InjectionRecipe;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@ZenClass("mods.mekanism.chemical.injection")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class ChemicalInjection
|
||||
{
|
||||
public static final String NAME = "Mekanism Chemical Injection Chamber";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || gasInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
AdvancedMachineInput input = new AdvancedMachineInput(InputHelper.toStack(itemInput), GasHelper.toGas(gasInput).getGas());
|
||||
ItemStackOutput output = new ItemStackOutput(InputHelper.toStack(itemOutput));
|
||||
|
||||
InjectionRecipe recipe = new InjectionRecipe(input, output);
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.CHEMICAL_INJECTION_CHAMBER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional IIngredient gasInput)
|
||||
{
|
||||
if (itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemInput == null)
|
||||
itemInput = IngredientAny.INSTANCE;
|
||||
if (gasInput == null)
|
||||
gasInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.CHEMICAL_INJECTION_CHAMBER.get(), itemOutput, itemInput, gasInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient itemInput;
|
||||
private IIngredient gasInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemOutput, IIngredient itemInput, IIngredient gasInput)
|
||||
{
|
||||
super(name, map);
|
||||
this.itemOutput = itemOutput;
|
||||
this.itemInput = itemInput;
|
||||
this.gasInput = gasInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<AdvancedMachineInput, InjectionRecipe> entry : ((Map<AdvancedMachineInput, InjectionRecipe>) RecipeHandler.Recipe.CHEMICAL_INJECTION_CHAMBER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().itemStack);
|
||||
IGasStack inputGas = new CraftTweakerGasStack(new GasStack(entry.getKey().gasType, 1));
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasInput, inputGas))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", NAME, itemOutput.toString(), itemInput.toString(), gasInput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.OxidationRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.chemical.oxidizer")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class ChemicalOxidizer
|
||||
{
|
||||
public static final String NAME = "Mekanism Chemical Oxidizer";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasOutput)
|
||||
{
|
||||
if (itemInput == null || gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
OxidationRecipe recipe = new OxidationRecipe(InputHelper.toStack(itemInput), GasHelper.toGas(gasOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.CHEMICAL_OXIDIZER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient itemInput)
|
||||
{
|
||||
if (gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemInput == null)
|
||||
itemInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.CHEMICAL_OXIDIZER.get(), gasOutput, itemInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient gasOutput;
|
||||
private IIngredient itemInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient gasOutput, IIngredient itemInput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.gasOutput = gasOutput;
|
||||
this.itemInput = itemInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<ItemStackInput, OxidationRecipe> entry : ((Map<ItemStackInput, OxidationRecipe>) RecipeHandler.Recipe.CHEMICAL_OXIDIZER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient);
|
||||
IGasStack outputGas = new CraftTweakerGasStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasOutput, outputGas))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, gasOutput.toString(), itemInput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.GasInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.WasherRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.chemical.washer")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class ChemicalWasher
|
||||
{
|
||||
public static final String NAME = "Mekanism Chemical Washer";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IGasStack gasInput, IGasStack gasOutput)
|
||||
{
|
||||
if (gasInput == null || gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
WasherRecipe recipe = new WasherRecipe(GasHelper.toGas(gasInput), GasHelper.toGas(gasOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.CHEMICAL_WASHER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient gasInput)
|
||||
{
|
||||
if (gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (gasInput == null)
|
||||
gasInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.CHEMICAL_WASHER.get(), gasOutput, gasInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient gasOutput;
|
||||
private IIngredient gasInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient gasOutput, IIngredient gasInput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.gasOutput = gasOutput;
|
||||
this.gasInput = gasInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<GasInput, WasherRecipe> entry : ((Map<GasInput, WasherRecipe>) RecipeHandler.Recipe.CHEMICAL_WASHER.get()).entrySet())
|
||||
{
|
||||
IGasStack inputGas = new CraftTweakerGasStack(entry.getKey().ingredient);
|
||||
IGasStack outputGas = new CraftTweakerGasStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!GasHelper.matches(gasInput, inputGas))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasOutput, outputGas))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, gasOutput.toString(), gasInput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.CombinerRecipe;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.combiner")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class Combiner
|
||||
{
|
||||
public static final String NAME = "Mekanism Combiner";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || gasInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
AdvancedMachineInput input = new AdvancedMachineInput(InputHelper.toStack(itemInput), GasHelper.toGas(gasInput).getGas());
|
||||
ItemStackOutput output = new ItemStackOutput(InputHelper.toStack(itemOutput));
|
||||
CombinerRecipe recipe = new CombinerRecipe(input, output);
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.COMBINER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
CombinerRecipe recipe = new CombinerRecipe(InputHelper.toStack(itemInput), InputHelper.toStack(itemOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.COMBINER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional IIngredient gasInput)
|
||||
{
|
||||
if (itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (gasInput == null)
|
||||
gasInput = IngredientAny.INSTANCE;
|
||||
if (itemInput == null)
|
||||
itemInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.COMBINER.get(), itemOutput, itemInput, gasInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient itemInput;
|
||||
private IIngredient gasInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemOutput, IIngredient itemInput, IIngredient gasInput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.itemOutput = itemOutput;
|
||||
this.itemInput = itemInput;
|
||||
this.gasInput = gasInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<AdvancedMachineInput, CombinerRecipe> entry : ((Map<AdvancedMachineInput, CombinerRecipe>) RecipeHandler.Recipe.COMBINER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().itemStack);
|
||||
IGasStack inputGas = new CraftTweakerGasStack(new GasStack(entry.getKey().gasType, 1));
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().getOutput().output);
|
||||
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasInput, inputGas))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", NAME, itemInput.toString(), gasInput.toString(), itemOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.OsmiumCompressorRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.compressor")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class Compressor
|
||||
{
|
||||
public static final String NAME = "Mekanism Compressor";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
OsmiumCompressorRecipe recipe = new OsmiumCompressorRecipe(InputHelper.toStack(itemInput), InputHelper.toStack(itemOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.OSMIUM_COMPRESSOR.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || gasInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
AdvancedMachineInput input = new AdvancedMachineInput(InputHelper.toStack(itemInput), GasHelper.toGas(gasInput).getGas());
|
||||
ItemStackOutput output = new ItemStackOutput(InputHelper.toStack(itemOutput));
|
||||
|
||||
OsmiumCompressorRecipe recipe = new OsmiumCompressorRecipe(input, output);
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.OSMIUM_COMPRESSOR.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional IIngredient gasInput)
|
||||
{
|
||||
if (itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemInput == null)
|
||||
itemInput = IngredientAny.INSTANCE;
|
||||
if (gasInput == null)
|
||||
gasInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.OSMIUM_COMPRESSOR.get(), itemOutput, itemInput, gasInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient itemInput;
|
||||
private IIngredient gasInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemOutput, IIngredient itemInput, IIngredient gasInput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.itemOutput = itemOutput;
|
||||
this.itemInput = itemInput;
|
||||
this.gasInput = gasInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<AdvancedMachineInput, OsmiumCompressorRecipe> entry : ((Map<AdvancedMachineInput, OsmiumCompressorRecipe>) RecipeHandler.Recipe.OSMIUM_COMPRESSOR.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().itemStack);
|
||||
IGasStack inputGas = new CraftTweakerGasStack(new GasStack(entry.getKey().gasType, 1));
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().getOutput().output);
|
||||
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasInput, inputGas))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", NAME, itemInput.toString(), gasInput.toString(), itemOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.CrusherRecipe;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.crusher")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class Crusher
|
||||
{
|
||||
public static final String NAME = "Mekanism Crusher";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
CrusherRecipe recipe = new CrusherRecipe(InputHelper.toStack(itemInput), InputHelper.toStack(itemOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.CRUSHER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput)
|
||||
{
|
||||
if (itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemInput == null)
|
||||
itemInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.CRUSHER.get(), itemOutput, itemInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient itemInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemOutput, IIngredient itemInput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.itemOutput = itemOutput;
|
||||
this.itemInput = itemInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<ItemStackInput, CrusherRecipe> entry : ((Map<ItemStackInput, CrusherRecipe>) RecipeHandler.Recipe.CRUSHER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient);
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, itemInput.toString(), itemOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.SmeltingRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.smelter")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class EnergizedSmelter
|
||||
{
|
||||
public static final String NAME = "Mekanism Smelter";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
SmeltingRecipe recipe = new SmeltingRecipe(InputHelper.toStack(itemInput), InputHelper.toStack(itemOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.ENERGIZED_SMELTER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemInput, @Optional IIngredient itemOutput)
|
||||
{
|
||||
if (itemInput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemOutput == null)
|
||||
itemOutput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.ENERGIZED_SMELTER.get(), itemInput, itemOutput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemInput;
|
||||
private IIngredient itemOutput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemInput, IIngredient itemOutput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.itemInput = itemInput;
|
||||
this.itemOutput = itemOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<ItemStackInput, SmeltingRecipe> entry : ((Map<ItemStackInput, SmeltingRecipe>) RecipeHandler.Recipe.ENERGIZED_SMELTER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient);
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, itemInput.toString(), itemOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.EnrichmentRecipe;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.enrichment")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class Enrichment
|
||||
{
|
||||
public static final String NAME = "Mekanism Enrichment Chamber";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
EnrichmentRecipe recipe = new EnrichmentRecipe(InputHelper.toStack(itemInput), InputHelper.toStack(itemOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.ENRICHMENT_CHAMBER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemInput, @Optional IIngredient itemOutput)
|
||||
{
|
||||
if (itemInput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", NAME));
|
||||
}
|
||||
|
||||
if (itemOutput == null)
|
||||
itemOutput = IngredientAny.INSTANCE;
|
||||
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.ENRICHMENT_CHAMBER.get(), itemInput, itemOutput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient itemInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemInput, IIngredient itemOutput)
|
||||
{
|
||||
super(name, map);
|
||||
this.itemOutput = itemOutput;
|
||||
this.itemInput = itemInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<ItemStackInput, EnrichmentRecipe> entry : ((Map<ItemStackInput, EnrichmentRecipe>) RecipeHandler.Recipe.ENRICHMENT_CHAMBER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient);
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, itemInput.toString(), itemOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.api.infuse.InfuseRegistry;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.InfusionInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.infuser")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class Infuser
|
||||
{
|
||||
public static final String NAME = "Mekanism Metallurgic Infuser";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(String infuseType, int infuseAmount, IItemStack itemInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || itemOutput == null || infuseType == null || infuseType.isEmpty())
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
InfusionInput input = new InfusionInput(InfuseRegistry.get(infuseType), infuseAmount, InputHelper.toStack(itemInput));
|
||||
ItemStackOutput output = new ItemStackOutput(InputHelper.toStack(itemOutput));
|
||||
|
||||
MetallurgicInfuserRecipe recipe = new MetallurgicInfuserRecipe(input, output);
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.METALLURGIC_INFUSER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional String infuseType)
|
||||
{
|
||||
if (itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemInput == null)
|
||||
itemInput = IngredientAny.INSTANCE;
|
||||
if (infuseType == null)
|
||||
infuseType = "";
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.METALLURGIC_INFUSER.get(), itemOutput, itemInput, infuseType));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient itemInput;
|
||||
private String infuseType;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemOutput, IIngredient itemInput, String infuseType)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.itemOutput = itemOutput;
|
||||
this.itemInput = itemInput;
|
||||
this.infuseType = infuseType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<InfusionInput, MetallurgicInfuserRecipe> entry : ((Map<InfusionInput, MetallurgicInfuserRecipe>) RecipeHandler.Recipe.METALLURGIC_INFUSER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().inputStack);
|
||||
String typeInfuse = entry.getKey().infuse.type.name;
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
if (!infuseType.isEmpty() && !infuseType.equalsIgnoreCase(typeInfuse))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, itemInput.toString(), itemOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.PurificationRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.purification")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class Purification
|
||||
{
|
||||
public static final String NAME = "Mekanism Purification";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
PurificationRecipe recipe = new PurificationRecipe(InputHelper.toStack(itemInput), InputHelper.toStack(itemOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.PURIFICATION_CHAMBER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput)
|
||||
{
|
||||
if (itemInput == null || gasInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
AdvancedMachineInput input = new AdvancedMachineInput(InputHelper.toStack(itemInput), GasHelper.toGas(gasInput).getGas());
|
||||
ItemStackOutput output = new ItemStackOutput(InputHelper.toStack(itemOutput));
|
||||
|
||||
PurificationRecipe recipe = new PurificationRecipe(input, output);
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.PURIFICATION_CHAMBER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional IIngredient gasInput)
|
||||
{
|
||||
if (itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemInput == null)
|
||||
itemInput = IngredientAny.INSTANCE;
|
||||
if (gasInput == null)
|
||||
gasInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.PURIFICATION_CHAMBER.get(), itemOutput, itemInput, gasInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient itemInput;
|
||||
private IIngredient gasInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemOutput, IIngredient itemInput, IIngredient gasInput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.itemOutput = itemOutput;
|
||||
this.itemInput = itemInput;
|
||||
this.gasInput = gasInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<AdvancedMachineInput, PurificationRecipe> entry : ((Map<AdvancedMachineInput, PurificationRecipe>) RecipeHandler.Recipe.PURIFICATION_CHAMBER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().itemStack);
|
||||
IGasStack inputGas = new CraftTweakerGasStack(new GasStack(entry.getKey().gasType, 1));
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasInput, inputGas))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", NAME, itemOutput.toString(), itemInput.toString(), gasInput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import crafttweaker.api.liquid.ILiquidStack;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.inputs.PressurizedInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.PressurizedRecipe;
|
||||
import mekanism.common.recipe.outputs.PressurizedOutput;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@ZenClass("mods.mekanism.reaction")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class Reaction
|
||||
{
|
||||
public static final String NAME = "Mekanism Reaction";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, ILiquidStack liquidInput, IGasStack gasInput, IItemStack itemOutput, IGasStack gasOutput, double energy, int duration)
|
||||
{
|
||||
if (itemInput == null || liquidInput == null || gasInput == null || itemOutput == null || gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
PressurizedInput input = new PressurizedInput(InputHelper.toStack(itemInput), InputHelper.toFluid(liquidInput), GasHelper.toGas(gasInput));
|
||||
PressurizedOutput output = new PressurizedOutput(InputHelper.toStack(itemOutput), GasHelper.toGas(gasOutput));
|
||||
|
||||
PressurizedRecipe recipe = new PressurizedRecipe(input, output, energy, duration);
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.PRESSURIZED_REACTION_CHAMBER.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemOutput, IIngredient gasOutput, @Optional IIngredient itemInput, @Optional IIngredient liquidInput, @Optional IIngredient gasInput)
|
||||
{
|
||||
if (itemOutput == null || gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemInput == null)
|
||||
itemInput = IngredientAny.INSTANCE;
|
||||
if (liquidInput == null)
|
||||
liquidInput = IngredientAny.INSTANCE;
|
||||
if (gasInput == null)
|
||||
gasInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.PRESSURIZED_REACTION_CHAMBER.get(), itemOutput, gasOutput, itemInput, liquidInput, gasInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient gasOutput;
|
||||
private IIngredient itemInput;
|
||||
private IIngredient liquidInput;
|
||||
private IIngredient gasInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemOutput, IIngredient gasOutput, IIngredient itemInput, IIngredient liquidInput, IIngredient gasInput)
|
||||
{
|
||||
super(name, map);
|
||||
|
||||
this.itemOutput = itemOutput;
|
||||
this.gasOutput = gasOutput;
|
||||
this.itemInput = itemInput;
|
||||
this.liquidInput = liquidInput;
|
||||
this.gasInput = gasInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<PressurizedInput, PressurizedRecipe> entry : ((Map<PressurizedInput, PressurizedRecipe>) RecipeHandler.Recipe.PRESSURIZED_REACTION_CHAMBER.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().getSolid());
|
||||
ILiquidStack inputLiquid = InputHelper.toILiquidStack(entry.getKey().getFluid());
|
||||
IGasStack inputGas = new CraftTweakerGasStack(entry.getKey().getGas());
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.getItemOutput());
|
||||
IGasStack outputGas = new CraftTweakerGasStack(entry.getValue().recipeOutput.getGasOutput());
|
||||
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
if (!StackHelper.matches(liquidInput, inputLiquid))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasInput, inputGas))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasOutput, outputGas))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s, %s, %s, %s and %s. Command ignored!", NAME, itemOutput.toString(), gasOutput.toString(), itemInput.toString(), liquidInput.toString(), gasInput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.SawmillRecipe;
|
||||
import mekanism.common.recipe.outputs.ChanceOutput;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStack;
|
||||
|
||||
@ZenClass("mods.mekanism.sawmill")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class Sawmill
|
||||
{
|
||||
public static final String NAME = "Mekanism Sawmill";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput, @Optional IItemStack optionalItemOutput, @Optional double optionalChance)
|
||||
{
|
||||
if (itemInput == null || itemOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStackInput input = new ItemStackInput(toStack(itemInput));
|
||||
ChanceOutput output = optionalItemOutput == null ? new ChanceOutput(toStack(itemOutput)) : new ChanceOutput(toStack(itemOutput), toStack(optionalItemOutput), optionalChance);
|
||||
|
||||
SawmillRecipe recipe = new SawmillRecipe(input, output);
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.PRECISION_SAWMILL.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient itemInput, @Optional IIngredient itemOutput, @Optional IIngredient optionalItemOutput)
|
||||
{
|
||||
if (itemInput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemOutput == null)
|
||||
itemOutput = IngredientAny.INSTANCE;
|
||||
if (optionalItemOutput == null)
|
||||
optionalItemOutput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.PRECISION_SAWMILL.get(), itemInput, itemOutput, optionalItemOutput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient itemInput;
|
||||
private IIngredient itemOutput;
|
||||
private IIngredient optionalItemOutput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient itemInput, IIngredient itemOutput, IIngredient optionalItemOutput)
|
||||
{
|
||||
super(name, map);
|
||||
this.itemInput = itemInput;
|
||||
this.itemOutput = itemOutput;
|
||||
this.optionalItemOutput = optionalItemOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<ItemStackInput, SawmillRecipe> entry : ((Map<ItemStackInput, SawmillRecipe>) RecipeHandler.Recipe.PRECISION_SAWMILL.get()).entrySet())
|
||||
{
|
||||
IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient);
|
||||
IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.primaryOutput);
|
||||
IItemStack outputItemOptional = InputHelper.toIItemStack(entry.getValue().recipeOutput.secondaryOutput);
|
||||
|
||||
if (!StackHelper.matches(itemOutput, outputItem))
|
||||
continue;
|
||||
if (!StackHelper.matches(itemInput, inputItem))
|
||||
continue;
|
||||
if (!StackHelper.matches(optionalItemOutput, outputItemOptional))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, itemInput.toString(), itemOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import crafttweaker.api.liquid.ILiquidStack;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.FluidInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.SeparatorRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.separator")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class Separator
|
||||
{
|
||||
public static final String NAME = "Mekanism Separator";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack liquidInput, double energy, IGasStack leftGasOutput, IGasStack rightGasOutput)
|
||||
{
|
||||
if (liquidInput == null || leftGasOutput == null || rightGasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
SeparatorRecipe recipe = new SeparatorRecipe(InputHelper.toFluid(liquidInput), energy, GasHelper.toGas(leftGasOutput), GasHelper.toGas(rightGasOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient liquidInput, @Optional IIngredient leftGasInput, @Optional IIngredient rightGasInput)
|
||||
{
|
||||
if (liquidInput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (leftGasInput == null)
|
||||
leftGasInput = IngredientAny.INSTANCE;
|
||||
if (rightGasInput == null)
|
||||
leftGasInput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.get(), liquidInput, leftGasInput, rightGasInput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient liquidInput;
|
||||
private IIngredient leftGasInput;
|
||||
private IIngredient rightGasInput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient liquidInput, IIngredient leftGasInput, IIngredient rightGasInput)
|
||||
{
|
||||
super(name, map);
|
||||
this.liquidInput = liquidInput;
|
||||
this.leftGasInput = leftGasInput;
|
||||
this.rightGasInput = rightGasInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<FluidInput, SeparatorRecipe> entry : ((Map<FluidInput, SeparatorRecipe>) RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.get()).entrySet())
|
||||
{
|
||||
ILiquidStack inputLiquid = InputHelper.toILiquidStack(entry.getKey().ingredient);
|
||||
IGasStack outputItemLeft = new CraftTweakerGasStack(entry.getValue().recipeOutput.leftGas);
|
||||
IGasStack outputItemRight = new CraftTweakerGasStack(entry.getValue().recipeOutput.rightGas);
|
||||
|
||||
if (!StackHelper.matches(liquidInput, inputLiquid))
|
||||
continue;
|
||||
if (!GasHelper.matches(leftGasInput, outputItemLeft))
|
||||
continue;
|
||||
if (!GasHelper.matches(rightGasInput, outputItemRight))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", NAME, liquidInput.toString(), leftGasInput.toString(), rightGasInput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
import mekanism.common.integration.crafttweaker.helpers.GasHelper;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.GasInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.SolarNeutronRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.solarneutronactivator")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class SolarNeutronActivator
|
||||
{
|
||||
public static final String NAME = "Mekanism Solar Neutron Activator";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IGasStack gasInput, IGasStack gasOutput)
|
||||
{
|
||||
if (gasInput == null || gasOutput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
SolarNeutronRecipe recipe = new SolarNeutronRecipe(GasHelper.toGas(gasInput), GasHelper.toGas(gasOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.SOLAR_NEUTRON_ACTIVATOR.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient gasInput, @Optional IIngredient gasOutput)
|
||||
{
|
||||
if (gasInput == null)
|
||||
{
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if (gasOutput == null)
|
||||
gasOutput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.SOLAR_NEUTRON_ACTIVATOR.get(), gasInput, gasOutput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient gasInput;
|
||||
private IIngredient gasOutput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient gasInput, IIngredient gasOutput)
|
||||
{
|
||||
super(name, map);
|
||||
this.gasInput = gasInput;
|
||||
this.gasOutput = gasOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for (Map.Entry<GasInput, SolarNeutronRecipe> entry : ((Map<GasInput, SolarNeutronRecipe>) RecipeHandler.Recipe.SOLAR_NEUTRON_ACTIVATOR.get()).entrySet())
|
||||
{
|
||||
IGasStack inputGas = new CraftTweakerGasStack(entry.getKey().ingredient);
|
||||
IGasStack outputGas = new CraftTweakerGasStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if (!GasHelper.matches(gasInput, inputGas))
|
||||
continue;
|
||||
if (!GasHelper.matches(gasOutput, outputGas))
|
||||
continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if (!recipesToRemove.isEmpty())
|
||||
{
|
||||
recipes.putAll(recipesToRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, gasInput.toString(), gasOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import crafttweaker.api.liquid.ILiquidStack;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.util.AddMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.inputs.FluidInput;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.machines.ThermalEvaporationRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.mekanism.thermalevaporation")
|
||||
@ModOnly("mtlib")
|
||||
@ZenRegister
|
||||
public class ThermalEvaporation
|
||||
{
|
||||
public static final String NAME = "Mekanism Solar Evaporation";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack liquidInput, ILiquidStack liquidOutput) {
|
||||
if(liquidInput == null || liquidOutput == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
ThermalEvaporationRecipe recipe = new ThermalEvaporationRecipe(InputHelper.toFluid(liquidInput), InputHelper.toFluid(liquidOutput));
|
||||
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe(NAME, RecipeHandler.Recipe.THERMAL_EVAPORATION_PLANT.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient liquidInput, @Optional IIngredient liquidOutput) {
|
||||
if(liquidInput == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if(liquidOutput == null) liquidOutput = IngredientAny.INSTANCE;
|
||||
|
||||
CrafttweakerIntegration.LATE_REMOVALS.add(new Remove(NAME, RecipeHandler.Recipe.THERMAL_EVAPORATION_PLANT.get(), liquidInput, liquidOutput));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe
|
||||
{
|
||||
private IIngredient liquidInput;
|
||||
private IIngredient liquidOutput;
|
||||
|
||||
public Remove(String name, Map<MachineInput, MachineRecipe> map, IIngredient liquidInput, IIngredient liquidOutput)
|
||||
{
|
||||
super(name, map);
|
||||
this.liquidInput = liquidInput;
|
||||
this.liquidOutput = liquidOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes()
|
||||
{
|
||||
Map<MachineInput, MachineRecipe> recipesToRemove = new HashMap<>();
|
||||
|
||||
for(Map.Entry<FluidInput, ThermalEvaporationRecipe> entry : ((Map<FluidInput, ThermalEvaporationRecipe>) RecipeHandler.Recipe.THERMAL_EVAPORATION_PLANT.get()).entrySet() ) {
|
||||
ILiquidStack inputLiquid = InputHelper.toILiquidStack(entry.getKey().ingredient);
|
||||
ILiquidStack outputLiquid = InputHelper.toILiquidStack(entry.getValue().recipeOutput.output);
|
||||
|
||||
if(!StackHelper.matches(liquidInput, inputLiquid)) continue;
|
||||
if(!StackHelper.matches(liquidOutput, outputLiquid)) continue;
|
||||
|
||||
recipesToRemove.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if(!recipesToRemove.isEmpty()) {
|
||||
recipes.putAll(recipesToRemove);
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", NAME, liquidInput.toString(), liquidOutput.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package mekanism.common.integration.crafttweaker.helpers;
|
||||
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
|
||||
public class GasHelper
|
||||
{
|
||||
private GasHelper()
|
||||
{
|
||||
}
|
||||
|
||||
public static boolean matches(IIngredient ingredient, IGasStack gasStack)
|
||||
{
|
||||
if (ingredient == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ingredient == IngredientAny.INSTANCE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ingredient instanceof IGasStack)
|
||||
{
|
||||
return toGas((IGasStack) ingredient).isGasEqual(toGas(gasStack));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static GasStack toGas(IGasStack iStack)
|
||||
{
|
||||
if (iStack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return new GasStack(GasRegistry.getGas(iStack.getName()), iStack.getAmount());
|
||||
}
|
||||
|
||||
public static GasStack[] toGases(IGasStack[] iStack)
|
||||
{
|
||||
GasStack[] stack = new GasStack[iStack.length];
|
||||
for (int i = 0; i < stack.length; i++)
|
||||
stack[i] = toGas(iStack[i]);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package mekanism.common.integration.crafttweaker.util;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseMapAddition;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ChanceOutput;
|
||||
import mekanism.common.recipe.outputs.ChemicalPairOutput;
|
||||
import mekanism.common.recipe.outputs.FluidOutput;
|
||||
import mekanism.common.recipe.outputs.GasOutput;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import mekanism.common.recipe.outputs.MachineOutput;
|
||||
import mekanism.common.recipe.outputs.PressurizedOutput;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AddMekanismRecipe extends BaseMapAddition<MachineInput, MachineRecipe>
|
||||
{
|
||||
private MachineRecipe recipe;
|
||||
|
||||
public AddMekanismRecipe(String name, Map<MachineInput, MachineRecipe> map, MachineRecipe recipe)
|
||||
{
|
||||
super(name, map);
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
public void addRecipes()
|
||||
{
|
||||
this.recipes.put(recipe.getInput(), recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
addRecipes();
|
||||
|
||||
super.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Map.Entry<MachineInput, MachineRecipe> recipe)
|
||||
{
|
||||
MachineOutput output = recipe.getValue().recipeOutput;
|
||||
|
||||
if (output instanceof ItemStackOutput)
|
||||
{
|
||||
return LogHelper.getStackDescription(((ItemStackOutput) output).output);
|
||||
}
|
||||
else if (output instanceof GasOutput)
|
||||
{
|
||||
return LogHelper.getStackDescription(((GasOutput) output).output);
|
||||
}
|
||||
else if (output instanceof FluidOutput)
|
||||
{
|
||||
return LogHelper.getStackDescription(((FluidOutput) output).output);
|
||||
}
|
||||
else if (output instanceof ChemicalPairOutput)
|
||||
{
|
||||
return "[" + LogHelper.getStackDescription(((ChemicalPairOutput) output).leftGas) + ", " + LogHelper.getStackDescription(((ChemicalPairOutput) output).rightGas) + "]";
|
||||
}
|
||||
else if (output instanceof ChanceOutput)
|
||||
{
|
||||
return LogHelper.getStackDescription(((ChanceOutput) output).primaryOutput);
|
||||
}
|
||||
else if (output instanceof PressurizedOutput)
|
||||
{
|
||||
return "[" + LogHelper.getStackDescription(((PressurizedOutput) output).getItemOutput()) + ", " + LogHelper.getStackDescription(((PressurizedOutput) output).getGasOutput()) + "]";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package mekanism.common.integration.crafttweaker.util;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ChanceOutput;
|
||||
import mekanism.common.recipe.outputs.ChemicalPairOutput;
|
||||
import mekanism.common.recipe.outputs.FluidOutput;
|
||||
import mekanism.common.recipe.outputs.GasOutput;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import mekanism.common.recipe.outputs.MachineOutput;
|
||||
import mekanism.common.recipe.outputs.PressurizedOutput;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class RemoveMekanismRecipe extends BaseMapRemoval<MachineInput, MachineRecipe>
|
||||
{
|
||||
public RemoveMekanismRecipe(String name, Map<MachineInput, MachineRecipe> map)
|
||||
{
|
||||
super(name, map);
|
||||
}
|
||||
|
||||
public abstract void addRecipes();
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
addRecipes();
|
||||
|
||||
super.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Map.Entry<MachineInput, MachineRecipe> recipe)
|
||||
{
|
||||
MachineOutput output = recipe.getValue().recipeOutput;
|
||||
|
||||
if (output instanceof ItemStackOutput)
|
||||
{
|
||||
return LogHelper.getStackDescription(((ItemStackOutput) output).output);
|
||||
}
|
||||
else if (output instanceof GasOutput)
|
||||
{
|
||||
return LogHelper.getStackDescription(((GasOutput) output).output);
|
||||
}
|
||||
else if (output instanceof FluidOutput)
|
||||
{
|
||||
return LogHelper.getStackDescription(((FluidOutput) output).output);
|
||||
}
|
||||
else if (output instanceof ChemicalPairOutput)
|
||||
{
|
||||
return "[" + LogHelper.getStackDescription(((ChemicalPairOutput) output).leftGas) + ", " + LogHelper.getStackDescription(((ChemicalPairOutput) output).rightGas) + "]";
|
||||
}
|
||||
else if (output instanceof ChanceOutput)
|
||||
{
|
||||
return LogHelper.getStackDescription(((ChanceOutput) output).primaryOutput);
|
||||
}
|
||||
else if (output instanceof PressurizedOutput)
|
||||
{
|
||||
return "[" + LogHelper.getStackDescription(((PressurizedOutput) output).getItemOutput()) + ", " + LogHelper.getStackDescription(((PressurizedOutput) output).getGasOutput()) + "]";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -287,6 +287,12 @@ public final class RecipeHandler
|
||||
HashMap<InfusionInput, MetallurgicInfuserRecipe> recipes = Recipe.METALLURGIC_INFUSER.get();
|
||||
|
||||
MetallurgicInfuserRecipe recipe = recipes.get(input);
|
||||
|
||||
if(recipe == null)
|
||||
{
|
||||
recipe = recipes.get(input.wildCopy());
|
||||
}
|
||||
|
||||
return recipe == null ? null : recipe.copy();
|
||||
}
|
||||
|
||||
@@ -427,6 +433,12 @@ public final class RecipeHandler
|
||||
if(input.isValid())
|
||||
{
|
||||
RECIPE recipe = recipes.get(input);
|
||||
|
||||
if(recipe == null)
|
||||
{
|
||||
recipe = recipes.get(input.wildCopy());
|
||||
}
|
||||
|
||||
return recipe == null ? null : recipe.copy();
|
||||
}
|
||||
|
||||
@@ -484,6 +496,12 @@ public final class RecipeHandler
|
||||
HashMap<PressurizedInput, PressurizedRecipe> recipes = Recipe.PRESSURIZED_REACTION_CHAMBER.get();
|
||||
|
||||
PressurizedRecipe recipe = recipes.get(input);
|
||||
|
||||
if(recipe == null)
|
||||
{
|
||||
recipe = recipes.get(input.wildCopy());
|
||||
}
|
||||
|
||||
return recipe == null ? null : recipe.copy();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import mekanism.common.util.StackUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class AdvancedMachineInput extends MachineInput<AdvancedMachineInput>
|
||||
{
|
||||
@@ -94,4 +95,9 @@ public class AdvancedMachineInput extends MachineInput<AdvancedMachineInput>
|
||||
{
|
||||
return other instanceof AdvancedMachineInput;
|
||||
}
|
||||
|
||||
public AdvancedMachineInput wildCopy()
|
||||
{
|
||||
return new AdvancedMachineInput(new ItemStack(itemStack.getItem(), itemStack.getCount(), OreDictionary.WILDCARD_VALUE), gasType);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import mekanism.common.util.StackUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/**
|
||||
* An infusion input, containing the type of and amount of infuse the operation requires, as well as the input ItemStack.
|
||||
@@ -94,4 +95,9 @@ public class InfusionInput extends MachineInput<InfusionInput>
|
||||
{
|
||||
return other instanceof InfusionInput;
|
||||
}
|
||||
|
||||
public InfusionInput wildCopy()
|
||||
{
|
||||
return new InfusionInput(infuse, new ItemStack(inputStack.getItem(), inputStack.getCount(), OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/**
|
||||
* An input of a gas, a fluid and an item for the pressurized reaction chamber
|
||||
@@ -165,4 +166,9 @@ public class PressurizedInput extends MachineInput<PressurizedInput>
|
||||
{
|
||||
return other instanceof PressurizedInput;
|
||||
}
|
||||
|
||||
public PressurizedInput wildCopy()
|
||||
{
|
||||
return new PressurizedInput(new ItemStack(theSolid.getItem(), theSolid.getCount(), OreDictionary.WILDCARD_VALUE), theFluid, theGas);
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public final class StackUtils
|
||||
return check == wild;
|
||||
}
|
||||
|
||||
return wild.getItem() == check.getItem() && (wild.getItemDamage() == OreDictionary.WILDCARD_VALUE || wild.getItemDamage() == check.getItemDamage());
|
||||
return wild.getItem() == check.getItem() && (wild.getItemDamage() == OreDictionary.WILDCARD_VALUE || check.getItemDamage() == OreDictionary.WILDCARD_VALUE || wild.getItemDamage() == check.getItemDamage());
|
||||
}
|
||||
|
||||
public static boolean equalsWildcardWithNBT(ItemStack wild, ItemStack check)
|
||||
|
||||
Reference in new issue
Block a user