This closes #17 and closes #58, I tested and it worked using the script given

Also changes like all packages
inb4 "jared changes a package name in ModTweaker2 breaking compatability
with everything" drama tweet.
This commit is contained in:
jaredlll08 committed 2015-02-20 23:57:32 +02:00
1 parent 4fd2551072
commit ec562b62ea
187 files changed
+977 -991

No files matched your search

@@ -0,0 +1,43 @@
package modtweaker2;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.player.IPlayer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import static modtweaker2.helpers.LogHelper.*;
public class ClientEvents {
public static int cooldown;
public static boolean active;
@SubscribeEvent
public void onDrawTooltip(ItemTooltipEvent event) {
IPlayer player = MineTweakerMC.getIPlayer(event.entityPlayer);
if (player != null) {
IItemStack hand = MineTweakerMC.getIItemStack(event.itemStack);
if (hand != null) {
if (active) {
String print = hand.toString();
event.toolTip.add(print);
if (GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSprint)) {
if (cooldown <= 0) {
cooldown = 30;
print(print + " -- " + hand.getDisplayName());
} else
cooldown--;
} else
cooldown--;
}
}
}
}
}
+66
View File
@@ -0,0 +1,66 @@
package modtweaker2;
import minetweaker.MineTweakerAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.commands.EntityMappingLogger;
import modtweaker2.mods.botania.commands.BotaniaBrewLogger;
import modtweaker2.mods.botania.commands.BotaniaOrechidLogger;
import modtweaker2.mods.botania.lexicon.commands.LexiconCategoryLogger;
import modtweaker2.mods.botania.lexicon.commands.LexiconEntryLogger;
import modtweaker2.mods.botania.lexicon.commands.LexiconKnowledgeTypesLogger;
import modtweaker2.mods.botania.lexicon.commands.LexiconPageLogger;
import modtweaker2.mods.chisel.commands.ChiselGroupLogger;
import modtweaker2.mods.chisel.commands.ChiselVariationLogger;
import modtweaker2.mods.mekanism.gas.GasLogger;
import modtweaker2.mods.tconstruct.MaterialLogger;
import modtweaker2.mods.thaumcraft.commands.AspectLogger;
import modtweaker2.mods.thaumcraft.research.commands.ResearchLogger;
import modtweaker2.util.TweakerPlugin;
public class Commands {
public static void registerCommands() {
registerMineTweakerCommand("tooltips", new String[] { "/minetweaker tooltips", " Adds tooltips to all items ingame with their mt script name, press ctrl on an item to print to the log" }, new ICommandFunction() {
@Override
public void execute(String[] arguments, IPlayer player) {
ClientEvents.active = !ClientEvents.active;
}
});
registerMineTweakerCommand("entities", new String[] { "/minetweaker entities", " Outputs a list of entities class mapping keys and the entity IDs" }, new EntityMappingLogger());
if (TweakerPlugin.isLoaded("Mekanism")) {
registerMineTweakerCommand("gases", new String[] { "/minetweaker gases", " Outputs a list of all gas names in the game to the minetweaker log" }, new GasLogger());
}
if (TweakerPlugin.isLoaded("Thaumcraft")) {
registerMineTweakerCommand("research", new String[] { "/minetweaker research", "/minetweaker research [CATEGORY]", " Outputs a list of all category names in the game to the minetweaker log," + " or outputs a list of all research keys in a category to the log." }, new ResearchLogger());
registerMineTweakerCommand("aspectList", new String[] { "/minetweaker aspectList", " Outputs a list of all aspects registered to entities and items" }, new AspectLogger());
}
if (TweakerPlugin.isLoaded("TConstruct")) {
registerMineTweakerCommand("materials", new String[] { "/minetweaker materials", " Outputs a list of all Tinker's Construct material names in the game to the minetweaker log" }, new MaterialLogger());
}
if (TweakerPlugin.isLoaded("Botania")) {
registerMineTweakerCommand("lexiconCategories", new String[] { "/minetweaker lexiconCategories", " Outputs a list of lexicon categories" }, new LexiconCategoryLogger());
registerMineTweakerCommand("lexiconEntries", new String[] { "/minetweaker lexiconEntries", "/minetweaker lexiconEntries [CATEGORY]", " Outputs a list of lexicon entries" }, new LexiconEntryLogger());
registerMineTweakerCommand("lexiconPages", new String[] { "/minetweaker lexiconPages", "/minetweaker lexiconPages [ENTRY]", " Outputs a list of lexicon pages for the entry" }, new LexiconPageLogger());
registerMineTweakerCommand("botaniaBrews", new String[] { "/minetweaker botaniaBrews", " Outputs a list of keys for botania brews" }, new BotaniaBrewLogger());
registerMineTweakerCommand("lexiconKnowledgeTypes", new String[] { "/minetweaker lexiconKnowledgeTypes", " Outputs a list of keys for lexicon knowledge types" }, new LexiconKnowledgeTypesLogger());
registerMineTweakerCommand("botaniaOrchid", new String[] { "/minetweaker botaniaOrechid", " Outputs a list of keys for botania orechid weights" }, new BotaniaOrechidLogger());
}
if (TweakerPlugin.isLoaded("chisel")) {
registerMineTweakerCommand("chiselGroups", new String[] { "/minetweaker chiselGroups", " Outputs a list of chisel groups" }, new ChiselGroupLogger());
registerMineTweakerCommand("chiselVariations", new String[] { "/minetweaker chiselVariations", "/minetweaker chiselVariations [GROUP]", " Outputs a list of chisel variations" }, new ChiselVariationLogger());
}
}
private static void registerMineTweakerCommand(String commandName, String[] usages, ICommandFunction commandFunction) {
MineTweakerAPI.server.addMineTweakerCommand(commandName, usages, commandFunction);
ModTweaker2.logger.info("Registering command " + commandName + ".");
}
}
+9
View File
@@ -0,0 +1,9 @@
package modtweaker2;
public class ModProps {
public static final String NAME = "Mod Tweaker 2", name = NAME;
public static final String MODID = "modtweaker2", modid = MODID;
public static final String VERSION = "0.7", version = VERSION;
public static final String DEPENDENCIES = "required-after:MineTweaker3", dependencies = DEPENDENCIES;
}
@@ -0,0 +1,98 @@
package modtweaker2;
import java.io.File;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.appeng.AppliedEnergistics;
import modtweaker2.mods.botania.Botania;
import modtweaker2.mods.chisel.Chisel;
import modtweaker2.mods.exnihilo.ExNihilo;
import modtweaker2.mods.extendedworkbench.ExtendedWorkbench;
import modtweaker2.mods.factorization.Factorization;
import modtweaker2.mods.forestry.Forestry;
import modtweaker2.mods.fsp.Steamcraft;
import modtweaker2.mods.hee.HardcoreEnderExpansion;
import modtweaker2.mods.imc.handler.Message;
import modtweaker2.mods.mariculture.Mariculture;
import modtweaker2.mods.mekanism.Mekanism;
import modtweaker2.mods.metallurgy.Metallurgy;
import modtweaker2.mods.pneumaticcraft.PneumaticCraft;
import modtweaker2.mods.railcraft.Railcraft;
import modtweaker2.mods.tconstruct.TConstruct;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thermalexpansion.ThermalExpansion;
import modtweaker2.util.TweakerPlugin;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.relauncher.Side;
@Mod(modid = ModProps.modid, version = ModProps.version, dependencies = ModProps.dependencies)
public class ModTweaker2 {
public static Logger logger = LogManager.getLogger(ModProps.modid);
@Instance(ModProps.modid)
public ModTweaker2 instance;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
logger.info("Starting PreInitialization for " + ModProps.modid);
File file = new File("scripts");
if (!file.exists()) {
file.mkdir();
}
new Message(file.getPath());
}
@EventHandler
public void init(FMLInitializationEvent event) {
logger.info("Starting Initialization for " + ModProps.modid);
TweakerPlugin.register("Botania", Botania.class);
TweakerPlugin.register("exnihilo", ExNihilo.class);
TweakerPlugin.register("extendedWorkbench", ExtendedWorkbench.class);
TweakerPlugin.register("factorization", Factorization.class);
TweakerPlugin.register("HardcoreEnderExpansion", HardcoreEnderExpansion.class);
TweakerPlugin.register("Mariculture", Mariculture.class);
TweakerPlugin.register("Mekanism", Mekanism.class);
TweakerPlugin.register("Metallurgy", Metallurgy.class);
TweakerPlugin.register("PneumaticCraft", PneumaticCraft.class);
TweakerPlugin.register("Railcraft", Railcraft.class);
TweakerPlugin.register("Steamcraft", Steamcraft.class);
TweakerPlugin.register("TConstruct", TConstruct.class);
TweakerPlugin.register("Thaumcraft", Thaumcraft.class);
TweakerPlugin.register("ThermalExpansion", ThermalExpansion.class);
TweakerPlugin.register("Forestry", Forestry.class);
TweakerPlugin.register("chisel", Chisel.class);
TweakerPlugin.register("appliedenergistics2-core", AppliedEnergistics.class);
MinecraftForge.EVENT_BUS.register(new TweakEventHandler());
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
MinecraftForge.EVENT_BUS.register(new ClientEvents());
}
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
logger.info("Starting PostInitialization for " + ModProps.modid);
}
@EventHandler
public void serverStart(FMLServerStartingEvent event) {
logger.info("Starting ServerStart for " + ModProps.modid);
Commands.registerCommands();
}
}
@@ -0,0 +1,35 @@
package modtweaker2;
import java.util.ArrayList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import org.apache.commons.lang3.tuple.MutablePair;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class TweakEventHandler {
public static ArrayList<MutablePair<EntityLivingBase, ArrayList<ItemStack>>> drops = new ArrayList<MutablePair<EntityLivingBase, ArrayList<ItemStack>>>();
public static ArrayList<EntityLiving> cancleDrops = new ArrayList<EntityLiving>();
@SubscribeEvent
public void handleDrops(LivingDropsEvent event) {
if (cancleDrops.contains(event.entityLiving)) {
event.setCanceled(true);
}
for (MutablePair<EntityLivingBase, ArrayList<ItemStack>> ent : drops) {
if (ent.left.isEntityEqual(event.entityLiving)) {
for (ItemStack stack : ent.right) {
event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, stack));
}
}
}
}
}
@@ -0,0 +1,29 @@
package modtweaker2.commands;
import java.util.Set;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.ModTweaker2;
import net.minecraft.entity.EntityList;
public class EntityMappingLogger implements ICommandFunction {
@Override
public void execute(String[] arguments, IPlayer player) {
Set<Integer> keys = EntityList.stringToIDMapping.keySet();
System.out.println("Mob Keys: " + keys.size());
for (Integer key : keys) {
ModTweaker2.logger.info("Mob Key " + EntityList.getStringFromID(key) + " : " + key);
MineTweakerAPI.logCommand("Mob Key " + EntityList.getStringFromID(key) + " : " + key);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,47 @@
package modtweaker2.helpers;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static modtweaker2.helpers.ReflectionHelper.*;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.ForgeHooks;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
public class ForgeHelper {
public static Map translate = null;
public static List seeds = null;
public static HashMap<String, ChestGenHooks> loot = null;
static {
try {
seeds = getStaticObject(ForgeHooks.class, "seedList");
loot = getStaticObject(ChestGenHooks.class, "chestInfo");
translate = getFinalObject(getStaticObject(StatCollector.class, "localizedName", "field_74839_a"), "languageList", "field_74816_c");
} catch (Exception e) {}
}
private ForgeHelper() {}
public static Object getSeedEntry(ItemStack stack, int weight) {
try {
Class clazz = Class.forName("net.minecraftforge.common.ForgeHooks$SeedEntry");
Constructor constructor = clazz.getDeclaredConstructor(ItemStack.class, int.class);
constructor.setAccessible(true);
return constructor.newInstance(stack, weight);
} catch (Exception e) {
throw new NullPointerException("Failed to instantiate SeedEntry");
}
}
public static boolean isLangActive(String lang) {
return FMLCommonHandler.instance().getSide() == Side.SERVER ? null : FMLClientHandler.instance().getCurrentLanguage().equals(lang);
}
}
@@ -0,0 +1,143 @@
package modtweaker2.helpers;
import java.util.ArrayList;
import minetweaker.MineTweakerAPI;
import minetweaker.api.entity.IEntity;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.oredict.IOreDictEntry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
public class InputHelper {
public static boolean isABlock(IItemStack block) {
if (!(isABlock(toStack(block)))) {
MineTweakerAPI.getLogger().logError("Item must be a block, or you must specify a block to render as when adding a TConstruct Melting recipe");
return false;
} else
return true;
}
public static boolean isABlock(ItemStack block) {
return block.getItem() instanceof ItemBlock;
}
public static Entity toEntity(){
return null;
}
public static ItemStack toStack(IItemStack iStack) {
if (iStack == null)
return null;
else {
Object internal = iStack.getInternal();
if (internal == null || !(internal instanceof ItemStack)) {
MineTweakerAPI.getLogger().logError("Not a valid item stack: " + iStack);
}
return (ItemStack) internal;
}
}
public static ItemStack[] toStacks(IItemStack[] iStack) {
if (iStack == null)
return null;
else {
ItemStack[] output = new ItemStack[iStack.length];
for (int i = 0; i < iStack.length; i++) {
output[i] = toStack(iStack[i]);
}
return output;
}
}
public static Object toObject(IIngredient iStack) {
if (iStack == null)
return null;
else {
if (iStack instanceof IOreDictEntry) {
return toString((IOreDictEntry) iStack);
} else if (iStack instanceof IItemStack) {
return toStack((IItemStack) iStack);
} else
return null;
}
}
public static Object[] toObjects(IIngredient[] ingredient) {
if (ingredient == null)
return null;
else {
Object[] output = new Object[ingredient.length];
for (int i = 0; i < ingredient.length; i++) {
if (ingredient[i] != null) {
output[i] = toObject(ingredient[i]);
} else
output[i] = "";
}
return output;
}
}
public static Object[] toShapedObjects(IIngredient[][] ingredients) {
if (ingredients == null)
return null;
else {
ArrayList prep = new ArrayList();
prep.add("abc");
prep.add("def");
prep.add("ghi");
char[][] map = new char[][] { { 'a', 'b', 'c' }, { 'd', 'e', 'f' }, { 'g', 'h', 'i' } };
for (int x = 0; x < ingredients.length; x++) {
if (ingredients[x] != null) {
for (int y = 0; y < ingredients[x].length; y++) {
if (ingredients[x][y] != null && x < map.length && y < map[x].length) {
prep.add(map[x][y]);
prep.add(toObject(ingredients[x][y]));
}
}
}
}
return prep.toArray();
}
}
public static String toString(IOreDictEntry entry) {
return ((IOreDictEntry) entry).getName();
}
public static FluidStack toFluid(ILiquidStack iStack) {
if (iStack == null) {
return null;
} else
return FluidRegistry.getFluidStack(iStack.getName(), iStack.getAmount());
}
public static Fluid getFluid(ILiquidStack iStack) {
if (iStack == null) {
return null;
} else
return FluidRegistry.getFluid(iStack.getName());
}
public static FluidStack[] toFluids(IIngredient[] input) {
return toFluids((IItemStack[]) input);
}
public static FluidStack[] toFluids(ILiquidStack[] iStack) {
FluidStack[] stack = new FluidStack[iStack.length];
for (int i = 0; i < stack.length; i++)
stack[i] = toFluid(iStack[i]);
return stack;
}
}
@@ -0,0 +1,24 @@
package modtweaker2.helpers;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
public class LogHelper {
public static void logPrinted(IPlayer player) {
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
public static void log(IPlayer player, String message) {
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage(message));
}
}
public static void print(String string) {
System.out.println(string);
MineTweakerAPI.logCommand(string);
}
}
@@ -0,0 +1,71 @@
package modtweaker2.helpers;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
public class ReflectionHelper {
public static Constructor getConstructor(String string, Class... types) {
try {
Class clazz = Class.forName(string);
Constructor constructor = clazz.getDeclaredConstructor(types);
constructor.setAccessible(true);
return constructor;
} catch (Exception ex) {}
return null;
}
public static <T> T getObject(Object o, String... fieldName) {
Class cls = o.getClass();
for (String field : fieldName) {
try {
Field result = cls.getDeclaredField(field);
result.setAccessible(true);
return (T) result.get(o);
} catch (Exception ex) {}
}
return null;
}
public static <T> T getFinalObject(Object o, String... fieldName) {
Class cls = o.getClass();
for (String field : fieldName) {
try {
Field result = cls.getDeclaredField(field);
result.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(result, result.getModifiers() & ~Modifier.FINAL);
return (T) result.get(o);
} catch (Exception ex) {}
}
return null;
}
public static <T> T getStaticObject(Class cls, String... fieldName) {
for (String field : fieldName) {
try {
Field result = cls.getDeclaredField(field);
result.setAccessible(true);
return (T) result.get(null);
} catch (Exception e) {}
}
return null;
}
public static void setPrivateValue(Class cls, String field, int var) {
try {
Field f = cls.getDeclaredField(field);
f.setAccessible(true);
f.setInt(null, var);
} catch (Exception e) {}
}
public static void setPrivateValue(Class cls, Object o, String field, Object var) {
cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(cls, o, var, field);
}
}
@@ -0,0 +1,15 @@
package modtweaker2.helpers;
import modtweaker2.mods.botania.Botania;
import modtweaker2.util.TweakerPlugin;
import net.minecraft.item.ItemStack;
public class StackHelper {
//Stack is the stack that is part of a recipe, stack2 is the one input trying to match
public static boolean areEqual(ItemStack stack, ItemStack stack2) {
if (stack == null || stack2 == null) return false;
else if (TweakerPlugin.isLoaded("Botania") && Botania.isSubtile(stack) && Botania.isSubtile(stack2)) {
return Botania.subtileMatches(stack, stack2);
} else return stack.isItemEqual(stack2);
}
}
@@ -0,0 +1,12 @@
package modtweaker2.mods.appeng;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.appeng.handlers.Inscriber;
public class AppliedEnergistics {
public AppliedEnergistics() {
MineTweakerAPI.registerClass(Inscriber.class);
}
}
@@ -0,0 +1,69 @@
package modtweaker2.mods.appeng.handlers;
import java.util.ArrayList;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import appeng.recipes.handlers.Inscribe;
import appeng.recipes.handlers.Inscribe.InscriberRecipe;
import static modtweaker2.helpers.InputHelper.*;
@ZenClass("mods.appeng.inscriber")
public class Inscriber {
@ZenMethod
public static void addRecipe(IItemStack[] imprintable, IItemStack plateA, IItemStack plateB, IItemStack out, boolean usePlates) {
MineTweakerAPI.apply(new Add(new InscriberRecipe(toStacks(imprintable), toStack(plateA), toStack(plateB), toStack(out), usePlates)));
Inscribe.inputs.add(toStack(imprintable[0]));
Inscribe.inputs.add(toStack(imprintable[1]));
Inscribe.inputs.add(toStack(plateA));
Inscribe.inputs.add(toStack(plateB));
Inscribe.plates.add(toStack(plateA));
Inscribe.plates.add(toStack(plateB));
}
public static class Add extends BaseListAddition {
public Add(InscriberRecipe recipe) {
super(recipe.toString(), Inscribe.recipes, recipe);
}
@Override
public void apply() {
Inscribe.recipes.add((InscriberRecipe) recipe);
}
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
public static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super(stack.getUnlocalizedName(), Inscribe.recipes, stack);
}
@Override
public void apply() {
ArrayList<InscriberRecipe> recipesToRemove = new ArrayList<Inscribe.InscriberRecipe>();
for (InscriberRecipe recipe : Inscribe.recipes) {
if (recipe.output.isItemEqual(stack)) {
recipesToRemove.add(recipe);
}
}
for (InscriberRecipe recipe : recipesToRemove) {
Inscribe.recipes.remove(recipe);
}
}
}
}
@@ -0,0 +1,30 @@
package modtweaker2.mods.botania;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.botania.handlers.Apothecary;
import modtweaker2.mods.botania.handlers.ElvenTrade;
import modtweaker2.mods.botania.handlers.Lexicon;
import modtweaker2.mods.botania.handlers.ManaInfusion;
import modtweaker2.mods.botania.handlers.Orechid;
import modtweaker2.mods.botania.handlers.RuneAltar;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
public class Botania {
public Botania() {
MineTweakerAPI.registerClass(Apothecary.class);
MineTweakerAPI.registerClass(ElvenTrade.class);
MineTweakerAPI.registerClass(ManaInfusion.class);
MineTweakerAPI.registerClass(Orechid.class);
MineTweakerAPI.registerClass(RuneAltar.class);
MineTweakerAPI.registerClass(Lexicon.class);
}
public static boolean isSubtile(ItemStack stack) {
return stack.getItem() instanceof ItemBlockSpecialFlower;
}
public static boolean subtileMatches(ItemStack stack, ItemStack stack2) {
return (ItemBlockSpecialFlower.getType(stack2).equals(ItemBlockSpecialFlower.getType(stack)));
}
}
@@ -0,0 +1,39 @@
package modtweaker2.mods.botania;
import java.util.List;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.KnowledgeType;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.api.lexicon.LexiconEntry;
public class BotaniaHelper {
public static LexiconCategory findCatagory(String name)
{
List<LexiconCategory> catagories=BotaniaAPI.getAllCategories();
for(int i=0;i<catagories.size();i++)
{
if(catagories.get(i).getUnlocalizedName().equalsIgnoreCase(name))
return catagories.get(i);
}
return null;
}
public static LexiconEntry findEntry(String name)
{
List<LexiconEntry> entries=BotaniaAPI.getAllEntries();
for(int i=0;i<entries.size();i++)
{
if(entries.get(i).getUnlocalizedName().equalsIgnoreCase(name))
return entries.get(i);
}
return null;
}
public static KnowledgeType findKnowledgeType(String name)
{
if(BotaniaAPI.knowledgeTypes.containsKey(name))
return BotaniaAPI.knowledgeTypes.get(name);
return null;
}
}
@@ -0,0 +1,26 @@
package modtweaker2.mods.botania.commands;
import java.util.Set;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import vazkii.botania.api.BotaniaAPI;
public class BotaniaBrewLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
Set<String> brew_keys=BotaniaAPI.brewMap.keySet();
System.out.println("Brews: " + brew_keys.size());
for (String key : brew_keys) {
System.out.println("Brew " + key);
MineTweakerAPI.logCommand(key);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,27 @@
package modtweaker2.mods.botania.commands;
import java.util.Set;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import vazkii.botania.api.BotaniaAPI;
public class BotaniaOrechidLogger implements ICommandFunction {
@Override
public void execute(String[] arguments, IPlayer player) {
Set<String> keys = BotaniaAPI.oreWeights.keySet();
System.out.println("Orechid Keys: " + keys.size());
for (String str : BotaniaAPI.oreWeights.keySet()) {
System.out.println("Orechid Key: " + str);
MineTweakerAPI.logCommand(str + ": " + BotaniaAPI.oreWeights.get(str) + "\n");
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,74 @@
package modtweaker2.mods.botania.handlers;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.botania.Apothecary")
public class Apothecary {
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient[] input) {
MineTweakerAPI.apply(new Add(new RecipePetals(toStack(output), toObjects(input))));
}
@ZenMethod
public static void addRecipe(String output, IIngredient[] input) {
MineTweakerAPI.apply(new Add(new RecipePetals(ItemBlockSpecialFlower.ofType(output), toObjects(input))));
}
private static class Add extends BaseListAddition {
public Add(RecipePetals recipe) {
super("Botania Petal Recipe", BotaniaAPI.petalRecipes, recipe);
}
@Override
public String getRecipeInfo() {
return ((RecipePetals) recipe).getOutput().getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
@ZenMethod
public static void removeRecipe(String output) {
MineTweakerAPI.apply(new Remove(ItemBlockSpecialFlower.ofType(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("Botania Petal recipe", BotaniaAPI.petalRecipes, stack);
}
@Override
public void apply() {
for (RecipePetals r : BotaniaAPI.petalRecipes) {
if (areEqual(r.getOutput(), stack)) {
recipe = r;
break;
}
}
BotaniaAPI.petalRecipes.remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,63 @@
package modtweaker2.mods.botania.handlers;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.botania.ElvenTrade")
public class ElvenTrade {
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient[] input) {
MineTweakerAPI.apply(new Add(new RecipeElvenTrade(toStack(output), toObjects(input))));
}
private static class Add extends BaseListAddition {
public Add(RecipeElvenTrade recipe) {
super("Botania Eleven Trade", BotaniaAPI.elvenTradeRecipes, recipe);
}
@Override
public String getRecipeInfo() {
return ((RecipeElvenTrade) recipe).getOutput().getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("Botania Elven Trade", BotaniaAPI.elvenTradeRecipes, stack);
}
@Override
public void apply() {
for (RecipeElvenTrade r : BotaniaAPI.elvenTradeRecipes) {
if (r.getOutput() != null && areEqual(r.getOutput(), stack)) {
recipe = r;
break;
}
}
BotaniaAPI.elvenTradeRecipes.remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,470 @@
package modtweaker2.mods.botania.handlers;
import static modtweaker2.helpers.InputHelper.toObject;
import static modtweaker2.helpers.InputHelper.toObjects;
import static modtweaker2.helpers.InputHelper.toStack;
import java.util.ArrayList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.api.recipes.ShapedRecipe;
import minetweaker.mc1710.recipes.RecipeConverter;
import modtweaker2.mods.botania.BotaniaHelper;
import modtweaker2.mods.botania.lexicon.AddCategory;
import modtweaker2.mods.botania.lexicon.AddEntry;
import modtweaker2.mods.botania.lexicon.AddPage;
import modtweaker2.mods.botania.lexicon.AddRecipeMapping;
import modtweaker2.mods.botania.lexicon.RemoveCategory;
import modtweaker2.mods.botania.lexicon.RemoveEntry;
import modtweaker2.mods.botania.lexicon.RemovePage;
import modtweaker2.mods.botania.lexicon.RemoveRecipeMapping;
import modtweaker2.mods.botania.lexicon.SetCategoryIcon;
import modtweaker2.mods.botania.lexicon.SetCategoryPriority;
import modtweaker2.mods.botania.lexicon.SetEntryKnowledgeType;
import net.minecraft.entity.EntityList;
import net.minecraft.item.crafting.IRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.KnowledgeType;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.common.lexicon.page.PageBrew;
import vazkii.botania.common.lexicon.page.PageCraftingRecipe;
import vazkii.botania.common.lexicon.page.PageElvenRecipe;
import vazkii.botania.common.lexicon.page.PageEntity;
import vazkii.botania.common.lexicon.page.PageImage;
import vazkii.botania.common.lexicon.page.PageLoreText;
import vazkii.botania.common.lexicon.page.PageManaInfusionRecipe;
import vazkii.botania.common.lexicon.page.PagePetalRecipe;
import vazkii.botania.common.lexicon.page.PageRuneRecipe;
import vazkii.botania.common.lexicon.page.PageText;
@ZenClass("mods.botania.Lexicon")
public class Lexicon {
@ZenMethod
public static void addBrewPage(String name, String entry, int page_number, String brew, IIngredient[] recipe, String bottomText) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(BotaniaAPI.getBrewFromKey(brew)==null)
{
MineTweakerAPI.getLogger().logError("Cannot find brew "+brew);
return;
}
RecipeBrew page_recipe=new RecipeBrew(BotaniaAPI.getBrewFromKey(brew),toObjects(recipe));
LexiconPage page=new PageBrew(page_recipe,name,bottomText);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addCraftingPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][][] inputs) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<IRecipe> recipes=new ArrayList<IRecipe>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(RecipeConverter.convert(new ShapedRecipe(outputs[i],inputs[i],null,false)));
}
LexiconPage page=new PageCraftingRecipe(name, recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addElvenPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeElvenTrade> recipes=new ArrayList<RecipeElvenTrade>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(new RecipeElvenTrade(toStack(outputs[i]),toObjects(inputs[i])));
}
LexiconPage page=new PageElvenRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addEntityPage(String name, String entry, int page_number, String entity, int size) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(!EntityList.stringToClassMapping.containsKey(entity))
{
MineTweakerAPI.getLogger().logError("No such entity "+entity);
return;
}
LexiconPage page=new PageEntity(entity, entity, size);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addImagePage(String name, String entry, int page_number, String resource) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
LexiconPage page=new PageImage(name, resource);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addLorePage(String name, String entry, int page_number) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
LexiconPage page=new PageLoreText(name);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addInfusionPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[] inputs, int[] mana) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length || outputs.length!=mana.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeManaInfusion> recipes=new ArrayList<RecipeManaInfusion>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(new RecipeManaInfusion(toStack(outputs[i]),toObject(inputs[i]),mana[i]));
}
LexiconPage page=new PageManaInfusionRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addAlchemyPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[] inputs, int[] mana) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length || outputs.length!=mana.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeManaInfusion> recipes=new ArrayList<RecipeManaInfusion>();
for(int i=0;i<outputs.length;i++)
{
RecipeManaInfusion current_recipe=new RecipeManaInfusion(toStack(outputs[i]),toObject(inputs[i]),mana[i]);
current_recipe.setAlchemy(true);
recipes.add(current_recipe);
}
LexiconPage page=new PageManaInfusionRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addConjurationPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[] inputs, int[] mana) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length || outputs.length!=mana.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeManaInfusion> recipes=new ArrayList<RecipeManaInfusion>();
for(int i=0;i<outputs.length;i++)
{
RecipeManaInfusion current_recipe=new RecipeManaInfusion(toStack(outputs[i]),toObject(inputs[i]),mana[i]);
current_recipe.setConjuration(true);
recipes.add(current_recipe);
}
LexiconPage page=new PageManaInfusionRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addPetalPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipePetals> recipes=new ArrayList<RecipePetals>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(new RecipePetals(toStack(outputs[i]),toObjects(inputs[i])));
}
LexiconPage page=new PagePetalRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addRunePage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs, int[] mana) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length || outputs.length!=mana.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeRuneAltar> recipes=new ArrayList<RecipeRuneAltar>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(new RecipeRuneAltar(toStack(outputs[i]),mana[i],toObjects(inputs[i])));
}
LexiconPage page=new PageRuneRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addTextPage(String name, String entry, int page_number) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
LexiconPage page=new PageText(name);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void removePage(String entry, int page_number) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>=lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
MineTweakerAPI.apply(new RemovePage(lexiconEntry,page_number));
}
@ZenMethod
public static void addEntry(String entry, String catagory) {
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(catagory);
if(lexiconCategory==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+catagory);
return;
}
LexiconEntry lexiconEntry=new LexiconEntry(entry,lexiconCategory);
MineTweakerAPI.apply(new AddEntry(lexiconEntry));
}
@ZenMethod
public static void removeEntry(String entry) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
MineTweakerAPI.apply(new RemoveEntry(lexiconEntry));
}
@ZenMethod
public static void setEntryKnowledgeType(String entry, String knowledgeType) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
KnowledgeType type=BotaniaHelper.findKnowledgeType(knowledgeType);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(type==null)
{
MineTweakerAPI.getLogger().logError("Cannot find knowledge type "+knowledgeType);
return;
}
MineTweakerAPI.apply(new SetEntryKnowledgeType(lexiconEntry,type));
}
@ZenMethod
public static void addCategory(String name) {
LexiconCategory lexiconCategory=new LexiconCategory(name);
MineTweakerAPI.apply(new AddCategory(lexiconCategory));
}
@ZenMethod
public static void removeCategory(String name) {
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(name);
if(lexiconCategory==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+name);
return;
}
MineTweakerAPI.apply(new RemoveCategory(lexiconCategory));
}
@ZenMethod
public static void setCategoryPriority(String name, int priority) {
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(name);
if(lexiconCategory==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+name);
return;
}
MineTweakerAPI.apply(new SetCategoryPriority(lexiconCategory,priority));
}
@ZenMethod
public static void setCategoryIcon(String name, String icon) {
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(name);
if(lexiconCategory==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+name);
return;
}
MineTweakerAPI.apply(new SetCategoryIcon(lexiconCategory,icon));
}
@ZenMethod
public static void addRecipeMapping(IItemStack stack, String Entry, int page) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(Entry);
if(LexiconRecipeMappings.getDataForStack(toStack(stack))!=null)
{
MineTweakerAPI.getLogger().logError("There is already a recipe mapping for "+stack);
return;
}
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+Entry);
return;
}
if(lexiconEntry.pages.size()<page)
{
MineTweakerAPI.getLogger().logError("Not enough pages in "+Entry);
return;
}
MineTweakerAPI.apply(new AddRecipeMapping(toStack(stack),lexiconEntry,page));
}
@ZenMethod
public static void removeRecipeMapping(IItemStack stack) {
if(LexiconRecipeMappings.getDataForStack(toStack(stack))==null)
{
MineTweakerAPI.getLogger().logError("There isn't a recipe mapping for "+stack);
return;
}
MineTweakerAPI.apply(new RemoveRecipeMapping(toStack(stack)));
}
}
@@ -0,0 +1,79 @@
package modtweaker2.mods.botania.handlers;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.InputHelper;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.botania.ManaInfusion")
public class ManaInfusion {
@ZenMethod
public static void addInfusion(IItemStack output, IIngredient input, int mana) {
MineTweakerAPI.apply(new Add(new RecipeManaInfusion(toStack(output), toObject(input), mana)));
}
@ZenMethod
public static void addAlchemy(IItemStack output, IIngredient input, int mana) {
RecipeManaInfusion recipe = new RecipeManaInfusion(toStack(output), toObject(input), mana);
recipe.setAlchemy(true);
MineTweakerAPI.apply(new Add(recipe));
}
@ZenMethod
public static void addConjuration(IItemStack output, IIngredient input, int mana) {
RecipeManaInfusion recipe = new RecipeManaInfusion(toStack(output), toObject(input), mana);
recipe.setConjuration(true);
MineTweakerAPI.apply(new Add(recipe));
}
private static class Add extends BaseListAddition {
public Add(RecipeManaInfusion recipe) {
super("Botania Mana Infusion", BotaniaAPI.manaInfusionRecipes, recipe);
}
@Override
public String getRecipeInfo() {
return ((RecipeManaInfusion) recipe).getOutput().getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("Botania Mana Infusion", BotaniaAPI.manaInfusionRecipes, stack);
}
@Override
public void apply() {
for (RecipeManaInfusion r : BotaniaAPI.manaInfusionRecipes) {
if (r.getOutput() != null && areEqual(r.getOutput(), stack)) {
recipe = r;
break;
}
}
BotaniaAPI.manaInfusionRecipes.remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,113 @@
package modtweaker2.mods.botania.handlers;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.oredict.IOreDictEntry;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
@ZenClass("mods.botania.Orechid")
public class Orechid {
@ZenMethod
public static void addOre(IOreDictEntry oreDict, int weight) {
MineTweakerAPI.apply(new Add(oreDict.getName(), weight));
}
@ZenMethod
public static void addOre(String oreDict, int weight) {
MineTweakerAPI.apply(new Add(oreDict, weight));
}
private static class Add implements IUndoableAction {
String oreDict;
int weight;
public Add(String ore, int prop) {
oreDict = ore;
weight = prop;
}
@Override
public void apply() {
BotaniaAPI.addOreWeight(oreDict, weight);
}
@Override
public String describe() {
return "Adding Orechid Ore Weight: " + oreDict + ":" + weight;
}
@Override
public boolean canUndo() {
return oreDict != null;
}
@Override
public void undo() {
BotaniaAPI.oreWeights.remove(oreDict);
}
@Override
public String describeUndo() {
return "Removing Orechid Ore: " + oreDict;
}
@Override
public String getOverrideKey() {
return null;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeOre(IOreDictEntry oreDict) {
MineTweakerAPI.apply(new Remove(oreDict.getName()));
}
@ZenMethod
public static void removeOre(String oreDict) {
MineTweakerAPI.apply(new Remove(oreDict));
}
private static class Remove implements IUndoableAction {
String oreDict;
int weight;
public Remove(String ore) {
oreDict = ore;
}
@Override
public void apply() {
weight = BotaniaAPI.getOreWeight(oreDict);
BotaniaAPI.oreWeights.remove(oreDict);
}
@Override
public String describe() {
return "Removing Orechid Ore: " + oreDict;
}
@Override
public boolean canUndo() {
return weight > 0;
}
@Override
public void undo() {
BotaniaAPI.addOreWeight(oreDict, weight);
}
@Override
public String describeUndo() {
return "Restoring Orechid Ore Weight: " + oreDict + ":" + weight;
}
@Override
public String getOverrideKey() {
return null;
}
}
}
@@ -0,0 +1,63 @@
package modtweaker2.mods.botania.handlers;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("")
public class RuneAltar {
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient[] input, int mana) {
MineTweakerAPI.apply(new Add(new RecipeRuneAltar(toStack(output), mana, toObjects(input))));
}
private static class Add extends BaseListAddition {
public Add(RecipeRuneAltar recipe) {
super("Botania Rune Altar", BotaniaAPI.runeAltarRecipes, recipe);
}
@Override
public String getRecipeInfo() {
return ((RecipeRuneAltar) recipe).getOutput().getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("Botania Rune Altar", BotaniaAPI.runeAltarRecipes, stack);
}
@Override
public void apply() {
for (RecipeRuneAltar r : BotaniaAPI.runeAltarRecipes) {
if (r.getOutput() != null && areEqual(r.getOutput(), stack)) {
recipe = r;
break;
}
}
BotaniaAPI.runeAltarRecipes.remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,44 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconCategory;
public class AddCategory implements IUndoableAction {
LexiconCategory category;
public AddCategory(LexiconCategory category) {
this.category=category;
}
@Override
public void apply() {
BotaniaAPI.addCategory(category);
}
@Override
public boolean canUndo() {
return category != null;
}
@Override
public String describe() {
return "Adding Lexicon Category: " + category.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Removing Lexicon Category: " + category.getUnlocalizedName();
}
@Override
public void undo() {
BotaniaAPI.getAllCategories().remove(category);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,45 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconEntry;
public class AddEntry implements IUndoableAction {
LexiconEntry Entry;
public AddEntry(LexiconEntry Entry) {
this.Entry=Entry;
}
@Override
public void apply() {
BotaniaAPI.addEntry(Entry, Entry.category);
}
@Override
public boolean canUndo() {
return Entry != null;
}
@Override
public String describe() {
return "Adding Lexicon Entry: " + Entry.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Removing Lexicon Entry: " + Entry.getUnlocalizedName();
}
@Override
public void undo() {
Entry.category.entries.remove(Entry);
BotaniaAPI.getAllEntries().remove(Entry);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,50 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
public class AddPage implements IUndoableAction {
String Name;
int page_number;
LexiconEntry Entry;
LexiconPage page;
public AddPage(String Name, LexiconEntry Entry, LexiconPage page, int page_number) {
this.Name=Name;
this.Entry=Entry;
this.page=page;
this.page_number=page_number;
}
@Override
public void apply() {
Entry.pages.add(page_number, page);
}
@Override
public boolean canUndo() {
return Name != null && Entry != null && page != null;
}
@Override
public String describe() {
return "Adding Lexicon Page: " + Name;
}
@Override
public String describeUndo() {
return "Removing Lexicon Page: " + Name;
}
@Override
public void undo() {
Entry.pages.remove(page_number);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,49 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
public class AddRecipeMapping implements IUndoableAction {
ItemStack stack;
LexiconEntry entry;
int page;
public AddRecipeMapping(ItemStack stack, LexiconEntry entry, int page) {
this.stack =stack;
this.entry=entry;
this.page=page;
}
@Override
public void apply() {
LexiconRecipeMappings.map(stack, entry, page);
}
@Override
public boolean canUndo() {
return true;
}
@Override
public String describe() {
return "Adding Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Removing Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
}
@Override
public void undo() {
LexiconRecipeMappings.remove(stack);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,44 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconCategory;
public class RemoveCategory implements IUndoableAction {
LexiconCategory category;
public RemoveCategory(LexiconCategory category) {
this.category=category;
}
@Override
public void apply() {
BotaniaAPI.getAllCategories().remove(category);
}
@Override
public boolean canUndo() {
return category != null;
}
@Override
public String describe() {
return "Removing Lexicon Category: " + category.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Adding Lexicon Category: " + category.getUnlocalizedName();
}
@Override
public void undo() {
BotaniaAPI.addCategory(category);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,45 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconEntry;
public class RemoveEntry implements IUndoableAction {
LexiconEntry Entry;
public RemoveEntry(LexiconEntry Entry) {
this.Entry=Entry;
}
@Override
public void apply() {
Entry.category.entries.remove(Entry);
BotaniaAPI.getAllEntries().remove(Entry);
}
@Override
public boolean canUndo() {
return Entry != null;
}
@Override
public String describe() {
return "Removing Lexicon Entry: " + Entry.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Adding Lexicon Entry: " + Entry.getUnlocalizedName();
}
@Override
public void undo() {
BotaniaAPI.addEntry(Entry, Entry.category);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,48 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
public class RemovePage implements IUndoableAction {
int page_number;
LexiconEntry Entry;
LexiconPage page;
public RemovePage(LexiconEntry Entry, int page_number) {
this.Entry=Entry;
this.page_number=page_number;
}
@Override
public void apply() {
this.page=Entry.pages.get(page_number);
Entry.pages.remove(page);
}
@Override
public boolean canUndo() {
return Entry != null && page != null;
}
@Override
public String describe() {
return "Removing Lexicon Page: " + Entry.pages.get(page_number).getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Adding Lexicon Page: " + page.getUnlocalizedName();
}
@Override
public void undo() {
Entry.pages.add(page_number,page);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,51 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
public class RemoveRecipeMapping implements IUndoableAction {
ItemStack stack;
LexiconEntry entry;
int page;
public RemoveRecipeMapping(ItemStack stack) {
this.stack =stack;
}
@Override
public void apply() {
EntryData data=LexiconRecipeMappings.getDataForStack(stack);
this.entry=data.entry;
this.page=data.page;
LexiconRecipeMappings.remove(stack);
}
@Override
public boolean canUndo() {
return true;
}
@Override
public String describe() {
return "Removing Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Adding Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
}
@Override
public void undo() {
LexiconRecipeMappings.map(stack,entry,page);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,48 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.api.lexicon.LexiconCategory;
public class SetCategoryIcon implements IUndoableAction {
LexiconCategory category;
ResourceLocation oldIcon;
ResourceLocation newIcon;
public SetCategoryIcon(LexiconCategory category, String icon) {
this.category=category;
this.newIcon=new ResourceLocation(icon);
}
@Override
public void apply() {
oldIcon=category.getIcon();
category.setIcon(newIcon);
}
@Override
public boolean canUndo() {
return category != null;
}
@Override
public String describe() {
return "Setting Lexicon Category priority: " + category.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Unsetting Lexicon Category priority: " + category.getUnlocalizedName();
}
@Override
public void undo() {
category.setIcon(oldIcon);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,47 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.lexicon.LexiconCategory;
public class SetCategoryPriority implements IUndoableAction {
LexiconCategory category;
int oldPriority;
int newPriority;
public SetCategoryPriority(LexiconCategory category, int priority) {
this.category=category;
this.newPriority=priority;
}
@Override
public void apply() {
oldPriority=category.getSortingPriority();
category.setPriority(newPriority);
}
@Override
public boolean canUndo() {
return category != null;
}
@Override
public String describe() {
return "Setting Lexicon Category priority: " + category.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Unsetting Lexicon Category priority: " + category.getUnlocalizedName();
}
@Override
public void undo() {
category.setPriority(oldPriority);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,48 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.lexicon.KnowledgeType;
import vazkii.botania.api.lexicon.LexiconEntry;
public class SetEntryKnowledgeType implements IUndoableAction {
LexiconEntry Entry;
KnowledgeType newType;
KnowledgeType oldType;
public SetEntryKnowledgeType(LexiconEntry Entry, KnowledgeType type) {
this.Entry=Entry;
this.newType=type;
}
@Override
public void apply() {
oldType=Entry.getKnowledgeType();
Entry.setKnowledgeType(newType);
}
@Override
public boolean canUndo() {
return Entry != null && oldType != null;
}
@Override
public String describe() {
return "Setting Knowledge type for: " + Entry.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Unsetting Knowledge type for: " + Entry.getUnlocalizedName();
}
@Override
public void undo() {
Entry.setKnowledgeType(oldType);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@@ -0,0 +1,27 @@
package modtweaker2.mods.botania.lexicon.commands;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconCategory;
public class LexiconCategoryLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
List<LexiconCategory> categories=BotaniaAPI.getAllCategories();
System.out.println("Categories: " + categories.size());
for (LexiconCategory category : categories) {
System.out.println("Category " + category.getUnlocalizedName());
MineTweakerAPI.logCommand(category.getUnlocalizedName());
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,42 @@
package modtweaker2.mods.botania.lexicon.commands;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.mods.botania.BotaniaHelper;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.api.lexicon.LexiconEntry;
public class LexiconEntryLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
LexiconCategory category=null;
if(arguments.length>0)
{
category=BotaniaHelper.findCatagory(arguments[0]);
if(category==null)
{
MineTweakerAPI.getLogger().logError("Category not found (" + arguments[0]+")");
return;
}
}
List<LexiconEntry> entries=BotaniaAPI.getAllEntries();
System.out.println("Entries: " + entries.size());
for (LexiconEntry entry : entries) {
if(category==null || entry.category==category)
{
System.out.println("Entry " + entry.getUnlocalizedName());
MineTweakerAPI.logCommand(entry.getUnlocalizedName());
}
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,26 @@
package modtweaker2.mods.botania.lexicon.commands;
import java.util.Set;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import vazkii.botania.api.BotaniaAPI;
public class LexiconKnowledgeTypesLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
Set<String> types=BotaniaAPI.knowledgeTypes.keySet();
System.out.println("Knowledge Types: " + types.size());
for (String key : types) {
System.out.println("Knowledge Type " + key);
MineTweakerAPI.logCommand(key);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,47 @@
package modtweaker2.mods.botania.lexicon.commands;
import java.util.ArrayList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.mods.botania.BotaniaHelper;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
public class LexiconPageLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
LexiconEntry entry=null;
if(arguments.length>0)
{
entry=BotaniaHelper.findEntry(arguments[0]);
if(entry==null)
{
MineTweakerAPI.getLogger().logError("Entry not found (" + arguments[0]+")");
return;
}
}
List<LexiconEntry> entries;
List<LexiconPage> pages=new ArrayList();
if(entry!=null)
pages.addAll(entry.pages);
else
for (LexiconEntry current_Entry : BotaniaAPI.getAllEntries())
pages.addAll(current_Entry.pages);
System.out.println("Pages: " + pages.size());
for (LexiconPage page : pages) {
System.out.println("Page " + page.getUnlocalizedName() + " (" + page.getClass() + ")");
MineTweakerAPI.logCommand(page.getUnlocalizedName() + " (" + page.getClass() + ")");
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,11 @@
package modtweaker2.mods.chisel;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.chisel.handlers.Groups;
public class Chisel {
public Chisel() {
MineTweakerAPI.registerClass(Groups.class);
}
}
@@ -0,0 +1,158 @@
package modtweaker2.mods.chisel;
import static modtweaker2.helpers.InputHelper.toStack;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import minetweaker.api.item.IItemStack;
import net.minecraft.block.Block;
import com.cricketcraft.chisel.api.carving.CarvingUtils;
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
import com.google.common.collect.Lists;
public class ChiselHelper {
public static ICarvingGroup getGroup(String name)
{
return CarvingUtils.getChiselRegistry().getGroup(name);
}
public static ICarvingGroup getGroup(IItemStack stack)
{
return CarvingUtils.getChiselRegistry().getGroup(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
}
public static ICarvingVariation getVariation(IItemStack stack)
{
ICarvingGroup g = getGroup(stack);
if (g != null) {
for (ICarvingVariation v : g.getVariations()) {
if (v.getBlock() == Block.getBlockFromItem(toStack(stack).getItem()) && v.getBlockMeta() == stack.getDamage()) {
return v;
}
}
}
return null;
}
public static ICarvingVariation makeVariation(IItemStack stack)
{
return new CarvingVariation(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
}
public static ICarvingGroup makeGroup(String name)
{
return new CarvingGroup(name);
}
public static boolean groupContainsVariation(ICarvingGroup group, ICarvingVariation variation)
{
for(ICarvingVariation otherVariation : group.getVariations())
{
if(otherVariation.getBlock()==variation.getBlock() && otherVariation.getBlockMeta()==variation.getBlockMeta())
return true;
}
return false;
}
static class CarvingVariation implements ICarvingVariation
{
Block block;
int meta;
public CarvingVariation(Block block, int meta)
{
this.block=block;
this.meta=meta;
}
@Override
public Block getBlock() {
return block;
}
@Override
public int getBlockMeta() {
return meta;
}
@Override
public int getItemMeta() {
return meta;
}
@Override
public int getOrder() {
return 99;
}
}
static class CarvingGroup implements ICarvingGroup
{
private String name;
private String sound;
private String oreName;
private List<ICarvingVariation> variations = Lists.newArrayList();
public CarvingGroup(String name) {
this.name = name;
}
public List<ICarvingVariation> getVariations() {
return Lists.newArrayList(variations);
}
@Override
public void addVariation(ICarvingVariation variation) {
variations.add(variation);
Collections.sort(variations, new Comparator<ICarvingVariation>() {
@Override
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
return CarvingUtils.compare(o1, o2);
}
});
}
@Override
public boolean removeVariation(ICarvingVariation variation) {
ICarvingVariation toRemove = null;
for (ICarvingVariation v : variations) {
if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) {
toRemove = v;
}
}
return toRemove == null ? false : variations.remove(toRemove);
}
@Override
public String getName() {
return name;
}
@Override
public String getSound() {
return sound;
}
@Override
public void setSound(String sound) {
this.sound = sound;
}
@Override
public String getOreName() {
return oreName;
}
@Override
public void setOreName(String oreName) {
this.oreName = oreName;
}
}
}
@@ -0,0 +1,27 @@
package modtweaker2.mods.chisel.commands;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import com.cricketcraft.chisel.api.carving.CarvingUtils;
public class ChiselGroupLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
List<String> keys=CarvingUtils.getChiselRegistry().getSortedGroupNames();
System.out.println("Chisel Groups: " + keys.size());
for (String key : keys) {
System.out.println("Chisel Group " + key);
MineTweakerAPI.logCommand(key);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,57 @@
package modtweaker2.mods.chisel.commands;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.mods.chisel.ChiselHelper;
import net.minecraft.item.Item;
import com.cricketcraft.chisel.api.carving.CarvingUtils;
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
public class ChiselVariationLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
Map<ICarvingVariation, ICarvingGroup> variations=new HashMap<ICarvingVariation, ICarvingGroup>();
List<String> keys=CarvingUtils.getChiselRegistry().getSortedGroupNames();
if(arguments.length>0)
{
ICarvingGroup group=ChiselHelper.getGroup(arguments[0]);
if(group==null)
{
MineTweakerAPI.getLogger().logError("Group not found (" + arguments[0]+")");
return;
}
else
{
keys.clear();
keys.add(arguments[0]);
}
}
for (String key : keys) {
ICarvingGroup group=CarvingUtils.getChiselRegistry().getGroup(key);
for(ICarvingVariation variation : group.getVariations())
variations.put(variation, group);
}
System.out.println("Chisel Variations: " + variations.size());
for (Entry<ICarvingVariation, ICarvingGroup> entry: variations.entrySet()) {
String stringedVariation="<"+Item.itemRegistry.getNameForObject(Item.getItemFromBlock(entry.getKey().getBlock()))+":"+entry.getKey().getBlockMeta()+">";
if(arguments.length==0)
stringedVariation+=" "+entry.getValue().getName();
System.out.println("Chisel Variation " + stringedVariation);
MineTweakerAPI.logCommand(stringedVariation);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,233 @@
package modtweaker2.mods.chisel.handlers;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.chisel.ChiselHelper;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import com.cricketcraft.chisel.api.carving.CarvingUtils;
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
@ZenClass("mods.chisel.Groups")
public class Groups {
@ZenMethod
public static void addVariation(String groupName, IItemStack stack) {
ICarvingGroup group=ChiselHelper.getGroup(groupName);
ICarvingVariation variation=ChiselHelper.makeVariation(stack);
if(group==null)
{
MineTweakerAPI.getLogger().logError("Cannot find group " + groupName);
return;
}
if(variation==null)
{
MineTweakerAPI.getLogger().logError("Can't create variation from " + stack);
return;
}
MineTweakerAPI.apply(new AddVariation(group,variation, stack.toString()));
}
static class AddVariation implements IUndoableAction {
ICarvingGroup group;
ICarvingVariation variation;
String variationName;
public AddVariation(ICarvingGroup group,ICarvingVariation variation, String variationName) {
this.group=group;
this.variation=variation;
this.variationName=variationName;
}
@Override
public void apply() {
CarvingUtils.getChiselRegistry().addVariation(group.getName(),variation);
}
@Override
public boolean canUndo() {
return group != null && variation != null;
}
@Override
public String describe() {
return "Adding Variation: " + variationName;
}
@Override
public String describeUndo() {
return "Removing Variation: " + variationName;
}
@Override
public void undo() {
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlock(),variation.getBlockMeta());
}
@Override
public Object getOverrideKey() {
return null;
}
}
@ZenMethod
public static void removeVariation(IItemStack stack) {
ICarvingVariation variation=ChiselHelper.getVariation(stack);
if(variation==null)
{
MineTweakerAPI.getLogger().logError("Can't find variation from " + stack);
return;
}
MineTweakerAPI.apply(new RemoveVariation(variation, stack.toString()));
}
static class RemoveVariation implements IUndoableAction {
ICarvingVariation variation;
String variationName;
ICarvingGroup group;
public RemoveVariation(ICarvingVariation variation, String variationName) {
this.variation=variation;
this.variationName=variationName;
}
@Override
public void apply() {
group=CarvingUtils.getChiselRegistry().getGroup(variation.getBlock(),variation.getBlockMeta());
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlock(),variation.getBlockMeta());
}
@Override
public boolean canUndo() {
return group!= null && variation != null;
}
@Override
public String describe() {
return "Removing Variation: " + variationName;
}
@Override
public String describeUndo() {
return "Adding Variation: " + variationName;
}
@Override
public void undo() {
CarvingUtils.getChiselRegistry().addVariation(group.getName(),variation);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@ZenMethod
public static void addGroup(String groupName) {
ICarvingGroup group=ChiselHelper.getGroup(groupName);
if(group!=null)
{
MineTweakerAPI.getLogger().logError("Group already exists " + groupName);
return;
}
group=ChiselHelper.makeGroup(groupName);
MineTweakerAPI.apply(new AddGroup(group));
}
static class AddGroup implements IUndoableAction {
ICarvingGroup group;
public AddGroup(ICarvingGroup group) {
this.group=group;
}
@Override
public void apply() {
CarvingUtils.getChiselRegistry().addGroup(group);
}
@Override
public boolean canUndo() {
return group != null;
}
@Override
public String describe() {
return "Adding Group: " + group.getName();
}
@Override
public String describeUndo() {
return "Removing Group: " + group.getName();
}
@Override
public void undo() {
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
}
@Override
public Object getOverrideKey() {
return null;
}
}
@ZenMethod
public static void removeGroup(String groupName) {
ICarvingGroup group=ChiselHelper.getGroup(groupName);
if(group==null)
{
MineTweakerAPI.getLogger().logError("Could not find group " + groupName);
return;
}
MineTweakerAPI.apply(new RemoveGroup(group));
}
static class RemoveGroup implements IUndoableAction {
ICarvingGroup group;
public RemoveGroup(ICarvingGroup group) {
this.group=group;
}
@Override
public void apply() {
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
}
@Override
public boolean canUndo() {
return group != null;
}
@Override
public String describe() {
return "Removing Group: " + group.getName();
}
@Override
public String describeUndo() {
return "Adding Group: " + group.getName();
}
@Override
public void undo() {
CarvingUtils.getChiselRegistry().addGroup(group);
}
@Override
public Object getOverrideKey() {
return null;
}
}
}
@@ -0,0 +1,16 @@
package modtweaker2.mods.exnihilo;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.exnihilo.handlers.Compost;
import modtweaker2.mods.exnihilo.handlers.Crucible;
import modtweaker2.mods.exnihilo.handlers.Hammer;
import modtweaker2.mods.exnihilo.handlers.Sieve;
public class ExNihilo {
public ExNihilo() {
MineTweakerAPI.registerClass(Compost.class);
MineTweakerAPI.registerClass(Crucible.class);
MineTweakerAPI.registerClass(Hammer.class);
MineTweakerAPI.registerClass(Sieve.class);
}
}
@@ -0,0 +1,56 @@
package modtweaker2.mods.exnihilo.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseMapAddition;
import modtweaker2.util.BaseMapRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.Optional;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import exnihilo.registries.CompostRegistry;
import exnihilo.registries.helpers.Color;
import exnihilo.registries.helpers.Compostable;
@ZenClass("mods.exnihilo.Composting")
public class Compost {
//Adding a Ex Nihilo Composting recipe
@ZenMethod
public static void addRecipe(IItemStack input, double value, @Optional String hex) {
hex = (hex == null || hex.equals("")) ? "35A82A" : hex;
MineTweakerAPI.apply(new Add(new Compostable(toStack(input).getItem(), toStack(input).getItemDamage(), Math.min(1.0F, (float) value), new Color(hex))));
}
//Passes the list to the map list implementation, and adds the recipe
private static class Add extends BaseMapAddition {
public Add(Compostable recipe) {
super("ExNihilo Composting", CompostRegistry.entries, recipe.item + ":" + recipe.meta, recipe);
}
@Override
public String getRecipeInfo() {
return new ItemStack(((Compostable) recipe).item, 1, ((Compostable) recipe).meta).getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Removing a Ex Nihilo Composting recipe
@ZenMethod
public static void removeRecipe(IItemStack input) {
MineTweakerAPI.apply(new Remove(toStack(input)));
}
//Removes a recipe, will always remove the key, so all should be good
private static class Remove extends BaseMapRemoval {
public Remove(ItemStack stack) {
super("ExNihilo Composting", CompostRegistry.entries, stack.getItem() + ":" + stack.getItemDamage(), stack);
}
@Override
public String getRecipeInfo() {
return ((ItemStack) stack).getDisplayName();
}
}
}
@@ -0,0 +1,112 @@
package modtweaker2.mods.exnihilo.handlers;
import static modtweaker2.helpers.InputHelper.isABlock;
import static modtweaker2.helpers.InputHelper.toFluid;
import static modtweaker2.helpers.InputHelper.toStack;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.util.BaseMapAddition;
import modtweaker2.util.BaseMapRemoval;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import exnihilo.registries.CrucibleRegistry;
import exnihilo.registries.HeatRegistry;
import exnihilo.registries.helpers.HeatSource;
import exnihilo.registries.helpers.Meltable;
@ZenClass("mods.exnihilo.Crucible")
public class Crucible {
/************************************************ Crucible Melting ************************************************/
//Adding a Ex Nihilo Crucible recipe
@ZenMethod
public static void addRecipe(IItemStack input, ILiquidStack fluid) {
if (isABlock(input)) {
Block theBlock = Block.getBlockFromItem(toStack(input).getItem());
int theMeta = toStack(input).getItemDamage();
MineTweakerAPI.apply(new AddRecipe(new Meltable(theBlock, theMeta, 2000, toFluid(fluid).getFluid(), toFluid(fluid).amount, theBlock)));
}
}
//Passes the list to the map list implementation, and adds the recipe
private static class AddRecipe extends BaseMapAddition {
public AddRecipe(Meltable recipe) {
super("ExNihilo Crucible", CrucibleRegistry.entries, recipe.block + ":" + recipe.meta, recipe);
}
@Override
public String getRecipeInfo() {
return new ItemStack(((Meltable) recipe).block, 1, ((Meltable) recipe).meta).getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Removing a Ex Nihilo Crucible recipe
@ZenMethod
public static void removeRecipe(IItemStack output) {
if (isABlock(output)) {
MineTweakerAPI.apply(new RemoveRecipe(toStack(output)));
}
}
//Removes a recipe, will always remove the key, so all should be good
private static class RemoveRecipe extends BaseMapRemoval {
public RemoveRecipe(ItemStack stack) {
super("ExNihilo Crucible", CrucibleRegistry.entries, Block.getBlockFromItem(stack.getItem()) + ":" + stack.getItemDamage(), stack);
}
@Override
public String getRecipeInfo() {
return ((ItemStack) stack).getDisplayName();
}
}
/********************************************** Crucible Heat Sources **********************************************/
//Adding a Ex Nihilo Crucible heat source
@ZenMethod
public static void addHeatSource(IItemStack input, double value) {
if (isABlock(input)) {
Block theBlock = Block.getBlockFromItem(toStack(input).getItem());
int theMeta = toStack(input).getItemDamage();
MineTweakerAPI.apply(new AddHeatSource(new HeatSource(theBlock, theMeta, (float) value)));
}
}
//Passes the list to the base map implementation, and adds the recipe
private static class AddHeatSource extends BaseMapAddition {
public AddHeatSource(HeatSource recipe) {
super("ExNihilo Crucible - Heat Source", HeatRegistry.entries, recipe.block + ":" + recipe.meta, recipe);
}
@Override
public String getRecipeInfo() {
return new ItemStack(((HeatSource) recipe).block, 1, ((HeatSource) recipe).meta).getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Removing a Ex Nihilo Crucible heat source
@ZenMethod
public static void removeHeatSource(IItemStack output) {
if (isABlock(output)) {
MineTweakerAPI.apply(new RemoveHeatSource(toStack(output)));
}
}
//Removes a recipe, will always remove the key, so all should be good
private static class RemoveHeatSource extends BaseMapRemoval {
public RemoveHeatSource(ItemStack stack) {
super("ExNihilo Crucible - Heat Source", HeatRegistry.entries, Block.getBlockFromItem(stack.getItem()) + ":" + stack.getItemDamage(), stack);
}
@Override
public String getRecipeInfo() {
return ((ItemStack) stack).getDisplayName();
}
}
}
@@ -0,0 +1,90 @@
package modtweaker2.mods.exnihilo.handlers;
import static modtweaker2.helpers.InputHelper.isABlock;
import static modtweaker2.helpers.InputHelper.toStack;
import java.util.Iterator;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import exnihilo.registries.HammerRegistry;
import exnihilo.registries.helpers.Smashable;
@ZenClass("mods.exnihilo.Hammer")
public class Hammer {
// Adding a Ex Nihilo Hammer recipe
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output, double chance, double luck) {
if (isABlock(input)) {
Block theBlock = Block.getBlockFromItem(toStack(input).getItem());
int theMeta = toStack(input).getItemDamage();
MineTweakerAPI.apply(new Add(new Smashable(theBlock, theMeta, toStack(output).getItem(), toStack(output).getItemDamage(), (float) chance, (float) luck)));
}
}
// Passes the list to the base list implementation, and adds the recipe
private static class Add extends BaseListAddition {
public Add(Smashable recipe) {
super("ExNihilo Hammer", HammerRegistry.rewards, recipe);
}
@Override
public String getRecipeInfo() {
return new ItemStack(((Smashable) recipe).source, 1, ((Smashable) recipe).sourceMeta).getDisplayName();
}
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Removing a Ex Nihilo Hammer recipe
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
// Removes a recipe, apply is never the same for anything, so will always
// need to override it
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("ExNihilo Hammer", HammerRegistry.rewards, stack);
}
// Loops through the registry, to find the item that matches, saves that
// recipe then removes it
@Override
public void apply() {
boolean found = false;
Iterator<Smashable> smashables = HammerRegistry.rewards.iterator();
while (!found && smashables.hasNext()) {
Smashable reward = smashables.next();
if (reward != null && reward.source != null && Block.getBlockFromItem(stack.getItem()) != null)
if (reward.source == Block.getBlockFromItem(stack.getItem())) {
reward.source = Blocks.air;
found = true;
}
}
// for (Smashable r : HammerRegistry.rewards.) {
// ItemStack check = new ItemStack(r.item, 1, r.meta);
// if (check != null && areEqual(check, stack)) {
// recipe = r;
// break;
// }
// }
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,80 @@
package modtweaker2.mods.exnihilo.handlers;
import static modtweaker2.helpers.InputHelper.isABlock;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.areEqual;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseMultipleListRemoval;
import modtweaker2.util.BaseMultipleListRemoval.Position;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import exnihilo.registries.SieveRegistry;
import exnihilo.registries.helpers.SiftReward;
@ZenClass("mods.exnihilo.Sieve")
public class Sieve {
//Adding a Ex Nihilo Sieve recipe
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output, int rarity) {
if (isABlock(input)) {
Block theBlock = Block.getBlockFromItem(toStack(input).getItem());
int theMeta = toStack(input).getItemDamage();
MineTweakerAPI.apply(new Add(new SiftReward(theBlock, theMeta, toStack(output).getItem(), toStack(output).getItemDamage(), rarity)));
}
}
//Passes the list to the base list implementation, and adds the recipe
private static class Add extends BaseListAddition {
public Add(SiftReward recipe) {
super("ExNihilo Sieve", SieveRegistry.rewards, recipe);
}
@Override
public String getRecipeInfo() {
return new ItemStack(((SiftReward) recipe).source, 1, ((SiftReward) recipe).sourceMeta).getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Removing a Ex Nihilo Sieve recipe
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output), Position.ALL));
}
@ZenMethod
public static void removeFirst(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output), Position.FIRST));
}
@ZenMethod
public static void removeLast(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output), Position.LAST));
}
//Removes a recipe, apply is never the same for anything, so will always need to override it
private static class Remove extends BaseMultipleListRemoval {
public Remove(ItemStack stack, Position pos) {
super("ExNihilo Sieve", SieveRegistry.rewards, stack, pos);
}
@Override
protected boolean isEqual(Object recipe, Object search) {
SiftReward r = (SiftReward) recipe;
ItemStack c = new ItemStack(r.item, 1, r.meta);
if (c != null && areEqual(c, (ItemStack) search)) {
return true;
} else return false;
}
@Override
public String getRecipeInfo() {
return ((ItemStack) search).getDisplayName();
}
}
}
@@ -0,0 +1,10 @@
package modtweaker2.mods.extendedworkbench;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.extendedworkbench.handlers.ExtendedCrafting;
public class ExtendedWorkbench {
public ExtendedWorkbench() {
MineTweakerAPI.registerClass(ExtendedCrafting.class);
}
}
@@ -0,0 +1,102 @@
package modtweaker2.mods.extendedworkbench.handlers;
import java.util.Arrays;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import naruto1310.extendedWorkbench.crafting.ExtendedCraftingManager;
import naruto1310.extendedWorkbench.crafting.ExtendedShapedRecipes;
import naruto1310.extendedWorkbench.crafting.ExtendedShapelessRecipes;
import naruto1310.extendedWorkbench.crafting.IExtendedRecipe;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.extendedworkbench")
public class ExtendedCrafting {
@ZenMethod
public static void addShaped(IItemStack output, IItemStack[][] ingredients) {
MineTweakerAPI.apply(new Add(getShapedRecipe(output, ingredients)));
}
@ZenMethod
public static void addShapeless(IItemStack output, IItemStack[] ingredients) {
MineTweakerAPI.apply(new Add(new ExtendedShapelessRecipes(toStack(output), Arrays.asList(toStacks(ingredients)))));
}
private static class Add extends BaseListAddition {
public Add(IExtendedRecipe recipe) {
super("Extended Workbench", ExtendedCraftingManager.getInstance().getRecipeList(), recipe);
}
@Override
public String getRecipeInfo() {
Object out = ((IExtendedRecipe) recipe).getRecipeOutput();
if (out != null) {
return ((ItemStack) out).getDisplayName();
} else return super.getRecipeInfo();
}
}
private static IExtendedRecipe getShapedRecipe(IItemStack out, IItemStack[][] ingredients) {
int width = 0;
int height = ingredients.length;
ItemStack[] recipe;
for (int x = 0; x < ingredients.length; x++) {
if (ingredients[x] != null && ingredients[x].length > width) width = ingredients[x].length;
}
recipe = new ItemStack[width * height];
int counter = 0;
for (int x = 0; x < ingredients.length; x++) {
if (ingredients[x] != null) {
for (int y = 0; y < ingredients[x].length; y++) {
recipe[counter++] = toStack(ingredients[x][y]);
}
}
}
return new ExtendedShapedRecipes(width, height, recipe, toStack(out));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("Extended Workbench", ExtendedCraftingManager.getInstance().getRecipeList(), stack);
}
@Override
public void apply() {
for (Object o : ExtendedCraftingManager.getInstance().getRecipeList()) {
if (o instanceof IExtendedRecipe) {
IExtendedRecipe r = (IExtendedRecipe) o;
if (r.getRecipeOutput() != null && areEqual((ItemStack) r.getRecipeOutput(), stack)) {
recipe = r;
break;
}
}
}
ExtendedCraftingManager.getInstance().getRecipeList().remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,14 @@
package modtweaker2.mods.factorization;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.factorization.handlers.Crystallizer;
import modtweaker2.mods.factorization.handlers.Lacerator;
import modtweaker2.mods.factorization.handlers.SlagFurnace;
public class Factorization {
public Factorization() {
MineTweakerAPI.registerClass(Crystallizer.class);
MineTweakerAPI.registerClass(Lacerator.class);
MineTweakerAPI.registerClass(SlagFurnace.class);
}
}
@@ -0,0 +1,56 @@
package modtweaker2.mods.factorization;
import java.lang.reflect.Constructor;
import java.util.List;
import net.minecraft.item.ItemStack;
import static modtweaker2.helpers.ReflectionHelper.*;
public class FactorizationHelper {
public static List lacerator = null;
public static List slag = null;
public static List crystallizer = null;
static {
try {
lacerator = getStaticObject(Class.forName("factorization.oreprocessing.TileEntityGrinder"), "recipes");
slag = getStaticObject(Class.forName("factorization.oreprocessing.TileEntitySlagFurnace$SlagRecipes"), "smeltingResults");
crystallizer = getStaticObject(Class.forName("factorization.oreprocessing.TileEntityCrystallizer"), "recipes");
} catch (Exception e) {}
}
private FactorizationHelper() {}
public static Object getLaceratorRecipe(ItemStack input, ItemStack output, float probability) {
try {
Class clazz = Class.forName("factorization.oreprocessing.TileEntityGrinder$GrinderRecipe");
Constructor constructor = clazz.getDeclaredConstructor(Object.class, ItemStack.class, float.class);
constructor.setAccessible(true);
return constructor.newInstance(input, output, probability);
} catch (Exception e) {
throw new NullPointerException("Failed to instantiate Lacerator Recipe");
}
}
public static Object getSlagFurnaceRecipe(ItemStack input, float chance1, ItemStack output1, float chance2, ItemStack output2) {
try {
Class clazz = Class.forName("factorization.oreprocessing.TileEntitySlagFurnace$SmeltingResult");
Constructor constructor = clazz.getDeclaredConstructor(ItemStack.class, float.class, ItemStack.class, float.class, ItemStack.class);
constructor.setAccessible(true);
return constructor.newInstance(input, chance1, output1, chance2, output2);
} catch (Exception e) {
throw new NullPointerException("Failed to instantiate SmeltingResult");
}
}
public static Object getCrystallizerRecipe(ItemStack input, ItemStack output, ItemStack solution, float output_count) {
try {
Class clazz = Class.forName("factorization.oreprocessing.TileEntityCrystallizer$CrystalRecipe");
Constructor constructor = clazz.getDeclaredConstructor(ItemStack.class, ItemStack.class, float.class, ItemStack.class);
constructor.setAccessible(true);
return constructor.newInstance(input, output, output_count, solution);
} catch (Exception e) {
throw new NullPointerException("Failed to instantiate CrystalRecipe");
}
}
}
@@ -0,0 +1,75 @@
package modtweaker2.mods.factorization.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.areEqual;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.ReflectionHelper;
import modtweaker2.mods.factorization.FactorizationHelper;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.factorization.Crystallizer")
public class Crystallizer {
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output, IItemStack solution, double output_count) {
Object recipe = FactorizationHelper.getCrystallizerRecipe(toStack(input), toStack(output), toStack(solution), (float) output_count);
MineTweakerAPI.apply(new Add(toStack(input), recipe));
}
private static class Add extends BaseListAddition {
private final ItemStack output;
public Add(ItemStack output, Object recipe) {
super("Crystallizer", FactorizationHelper.crystallizer, recipe);
this.output = output;
}
@Override
public String getRecipeInfo() {
return output.getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("Crystallizer", FactorizationHelper.crystallizer, stack);
}
//Returns the output ItemStack
private ItemStack getOutput(Object o) {
return (ItemStack) ReflectionHelper.getObject(o, "output");
}
@Override
public void apply() {
for (Object r : list) {
if (r != null) {
ItemStack output = getOutput(r);
if (output != null && areEqual(output, stack)) {
recipe = r;
break;
}
}
}
list.remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,72 @@
package modtweaker2.mods.factorization.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.areEqual;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.ReflectionHelper;
import modtweaker2.mods.factorization.FactorizationHelper;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.factorization.Lacerator")
public class Lacerator {
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output, double probability) {
Object recipe = FactorizationHelper.getLaceratorRecipe(toStack(input), toStack(output), (float) probability);
MineTweakerAPI.apply(new Add(toStack(input), recipe));
}
private static class Add extends BaseListAddition {
private final ItemStack output;
public Add(ItemStack output, Object recipe) {
super("Lacerator", FactorizationHelper.lacerator, recipe);
this.output = output;
}
@Override
public String getRecipeInfo() {
return output.getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("Lacerator", FactorizationHelper.lacerator, stack);
}
//Returns the output ItemStack
private ItemStack getOutput(Object o) {
return (ItemStack) ReflectionHelper.getObject(o, "output");
}
@Override
public void apply() {
for (Object r : list) {
ItemStack output = getOutput(r);
if (output != null && areEqual(output, stack)) {
recipe = r;
break;
}
}
list.remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,74 @@
package modtweaker2.mods.factorization.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.areEqual;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.ReflectionHelper;
import modtweaker2.mods.factorization.FactorizationHelper;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseMultipleListRemoval;
import modtweaker2.util.BaseMultipleListRemoval.Position;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.factorization.SlagFurnace")
public class SlagFurnace {
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output2, double chance2, IItemStack output1, double chance1) {
Object recipe = FactorizationHelper.getSlagFurnaceRecipe(toStack(input), (float) chance1, toStack(output1), (float) chance2, toStack(output2));
MineTweakerAPI.apply(new Add(toStack(input), recipe));
}
private static class Add extends BaseListAddition {
private final ItemStack input;
public Add(ItemStack input, Object recipe) {
super("Slag Furnace", FactorizationHelper.slag, recipe);
this.input = input;
}
@Override
public String getRecipeInfo() {
return input.getDisplayName();
}
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack input) {
MineTweakerAPI.apply(new Remove(toStack(input), Position.ALL));
}
@ZenMethod
public static void removeFirst(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output), Position.FIRST));
}
@ZenMethod
public static void removeLast(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output), Position.LAST));
}
private static class Remove extends BaseMultipleListRemoval {
public Remove(ItemStack stack, Position pos) {
super("Slag Furnace", FactorizationHelper.slag, stack, pos);
}
@Override
protected boolean isEqual(Object recipe, Object search) {
ItemStack input = (ItemStack) ReflectionHelper.getObject(recipe, "input");
if (input != null && areEqual(input, (ItemStack) search)) {
return true;
} else
return false;
}
@Override
public String getRecipeInfo() {
return ((ItemStack) search).getDisplayName();
}
}
}
@@ -0,0 +1,22 @@
package modtweaker2.mods.forestry;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.forestry.handlers.Carpenter;
import modtweaker2.mods.forestry.handlers.Centrifuge;
import modtweaker2.mods.forestry.handlers.Fermenter;
import modtweaker2.mods.forestry.handlers.Moistener;
import modtweaker2.mods.forestry.handlers.Squeezer;
import modtweaker2.mods.forestry.handlers.Still;
import modtweaker2.mods.forestry.handlers.ThermionicFabricator;
public class Forestry {
public Forestry() {
MineTweakerAPI.registerClass(Fermenter.class);
MineTweakerAPI.registerClass(Still.class);
MineTweakerAPI.registerClass(Moistener.class);
MineTweakerAPI.registerClass(Carpenter.class);
MineTweakerAPI.registerClass(Squeezer.class);
MineTweakerAPI.registerClass(Centrifuge.class);
MineTweakerAPI.registerClass(ThermionicFabricator.class);
}
}
@@ -0,0 +1,51 @@
package modtweaker2.mods.forestry;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashSet;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
public class ForestryHelper {
@SuppressWarnings("unchecked")
public static void addCarpenterRecipeBox(ItemStack box) {
Class clazz;
try {
clazz = Class.forName("forestry.factory.gadgets.MachineCarpenter$RecipeManager");
Field field_box = clazz.getDeclaredField("boxes");
field_box.setAccessible(true);
ArrayList<ItemStack> recipeBoxes = (ArrayList<ItemStack>) field_box.get(clazz);
recipeBoxes.add(box);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
@SuppressWarnings("unchecked")
public static void addCarpenterRecipeFluids(Fluid newFluid) {
Class clazz;
try {
clazz = Class.forName("forestry.factory.gadgets.MachineCarpenter$RecipeManager");
Field field_recipeFluids = clazz.getDeclaredField("recipeFluids");
field_recipeFluids.setAccessible(true);
HashSet<Fluid> recipeFluids = (HashSet<Fluid>) field_recipeFluids.get(clazz);
recipeFluids.add(newFluid);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,91 @@
package modtweaker2.mods.forestry.handlers;
import java.util.ArrayList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.mods.forestry.ForestryHelper;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import forestry.core.utils.ShapedRecipeCustom;
import forestry.factory.gadgets.MachineCarpenter;
import forestry.factory.gadgets.MachineCarpenter.Recipe;
import forestry.factory.gadgets.MachineCarpenter.RecipeManager;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.forestry.Carpenter")
public class Carpenter {
@ZenMethod
public static void addRecipe(int packagingTime, ILiquidStack liquid, IItemStack[] ingredients, IItemStack ingredient, IItemStack product) {
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
for (ItemStack stack : toStacks(ingredients)) {
if (stack != null) {
stacks.add(stack);
}
if (stack == null) {
stacks.add(new ItemStack(Blocks.air));
}
}
MineTweakerAPI.apply(new Add(new Recipe(packagingTime, toFluid(liquid), toStack(ingredient), new ShapedRecipeCustom(3, 3, toStacks(ingredients), toStack(product)))));
}
public ShapedRecipeCustom convertToRecipeCustom() {
return null;
}
private static class Add extends BaseListAddition {
public Add(Recipe recipe) {
super("Forestry Carpenter", MachineCarpenter.RecipeManager.recipes, recipe);
// The Carpenter has a list of valid Fluids, access them via
// Relfection because of private
if (recipe.getLiquid() != null)
ForestryHelper.addCarpenterRecipeFluids(recipe.getLiquid().getFluid());
if(!RecipeManager.isBox(recipe.getBox())){
ForestryHelper.addCarpenterRecipeBox(recipe.getBox());
}
}
public void apply() {
Recipe r = (MachineCarpenter.Recipe)recipe;
}
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(MachineCarpenter.RecipeManager.recipes, toStack(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(List list, ItemStack stack) {
super("Forestry Carpenter", list, stack);
}
@Override
public void apply() {
for (Recipe r : RecipeManager.recipes) {
if (r.getCraftingResult() != null && r.getCraftingResult().isItemEqual(stack)) {
recipe = r;
break;
}
}
RecipeManager.recipes.remove(recipe);
}
}
}
@@ -0,0 +1,78 @@
package modtweaker2.mods.forestry.handlers;
import java.util.HashMap;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import forestry.factory.gadgets.MachineCentrifuge.Recipe;
import forestry.factory.gadgets.MachineCentrifuge.RecipeManager;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.forestry.Centrifuge")
public class Centrifuge {
@ZenMethod
public static void addRecipe(int timePerItem, IItemStack itemInput, IItemStack[] output, int[] chances) {
HashMap<ItemStack, Integer> products = new HashMap<ItemStack, Integer>();
// products.put(toStack(output[0]), chances[0]);
int i = 0;
for (IItemStack product : output) {
products.put(toStack(product), chances[i]);
i++;
}
MineTweakerAPI.apply(new Add(new Recipe(timePerItem, toStack(itemInput), products)));
}
@ZenMethod
public static void removeRecipe(IItemStack itemInput) {
MineTweakerAPI.apply(new Remove(RecipeManager.recipes, toStack(itemInput)));
}
/*
Implements the actions to add the recipe
*/
private static class Add extends BaseListAddition {
public Add(Recipe recipe) {
super("Forestry Centrifuge", RecipeManager.recipes, recipe);
}
@Override
public String getRecipeInfo() {
return " Input:" + ((Recipe) recipe).resource.getDisplayName();
}
}
/*
Implements the actions to remove the recipe
*/
private static class Remove extends BaseListRemoval {
public Remove(List list, ItemStack input) {
super("Forestry Centrifuge", RecipeManager.recipes, input);
}
@Override
public void apply() {
for (Recipe r : RecipeManager.recipes) {
if (r.matches(stack)) {
recipe = r;
RecipeManager.recipes.remove(r);
break;
}
}
}
@Override
public String getRecipeInfo() {
return " Input:" + stack.getDisplayName();
}
}
}
@@ -0,0 +1,68 @@
package modtweaker2.mods.forestry.handlers;
import java.util.ArrayList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import forestry.factory.gadgets.MachineFermenter;
import forestry.factory.gadgets.MachineFermenter.Recipe;
import forestry.factory.gadgets.MachineFermenter.RecipeManager;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.forestry.Fermenter")
public class Fermenter {
@ZenMethod
public static void addRecipe(IItemStack resource, ILiquidStack liquid, int fermentationValue, float modifier, ILiquidStack output) {
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), fermentationValue, modifier, toFluid(output), toFluid(liquid))));
MachineFermenter.RecipeManager.recipeFluidInputs.add(getFluid(liquid));
MachineFermenter.RecipeManager.recipeFluidOutputs.add(getFluid(output));
}
private static class Add extends BaseListAddition {
public Add(Recipe recipe) {
super("Forestry Fermenter", MachineFermenter.RecipeManager.recipes, recipe);
}
@Override
public String getRecipeInfo() {
return ((Recipe) recipe).output.getLocalizedName();
}
}
@ZenMethod
public static void removeRecipe(IItemStack input) {
MineTweakerAPI.apply(new Remove(MachineFermenter.RecipeManager.recipes, toStack(input)));
}
private static class Remove extends BaseListRemoval {
public Remove(List list, ItemStack stack) {
super(list, stack);
}
@Override
public void apply() {
ArrayList<Recipe> recipes = new ArrayList<Recipe>();
for (Recipe r : RecipeManager.recipes) {
if (r != null && r.resource != null && r.resource.isItemEqual(stack)) {
recipes.add(r);
}
}
for (Recipe r : recipes) {
RecipeManager.recipes.remove(r);
}
}
}
}
@@ -0,0 +1,63 @@
package modtweaker2.mods.forestry.handlers;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import forestry.factory.gadgets.MachineMoistener;
import forestry.factory.gadgets.MachineMoistener.Recipe;
import forestry.factory.gadgets.MachineMoistener.RecipeManager;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.forestry.Moistener")
public class Moistener {
@ZenMethod
public static void addRecipe(int timePerItem, IItemStack resource, IItemStack product) {
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), toStack(product), timePerItem)));
}
private static class Add extends BaseListAddition {
public Add(Recipe recipe) {
super("Forestry Moistener", MachineMoistener.RecipeManager.recipes, recipe);
}
@Override
public String getRecipeInfo() {
return ((Recipe) recipe).product.getDisplayName();
}
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(MachineMoistener.RecipeManager.recipes, toStack(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(List list, ItemStack stack) {
super(list, stack);
}
@Override
public void apply() {
for (Recipe r : RecipeManager.recipes) {
if (r.product != null && r.product.isItemEqual(stack)) {
recipe = r;
break;
}
}
RecipeManager.recipes.remove(recipe);
}
}
}
@@ -0,0 +1,64 @@
package modtweaker2.mods.forestry.handlers;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import forestry.factory.gadgets.MachineSqueezer;
import forestry.factory.gadgets.MachineSqueezer.Recipe;
import forestry.factory.gadgets.MachineSqueezer.RecipeManager;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.forestry.Squeezer")
public class Squeezer {
@ZenMethod
public static void addRecipe(int timePerItem, IItemStack[] resources, ILiquidStack liquid, IItemStack remnants, int chance) {
MineTweakerAPI.apply(new Add(new Recipe(timePerItem, toStacks(resources), toFluid(liquid), toStack(remnants), chance)));
MachineSqueezer.RecipeManager.recipeFluids.add(getFluid(liquid));
}
private static class Add extends BaseListAddition {
public Add(Recipe recipe) {
super("Forestry Squeezer", MachineSqueezer.RecipeManager.recipes, recipe);
}
@Override
public String getRecipeInfo() {
return ((Recipe) recipe).liquid.getLocalizedName();
}
}
@ZenMethod
public static void removeRecipe(ILiquidStack liquid) {
MineTweakerAPI.apply(new Remove(MachineSqueezer.RecipeManager.recipes, toFluid(liquid)));
}
private static class Remove extends BaseListRemoval {
public Remove(List list, FluidStack liquid) {
super(list, liquid);
}
@Override
public void apply() {
for (Recipe r : RecipeManager.recipes) {
if (r.liquid != null && r.liquid.isFluidEqual(fluid)) {
recipe = r;
break;
}
}
RecipeManager.recipes.remove(recipe);
}
}
}
@@ -0,0 +1,67 @@
package modtweaker2.mods.forestry.handlers;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import forestry.factory.gadgets.MachineStill;
import forestry.factory.gadgets.MachineStill.Recipe;
import forestry.factory.gadgets.MachineStill.RecipeManager;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.forestry.Still")
public class Still {
@ZenMethod
public static void addRecipe(int timePerUnit, ILiquidStack input, ILiquidStack output) {
output.amount(output.getAmount() / 100);
input.amount(input.getAmount() / 100);
MineTweakerAPI.apply(new Add(new Recipe(timePerUnit, toFluid(input), toFluid(output))));
MachineStill.RecipeManager.recipeFluidInputs.add(getFluid(input));
MachineStill.RecipeManager.recipeFluidOutputs.add(getFluid(output));
}
private static class Add extends BaseListAddition {
public Add(Recipe recipe) {
super("Forestry Still", MachineStill.RecipeManager.recipes, recipe);
}
@Override
public String getRecipeInfo() {
return ((Recipe) recipe).output.getLocalizedName();
}
}
@ZenMethod
public static void removeRecipe(ILiquidStack output, ILiquidStack input) {
MineTweakerAPI.apply(new Remove(MachineStill.RecipeManager.recipes, toFluid(input)));
}
private static class Remove extends BaseListRemoval {
public Remove(List list, FluidStack input) {
super(list, input);
}
@Override
public void apply() {
for (Recipe r : RecipeManager.recipes) {
if (r.output != null && r.output.isFluidEqual(fluid)) {
recipe = r;
break;
}
}
RecipeManager.recipes.remove(recipe);
}
}
}
@@ -0,0 +1,126 @@
package modtweaker2.mods.forestry.handlers;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidRegistry;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import forestry.core.utils.ShapedRecipeCustom;
import forestry.factory.gadgets.MachineFabricator.Recipe;
import forestry.factory.gadgets.MachineFabricator.RecipeManager;
import forestry.factory.gadgets.MachineFabricator.Smelting;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.forestry.ThermionicFabricator")
public class ThermionicFabricator {
//first production step: smelting item into liquid
@ZenMethod
public static void addSmelting(IItemStack itemInput, int meltingPoint, int fluidOutput) {
//The machines internal tank accept only liquid glass, therefor this function only accept the amount and hardcode the fluid to glass
MineTweakerAPI.apply(new Add(new Smelting(toStack(itemInput), FluidRegistry.getFluidStack("glass", fluidOutput), meltingPoint)));
}
@ZenMethod
public static void removeSmelting(IItemStack itemInput) {
MineTweakerAPI.apply(new RemoveSmelting(toStack(itemInput)));
}
//second step: casting liquid + objetcs + plan into result
@ZenMethod
public static void addCast(ILiquidStack fluidInput, IItemStack[][] ingredients, IItemStack plan, IItemStack product) {
ItemStack[] flatList = new ItemStack[9];
for ( int i = 0; i < 3; i++) {
for ( int j = 0; j < 3; j++) {
flatList[i*3 + j] = toStack(ingredients[i][j]);
}
}
MineTweakerAPI.apply(new Add(new Recipe(toStack(plan), toFluid(fluidInput), new ShapedRecipeCustom(3, 3, flatList, toStack(product)))));
}
@ZenMethod
public static void removeCasts(IItemStack product) {
MineTweakerAPI.apply(new RemoveCastings(toStack(product)));
}
/*
Implements the actions to add a recipe
Since the machine has two crafting Steps, this is a constructors for both
*/
private static class Add extends BaseListAddition {
public Add(Smelting recipe) {
super("Forestry Thermionic Fabricator (Smelting)", RecipeManager.smeltings, recipe);
}
public Add(Recipe recipe) {
super("Forestry Thermionic Fabricator (Casting)", RecipeManager.recipes, recipe);
}
@Override
public String getRecipeInfo() {
if (recipe instanceof Smelting)
return " Input:" + ((Smelting) recipe).getResource().getDisplayName();
else
return "Output: " + ((Recipe) recipe).asIRecipe().getRecipeOutput().getDisplayName();
}
}
/*
Implements the actions to remove a smelting recipe
*/
private static class RemoveSmelting extends BaseListRemoval {
public RemoveSmelting(ItemStack input) {
super("Forestry Thermionic Fabricator (Smelting)", RecipeManager.smeltings, input);
}
@Override
public void apply() {
for (Smelting r : RecipeManager.smeltings) {
if (r.getResource() != null && r.getResource().isItemEqual(stack)) {
RecipeManager.smeltings.remove(r);
recipe = r;
break;
}
}
}
@Override
public String getRecipeInfo() {
return " Input:" + stack.getDisplayName(); // + " -- Output:" + ((Smelting) recipe).getProduct().getLocalizedName();
}
}
/*
Implements the actions to remove a casting recipe
*/
private static class RemoveCastings extends BaseListRemoval {
public RemoveCastings(ItemStack output) {
super("Forestry Thermionic Fabricator (Casting)", RecipeManager.recipes, output);
}
@Override
public void apply() {
for (Recipe r : RecipeManager.recipes) {
if (r.asIRecipe().getRecipeOutput() != null && r.asIRecipe().getRecipeOutput().isItemEqual(stack)) {
RecipeManager.recipes.remove(r);
recipe = r;
}
}
}
@Override
public String getRecipeInfo() {
return " Output:" + stack.getDisplayName(); // + " -- Output:" + ((Recipe) recipe).asIRecipe().getIngredients()[0].getDisplayName();
}
}
}
@@ -0,0 +1,16 @@
package modtweaker2.mods.fsp;
import flaxbeard.steamcraft.api.CrucibleLiquid;
import flaxbeard.steamcraft.api.SteamcraftRegistry;
public class FSPHelper {
public static CrucibleLiquid getLiquid(String name) {
for (CrucibleLiquid l : SteamcraftRegistry.liquids) {
if (l.name.equals(name)) {
return l;
}
}
return null;
}
}
@@ -0,0 +1,12 @@
package modtweaker2.mods.fsp;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.fsp.handlers.Crucible;
import modtweaker2.mods.fsp.handlers.Furnace;
public class Steamcraft {
public Steamcraft() {
MineTweakerAPI.registerClass(Crucible.class);
MineTweakerAPI.registerClass(Furnace.class);
}
}
@@ -0,0 +1,133 @@
package modtweaker2.mods.fsp.handlers;
import static modtweaker2.mods.fsp.FSPHelper.getLiquid;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseMapAddition;
import modtweaker2.util.BaseMapRemoval;
import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.tuple.MutablePair;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import flaxbeard.steamcraft.api.CrucibleFormula;
import flaxbeard.steamcraft.api.CrucibleLiquid;
import flaxbeard.steamcraft.api.SteamcraftRegistry;
import flaxbeard.steamcraft.api.Tuple3;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.fsp.Crucible")
public class Crucible {
@ZenMethod
public static void addLiquid(String name, IItemStack ingot, IItemStack plate, IItemStack nugget, int r, int g, int b) {
MineTweakerAPI.apply(new AddLiquid(new CrucibleLiquid(name, toStack(ingot), toStack(plate), toStack(nugget), null, r, g, b)));
}
@ZenMethod
public static void addLiquid(String name, IItemStack ingot, IItemStack plate, IItemStack nugget, int r, int g, int b, String l1, int n1, String l2, int n2, int n3) {
MineTweakerAPI.apply(new AddLiquid(new CrucibleLiquid(name, toStack(ingot), toStack(plate), toStack(nugget), new CrucibleFormula(getLiquid(l1), n1, getLiquid(l2), n2, n3), r, g, b)));
}
private static class AddLiquid extends BaseListAddition {
public AddLiquid(CrucibleLiquid recipe) {
super("FSP Crucible Liquid", SteamcraftRegistry.liquids, recipe);
}
@Override
public String getRecipeInfo() {
return ((CrucibleLiquid) recipe).name;
}
}
@ZenMethod
public static void addMelting(IItemStack input, String liquid, int volume) {
ItemStack stack = toStack(input);
CrucibleLiquid fluid = getLiquid(liquid);
if (fluid != null) {
MineTweakerAPI.apply(new AddMelting(stack, MutablePair.of(stack.getItem(), stack.getItemDamage()), MutablePair.of(fluid, volume)));
}
}
private static class AddMelting extends BaseMapAddition {
private final ItemStack stack;
public AddMelting(ItemStack stack, Object key, Object recipe) {
super("FSP Crucible Melting", SteamcraftRegistry.smeltThings, key, recipe);
this.stack = stack;
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
@ZenMethod
public static void removeMelting(IItemStack input) {
MineTweakerAPI.apply(new RemoveMelting(toStack(input), MutablePair.of(toStack(input).getItem(), toStack(input).getItemDamage())));
}
private static class RemoveMelting extends BaseMapRemoval {
private final ItemStack stack;
public RemoveMelting(ItemStack stack, Object key) {
super("FSP Crucible Melting", SteamcraftRegistry.smeltThings, key);
this.stack = stack;
}
public void apply(){
SteamcraftRegistry.smeltThings.remove(stack);
MutablePair<String, Integer> pair;
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
@ZenMethod
public static void addDunking(IItemStack input, String liquid, int volume, IItemStack output) {
ItemStack stack = toStack(input);
CrucibleLiquid fluid = getLiquid(liquid);
if (fluid != null) {
MineTweakerAPI.apply(new AddDunking(toStack(input), new Tuple3(stack.getItem(), stack.getItemDamage(), fluid), MutablePair.of(volume, toStack(output))));
}
}
private static class AddDunking extends BaseMapAddition {
private final ItemStack stack;
public AddDunking(ItemStack stack, Object key, Object recipe) {
super("FSP Crucible Dunking", SteamcraftRegistry.dunkThings, key, recipe);
this.stack = stack;
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
@ZenMethod
public static void removeDunking(IItemStack input, String liquid) {
MineTweakerAPI.apply(new RemoveDunking(toStack(input), new Tuple3(toStack(input).getItem(), toStack(input).getItemDamage(), getLiquid(liquid))));
}
private static class RemoveDunking extends BaseMapRemoval {
private final ItemStack stack;
public RemoveDunking(ItemStack stack, Object key) {
super("FSP Crucible Dunking", SteamcraftRegistry.dunkThings, key);
this.stack = stack;
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,56 @@
package modtweaker2.mods.fsp.handlers;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseMapAddition;
import modtweaker2.util.BaseMapRemoval;
import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.tuple.MutablePair;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import flaxbeard.steamcraft.api.SteamcraftRegistry;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.fsp.Furnace")
public class Furnace {
@ZenMethod
public static void addSteamFood(IItemStack input, IItemStack output) {
MineTweakerAPI.apply(new AddSteamFood(toStack(input), MutablePair.of(toStack(input).getItem(), toStack(input).getItemDamage()), MutablePair.of(toStack(output).getItem(), toStack(output).getItemDamage())));
}
private static class AddSteamFood extends BaseMapAddition {
private final ItemStack stack;
public AddSteamFood(ItemStack stack, MutablePair key, MutablePair recipe) {
super("FSP Furnace - Steam Food", SteamcraftRegistry.steamedFoods, key, recipe);
this.stack = stack;
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
@ZenMethod
public static void removeSteamFood(IItemStack input) {
MineTweakerAPI.apply(new RemoveSteamFood(toStack(input), MutablePair.of(toStack(input).getItem(), toStack(input).getItemDamage())));
}
private static class RemoveSteamFood extends BaseMapRemoval {
private final ItemStack stack;
public RemoveSteamFood(ItemStack stack, MutablePair key) {
super("FSP Furnace - Steam Food", SteamcraftRegistry.steamedFoods, key);
this.stack = stack;
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,10 @@
package modtweaker2.mods.hee;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.hee.handlers.EssenceAltar;
public class HardcoreEnderExpansion {
public HardcoreEnderExpansion() {
MineTweakerAPI.registerClass(EssenceAltar.class);
}
}
@@ -0,0 +1,76 @@
package modtweaker2.mods.hee.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.areEqual;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.ReflectionHelper;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import chylex.hee.mechanics.essence.handler.DragonEssenceHandler;
import chylex.hee.mechanics.essence.handler.dragon.AltarItemRecipe;
@ZenClass("mods.hee.EssenceAltar")
public class EssenceAltar {
@ZenMethod
public static void addRecipe(IItemStack source, IItemStack result, int cost) {
MineTweakerAPI.apply(new Add(toStack(result), new AltarItemRecipe(toStack(source), toStack(result), cost)));
}
private static class Add extends BaseListAddition {
private final ItemStack result;
public Add(ItemStack result, AltarItemRecipe recipe) {
super("Essence Altar", DragonEssenceHandler.recipes, recipe);
this.result = result;
}
@Override
public String getRecipeInfo() {
return result.getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("Essence Altar", DragonEssenceHandler.recipes, stack);
}
//Returns the output ItemStack
private ItemStack getOutput(Object o) {
return (ItemStack) ReflectionHelper.getObject(o, "result");
}
@Override
public void apply() {
for (AltarItemRecipe r : (List<AltarItemRecipe>) list) {
ItemStack output = getOutput(r);
if (output != null && areEqual(output, stack)) {
recipe = r;
break;
}
}
list.remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,9 @@
package modtweaker2.mods.imc;
import java.util.ArrayList;
public class IMC {
public static ArrayList<ArrayList<String>> IMCmessages = new ArrayList<ArrayList<String>>();
}
@@ -0,0 +1,48 @@
package modtweaker2.mods.imc.handler;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.util.Scanner;
import cpw.mods.fml.common.event.FMLInterModComms;
public class Message {
public static String destination;
public File[] files;
public Scanner fileReader;
public Message(String destination) {
this.destination = destination;
files = new File(destination).listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if (name.toLowerCase().endsWith(".imc")) {
return true;
}
return false;
}
});
try {
for (File file : files) {
this.fileReader = new Scanner(file);
while (fileReader.hasNextLine()) {
String command = fileReader.nextLine().trim();
if (command.toLowerCase().startsWith("sendimc(") && command.substring(command.length() - 1).equals(";")) {
command = command.substring("sendimc(".length()).replace(command.substring(command.length() - 1), "").replace(command.substring(command.length() - 1), "").replaceAll("\"", "");
String[] input = command.split(",");
FMLInterModComms.sendMessage(input[0], input[1], input[2]);
}
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,18 @@
package modtweaker2.mods.mariculture;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.mariculture.handlers.Anvil;
import modtweaker2.mods.mariculture.handlers.Casting;
import modtweaker2.mods.mariculture.handlers.Crucible;
import modtweaker2.mods.mariculture.handlers.Fishing;
import modtweaker2.mods.mariculture.handlers.Vat;
public class Mariculture {
public Mariculture() {
MineTweakerAPI.registerClass(Anvil.class);
MineTweakerAPI.registerClass(Casting.class);
MineTweakerAPI.registerClass(Crucible.class);
MineTweakerAPI.registerClass(Fishing.class);
MineTweakerAPI.registerClass(Vat.class);
}
}
@@ -0,0 +1,49 @@
package modtweaker2.mods.mariculture;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import mariculture.api.core.MaricultureHandlers;
import mariculture.api.fishery.Fishing;
import mariculture.api.fishery.Loot;
import mariculture.api.fishery.Loot.Rarity;
import modtweaker2.helpers.ReflectionHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
public class MaricultureHelper {
public static Map fuels = null;
public static HashMap<Rarity, ArrayList<Loot>> loot = null;
static {
try {
fuels = ReflectionHelper.getFinalObject(MaricultureHandlers.crucible, "fuels");
loot = ReflectionHelper.getFinalObject(Fishing.fishing, "fishing_loot");
} catch (Exception e) {}
}
private MaricultureHelper() {}
//Helper for getting the key that is used when adding/removing fuels
public static String getKey(Object o) {
if (o instanceof String) return (String) o;
else if (o instanceof ItemStack) {
String name = "";
ItemStack stack = (ItemStack) o;
if (OreDictionary.getOreIDs(stack).length > 0) {
name = OreDictionary.getOreName(OreDictionary.getOreIDs(stack)[0]);
} else if (stack.isItemStackDamageable()) {
name = Item.itemRegistry.getNameForObject(stack.getItem()) + "|ignore";
} else {
name = Item.itemRegistry.getNameForObject(stack.getItem()) + "|" + stack.getItemDamage();
}
return name;
} else if (o instanceof FluidStack) {
return ((FluidStack) o).getFluid().getName();
} else return null;
}
}
@@ -0,0 +1,52 @@
package modtweaker2.mods.mariculture.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import mariculture.api.core.IAnvilHandler.RecipeAnvil;
import mariculture.api.core.MaricultureHandlers;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mariculture.MaricultureHelper;
import modtweaker2.util.BaseMapAddition;
import modtweaker2.util.BaseMapRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mariculture.Anvil")
public class Anvil {
//Adding a Mariculture Anvil recipe
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output, int hits) {
MineTweakerAPI.apply(new Add(new RecipeAnvil(toStack(input), toStack(output), hits)));
}
private static class Add extends BaseMapAddition {
public Add(RecipeAnvil recipe) {
super("Mariculture Anvil", MaricultureHandlers.anvil.getRecipes(), MaricultureHelper.getKey(recipe.input), recipe);
}
@Override
public String getRecipeInfo() {
return ((RecipeAnvil) recipe).output.getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Removing a Mariculture Anvil recipe
@ZenMethod
public static void removeRecipe(IItemStack input) {
MineTweakerAPI.apply(new Remove(toStack(input)));
}
private static class Remove extends BaseMapRemoval {
public Remove(ItemStack stack) {
super("Mariculture Anvil", MaricultureHandlers.anvil.getRecipes(), MaricultureHelper.getKey(stack), stack);
}
@Override
public String getRecipeInfo() {
return ((ItemStack) stack).getDisplayName();
}
}
}
@@ -0,0 +1,78 @@
package modtweaker2.mods.mariculture.handlers;
import static modtweaker2.helpers.InputHelper.toFluid;
import static modtweaker2.helpers.InputHelper.toStack;
import java.util.HashMap;
import mariculture.api.core.MaricultureHandlers;
import mariculture.api.core.RecipeCasting;
import mariculture.api.core.RecipeCasting.RecipeNuggetCasting;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.mods.mariculture.MaricultureHelper;
import modtweaker2.util.BaseMapAddition;
import modtweaker2.util.BaseMapRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mariculture.Casting")
public class Casting {
//Adding Mariculture Casting Recipes
@ZenMethod
public static void addNuggetRecipe(ILiquidStack input, IItemStack output) {
MineTweakerAPI.apply(new Add(new RecipeNuggetCasting(toFluid(input), toStack(output)), MaricultureHandlers.casting.getNuggetRecipes()));
}
@ZenMethod
public static void addIngotRecipe(ILiquidStack input, IItemStack output) {
MineTweakerAPI.apply(new Add(new RecipeNuggetCasting(toFluid(input), toStack(output)), MaricultureHandlers.casting.getIngotRecipes()));
}
@ZenMethod
public static void addBlockRecipe(ILiquidStack input, IItemStack output) {
MineTweakerAPI.apply(new Add(new RecipeNuggetCasting(toFluid(input), toStack(output)), MaricultureHandlers.casting.getBlockRecipes()));
}
private static class Add extends BaseMapAddition {
public Add(RecipeCasting recipe, HashMap map) {
super("Mariculture Casting", map, MaricultureHelper.getKey(recipe.fluid), recipe);
}
@Override
public String getRecipeInfo() {
return ((RecipeCasting) recipe).output.getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Removing Mariculture Casting Recipes
@ZenMethod
public static void removeNuggetRecipe(IItemStack input) {
MineTweakerAPI.apply(new Remove(toStack(input), MaricultureHandlers.casting.getNuggetRecipes()));
}
@ZenMethod
public static void removeIngotRecipe(IItemStack input) {
MineTweakerAPI.apply(new Remove(toStack(input), MaricultureHandlers.casting.getIngotRecipes()));
}
@ZenMethod
public static void removeBlockRecipe(IItemStack input) {
MineTweakerAPI.apply(new Remove(toStack(input), MaricultureHandlers.casting.getBlockRecipes()));
}
private static class Remove extends BaseMapRemoval {
public Remove(ItemStack stack, HashMap map) {
super("Mariculture Casting", map, MaricultureHelper.getKey(stack), stack);
}
@Override
public String getRecipeInfo() {
return ((ItemStack) stack).getDisplayName();
}
}
}
@@ -0,0 +1,139 @@
package modtweaker2.mods.mariculture.handlers;
import static modtweaker2.helpers.InputHelper.toFluid;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.areEqual;
import mariculture.api.core.FuelInfo;
import mariculture.api.core.MaricultureHandlers;
import mariculture.api.core.RecipeSmelter;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.mods.mariculture.MaricultureHelper;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import modtweaker2.util.BaseMapAddition;
import modtweaker2.util.BaseMapRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.Optional;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mariculture.Crucible")
public class Crucible {
/********************************************** Mariculture Crucible Recipes **********************************************/
// Adding a Mariculture Crucible recipe
@ZenMethod
public static void addRecipe(int temp, IItemStack input, ILiquidStack fluid, @Optional IItemStack output, @Optional int chance) {
ItemStack out = output != null ? toStack(output) : null;
MineTweakerAPI.apply(new AddRecipe(new RecipeSmelter(toStack(input), null, temp, toFluid(fluid), out, chance)));
}
// Passes the list to the base list implementation, and adds the recipe
private static class AddRecipe extends BaseListAddition {
public AddRecipe(RecipeSmelter recipe) {
super("Mariculture Crucible", MaricultureHandlers.crucible.getRecipes(), recipe);
}
@Override
public String getRecipeInfo() {
return ((RecipeSmelter) recipe).input.getDisplayName();
}
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Removing a Mariculture Crucible recipe
@ZenMethod
public static void removeRecipe(IItemStack input) {
MineTweakerAPI.apply(new RemoveRecipe(toStack(input)));
}
// Removes a recipe, apply is never the same for anything, so will always
// need to override it
private static class RemoveRecipe extends BaseListRemoval {
public RemoveRecipe(ItemStack stack) {
super("Mariculture Crucible", MaricultureHandlers.crucible.getRecipes(), stack);
}
// Loops through the registry, to find the item that matches, saves that
// recipe then removes it
@Override
public void apply() {
for (RecipeSmelter r : MaricultureHandlers.crucible.getRecipes()) {
if (r != null) {
if (r.input != null && stack != null && areEqual(r.input, stack)) {
recipe = r;
break;
}
}
}
if (recipe != null)
MaricultureHandlers.crucible.getRecipes().remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
/********************************************** Crucible Fuels **********************************************/
@ZenMethod
public static void addFuel(IItemStack input, int max, int per, int time) {
MineTweakerAPI.apply(new AddFuel(toStack(input), new FuelInfo(max, per, time)));
}
@ZenMethod
public static void addFuel(ILiquidStack input, int max, int per, int time) {
MineTweakerAPI.apply(new AddFuel(toFluid(input), new FuelInfo(max, per, time)));
}
@ZenMethod
public static void addFuel(String input, int max, int per, int time) {
MineTweakerAPI.apply(new AddFuel(input, new FuelInfo(max, per, time)));
}
// Passes the list to the base map implementation, and adds the recipe
private static class AddFuel extends BaseMapAddition {
public AddFuel(Object o, FuelInfo info) {
super("Mariculture Crucible Fuel", MaricultureHelper.fuels, MaricultureHelper.getKey(o), info);
}
@Override
public String getRecipeInfo() {
return (String) key;
}
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeFuel(IItemStack fuel) {
MineTweakerAPI.apply(new RemoveFuel(fuel));
}
@ZenMethod
public static void removeFuel(ILiquidStack fuel) {
MineTweakerAPI.apply(new RemoveFuel(fuel));
}
@ZenMethod
public static void removeFuel(String fuel) {
MineTweakerAPI.apply(new RemoveFuel(fuel));
}
// Removes a recipe, will always remove the key, so all should be good
private static class RemoveFuel extends BaseMapRemoval {
public RemoveFuel(Object o) {
super("Mariculture Crucible Fuel", MaricultureHelper.fuels, MaricultureHelper.getKey(o), null);
}
@Override
public String getRecipeInfo() {
return (String) key;
}
}
}
@@ -0,0 +1,159 @@
package modtweaker2.mods.mariculture.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.areEqual;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import mariculture.api.fishery.Loot;
import mariculture.api.fishery.Loot.Rarity;
import mariculture.api.fishery.RodType;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.ReflectionHelper;
import modtweaker2.mods.mariculture.MaricultureHelper;
import modtweaker2.util.BaseDescriptionAddition;
import modtweaker2.util.BaseDescriptionRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.Optional;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import cpw.mods.fml.common.Loader;
@ZenClass("mods.mariculture.Fishing")
public class Fishing {
//HashMap Helper for converting strings to rodtypes, (will personally add a registry to mariculture eventually...)
public static HashMap<String, RodType> rodTypes = new HashMap();
static {
rodTypes.put("net", RodType.NET);
rodTypes.put("old", RodType.OLD);
rodTypes.put("good", RodType.GOOD);
rodTypes.put("dire", RodType.DIRE);
rodTypes.put("super", RodType.SUPER);
rodTypes.put("flux", RodType.FLUX);
if (Loader.isModLoaded("AWWayofTime")) {
try {
rodTypes.put("blood", (RodType) ReflectionHelper.getStaticObject(Class.forName("mariculture.plugins.PluginBloodMagic"), "BLOOD"));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
//Adding Fishing Loot
@ZenMethod
public static void addJunk(IItemStack loot, double chance, @Optional String type, @Optional boolean exact, @Optional int[] dimension) {
addLoot(toStack(loot), chance, type, exact, dimension, Rarity.JUNK);
}
@ZenMethod
public static void addGood(IItemStack loot, double chance, @Optional String type, @Optional boolean exact, @Optional int[] dimension) {
addLoot(toStack(loot), chance, type, exact, dimension, Rarity.GOOD);
}
@ZenMethod
public static void addRare(IItemStack loot, double chance, @Optional String type, @Optional boolean exact, @Optional int[] dimension) {
addLoot(toStack(loot), chance, type, exact, dimension, Rarity.RARE);
}
private static void addLoot(ItemStack stack, double chance, String type, boolean exact, int[] dimension, Rarity rarity) {
if (dimension == null || dimension.length == 0) dimension = new int[] { Short.MAX_VALUE };
if (type == null) type = "dire";
for (int dim : dimension) {
MineTweakerAPI.apply(new AddLoot(new Loot(stack, chance, rarity, dim, rodTypes.get(type), exact), rarity.name()));
}
}
private static class AddLoot extends BaseDescriptionAddition {
private final Loot loot;
public AddLoot(Loot loot, String description) {
super("Fishing Loot - " + description);
this.loot = loot;
}
@Override
public void apply() {
ArrayList<Loot> list = MaricultureHelper.loot.get(loot.rarity);
list.add(loot);
MaricultureHelper.loot.put(loot.rarity, list);
}
@Override
public void undo() {
ArrayList<Loot> list = MaricultureHelper.loot.get(loot.rarity);
list.remove(loot);
MaricultureHelper.loot.put(loot.rarity, list);
}
@Override
public String getRecipeInfo() {
return loot.loot.getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Removing Fishing Loot, will remove it from every single list
@ZenMethod
public static void removeLoot(IItemStack loot) {
MineTweakerAPI.apply(new RemoveLoot(toStack(loot)));
}
private static class RemoveLoot extends BaseDescriptionRemoval {
private HashMap<Rarity, Loot> loot;
private final ItemStack stack;
public RemoveLoot(ItemStack stack) {
super("Fishing Loot");
this.loot = new HashMap();
this.stack = stack;
}
@Override
public void apply() {
loot.clear();
apply(Rarity.JUNK);
apply(Rarity.GOOD);
apply(Rarity.RARE);
}
//Performs the apply function on all rarity types
public void apply(Rarity rarity) {
ArrayList<Loot> list = MaricultureHelper.loot.get(rarity);
int preSize = list.size();
for (Loot l : list) {
if (areEqual(l.loot, stack)) {
loot.put(rarity, l);
break;
}
}
list.remove(loot);
if (list.size() != preSize) MaricultureHelper.loot.put(rarity, list);
}
@Override
public void undo() {
for (Map.Entry<Rarity, Loot> entry : loot.entrySet()) {
undo(entry.getKey(), entry.getValue());
}
}
//Undoes the action on the applicable rarities
public void undo(Rarity rarity, Loot l) {
ArrayList<Loot> list = MaricultureHelper.loot.get(rarity);
list.add(l);
MaricultureHelper.loot.put(rarity, list);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}
@@ -0,0 +1,135 @@
package modtweaker2.mods.mariculture.handlers;
import mariculture.api.core.MaricultureHandlers;
import mariculture.api.core.RecipeVat;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.mariculture.Vat")
public class Vat {
// Adding a Mariculture Vat recipe
@ZenMethod
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, ILiquidStack outputFluid, int time) {
addRecipe(fluid1, fluid2, null, outputFluid, null, time);
}
@ZenMethod
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack outputItem, int time) {
addRecipe(fluid1, fluid2, null, null, outputItem, time);
}
@ZenMethod
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, ILiquidStack outputFluid, IItemStack outputItem, int time) {
addRecipe(fluid1, fluid2, null, outputFluid, outputItem, time);
}
@ZenMethod
public static void addRecipe(ILiquidStack fluid1, IItemStack input, ILiquidStack outputFluid, int time) {
addRecipe(fluid1, null, input, outputFluid, null, time);
}
@ZenMethod
public static void addRecipe(ILiquidStack fluid1, IItemStack input, IItemStack outputItem, int time) {
addRecipe(fluid1, null, input, null, outputItem, time);
}
@ZenMethod
public static void addRecipe(ILiquidStack fluid1, IItemStack input, ILiquidStack outputFluid, IItemStack outputItem, int time) {
addRecipe(fluid1, null, input, outputFluid, outputItem, time);
}
@ZenMethod
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack input, ILiquidStack outputFluid, int time) {
addRecipe(fluid1, fluid2, input, outputFluid, null, time);
}
@ZenMethod
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack input, IItemStack outputItem, int time) {
addRecipe(fluid1, fluid2, input, null, outputItem, time);
}
@ZenMethod
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack input, ILiquidStack outputFluid, IItemStack outputItem, int time) {
MineTweakerAPI.apply(new Add(new RecipeVat(toStack(input), toFluid(fluid1), toFluid(fluid2), toFluid(outputFluid), toStack(outputItem), time)));
}
// Passes the list to the base list implementation, and adds the recipe
private static class Add extends BaseListAddition {
public Add(RecipeVat recipe) {
super("Mariculture Vat", MaricultureHandlers.vat.getRecipes(), recipe);
}
@Override
public String getRecipeInfo() {
if (((RecipeVat) recipe).outputItem != null)
return ((RecipeVat) recipe).outputItem.getDisplayName();
else
return ((RecipeVat) recipe).outputFluid.getFluid().getLocalizedName();
}
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Removing a Mariculture Vat recipe
@ZenMethod
public static void removeRecipe(IItemStack outputItem) {
MineTweakerAPI.apply(new Remove(toStack(outputItem), null));
}
@ZenMethod
public static void removeRecipe(ILiquidStack outputFluid) {
MineTweakerAPI.apply(new Remove(null, toFluid(outputFluid)));
}
@ZenMethod
public static void removeRecipe(IItemStack outputItem, ILiquidStack outputFluid) {
MineTweakerAPI.apply(new Remove(toStack(outputItem), toFluid(outputFluid)));
}
// Removes a recipe, apply is never the same for anything, so will always
// need to override it
private static class Remove extends BaseListRemoval {
private final FluidStack fluid;
public Remove(ItemStack stack, FluidStack fluid) {
super("Mariculture Vat", MaricultureHandlers.vat.getRecipes(), stack);
this.fluid = fluid;
}
// Loops through the registry, to find the item that matches, saves that
// recipe then removes it
@Override
public void apply() {
for (RecipeVat r : MaricultureHandlers.vat.getRecipes()) {
if (r != null)
if (r.outputItem != null && stack != null && areEqual(r.outputItem, stack)) {
if (r.outputFluid == null || (fluid != null && r.outputFluid.isFluidStackIdentical(fluid))) {
recipe = r;
break;
}
}
if ((r.outputFluid != null && fluid != null && r.outputFluid.isFluidStackIdentical(fluid))) {
recipe = r;
break;
}
}
if (recipe != null)
MaricultureHandlers.vat.getRecipes().remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack != null ? stack.getDisplayName() : fluid.getFluid().getLocalizedName();
}
}
}
@@ -0,0 +1,41 @@
package modtweaker2.mods.mekanism;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.mekanism.gas.GasBracketHandler;
import modtweaker2.mods.mekanism.handlers.ChemicalCrystallizer;
import modtweaker2.mods.mekanism.handlers.ChemicalDissolution;
import modtweaker2.mods.mekanism.handlers.ChemicalInfuser;
import modtweaker2.mods.mekanism.handlers.ChemicalInjection;
import modtweaker2.mods.mekanism.handlers.ChemicalOxidizer;
import modtweaker2.mods.mekanism.handlers.ChemicalWasher;
import modtweaker2.mods.mekanism.handlers.Combiner;
import modtweaker2.mods.mekanism.handlers.Compressor;
import modtweaker2.mods.mekanism.handlers.Crusher;
import modtweaker2.mods.mekanism.handlers.Enrichment;
import modtweaker2.mods.mekanism.handlers.Infuser;
import modtweaker2.mods.mekanism.handlers.Purification;
import modtweaker2.mods.mekanism.handlers.Reaction;
import modtweaker2.mods.mekanism.handlers.Sawmill;
import modtweaker2.mods.mekanism.handlers.Separator;
import modtweaker2.util.TweakerPlugin;
public class Mekanism extends TweakerPlugin {
public Mekanism() {
MineTweakerAPI.registerBracketHandler(new GasBracketHandler());
MineTweakerAPI.registerClass(Combiner.class);
MineTweakerAPI.registerClass(Compressor.class);
MineTweakerAPI.registerClass(Crusher.class);
MineTweakerAPI.registerClass(Enrichment.class);
MineTweakerAPI.registerClass(Infuser.class);
MineTweakerAPI.registerClass(Purification.class);
MineTweakerAPI.registerClass(Reaction.class);
MineTweakerAPI.registerClass(Sawmill.class);
MineTweakerAPI.registerClass(Separator.class);
MineTweakerAPI.registerClass(ChemicalCrystallizer.class);
MineTweakerAPI.registerClass(ChemicalDissolution.class);
MineTweakerAPI.registerClass(ChemicalInfuser.class);
MineTweakerAPI.registerClass(ChemicalInjection.class);
MineTweakerAPI.registerClass(ChemicalOxidizer.class);
MineTweakerAPI.registerClass(ChemicalWasher.class);
}
}
@@ -0,0 +1,27 @@
package modtweaker2.mods.mekanism;
import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack;
import minetweaker.api.item.IIngredient;
import modtweaker2.mods.mekanism.gas.IGasStack;
public class MekanismHelper {
private MekanismHelper() {}
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(IIngredient[] input) {
return toGases((IGasStack[]) input);
}
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,85 @@
package modtweaker2.mods.mekanism.gas;
import java.util.List;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack;
import minetweaker.IBracketHandler;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.BracketHandler;
import minetweaker.api.item.IngredientAny;
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;
@BracketHandler(priority = 100)
public class GasBracketHandler implements IBracketHandler {
public static IGasStack getGas(String name) {
Gas gas = GasRegistry.getGas(name);
if (gas != null) {
return new MCGasStack(new GasStack(gas, 1));
} else {
return null;
}
}
private final IZenSymbol symbolAny;
private final IJavaMethod method;
public GasBracketHandler() {
symbolAny = MineTweakerAPI.getJavaStaticFieldSymbol(IngredientAny.class, "INSTANCE");
method = MineTweakerAPI.getJavaMethod(GasBracketHandler.class, "getGas", String.class);
}
@Override
public IZenSymbol resolve(IEnvironmentGlobal environment, List<Token> tokens) {
// any symbol
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 position) {
return new ExpressionCallStatic(position, environment, method, new ExpressionString(position, name));
}
}
}
@@ -0,0 +1,38 @@
package modtweaker2.mods.mekanism.gas;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
public class GasLogger implements ICommandFunction {
public static final Comparator<Gas> COMPARATOR = new Compare();
private static class Compare implements Comparator<Gas> {
@Override
public int compare(Gas o1, Gas o2) {
return o1.getName().compareTo(o2.getName());
}
}
@Override
public void execute(String[] arguments, IPlayer player) {
List<Gas> gases = GasRegistry.getRegisteredGasses();
System.out.println("Gases: " + GasRegistry.getRegisteredGasses().size());
Collections.sort(gases, COMPARATOR);
for (Gas gas : gases) {
System.out.println("Gas " + gas.getName());
MineTweakerAPI.logCommand("<" + gas.getName() + "> -- " + gas.getLocalizedName());
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
@@ -0,0 +1,18 @@
package modtweaker2.mods.mekanism.gas;
import stanhebben.zenscript.annotations.OperatorType;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenOperator;
@ZenClass("modtweaker.gas.IGasDefinition")
public interface IGasDefinition {
@ZenOperator(OperatorType.MUL)
public IGasStack asStack(int millibuckets);
@ZenGetter("name")
public String getName();
@ZenGetter("displayName")
public String getDisplayName();
}
@@ -0,0 +1,28 @@
package modtweaker2.mods.mekanism.gas;
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("modtweaker.gas.IGasStack")
public interface IGasStack {
@ZenGetter("definition")
public IGasDefinition getDefinition();
@ZenGetter("name")
public String getName();
@ZenGetter("displayName")
public String getDisplayName();
@ZenGetter("amount")
public int getAmount();
@ZenOperator(OperatorType.MUL)
@ZenMethod
public IGasStack withAmount(int amount);
public Object getInternal();
}
@@ -0,0 +1,28 @@
package modtweaker2.mods.mekanism.gas;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
public class MCGasDefinition implements IGasDefinition {
private final Gas gas;
public MCGasDefinition(Gas gas) {
this.gas = gas;
}
@Override
public String getName() {
return gas.getName();
}
@Override
public String getDisplayName() {
return gas.getLocalizedName();
}
@Override
public IGasStack asStack(int millibuckets) {
return new MCGasStack(new GasStack(gas, millibuckets));
}
}
@@ -0,0 +1,45 @@
package modtweaker2.mods.mekanism.gas;
import mekanism.api.gas.GasStack;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
public class MCGasStack implements IGasStack {
private final GasStack stack;
public MCGasStack(GasStack stack) {
this.stack = stack;
}
@Override
public IGasDefinition getDefinition() {
return new MCGasDefinition(stack.getGas());
}
@Override
public String getName() {
return stack.getGas().getName();
}
@Override
public String getDisplayName() {
return stack.getGas().getLocalizedName();
}
@Override
public int getAmount() {
return stack.amount;
}
@Override
public IGasStack withAmount(int amount) {
GasStack result = new GasStack(stack.getGas(), amount);
return new MCGasStack(result);
}
@Override
public Object getInternal() {
return stack;
}
}
@@ -0,0 +1,25 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.mods.mekanism.MekanismHelper.toGas;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mekanism.gas.IGasStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.chemical.Crystallizer")
public class ChemicalCrystallizer {
@ZenMethod
public static void addRecipe(IGasStack input, IItemStack output) {
MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_CRYSTALLIZER", Recipe.CHEMICAL_CRYSTALLIZER.get(), toGas(input), toStack(output)));
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_CRYSTALLIZER", Recipe.CHEMICAL_CRYSTALLIZER.get(), toStack(output)));
}
}
@@ -0,0 +1,78 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.mods.mekanism.MekanismHelper.toGas;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.oredict.IOreDictEntry;
import modtweaker2.helpers.InputHelper;
import modtweaker2.mods.mekanism.gas.IGasStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.mekanism.chemical.Dissolution")
public class ChemicalDissolution {
@ZenMethod
public static void addRecipe(IItemStack input, IGasStack output) {
MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), toStack(input), toGas(output)));
}
@ZenMethod
public static void removeRecipe(IItemStack input) {
MineTweakerAPI.apply(new Remove("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), toStack(input)));
}
@ZenMethod
public static void removeRecipe(IOreDictEntry input) {
List<ItemStack> stacks = OreDictionary.getOres(InputHelper.toString(input));
for (ItemStack stack : stacks) {
MineTweakerAPI.apply(new Remove("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), stack));
}
}
@ZenMethod
public static void removeRecipe(IGasStack input) {
MineTweakerAPI.apply(new Remove("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), toGas(input)));
}
private static class Remove extends RemoveMekanismRecipe {
public Remove(String string, Map map, Object key) {
super(string, map, key);
}
@Override
public void apply() {
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
ItemStack key = (ItemStack) pairs.getKey();
GasStack value = (GasStack) pairs.getValue();
if (key != null) {
if (this.key instanceof ItemStack && areEqual(key, (ItemStack) this.key)) {
this.key = key;
break;
} else if (this.key instanceof GasStack && value.isGasEqual((GasStack) this.key)) {
this.key = key;
break;
}
}
}
recipe = map.get(key);
map.remove(key);
}
}
}
@@ -0,0 +1,25 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.mods.mekanism.MekanismHelper.toGas;
import mekanism.api.ChemicalPair;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.mekanism.gas.IGasStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.chemical.Infuser")
public class ChemicalInfuser {
@ZenMethod
public static void addRecipe(IGasStack left, IGasStack right, IGasStack out) {
ChemicalPair pair = new ChemicalPair(toGas(left), toGas(right));
MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INFUSER", Recipe.CHEMICAL_INFUSER.get(), pair, toGas(out)));
}
@ZenMethod
public static void removeRecipe(IGasStack output) {
MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_INFUSER", Recipe.CHEMICAL_INFUSER.get(), toGas(output)));
}
}
@@ -0,0 +1,27 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.mods.mekanism.MekanismHelper.toGas;
import mekanism.api.AdvancedInput;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mekanism.gas.IGasStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.chemical.Injection")
public class ChemicalInjection {
@ZenMethod
public static void addRecipe(IItemStack input, IGasStack gas, IItemStack output) {
AdvancedInput aInput = new AdvancedInput(toStack(input), toGas(gas).getGas());
MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INJECTION_CHAMBER", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), aInput, toStack(output)));
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_INJECTION_CHAMBER", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), toStack(output)));
}
}
@@ -0,0 +1,25 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.mods.mekanism.MekanismHelper.toGas;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mekanism.gas.IGasStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.chemical.Oxidizer")
public class ChemicalOxidizer {
@ZenMethod
public static void addRecipe(IItemStack input, IGasStack output) {
MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_OXIDIZER", Recipe.CHEMICAL_OXIDIZER.get(), toStack(input), toGas(output)));
}
@ZenMethod
public static void removeRecipe(IGasStack output) {
MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_OXIDIZER", Recipe.CHEMICAL_OXIDIZER.get(), toGas(output)));
}
}
@@ -0,0 +1,54 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.mods.mekanism.MekanismHelper.toGas;
import java.util.Iterator;
import java.util.Map;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.mekanism.gas.IGasStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.chemical.Washer")
public class ChemicalWasher {
@ZenMethod
public static void addRecipe(IGasStack input, IGasStack output) {
MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_WASHER", Recipe.CHEMICAL_WASHER.get(), toGas(input), toGas(output)));
}
@ZenMethod
public static void removeRecipe(IGasStack output) {
MineTweakerAPI.apply(new Remove("CHEMICAL_WASHER", Recipe.CHEMICAL_WASHER.get(), toGas(output)));
}
private static class Remove extends RemoveMekanismRecipe {
public Remove(String string, Map map, Object key) {
super(string, map, key);
}
@Override
public void apply() {
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
GasStack key = (GasStack) pairs.getKey();
GasStack value = (GasStack) pairs.getValue();
if (key != null) {
if (this.key instanceof GasStack && value.isGasEqual((GasStack) this.key)) {
this.key = key;
break;
}
}
}
recipe = map.get(key);
map.remove(key);
}
}
}
@@ -0,0 +1,26 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import mekanism.api.AdvancedInput;
import mekanism.api.gas.GasRegistry;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.Combiner")
public class Combiner {
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output) {
AdvancedInput aInput = new AdvancedInput(toStack(input), GasRegistry.getGas("liquidStone"));
MineTweakerAPI.apply(new AddMekanismRecipe("COMBINER", Recipe.COMBINER.get(), aInput, toStack(output)));
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new RemoveMekanismRecipe("COMBINER", Recipe.COMBINER.get(), toStack(output)));
}
}
@@ -0,0 +1,26 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import mekanism.api.AdvancedInput;
import mekanism.api.gas.GasRegistry;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.Compressor")
public class Compressor {
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output) {
AdvancedInput aInput = new AdvancedInput(toStack(input), GasRegistry.getGas("liquidOsmium"));
MineTweakerAPI.apply(new AddMekanismRecipe("OSMIUM_COMPRESSOR", Recipe.OSMIUM_COMPRESSOR.get(), aInput, toStack(output)));
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new RemoveMekanismRecipe("OSMIUM_COMPRESSOR", Recipe.OSMIUM_COMPRESSOR.get(), toStack(output)));
}
}
@@ -0,0 +1,23 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.Crusher")
public class Crusher {
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output) {
MineTweakerAPI.apply(new AddMekanismRecipe("CRUSHER", Recipe.CRUSHER.get(), toStack(input), toStack(output)));
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new RemoveMekanismRecipe("CRUSHER", Recipe.CRUSHER.get(), toStack(output)));
}
}
@@ -0,0 +1,23 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.Enrichment")
public class Enrichment {
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output) {
MineTweakerAPI.apply(new AddMekanismRecipe("ENRICHMENT_CHAMBER", Recipe.ENRICHMENT_CHAMBER.get(), toStack(input), toStack(output)));
}
@ZenMethod
public static void removeRecipe(IItemStack input) {
MineTweakerAPI.apply(new RemoveMekanismRecipe("ENRICHMENT_CHAMBER", Recipe.ENRICHMENT_CHAMBER.get(), toStack(input)));
}
}
@@ -0,0 +1,59 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.areEqual;
import java.util.Iterator;
import java.util.Map;
import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfusionInput;
import mekanism.api.infuse.InfusionOutput;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.Infuser")
public class Infuser {
@ZenMethod
public static void addRecipe(String type, int infuse, IItemStack input, IItemStack output) {
InfusionInput infuseIn = new InfusionInput(InfuseRegistry.get(type), infuse, toStack(input));
InfusionOutput infuseOut = new InfusionOutput(infuseIn, toStack(output));
MineTweakerAPI.apply(new AddMekanismRecipe("METALLURGIC_INFUSER", Recipe.METALLURGIC_INFUSER.get(), infuseIn, infuseOut));
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove("METALLURGIC_INFUSER", Recipe.METALLURGIC_INFUSER.get(), new InfusionOutput(null, toStack(output))));
}
private static class Remove extends RemoveMekanismRecipe {
public Remove(String string, Map map, Object key) {
super(string, map, key);
}
@Override
public void apply() {
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
InfusionInput key = (InfusionInput) pairs.getKey();
InfusionOutput value = (InfusionOutput) pairs.getValue();
if (key != null) {
if (this.key instanceof InfusionOutput && areEqual(value.resource, ((InfusionOutput) this.key).resource)) {
this.key = key;
break;
}
}
}
recipe = map.get(key);
map.remove(key);
}
}
}
@@ -0,0 +1,50 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.areEqual;
import java.util.Map;
import mekanism.api.AdvancedInput;
import mekanism.api.gas.GasRegistry;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.util.BaseMapRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.Purification")
public class Purification {
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output) {
AdvancedInput aInput = new AdvancedInput(toStack(input), GasRegistry.getGas("oxygen"));
MineTweakerAPI.apply(new AddMekanismRecipe("PURIFICATION_CHAMBER", Recipe.PURIFICATION_CHAMBER.get(), aInput, toStack(output)));
}
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
private static class Remove extends BaseMapRemoval {
public Remove(ItemStack stack) {
super("Purification Chamber", Recipe.PURIFICATION_CHAMBER.get(), stack);
}
//We must search through the recipe entries so that we can assign the correct key for removal
@Override
public void apply() {
for (Map.Entry<AdvancedInput, ItemStack> entry : ((Map<AdvancedInput, ItemStack>) map).entrySet()) {
if (entry.getValue() != null && areEqual(entry.getValue(), (ItemStack) stack)) {
key = entry.getKey();
break;
}
}
super.apply();
}
}
}
@@ -0,0 +1,33 @@
package modtweaker2.mods.mekanism.handlers;
import static modtweaker2.helpers.InputHelper.toFluid;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.mods.mekanism.MekanismHelper.toGas;
import mekanism.api.PressurizedProducts;
import mekanism.api.PressurizedReactants;
import mekanism.api.PressurizedRecipe;
import mekanism.common.recipe.RecipeHandler.Recipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.mods.mekanism.gas.IGasStack;
import modtweaker2.mods.mekanism.util.AddMekanismRecipe;
import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.Reaction")
public class Reaction {
@ZenMethod
public static void addRecipe(IItemStack solid, ILiquidStack liquid, IGasStack gas, IItemStack outItem, IGasStack outGas, double energy, int ticks) {
PressurizedReactants input = new PressurizedReactants(toStack(solid), toFluid(liquid), toGas(gas));
PressurizedRecipe recipe = new PressurizedRecipe(input, energy, new PressurizedProducts(toStack(outItem), toGas(outGas)), ticks);
MineTweakerAPI.apply(new AddMekanismRecipe("PRESSURIZED_REACTION_CHAMBER", Recipe.PRESSURIZED_REACTION_CHAMBER.get(), input, recipe));
}
@ZenMethod
public static void removeRecipe(IItemStack outItem, IGasStack outGas) {
PressurizedProducts output = new PressurizedProducts(toStack(outItem), toGas(outGas));
MineTweakerAPI.apply(new RemoveMekanismRecipe("PRESSURIZED_REACTION_CHAMBER", Recipe.PRESSURIZED_REACTION_CHAMBER.get(), output));
}
}
Loaded 100 of 187 files, more files were not shown because too many files have changed in this diff. Show more