From e36dd43b18697669e44bbe0a8b8e6986d11b9df2 Mon Sep 17 00:00:00 2001 From: jaredlll08 Date: Tue, 20 Jan 2015 18:07:46 +0200 Subject: [PATCH] forestry update --- src/main/java/modtweaker/ModTweaker.java | 9 ++++ .../mods/forestry/handlers/Carpenter.java | 2 +- .../mods/forestry/handlers/Centrifuge.java | 2 +- .../mods/forestry/handlers/Fermenter.java | 2 +- .../mods/forestry/handlers/Squeezer.java | 8 +-- .../handlers/ThermionicFabricator.java | 2 +- src/main/java/modtweaker/mods/imc/IMC.java | 10 ++++ .../modtweaker/mods/imc/handler/Message.java | 50 +++++++++++++++++++ 8 files changed, 77 insertions(+), 8 deletions(-) create mode 100644 src/main/java/modtweaker/mods/imc/IMC.java create mode 100644 src/main/java/modtweaker/mods/imc/handler/Message.java diff --git a/src/main/java/modtweaker/ModTweaker.java b/src/main/java/modtweaker/ModTweaker.java index 8f0f9c1..97a3ea4 100644 --- a/src/main/java/modtweaker/ModTweaker.java +++ b/src/main/java/modtweaker/ModTweaker.java @@ -13,6 +13,7 @@ import modtweaker.mods.factorization.Factorization; import modtweaker.mods.forestry.Forestry; import modtweaker.mods.fsp.Steamcraft; import modtweaker.mods.hee.HardcoreEnderExpansion; +import modtweaker.mods.imc.handler.Message; import modtweaker.mods.mariculture.Mariculture; import modtweaker.mods.mekanism.Mekanism; import modtweaker.mods.mekanism.gas.GasLogger; @@ -30,11 +31,19 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent; +import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.relauncher.Side; @Mod(modid = ModProps.modid, name = ModProps.name, dependencies = ModProps.dependencies) public class ModTweaker { + + @EventHandler + public void preInit(FMLPreInitializationEvent event){ + new Message(event.getModConfigurationDirectory().getPath() + "/modtweaker/"); + } @EventHandler public void init(FMLInitializationEvent event) { TweakerPlugin.register("Botania", Botania.class); diff --git a/src/main/java/modtweaker/mods/forestry/handlers/Carpenter.java b/src/main/java/modtweaker/mods/forestry/handlers/Carpenter.java index 7ad58cd..9981e2a 100644 --- a/src/main/java/modtweaker/mods/forestry/handlers/Carpenter.java +++ b/src/main/java/modtweaker/mods/forestry/handlers/Carpenter.java @@ -32,7 +32,7 @@ import forestry.factory.gadgets.MachineCarpenter.RecipeManager; public class Carpenter { @ZenMethod - public static void addRecipe(int packagingTime, ILiquidStack liquid, IItemStack product, IItemStack[] ingredients, IItemStack ingredient) { + public static void addRecipe(int packagingTime, ILiquidStack liquid, IItemStack[] ingredients, IItemStack ingredient, IItemStack product) { ArrayList stacks = new ArrayList(); for (ItemStack stack : toStacks(ingredients)) { if (stack != null) { diff --git a/src/main/java/modtweaker/mods/forestry/handlers/Centrifuge.java b/src/main/java/modtweaker/mods/forestry/handlers/Centrifuge.java index 340309c..b14fcc0 100644 --- a/src/main/java/modtweaker/mods/forestry/handlers/Centrifuge.java +++ b/src/main/java/modtweaker/mods/forestry/handlers/Centrifuge.java @@ -22,7 +22,7 @@ import forestry.factory.gadgets.MachineCentrifuge.RecipeManager; public class Centrifuge { @ZenMethod - public static void addRecipe(IItemStack[] output, int[] chances, int timePerItem, IItemStack itemInput) { + public static void addRecipe(int timePerItem, IItemStack itemInput, int[] chances, IItemStack[] output) { HashMap products = new HashMap(); // products.put(toStack(output[0]), chances[0]); int i = 0; diff --git a/src/main/java/modtweaker/mods/forestry/handlers/Fermenter.java b/src/main/java/modtweaker/mods/forestry/handlers/Fermenter.java index 8ef8597..637641e 100644 --- a/src/main/java/modtweaker/mods/forestry/handlers/Fermenter.java +++ b/src/main/java/modtweaker/mods/forestry/handlers/Fermenter.java @@ -22,7 +22,7 @@ import forestry.factory.gadgets.MachineFermenter.RecipeManager; public class Fermenter { @ZenMethod - public static void addRecipe(IItemStack resource, int fermentationValue, float modifier, ILiquidStack output, ILiquidStack liquid) { + 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)); diff --git a/src/main/java/modtweaker/mods/forestry/handlers/Squeezer.java b/src/main/java/modtweaker/mods/forestry/handlers/Squeezer.java index c1d7ee2..c488fd8 100644 --- a/src/main/java/modtweaker/mods/forestry/handlers/Squeezer.java +++ b/src/main/java/modtweaker/mods/forestry/handlers/Squeezer.java @@ -40,14 +40,14 @@ public class Squeezer { } @ZenMethod - public static void removeRecipe(ILiquidStack output) { - MineTweakerAPI.apply(new Remove(MachineSqueezer.RecipeManager.recipes, toFluid(output))); + 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 stack) { - super(list, stack); + public Remove(List list, FluidStack liquid) { + super(list, liquid); } diff --git a/src/main/java/modtweaker/mods/forestry/handlers/ThermionicFabricator.java b/src/main/java/modtweaker/mods/forestry/handlers/ThermionicFabricator.java index ac4b6f1..b019e17 100644 --- a/src/main/java/modtweaker/mods/forestry/handlers/ThermionicFabricator.java +++ b/src/main/java/modtweaker/mods/forestry/handlers/ThermionicFabricator.java @@ -29,7 +29,7 @@ public class ThermionicFabricator { //first production step: smelting item into liquid @ZenMethod - public static void addSmelting(IItemStack itemInput, int fluidOutput, int meltingPoint) { + 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))); } diff --git a/src/main/java/modtweaker/mods/imc/IMC.java b/src/main/java/modtweaker/mods/imc/IMC.java new file mode 100644 index 0000000..6030b35 --- /dev/null +++ b/src/main/java/modtweaker/mods/imc/IMC.java @@ -0,0 +1,10 @@ +package modtweaker.mods.imc; + +import java.util.ArrayList; +import java.util.List; + +public class IMC { + + public static ArrayList> IMCmessages = new ArrayList>(); + +} diff --git a/src/main/java/modtweaker/mods/imc/handler/Message.java b/src/main/java/modtweaker/mods/imc/handler/Message.java new file mode 100644 index 0000000..b1fc331 --- /dev/null +++ b/src/main/java/modtweaker/mods/imc/handler/Message.java @@ -0,0 +1,50 @@ +package modtweaker.mods.imc.handler; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.util.ArrayList; +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; + } + }); + + for (File file : files) { + try { + 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]); + System.out.println(input[0] + ", " + input[1] + ", " + input[2]); + } + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + } + } +}