diff --git a/ModTweaker2_Client.launch b/ModTweaker2_Client.launch new file mode 100644 index 0000000..1dc175b --- /dev/null +++ b/ModTweaker2_Client.launch @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ModTweaker2_Server.launch b/ModTweaker2_Server.launch new file mode 100644 index 0000000..424ec8b --- /dev/null +++ b/ModTweaker2_Server.launch @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/build.gradle b/build.gradle index da68dbe..ab62150 100644 --- a/build.gradle +++ b/build.gradle @@ -1,27 +1,20 @@ buildscript { repositories { - mavenCentral() + jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' } } -apply plugin: 'forge' -apply plugin: 'java' +apply plugin: 'net.minecraftforge.gradle.forge' -// define the properties file ext.configFile = file "build.properties" configFile.withReader { - // read config. it shall from now on be referenced as simply config or as project.config def prop = new Properties() prop.load(it) project.ext.config = new ConfigSlurper().parse prop @@ -35,6 +28,7 @@ minecraft { version = "${config.minecraft.version}-${config.forge.version}" runDir = "eclipse" replace "@modVersion@", config.mod.version + mappings = "stable_20" } repositories { @@ -44,25 +38,18 @@ repositories { } } -dependencies { - compile "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:api" -} processResources { - // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", config.minecraft.version - // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - // replace version and mcversion expand 'version':project.version, 'mcversion':config.minecraft.version } - - // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } diff --git a/build.properties b/build.properties index 99af6ea..065b026 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,4 @@ -minecraft.version=1.7.10 -forge.version=10.13.4.1448-1.7.10 +minecraft.version=1.8.9 +forge.version=11.15.0.1701 -mod.version=0.9.5 - -forestry.version=4.1.0.43 +mod.version=1.0.0 \ No newline at end of file diff --git a/libs/AuraCascade-552-dev.jar b/libs/AuraCascade-552-dev.jar deleted file mode 100644 index a0838c6..0000000 Binary files a/libs/AuraCascade-552-dev.jar and /dev/null differ diff --git a/libs/Baubles-deobf-1.7.10-1.0.1.10.jar b/libs/Baubles-deobf-1.7.10-1.0.1.10.jar deleted file mode 100644 index 8585569..0000000 Binary files a/libs/Baubles-deobf-1.7.10-1.0.1.10.jar and /dev/null differ diff --git a/libs/Baubles-deobf.jar b/libs/Baubles-deobf.jar new file mode 100644 index 0000000..addccc7 Binary files /dev/null and b/libs/Baubles-deobf.jar differ diff --git a/libs/BloodMagic-1.7.10-1.3.0b-3-deobf.jar b/libs/BloodMagic-1.7.10-1.3.0b-3-deobf.jar deleted file mode 100644 index 8db3ee6..0000000 Binary files a/libs/BloodMagic-1.7.10-1.3.0b-3-deobf.jar and /dev/null differ diff --git a/libs/Botania r1.7-223-deobf.jar b/libs/Botania r1.7-223-deobf.jar deleted file mode 100644 index 95d1e7a..0000000 Binary files a/libs/Botania r1.7-223-deobf.jar and /dev/null differ diff --git a/libs/CTMLib-1.2.0-11.jar b/libs/CTMLib-1.2.0-11.jar deleted file mode 100644 index f4d5905..0000000 Binary files a/libs/CTMLib-1.2.0-11.jar and /dev/null differ diff --git a/libs/Chisel-MC1.8.9-0.0.2.6-api.jar b/libs/Chisel-MC1.8.9-0.0.2.6-api.jar new file mode 100644 index 0000000..3d0fbcb Binary files /dev/null and b/libs/Chisel-MC1.8.9-0.0.2.6-api.jar differ diff --git a/libs/Chisel2_DEV-2.5.0.163-deobf.jar b/libs/Chisel2_DEV-2.5.0.163-deobf.jar deleted file mode 100644 index 7d7bf1e..0000000 Binary files a/libs/Chisel2_DEV-2.5.0.163-deobf.jar and /dev/null differ diff --git a/libs/CoFHCore-[1.7.10]3.0.4B1-308-dev.jar b/libs/CoFHCore-[1.7.10]3.0.4B1-308-dev.jar deleted file mode 100644 index c5b1e44..0000000 Binary files a/libs/CoFHCore-[1.7.10]3.0.4B1-308-dev.jar and /dev/null differ diff --git a/libs/CoFHLib-[1.7.10]1.0.4B1-176-dev.jar b/libs/CoFHLib-[1.7.10]1.0.4B1-176-dev.jar deleted file mode 100644 index a62a2e3..0000000 Binary files a/libs/CoFHLib-[1.7.10]1.0.4B1-176-dev.jar and /dev/null differ diff --git a/libs/CodeChickenCore-1.7.10-1.0.4.29-dev (2).jar b/libs/CodeChickenCore-1.7.10-1.0.4.29-dev (2).jar deleted file mode 100644 index 40a38e3..0000000 Binary files a/libs/CodeChickenCore-1.7.10-1.0.4.29-dev (2).jar and /dev/null differ diff --git a/libs/CodeChickenLib-1.7.10-1.1.1.110-dev.jar b/libs/CodeChickenLib-1.7.10-1.1.1.110-dev.jar deleted file mode 100644 index f7a9ecc..0000000 Binary files a/libs/CodeChickenLib-1.7.10-1.1.1.110-dev.jar and /dev/null differ diff --git a/libs/MineTweaker3-Dev-Full-1.7.10-3.0.10B.jar b/libs/CraftTweaker-Customized-Dev-Full-1.8.8-3.0.2.jar similarity index 52% rename from libs/MineTweaker3-Dev-Full-1.7.10-3.0.10B.jar rename to libs/CraftTweaker-Customized-Dev-Full-1.8.8-3.0.2.jar index 299ae58..8cf8aa0 100644 Binary files a/libs/MineTweaker3-Dev-Full-1.7.10-3.0.10B.jar and b/libs/CraftTweaker-Customized-Dev-Full-1.8.8-3.0.2.jar differ diff --git a/libs/Enchiridion 2-1.7.10-2.0.2a-73-dev.jar b/libs/Enchiridion 2-1.7.10-2.0.2a-73-dev.jar deleted file mode 100644 index 5199e25..0000000 Binary files a/libs/Enchiridion 2-1.7.10-2.0.2a-73-dev.jar and /dev/null differ diff --git a/libs/Ex-Nihilo-1.38-46-deobf.jar b/libs/Ex-Nihilo-1.38-46-deobf.jar deleted file mode 100644 index e5d4837..0000000 Binary files a/libs/Ex-Nihilo-1.38-46-deobf.jar and /dev/null differ diff --git a/libs/ForgeMultipart-1.7.10-1.2.0.345-dev.jar b/libs/ForgeMultipart-1.7.10-1.2.0.345-dev.jar deleted file mode 100644 index 7244bfb..0000000 Binary files a/libs/ForgeMultipart-1.7.10-1.2.0.345-dev.jar and /dev/null differ diff --git a/libs/IC2.Classic.Version.1.1.0.19.Dev.jar b/libs/IC2.Classic.Version.1.1.0.19.Dev.jar deleted file mode 100644 index 8db0d5c..0000000 Binary files a/libs/IC2.Classic.Version.1.1.0.19.Dev.jar and /dev/null differ diff --git a/libs/Mantle-1.7.10-0.3.2.jenkins190-deobf.jar b/libs/Mantle-1.7.10-0.3.2.jenkins190-deobf.jar deleted file mode 100644 index ba29253..0000000 Binary files a/libs/Mantle-1.7.10-0.3.2.jenkins190-deobf.jar and /dev/null differ diff --git a/libs/Mariculture-Deluxe-1.7.10-1.2.4.2-51-dev.jar b/libs/Mariculture-Deluxe-1.7.10-1.2.4.2-51-dev.jar deleted file mode 100644 index 036ae95..0000000 Binary files a/libs/Mariculture-Deluxe-1.7.10-1.2.4.2-51-dev.jar and /dev/null differ diff --git a/libs/Metallurgy-1.7.10-4.0.8.128-deobf.jar b/libs/Metallurgy-1.7.10-4.0.8.128-deobf.jar deleted file mode 100644 index 1357d50..0000000 Binary files a/libs/Metallurgy-1.7.10-4.0.8.128-deobf.jar and /dev/null differ diff --git a/libs/MetallurgyCore-1.7.10-4.0.4.24-deobf.jar b/libs/MetallurgyCore-1.7.10-4.0.4.24-deobf.jar deleted file mode 100644 index 868c458..0000000 Binary files a/libs/MetallurgyCore-1.7.10-4.0.4.24-deobf.jar and /dev/null differ diff --git a/libs/NotEnoughItems-1.7.10-1.0.4.83-dev.jar b/libs/NotEnoughItems-1.7.10-1.0.4.83-dev.jar deleted file mode 100644 index da520d5..0000000 Binary files a/libs/NotEnoughItems-1.7.10-1.0.4.83-dev.jar and /dev/null differ diff --git a/libs/Railcraft_1.7.10-9.7.0.0-dev.jar b/libs/Railcraft_1.7.10-9.7.0.0-dev.jar deleted file mode 100644 index e598037..0000000 Binary files a/libs/Railcraft_1.7.10-9.7.0.0-dev.jar and /dev/null differ diff --git a/libs/Steamcraft-0.27.3-dev.jar b/libs/Steamcraft-0.27.3-dev.jar deleted file mode 100644 index a58eba7..0000000 Binary files a/libs/Steamcraft-0.27.3-dev.jar and /dev/null differ diff --git a/libs/Mekanism-1.7.10-8.1.7.252.jar b/libs/TC-deobf.jar similarity index 56% rename from libs/Mekanism-1.7.10-8.1.7.252.jar rename to libs/TC-deobf.jar index e2731a7..689b114 100644 Binary files a/libs/Mekanism-1.7.10-8.1.7.252.jar and b/libs/TC-deobf.jar differ diff --git a/libs/TConstruct-1.7.10-1.8.7.build982-deobf.jar b/libs/TConstruct-1.7.10-1.8.7.build982-deobf.jar deleted file mode 100644 index f466980..0000000 Binary files a/libs/TConstruct-1.7.10-1.8.7.build982-deobf.jar and /dev/null differ diff --git a/libs/ThermalExpansion-[1.7.10]4.0.3B1-218-dev.jar b/libs/ThermalExpansion-[1.7.10]4.0.3B1-218-dev.jar deleted file mode 100644 index 94a2f7f..0000000 Binary files a/libs/ThermalExpansion-[1.7.10]4.0.3B1-218-dev.jar and /dev/null differ diff --git a/libs/ThermalFoundation-[1.7.10]1.2.0-102-dev.jar b/libs/ThermalFoundation-[1.7.10]1.2.0-102-dev.jar deleted file mode 100644 index e1d406f..0000000 Binary files a/libs/ThermalFoundation-[1.7.10]1.2.0-102-dev.jar and /dev/null differ diff --git a/libs/appliedenergistics2-rv2-stable-10-dev.jar b/libs/appliedenergistics2-rv2-stable-10-dev.jar deleted file mode 100644 index b087987..0000000 Binary files a/libs/appliedenergistics2-rv2-stable-10-dev.jar and /dev/null differ diff --git a/libs/extrautilities-1.2.11-deobf.jar b/libs/extrautilities-1.2.11-deobf.jar deleted file mode 100644 index e4099e5..0000000 Binary files a/libs/extrautilities-1.2.11-deobf.jar and /dev/null differ diff --git a/src/api/java/naruto1310/extendedWorkbench/crafting/ExtendedCraftingManager.java b/src/api/java/naruto1310/extendedWorkbench/crafting/ExtendedCraftingManager.java deleted file mode 100644 index 26a0bfb..0000000 --- a/src/api/java/naruto1310/extendedWorkbench/crafting/ExtendedCraftingManager.java +++ /dev/null @@ -1,141 +0,0 @@ -package naruto1310.extendedWorkbench.crafting; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; - -public class ExtendedCraftingManager -{ - /** The static instance of this class */ - private static final ExtendedCraftingManager instance = new ExtendedCraftingManager(); - - /** A list of all the recipes added */ - private List recipes = new ArrayList(); - - /** - * Returns the static instance of this class - */ - public static final ExtendedCraftingManager getInstance() - { - return instance; - } - - private void addExtendedRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj) - { - String var3 = ""; - int var4 = 0; - int var5 = 0; - int var6 = 0; - - if(par2ArrayOfObj[var4] instanceof String[]) - { - String[] var7 =((String[])par2ArrayOfObj[var4++]); - - for(int var8 = 0; var8 < var7.length; ++var8) - { - String var9 = var7[var8]; - ++var6; - var5 = var9.length(); - var3 = var3 + var9; - } - } - else - { - while(par2ArrayOfObj[var4] instanceof String) - { - String var11 =(String)par2ArrayOfObj[var4++]; - ++var6; - var5 = var11.length(); - var3 = var3 + var11; - } - } - - HashMap var12; - - for(var12 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2) - { - Character var13 =(Character)par2ArrayOfObj[var4]; - ItemStack var14 = null; - - if(par2ArrayOfObj[var4 + 1] instanceof Item) - var14 = new ItemStack((Item)par2ArrayOfObj[var4 + 1], 1, 32767); - if(par2ArrayOfObj[var4 + 1] instanceof Block) - var14 = new ItemStack((Block)par2ArrayOfObj[var4 + 1], 1, 32767); - if(par2ArrayOfObj[var4 + 1] instanceof ItemStack) - var14 =(ItemStack)par2ArrayOfObj[var4 + 1]; - - var12.put(var13, var14); - } - - ItemStack[] var15 = new ItemStack[var5 * var6]; - - for(int var16 = 0; var16 < var5 * var6; ++var16) - { - char var10 = var3.charAt(var16); - - if(var12.containsKey(Character.valueOf(var10))) - var15[var16] = var12.get(Character.valueOf(var10)).copy(); - else - var15[var16] = null; - } - - this.recipes.add(new ExtendedShapedRecipes(var5, var6, var15, par1ItemStack)); - } - - private void addExtendedShapelessRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj) - { - ArrayList var3 = new ArrayList(); - Object[] var4 = par2ArrayOfObj; - int var5 = par2ArrayOfObj.length; - - for(int var6 = 0; var6 < var5; var6++) - { - Object var7 = var4[var6]; - - if(var7 instanceof Item) - var3.add(new ItemStack((Item)var7, 1, 32767)); - else if(var7 instanceof Block) - var3.add(new ItemStack((Block)var7, 1, 32767)); - else if(var7 instanceof ItemStack) - var3.add(((ItemStack)var7).copy()); - else throw new RuntimeException("Invalid shapeless recipy!"); - } - - this.recipes.add(new ExtendedShapelessRecipes(par1ItemStack, var3)); - } - - public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) - { - for(int i = 0; i < this.recipes.size(); i++) - { - IRecipe recipe = this.recipes.get(i); - - if(recipe.matches(inv, world)) - return recipe.getCraftingResult(inv); - } - - return null; - } - - public List getRecipeList() - { - return this.recipes; - } - - public static void addRecipe(ItemStack output, Object ... input) - { - ExtendedCraftingManager.getInstance().addExtendedRecipe(output, input); - } - - public static void addShapelessRecipe(ItemStack output, Object ... input) - { - ExtendedCraftingManager.getInstance().addExtendedShapelessRecipe(output, input); - } -} diff --git a/src/api/java/naruto1310/extendedWorkbench/crafting/ExtendedShapedRecipes.java b/src/api/java/naruto1310/extendedWorkbench/crafting/ExtendedShapedRecipes.java deleted file mode 100644 index 78c6c09..0000000 --- a/src/api/java/naruto1310/extendedWorkbench/crafting/ExtendedShapedRecipes.java +++ /dev/null @@ -1,103 +0,0 @@ -package naruto1310.extendedWorkbench.crafting; - -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class ExtendedShapedRecipes implements IExtendedRecipe -{ - private int maxRecipeSize = 6; - - /** How many horizontal slots this recipe is wide. */ - private int recipeWidth; - - /** How many vertical slots this recipe uses. */ - private int recipeHeight; - - /** Is a array of ItemStack that composes the recipe. */ - private ItemStack[] recipeItems; - - /** Is the ItemStack that you get when craft the recipe. */ - private ItemStack recipeOutput; - - public ExtendedShapedRecipes(int par1, int par2, ItemStack[] par3ArrayOfItemStack, ItemStack par4ItemStack) - { - this.recipeWidth = par1; - this.recipeHeight = par2; - this.recipeItems = par3ArrayOfItemStack; - this.recipeOutput = par4ItemStack; - } - - @Override - public ItemStack getRecipeOutput() - { - return this.recipeOutput; - } - - /** - * Used to check if a recipe matches current crafting inventory - */ - @Override - public boolean matches(InventoryCrafting par1InventoryCrafting, World world) - { - for(int x = 0; x <= this.maxRecipeSize - this.recipeWidth; ++x) - for(int y = 0; y <= this.maxRecipeSize - this.recipeHeight; ++y) - if(this.checkMatch(par1InventoryCrafting, x, y, true) || this.checkMatch(par1InventoryCrafting, x, y, false)) - return true; - - return false; - } - - /** - * Checks if the region of a crafting inventory is match for the recipe. - */ - private boolean checkMatch(InventoryCrafting par1InventoryCrafting, int x, int y, boolean mirrored) - { - for(int i = 0; i < this.maxRecipeSize; ++i) - { - for(int j = 0; j < this.maxRecipeSize; ++j) - { - int var7 = i - x; - int var8 = j - y; - ItemStack stackFound = null; - - if(var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) - if(mirrored) - stackFound = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth]; - else - stackFound = this.recipeItems[var7 + var8 * this.recipeWidth]; - - ItemStack stackExcpected = par1InventoryCrafting.getStackInRowAndColumn(i, j); - - if(stackFound == null && stackExcpected == null) - continue; - if((stackExcpected == null && stackFound != null) || (stackExcpected != null && stackFound == null)) - return false; - if(stackFound.getItem() != stackExcpected.getItem()) - return false; - if(stackFound.getItemDamage() != 32767 && stackFound.getItemDamage() != stackExcpected.getItemDamage()) - return false; - } - } - - return true; - } - - /** - * Returns an Item that is the result of this recipe - */ - @Override - public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) - { - return this.getRecipeOutput().copy(); - } - - /** - * Returns the size of the recipe area - */ - @Override - public int getRecipeSize() - { - return this.recipeWidth * this.recipeHeight; - } -} diff --git a/src/api/java/naruto1310/extendedWorkbench/crafting/ExtendedShapelessRecipes.java b/src/api/java/naruto1310/extendedWorkbench/crafting/ExtendedShapelessRecipes.java deleted file mode 100644 index 077e823..0000000 --- a/src/api/java/naruto1310/extendedWorkbench/crafting/ExtendedShapelessRecipes.java +++ /dev/null @@ -1,92 +0,0 @@ -package naruto1310.extendedWorkbench.crafting; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class ExtendedShapelessRecipes implements IExtendedRecipe -{ - private int maxRecipeSize = 6; - - /** Is the ItemStack that you get when craft the recipe. */ - private final ItemStack recipeOutput; - - /** Is a List of ItemStack that composes the recipe. */ - private final List recipeItems; - - public ExtendedShapelessRecipes(ItemStack par1ItemStack, List par2List) - { - this.recipeOutput = par1ItemStack; - this.recipeItems = par2List; - } - - @Override - public ItemStack getRecipeOutput() - { - return this.recipeOutput; - } - - /** - * Used to check if a recipe matches current crafting inventory - */ - @Override - public boolean matches(InventoryCrafting par1InventoryCrafting, World world) - { - ArrayList var2 = new ArrayList(this.recipeItems); - - for (int var3 = 0; var3 < this.maxRecipeSize; ++var3) - { - for (int var4 = 0; var4 < this.maxRecipeSize; ++var4) - { - ItemStack var5 = par1InventoryCrafting.getStackInRowAndColumn(var4, var3); - - if (var5 != null) - { - boolean var6 = false; - Iterator var7 = var2.iterator(); - - while (var7.hasNext()) - { - ItemStack var8 = var7.next(); - - if (var5 == var8 && (var8.getItemDamage() == 32767 || var5.getItemDamage() == var8.getItemDamage())) - { - var6 = true; - var2.remove(var8); - break; - } - } - - if (!var6) - { - return false; - } - } - } - } - - return var2.isEmpty(); - } - - /** - * Returns an Item that is the result of this recipe - */ - @Override - public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) - { - return this.recipeOutput.copy(); - } - - /** - * Returns the size of the recipe area - */ - @Override - public int getRecipeSize() - { - return this.recipeItems.size(); - } -} diff --git a/src/api/java/naruto1310/extendedWorkbench/crafting/IExtendedRecipe.java b/src/api/java/naruto1310/extendedWorkbench/crafting/IExtendedRecipe.java deleted file mode 100644 index 526cfca..0000000 --- a/src/api/java/naruto1310/extendedWorkbench/crafting/IExtendedRecipe.java +++ /dev/null @@ -1,8 +0,0 @@ -package naruto1310.extendedWorkbench.crafting; - -import net.minecraft.item.crafting.IRecipe; - -public interface IExtendedRecipe extends IRecipe -{ - -} diff --git a/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java b/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java deleted file mode 100644 index 8c74b4b..0000000 --- a/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java +++ /dev/null @@ -1,49 +0,0 @@ -package pneumaticCraft.api.recipe; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class AssemblyRecipe{ - public static List drillRecipes = new ArrayList(); - public static List laserRecipes = new ArrayList(); - public static List drillLaserRecipes = new ArrayList(); - - private final ItemStack input; - private final ItemStack output; - - public AssemblyRecipe(ItemStack input, ItemStack output){ - this.input = input; - this.output = output; - } - - public ItemStack getInput(){ - return input; - } - - public ItemStack getOutput(){ - return output; - } - - public static void addDrillRecipe(Object input, Object output){ - drillRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output))); - } - - public static void addLaserRecipe(Object input, Object output){ - laserRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output))); - } - - private static ItemStack getStackFromObject(Object object){ - if(object instanceof Block) { - return new ItemStack((Block)object); - } else if(object instanceof Item) { - return new ItemStack((Item)object); - } else { - return (ItemStack)object; - } - } - -} diff --git a/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java b/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java deleted file mode 100644 index 93eba67..0000000 --- a/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java +++ /dev/null @@ -1,34 +0,0 @@ -package pneumaticCraft.api.recipe; - -import net.minecraft.item.ItemStack; - -public interface IPressureChamberRecipe{ - - /** - * Returns the threshold which is minimal to craft the recipe. Negative pressures also work. - * @return threshold pressure - */ - public float getCraftingPressure(); - - /** - * This method should return the used items in the recipe when the right items are provided to craft this recipe. - * @param inputStacks - * @return usedStacks, return null when the inputStacks aren't valid for this recipe. - */ - public ItemStack[] isValidRecipe(ItemStack[] inputStacks); - - /** - * When returned true, only the exact same references of the stacks returned by isValidRecipe() will be removed. This is useful - * to remove stacks with a certain NBT value (like Enchanted Books). Return false for normal behaviour. - * @return true if exact stacks should be removed only. - */ - public boolean shouldRemoveExactStacks(); - - /** - * This method will be called when the recipe should output its items. the stacks the recipe output, may be dependent on the input stacks. - * @param removedStacks same reference to the stacks returned by isValidRecipe. - * @param inputStacks. These stacks can be modified (like adding/removing NBT data eg.) - * @return outputStacks. Stacks that will pop 'out of the chamber' - */ - public ItemStack[] craftRecipe(ItemStack[] inputStacks, ItemStack[] removedStacks); -} diff --git a/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java b/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java deleted file mode 100644 index 5d6b29e..0000000 --- a/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java +++ /dev/null @@ -1,24 +0,0 @@ -package pneumaticCraft.api.recipe; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.ItemStack; - -public class PressureChamberRecipe{ - public static List chamberRecipes = new ArrayList(); - public static List specialRecipes = new ArrayList(); - - public final ItemStack[] input; - public final ItemStack[] output; - public final float pressure; - public final boolean outputAsBlock; - - public PressureChamberRecipe(ItemStack[] input, float pressureRequired, ItemStack[] output, boolean outputAsBlock){ - this.input = input; - this.output = output; - pressure = pressureRequired; - this.outputAsBlock = outputAsBlock; - } - -} diff --git a/src/api/java/thaumcraft b/src/api/java/thaumcraft deleted file mode 160000 index ced30ed..0000000 --- a/src/api/java/thaumcraft +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ced30ed35097d53cdb2a843d705477e52896e54b diff --git a/src/main/java/modtweaker2/ClientEvents.java b/src/main/java/modtweaker2/ClientEvents.java index abcfb4f..e8d98b7 100644 --- a/src/main/java/modtweaker2/ClientEvents.java +++ b/src/main/java/modtweaker2/ClientEvents.java @@ -1,13 +1,14 @@ package modtweaker2; import static modtweaker2.helpers.LogHelper.print; + 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.player.ItemTooltipEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ClientEvents { public static int cooldown; diff --git a/src/main/java/modtweaker2/Commands.java b/src/main/java/modtweaker2/Commands.java index 792b04d..7aff945 100644 --- a/src/main/java/modtweaker2/Commands.java +++ b/src/main/java/modtweaker2/Commands.java @@ -4,27 +4,8 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.player.IPlayer; import minetweaker.api.server.ICommandFunction; import modtweaker2.commands.EntityMappingLogger; -import modtweaker2.mods.appeng.commands.AppliedEnergisticsLogger; -import modtweaker2.mods.auracascade.commands.AuraLogger; -import modtweaker2.mods.botania.commands.BotaniaBrewLogger; -import modtweaker2.mods.botania.commands.BotaniaLogger; -import modtweaker2.mods.botania.commands.BotaniaOrechidLogger; -import modtweaker2.mods.botania.lexicon.commands.LexiconCategoryLogger; -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.exnihilo.commands.ExNihiloLogger; -import modtweaker2.mods.factorization.commands.FactorizationLogger; -import modtweaker2.mods.mekanism.commands.GasLogger; -import modtweaker2.mods.mekanism.commands.MekanismLogger; -import modtweaker2.mods.railcraft.commands.RailcraftLogger; -import modtweaker2.mods.tconstruct.commands.MaterialLogger; -import modtweaker2.mods.tconstruct.commands.ModifierLogger; -import modtweaker2.mods.tconstruct.commands.TConstructLogger; import modtweaker2.mods.thaumcraft.commands.AspectLogger; import modtweaker2.mods.thaumcraft.research.commands.ResearchLogger; -import modtweaker2.mods.thermalexpansion.commands.ThermalExpansionLogger; import modtweaker2.utils.TweakerPlugin; public class Commands { @@ -41,59 +22,12 @@ public class Commands { MineTweakerAPI.server.addMineTweakerCommand("entities", new String[] { "/minetweaker entities", " Outputs a list of entities class mapping keys and the entity IDs" }, new EntityMappingLogger()); - if (TweakerPlugin.isLoaded("appliedenergistics2-core")) { - MineTweakerAPI.server.addMineTweakerCommand("appeng", new String[] {"/minetweaker appeng [HANDLER]", " Outputs a list of all Applied Energistics 2 recipes."}, new AppliedEnergisticsLogger()); - } - - if (TweakerPlugin.isLoaded("aura")) { - MineTweakerAPI.server.addMineTweakerCommand("auras", new String[] { "/minetweaker auras", "Outputs a list of Aura Types" }, new AuraLogger()); - } - - if (TweakerPlugin.isLoaded("Botania")) { - MineTweakerAPI.server.addMineTweakerCommand("lexiconCategories", new String[] { "/minetweaker lexiconCategories", " Outputs a list of lexicon categories" }, new LexiconCategoryLogger()); - MineTweakerAPI.server.addMineTweakerCommand("lexiconPages", new String[] { "/minetweaker lexiconPages", "/minetweaker lexiconPages [ENTRY]", " Outputs a list of lexicon pages for the entry" }, new LexiconPageLogger()); - MineTweakerAPI.server.addMineTweakerCommand("botaniaBrews", new String[] { "/minetweaker botaniaBrews", " Outputs a list of keys for botania brews" }, new BotaniaBrewLogger()); - MineTweakerAPI.server.addMineTweakerCommand("lexiconKnowledgeTypes", new String[] { "/minetweaker lexiconKnowledgeTypes", " Outputs a list of keys for lexicon knowledge types" }, new LexiconKnowledgeTypesLogger()); - MineTweakerAPI.server.addMineTweakerCommand("botaniaOrechid", new String[] { "/minetweaker botaniaOrechid", " Outputs a list of keys for botania orechid weights" }, new BotaniaOrechidLogger()); - MineTweakerAPI.server.addMineTweakerCommand("botania", new String[] { "/minetweaker botania [HANDLER]", " Outputs a list of all Botania recipes." }, new BotaniaLogger()); - } - - if (TweakerPlugin.isLoaded("chisel")) { - MineTweakerAPI.server.addMineTweakerCommand("chiselGroups", new String[] { "/minetweaker chiselGroups", " Outputs a list of chisel groups" }, new ChiselGroupLogger()); - MineTweakerAPI.server.addMineTweakerCommand("chiselVariations", new String[] { "/minetweaker chiselVariations", "/minetweaker chiselVariations [GROUP]", " Outputs a list of chisel variations" }, new ChiselVariationLogger()); - } - - if (TweakerPlugin.isLoaded("exnihilo")) { - MineTweakerAPI.server.addMineTweakerCommand("exnihilo", new String[] {"/minetweaker exnihilo [HANDLER]", " Outputs a list of all ExNihilo recipes."}, new ExNihiloLogger()); - } - - if (TweakerPlugin.isLoaded("factorization")) { - MineTweakerAPI.server.addMineTweakerCommand("factorization", new String[] {"/minetweaker factorization [HANDLER]", " Outputs a list of all Factorization recipes."}, new FactorizationLogger()); - } - - if (TweakerPlugin.isLoaded("Mekanism")) { - MineTweakerAPI.server.addMineTweakerCommand("gases", new String[] { "/minetweaker gases", " Outputs a list of all gas names in the game to the minetweaker log" }, new GasLogger()); - MineTweakerAPI.server.addMineTweakerCommand("mekanism", new String[] { "/minetweaker mekanism [HANDLER]", " Outputs a list of all Mekanism recipes." }, new MekanismLogger()); - } - - if (TweakerPlugin.isLoaded("Railcraft")) { - MineTweakerAPI.server.addMineTweakerCommand("railcraft", new String[] {"/minetweaker railcraft [HANDLER]", " Outputs a list of all Railcraft recipes."}, new RailcraftLogger()); - } - - if (TweakerPlugin.isLoaded("TConstruct")) { - MineTweakerAPI.server.addMineTweakerCommand("materials", new String[] { "/minetweaker materials", " Outputs a list of all Tinker's Construct material names in the game to the minetweaker log" }, new MaterialLogger()); - MineTweakerAPI.server.addMineTweakerCommand("modifiers", new String[] { "/minetweaker modifiers", " Outputs a list of all Tinker's Construct modifier names in the game to the minetweaker log" }, new ModifierLogger()); - MineTweakerAPI.server.addMineTweakerCommand("tconstruct", new String[]{ "/minetweaker tconstruct [HANDLER]", " Outputs a list of all Tinkers Construct recipes."}, new TConstructLogger()); - } if (TweakerPlugin.isLoaded("Thaumcraft")) { MineTweakerAPI.server.addMineTweakerCommand("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()); MineTweakerAPI.server.addMineTweakerCommand("aspectList", new String[] { "/minetweaker aspectList", " Outputs a list of all aspects registered to entities and items" }, new AspectLogger()); } - if (TweakerPlugin.isLoaded("ThermalExpansion")) { - MineTweakerAPI.server.addMineTweakerCommand("thermalexpansion", new String[] {"/minetweaker thermalexpansion [HANDLER]", " Outputs a list of all Thermal Expansion recipes."}, new ThermalExpansionLogger()); - } } } diff --git a/src/main/java/modtweaker2/ModProps.java b/src/main/java/modtweaker2/ModProps.java index ce1a1a1..54c7d16 100644 --- a/src/main/java/modtweaker2/ModProps.java +++ b/src/main/java/modtweaker2/ModProps.java @@ -5,5 +5,5 @@ 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 = "@modVersion@", version = VERSION; - public static final String DEPENDENCIES = "required-after:MineTweaker3;after:Forestry@[4.1.0,);", dependencies = DEPENDENCIES; + public static final String DEPENDENCIES = "required-after:crafttweaker;", dependencies = DEPENDENCIES; } diff --git a/src/main/java/modtweaker2/ModTweaker2.java b/src/main/java/modtweaker2/ModTweaker2.java index e15a7bd..3a01a59 100644 --- a/src/main/java/modtweaker2/ModTweaker2.java +++ b/src/main/java/modtweaker2/ModTweaker2.java @@ -2,117 +2,79 @@ package modtweaker2; import java.io.File; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import minetweaker.MineTweakerImplementationAPI; import minetweaker.MineTweakerImplementationAPI.ReloadEvent; import minetweaker.runtime.providers.ScriptProviderDirectory; import minetweaker.util.IEventHandler; -import modtweaker2.mods.appeng.AppliedEnergistics; -import modtweaker2.mods.auracascade.AuraCascade; -import modtweaker2.mods.botania.Botania; -import modtweaker2.mods.chisel.Chisel; -import modtweaker2.mods.exnihilo.ExNihilo; -import modtweaker2.mods.extendedworkbench.ExtendedWorkbench; -import modtweaker2.mods.extraUtils.ExtraUtils; -import modtweaker2.mods.factorization.Factorization; -import modtweaker2.mods.forestry.Forestry; -import modtweaker2.mods.fsp.Steamcraft; -import modtweaker2.mods.ic2c.IC2C; -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.proxy.CommonProxy; import modtweaker2.utils.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.SidedProxy; -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; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.Mod.Instance; +import net.minecraftforge.fml.common.SidedProxy; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.relauncher.Side; @Mod(modid = ModProps.modid, version = ModProps.version, dependencies = ModProps.dependencies) public class ModTweaker2 { - public static Logger logger = LogManager.getLogger(ModProps.modid); + public static Logger logger = LogManager.getLogger(ModProps.modid); - public static File baseIMCFolder; - @Instance(ModProps.modid) - public ModTweaker2 instance; + @SidedProxy(clientSide = "modtweaker2.proxy.ClientProxy", serverSide = "modtweaker2.proxy.CommonProxy") + public static CommonProxy proxy; - @EventHandler - public void preInit(FMLPreInitializationEvent event) { - logger.info("Starting PreInitialization for " + ModProps.modid); - } + @Instance(ModProps.modid) + public ModTweaker2 instance; - @SidedProxy(clientSide = "modtweaker2.proxy.ClientProxy", serverSide = "modtweaker2.proxy.CommonProxy") - public static CommonProxy proxy; + @EventHandler + public void preInit(FMLPreInitializationEvent event) { + logger.info("Starting PreInitialization for " + ModProps.modid); + } - @EventHandler - public void init(FMLInitializationEvent event) { - logger.info("Starting Initialization for " + ModProps.modid); - TweakerPlugin.register("appliedenergistics2-core", AppliedEnergistics.class); - TweakerPlugin.register("Botania", Botania.class); - TweakerPlugin.register("exnihilo", ExNihilo.class); - TweakerPlugin.register("extendedWorkbench", ExtendedWorkbench.class); - TweakerPlugin.register("factorization", Factorization.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("aura", AuraCascade.class); - TweakerPlugin.register("ExtraUtilities", ExtraUtils.class); - TweakerPlugin.register("IC2", IC2C.class); - + + @EventHandler + public void init(FMLInitializationEvent event) { + logger.info("Starting Initialization for " + ModProps.modid); + TweakerPlugin.register("Thaumcraft", Thaumcraft.class); - if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { - MinecraftForge.EVENT_BUS.register(new ClientEvents()); - } + if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { + MinecraftForge.EVENT_BUS.register(new ClientEvents()); + } - MineTweakerImplementationAPI.onReloadEvent(new IEventHandler() { + MineTweakerImplementationAPI.onReloadEvent(new IEventHandler() { - @Override - public void handle(ReloadEvent event) { - proxy.registerCommands(); + @Override + public void handle(ReloadEvent event) { + proxy.registerCommands(); - } - }); + } + }); - File scripts = new File("scripts"); - if (!scripts.exists()) { - scripts.mkdir(); - } - MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderDirectory(scripts)); - } + File scripts = new File("scripts"); + if (!scripts.exists()) { + scripts.mkdir(); + } + MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderDirectory(scripts)); + } - @EventHandler - public void postInit(FMLPostInitializationEvent event) { - logger.info("Starting PostInitialization for " + ModProps.modid); - } + @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); - proxy.registerCommands(); + @EventHandler + public void serverStart(FMLServerStartingEvent event) { + logger.info("Starting ServerStart for " + ModProps.modid); + proxy.registerCommands(); - } + } } diff --git a/src/main/java/modtweaker2/commands/EntityMappingLogger.java b/src/main/java/modtweaker2/commands/EntityMappingLogger.java index 309fb63..ed11480 100644 --- a/src/main/java/modtweaker2/commands/EntityMappingLogger.java +++ b/src/main/java/modtweaker2/commands/EntityMappingLogger.java @@ -11,22 +11,22 @@ import net.minecraft.entity.EntityList; public class EntityMappingLogger implements ICommandFunction { - @Override - public void execute(String[] arguments, IPlayer player) { + @Override + public void execute(String[] arguments, IPlayer player) { - @SuppressWarnings("unchecked") - Set 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); + @SuppressWarnings("unchecked") + Set keys = EntityList.stringToClassMapping.keySet(); - } + System.out.println("Mob Keys: " + keys.size()); - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } + for (String key : keys) { + ModTweaker2.logger.info("Mob Key " + key); + MineTweakerAPI.logCommand("Mob Key " + key); + + } + + if (player != null) { + player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); + } + } } diff --git a/src/main/java/modtweaker2/helpers/ForgeHelper.java b/src/main/java/modtweaker2/helpers/ForgeHelper.java index b196bea..88bb687 100644 --- a/src/main/java/modtweaker2/helpers/ForgeHelper.java +++ b/src/main/java/modtweaker2/helpers/ForgeHelper.java @@ -13,9 +13,9 @@ 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; +import net.minecraftforge.fml.client.FMLClientHandler; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.relauncher.Side; public class ForgeHelper { @SuppressWarnings("rawtypes") @@ -29,15 +29,15 @@ public class ForgeHelper { 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) { } + } catch (Exception e) { + } } private ForgeHelper() { } public static Object getSeedEntry(ItemStack stack, int weight) { - Object seedEntry = getInstance(getConstructor("net.minecraftforge.common.ForgeHooks$SeedEntry", - ItemStack.class, int.class), stack, weight); + Object seedEntry = getInstance(getConstructor("net.minecraftforge.common.ForgeHooks$SeedEntry", ItemStack.class, int.class), stack, weight); if (seedEntry == null) { throw new NullPointerException("Failed to instantiate SeedEntry"); @@ -47,7 +47,6 @@ public class ForgeHelper { } public static boolean isLangActive(String lang) { - return FMLCommonHandler.instance().getSide() == Side.SERVER ? null - : FMLClientHandler.instance().getCurrentLanguage().equals(lang); + return FMLCommonHandler.instance().getSide() == Side.SERVER ? null : FMLClientHandler.instance().getCurrentLanguage().equals(lang); } } diff --git a/src/main/java/modtweaker2/helpers/InputHelper.java b/src/main/java/modtweaker2/helpers/InputHelper.java index 83a8fd7..ab3e192 100644 --- a/src/main/java/modtweaker2/helpers/InputHelper.java +++ b/src/main/java/modtweaker2/helpers/InputHelper.java @@ -8,8 +8,8 @@ import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.oredict.IOreDictEntry; -import minetweaker.mc1710.item.MCItemStack; -import minetweaker.mc1710.liquid.MCLiquidStack; +import minetweaker.mc18.item.MCItemStack; +import minetweaker.mc18.liquid.MCLiquidStack; import net.minecraft.entity.Entity; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; diff --git a/src/main/java/modtweaker2/helpers/LogHelper.java b/src/main/java/modtweaker2/helpers/LogHelper.java index a92ead4..22bd852 100644 --- a/src/main/java/modtweaker2/helpers/LogHelper.java +++ b/src/main/java/modtweaker2/helpers/LogHelper.java @@ -4,14 +4,12 @@ import java.util.Arrays; import java.util.LinkedList; import java.util.List; -import mekanism.api.gas.GasStack; import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerImplementationAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.oredict.IOreDictEntry; import minetweaker.api.player.IPlayer; -import minetweaker.mc1710.item.MCItemStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; +import minetweaker.mc18.item.MCItemStack; import modtweaker2.mods.thaumcraft.aspect.AspectStack; import modtweaker2.mods.thaumcraft.aspect.MCAspectStack; import modtweaker2.utils.TweakerPlugin; @@ -64,6 +62,7 @@ public class LogHelper { /** * Returns a string representation of the item which can also be used in scripts */ + @SuppressWarnings("rawtypes") public static String getStackDescription(Object object) { if(object instanceof IIngredient) { return getStackDescription((IIngredient)object); @@ -73,9 +72,7 @@ public class LogHelper { return getStackDescription((FluidStack) object); } else if (object instanceof Block) { return new MCItemStack(new ItemStack((Block)object, 1, 0)).toString(); - } else if (TweakerPlugin.isLoaded("Mekanism") && object instanceof GasStack) { - return new MCGasStack((GasStack)object).toString(); - } else if (TweakerPlugin.isLoaded("Thaumcraft") && object instanceof AspectStack) { + } else if (TweakerPlugin.isLoaded("Thaumcraft") && object instanceof AspectStack) { return new MCAspectStack((AspectStack)object).toString(); } else if(TweakerPlugin.isLoaded("Thaumcraft") && object instanceof AspectList) { List stacks = new LinkedList(); diff --git a/src/main/java/modtweaker2/helpers/ReflectionHelper.java b/src/main/java/modtweaker2/helpers/ReflectionHelper.java index 73fb3c5..1a367c0 100644 --- a/src/main/java/modtweaker2/helpers/ReflectionHelper.java +++ b/src/main/java/modtweaker2/helpers/ReflectionHelper.java @@ -155,6 +155,6 @@ public class ReflectionHelper { @SuppressWarnings({ "rawtypes", "unchecked" }) public static void setPrivateValue( Class cls, Object o, String field, Object var) { - cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(cls, o, var, field); + net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(cls, o, var, field); } } diff --git a/src/main/java/modtweaker2/helpers/StackHelper.java b/src/main/java/modtweaker2/helpers/StackHelper.java index 2702254..f9003d9 100644 --- a/src/main/java/modtweaker2/helpers/StackHelper.java +++ b/src/main/java/modtweaker2/helpers/StackHelper.java @@ -1,13 +1,11 @@ package modtweaker2.helpers; import static modtweaker2.helpers.InputHelper.toStack; + import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.item.IngredientAny; import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.mods.botania.Botania; -import modtweaker2.mods.mekanism.MekanismHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; import modtweaker2.utils.TweakerPlugin; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -19,9 +17,7 @@ public class StackHelper { public static boolean areEqual(ItemStack stack1, ItemStack stack2) { if (stack1 == null || stack2 == null) { return false; - } else if (TweakerPlugin.isLoaded("Botania") && Botania.isSubtile(stack1) && Botania.isSubtile(stack2)) { - return Botania.subtileMatches(stack1, stack2); - } else { + } else { return stack1.isItemEqual(stack2); } } @@ -69,18 +65,7 @@ public class StackHelper { return false; } - // Check for Botania special flowers - if(ingredient.getItems() != null && TweakerPlugin.isLoaded("Botania") && Botania.isSubtile(toStack(itemStack))) { - for(IItemStack item : ingredient.getItems()) { - if(areEqual(toStack(item), toStack(itemStack))) { - return true; - } - } - } else { return true; - } - - return false; } /** @@ -109,20 +94,5 @@ public class StackHelper { return false; } - public static boolean matches(IIngredient ingredient, IGasStack gasStack) { - if(ingredient == null) { - return false; - } - - if(ingredient == IngredientAny.INSTANCE) { - return true; - } - - if(ingredient instanceof IGasStack) { - return MekanismHelper.toGas((IGasStack)ingredient).isGasEqual(MekanismHelper.toGas(gasStack)); - } - - return false; - } } diff --git a/src/main/java/modtweaker2/mods/appeng/AppliedEnergistics.java b/src/main/java/modtweaker2/mods/appeng/AppliedEnergistics.java deleted file mode 100644 index 42ba6af..0000000 --- a/src/main/java/modtweaker2/mods/appeng/AppliedEnergistics.java +++ /dev/null @@ -1,13 +0,0 @@ -package modtweaker2.mods.appeng; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.appeng.handlers.Grind; -import modtweaker2.mods.appeng.handlers.Inscriber; - -public class AppliedEnergistics { - - public AppliedEnergistics() { - MineTweakerAPI.registerClass(Inscriber.class); - MineTweakerAPI.registerClass(Grind.class); - } -} diff --git a/src/main/java/modtweaker2/mods/appeng/AppliedEnergisticsHelper.java b/src/main/java/modtweaker2/mods/appeng/AppliedEnergisticsHelper.java deleted file mode 100644 index c1579d1..0000000 --- a/src/main/java/modtweaker2/mods/appeng/AppliedEnergisticsHelper.java +++ /dev/null @@ -1,77 +0,0 @@ -package modtweaker2.mods.appeng; - -import static modtweaker2.helpers.StackHelper.areEqualOrNull; -import net.minecraft.item.ItemStack; -import appeng.api.features.IGrinderEntry; -import appeng.api.features.IInscriberRecipe; - -public class AppliedEnergisticsHelper { - /** - * Compares two IInscriberRecipe objects, if they are the same or have the same inputs - */ - public static boolean equals(IInscriberRecipe r1, IInscriberRecipe r2) { - if(r1 == r2) { - return true; - } - - if (r1 == null || r2 == null) { - return false; - } - - if(!areEqualOrNull(r1.getTopOptional().orNull(), r2.getTopOptional().orNull())) { - return false; - } - - if(!areEqualOrNull(r1.getBottomOptional().orNull(), r2.getBottomOptional().orNull())) { - return false; - } - - if(r1.getInputs() == null && r2.getInputs() != null || r1.getInputs() != null && r2.getInputs() == null) { - return false; - } - - if(r1.getInputs() != null && r2.getInputs() != null) { - if(r1.getInputs().size() != r2.getInputs().size()) { - return false; - } - - // Check if every item in recipe 1 is in recipe 2 - for(ItemStack i1 : r1.getInputs()) { - boolean found = false; - - for(ItemStack i2 : r2.getInputs()) { - if(areEqualOrNull(i1, i2)) { - found = true; - } - } - - if(!found) { - return false; - } - } - } - - return true; - } - - /** - * Compares two IGrinderEntry objects, if they are the same or have the same inputs - */ - public static boolean equals(IGrinderEntry r1, IGrinderEntry r2) { - if(r1 == r2) { - return true; - } - - if (r1 == null || r2 == null) { - return false; - } - - if(!areEqualOrNull(r1.getInput(), r2.getInput())) { - return false; - } - - return true; - } - - -} diff --git a/src/main/java/modtweaker2/mods/appeng/commands/AppliedEnergisticsLogger.java b/src/main/java/modtweaker2/mods/appeng/commands/AppliedEnergisticsLogger.java deleted file mode 100644 index 3fa9ef6..0000000 --- a/src/main/java/modtweaker2/mods/appeng/commands/AppliedEnergisticsLogger.java +++ /dev/null @@ -1,64 +0,0 @@ -package modtweaker2.mods.appeng.commands; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StringHelper; -import appeng.api.AEApi; -import appeng.api.features.IGrinderEntry; -import appeng.api.features.IInscriberRecipe; - -public class AppliedEnergisticsLogger implements ICommandFunction { - - private static final List validArguments = new LinkedList(); - - static { - validArguments.add("Grinder"); - validArguments.add("Inscriber"); - } - - @Override - public void execute(String[] arguments, IPlayer player) { - List args = StringHelper.toLowerCase(Arrays.asList(arguments)); - - if(!validArguments.containsAll(args)) { - if(player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", "))); - } - } else { - if(args.isEmpty() || args.contains("Grinder")) { - for(IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes()) { - MineTweakerAPI.logCommand(String.format("mods.appeng.Grinder.addRecipe(%s, %s, %d, %s, %s, %s, %s);", - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(recipe.getOutput()), - recipe.getEnergyCost(), - LogHelper.getStackDescription(recipe.getOptionalOutput()), - recipe.getOptionalChance(), - LogHelper.getStackDescription(recipe.getSecondOptionalOutput()), - recipe.getSecondOptionalChance())); - } - } - - if(args.isEmpty() || args.contains("Inscriber")) { - for(IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes()) { - MineTweakerAPI.logCommand(String.format("mods.appeng.Inscriber.addRecipe(%s, %s, %s, %s, \"%s\");", - LogHelper.getListDescription(recipe.getInputs()), - LogHelper.getStackDescription(recipe.getTopOptional().orNull()), - LogHelper.getStackDescription(recipe.getBottomOptional().orNull()), - LogHelper.getStackDescription(recipe.getOutput()), - recipe.getProcessType().toString())); - } - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } - } -} diff --git a/src/main/java/modtweaker2/mods/appeng/handlers/Grind.java b/src/main/java/modtweaker2/mods/appeng/handlers/Grind.java deleted file mode 100644 index f6794ab..0000000 --- a/src/main/java/modtweaker2/mods/appeng/handlers/Grind.java +++ /dev/null @@ -1,192 +0,0 @@ -package modtweaker2.mods.appeng.handlers; - -import appeng.api.AEApi; -import appeng.api.features.IGrinderEntry; -import appeng.core.features.registries.entries.AppEngGrinderRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.appeng.AppliedEnergisticsHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import java.util.LinkedList; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -@ZenClass("mods.appeng.Grinder") -public class Grind { - - protected static final String name = "Applied Energistics 2 Grindstone"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a shaped recipe for the Grindstone - * @param outputs - * @param inputStack - * @param turns - */ - @ZenMethod - public static void addRecipe(WeightedItemStack[] outputs, IItemStack inputStack, int turns) { - IGrinderEntry recipe; - if (outputs.length == 1) - recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputs[0].getStack()), turns); - else if (outputs.length == 2) - recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputs[0].getStack()), InputHelper.toStack(outputs[1].getStack()), outputs[1].getChance(), turns); - else if (outputs.length == 3) - recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputs[0].getStack()), InputHelper.toStack(outputs[1].getStack()), InputHelper.toStack(outputs[2].getStack()), outputs[1].getChance(), outputs[2].getChance(), turns); - else { - LogHelper.logWarning(String.format("No more then 3 output stacks are allowed in %s. Command ignored!", name, LogHelper.getStackDescription(toStack(inputStack)))); - return; - } - - // Check if the recipe is already present, we don't want to add duplicates - for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) { - if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(inputStack)))); - return; - } - } - - MineTweakerAPI.apply(new Add(recipe)); - } - - /** - * Adds a shaped recipe for the Grindstone - * - * @param outputStack - Product of the Recipe - * @param inputStack - Ingredient of the Recipe - * @param inputEnergy - Energy requirement of the Recipe - * @optionalParam outputStack2 - Second product of the Recipe - * @optionalParam outputStack2Chance - Chance for the acquirement of the second product - * @optionalParam outputStack3 - Third product of the Recipe - * @optionalParam outputStack3Chance - Chance for the acquirement of the third product - **/ - @Deprecated - @ZenMethod - public static void addRecipe(IItemStack outputStack, IItemStack inputStack, @Optional IItemStack outputStack2, @Optional float outputStack2Chance, @Optional IItemStack outputStack3, @Optional float outputStack3Chance, int inputEnergy) { - if (inputStack == null || outputStack == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - // Create recipe - IGrinderEntry recipe; - - if (outputStack2 != null && outputStack3 != null) - recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputStack), InputHelper.toStack(outputStack2), InputHelper.toStack(outputStack3), outputStack2Chance, outputStack3Chance, inputEnergy); - else if (outputStack2 != null) - recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputStack), InputHelper.toStack(outputStack2), outputStack2Chance, inputEnergy); - else - recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputStack), inputEnergy); - - // Check if the recipe is already present, we don't want to add duplicates - for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) { - if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(inputStack)))); - return; - } - } - - MineTweakerAPI.apply(new Add(recipe)); - } - - @Deprecated - @ZenMethod - public static void addRecipe(IItemStack input, IItemStack output, int energy, @Optional IItemStack output2, @Optional float chance2, @Optional IItemStack output3, @Optional float chance3) { - if (input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - // Create recipe - IGrinderEntry recipe; - - if (output2 != null && output3 != null) - recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), InputHelper.toStack(output2), InputHelper.toStack(output3), chance2, chance3, energy); - else if (output2 != null) - recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), InputHelper.toStack(output2), chance2, energy); - else - recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), energy); - - // Check if the recipe is already present, we don't want to add duplicates - for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) { - if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(input)))); - return; - } - } - - MineTweakerAPI.apply(new Add(recipe)); - } - - private static class Add extends BaseListAddition { - - public Add(IGrinderEntry recipe) { - super(Grind.name, AEApi.instance().registries().grinder().getRecipes()); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(IGrinderEntry recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - - @Override - protected boolean equals(IGrinderEntry recipe, IGrinderEntry otherRecipe) { - return AppliedEnergisticsHelper.equals(recipe, otherRecipe); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Removes a recipe for the Grindstone - * - * @param input - Product of the Recipe - **/ - @ZenMethod - public static void removeRecipe(IIngredient input) { - if (input == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - // Get list of existing recipes, matching with parameter - LinkedList result = new LinkedList(); - - for (IGrinderEntry entry : AEApi.instance().registries().grinder().getRecipes()) { - if (entry != null && entry.getOutput() != null && matches(input, toIItemStack(entry.getOutput()))) { - result.add(entry); - } - } - - // Check if we found the recipes and apply the action - if (!result.isEmpty()) { - MineTweakerAPI.apply(new Remove(result)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", name, input.toString())); - } - } - - private static class Remove extends BaseListRemoval { - public Remove(LinkedList recipes) { - super(Grind.name, AEApi.instance().registries().grinder().getRecipes(), recipes); - } - - @Override - public String getRecipeInfo(IGrinderEntry recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/appeng/handlers/Inscriber.java b/src/main/java/modtweaker2/mods/appeng/handlers/Inscriber.java deleted file mode 100644 index 650edb5..0000000 --- a/src/main/java/modtweaker2/mods/appeng/handlers/Inscriber.java +++ /dev/null @@ -1,196 +0,0 @@ -package modtweaker2.mods.appeng.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.InputHelper.toStacks; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.appeng.AppliedEnergisticsHelper; -import modtweaker2.utils.ArrayUtils; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import appeng.api.AEApi; -import appeng.api.features.IInscriberRecipe; -import appeng.api.features.InscriberProcessType; -import appeng.core.features.registries.entries.InscriberRecipe; - -@ZenClass("mods.appeng.Inscriber") -public class Inscriber { - - protected static final String name = "Applied Energistics 2 Inscriber"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a shaped recipe for the Carpenter - * - * @param outputStack - Product of the Recipe - * @param inputArray - Ingredients of the Recipe - * @param inputStackPlateA - Ingredient of the Recipe for Plate Slot A - * @param inputStackPlateB - Ingredient of the Recipe for Plate Slot B - * @param typeString - Type that decides whether to consume the ItemStack in Plate Slot A/B - **/ - @ZenMethod - public static void addRecipe(IItemStack outputStack, IItemStack[] inputArray, IItemStack inputStackPlateA, IItemStack inputStackPlateB, String typeString) { - if(inputArray == null || outputStack == null || (!typeString.equals("Press") && !typeString.equals("Inscribe"))) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", Inscriber.name)); - return; - } - - // Create recipe - IInscriberRecipe recipe = new InscriberRecipe(ArrayUtils.toArrayList(toStacks(inputArray)), toStack(outputStack), toStack(inputStackPlateA), toStack(inputStackPlateB), InscriberProcessType.valueOf(typeString)); - - // Check if the recipe is already present, we don't want to add duplicates - for(IInscriberRecipe r : AEApi.instance().registries().inscriber().getRecipes()) { - if(r != null && AppliedEnergisticsHelper.equals(r, recipe)) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", Inscriber.name, LogHelper.getStackDescription(toStack(outputStack)))); - return; - } - } - - MineTweakerAPI.apply(new Add(recipe)); - } - - @Deprecated - @ZenMethod - public static void addRecipe(IItemStack[] imprintable, IItemStack plateA, IItemStack plateB, IItemStack out, String type) { - if(imprintable == null || out == null || (!type.equals("Press") && !type.equals("Inscribe"))) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", Inscriber.name)); - return; - } - - // Create recipe - IInscriberRecipe recipe = new InscriberRecipe(ArrayUtils.toArrayList(toStacks(imprintable)), toStack(out), toStack(plateA), toStack(plateB), InscriberProcessType.valueOf(type)); - - // Check if the recipe is already present, we don't want to add duplicates - for(IInscriberRecipe r : AEApi.instance().registries().inscriber().getRecipes()) { - if(r != null && AppliedEnergisticsHelper.equals(r, recipe)) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", Inscriber.name, LogHelper.getStackDescription(toStack(out)))); - return; - } - } - - MineTweakerAPI.apply(new Add(recipe)); - } - - public static class Add extends BaseListAddition { - public Add(IInscriberRecipe recipe) { - super(Inscriber.name, AEApi.instance().registries().inscriber().getRecipes()); - recipes.add(recipe); - } - - @Override - public void apply() { - if(recipes.isEmpty()) { - return; - } - - for(IInscriberRecipe recipe : recipes) { - try { - AEApi.instance().registries().inscriber().addRecipe(recipe); - successful.add(recipe); - } catch (Exception ex) { LogHelper.logError("Error adding inscriber recipe.", ex); } - } - } - - @Override - public void undo() { - if(successful.isEmpty()) { - return; - } - - for(IInscriberRecipe recipe : successful) { - try { - AEApi.instance().registries().inscriber().removeRecipe(recipe); - } catch (Exception ex) { LogHelper.logError("Error removing inscriber recipe.", ex); } - } - } - - @Override - public String getRecipeInfo(IInscriberRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - - @Override - protected boolean equals(IInscriberRecipe recipe, IInscriberRecipe otherRecipe) { - return AppliedEnergisticsHelper.equals(recipe, otherRecipe); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a shaped recipe for the Carpenter - * - * @param outputStack - Product of the Recipe - **/ - @ZenMethod - public static void removeRecipe(IIngredient outputStack) { - if(outputStack == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", Inscriber.name)); - return; - } - - // Get list of existing recipes, matching with parameter - LinkedList result = new LinkedList(); - - for(IInscriberRecipe entry : AEApi.instance().registries().inscriber().getRecipes()) { - if(entry != null && entry.getOutput() != null && matches(outputStack, toIItemStack(entry.getOutput()))) { - result.add(entry); - } - } - - // Check if we found the recipes and apply the action - if(!result.isEmpty()) { - MineTweakerAPI.apply(new Remove(result)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Inscriber.name, outputStack.toString())); - } - } - - public static class Remove extends BaseListRemoval { - public Remove(LinkedList recipes) { - super(Inscriber.name, AEApi.instance().registries().inscriber().getRecipes(), recipes); - } - - @Override - public void apply() { - if(this.recipes.isEmpty()) { - return; - } - - for(IInscriberRecipe recipe : recipes) { - try { - AEApi.instance().registries().inscriber().removeRecipe(recipe); - successful.add(recipe); - } catch (Exception ex) { LogHelper.logError("Error removing inscriber recipe.", ex); } - } - } - - @Override - public void undo() { - if(successful.isEmpty()) { - return; - } - - for(IInscriberRecipe recipe : successful) { - try { - AEApi.instance().registries().inscriber().addRecipe(recipe); - } catch (Exception ex) { LogHelper.logError("Error restoring inscriber recipe.", ex); } - } - } - - @Override - public String getRecipeInfo(IInscriberRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/auracascade/AuraCascade.java b/src/main/java/modtweaker2/mods/auracascade/AuraCascade.java deleted file mode 100644 index 3833d02..0000000 --- a/src/main/java/modtweaker2/mods/auracascade/AuraCascade.java +++ /dev/null @@ -1,13 +0,0 @@ -package modtweaker2.mods.auracascade; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.auracascade.aura.AuraBracketHandler; -import modtweaker2.mods.auracascade.handlers.Pylon; - -public class AuraCascade { - public AuraCascade(){ - MineTweakerAPI.registerBracketHandler(new AuraBracketHandler()); - MineTweakerAPI.registerClass(Pylon.class); - } - -} diff --git a/src/main/java/modtweaker2/mods/auracascade/AuraCascadeHelper.java b/src/main/java/modtweaker2/mods/auracascade/AuraCascadeHelper.java deleted file mode 100644 index 5d581e0..0000000 --- a/src/main/java/modtweaker2/mods/auracascade/AuraCascadeHelper.java +++ /dev/null @@ -1,24 +0,0 @@ -package modtweaker2.mods.auracascade; - -import modtweaker2.mods.auracascade.aura.IAuraStack; -import pixlepix.auracascade.data.AuraQuantity; -import pixlepix.auracascade.data.EnumAura; - -public class AuraCascadeHelper { - public static AuraQuantity toAura(IAuraStack iStack) { - if (iStack == null) { - return null; - } else return new AuraQuantity(EnumAura.valueOf(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; -// } -} diff --git a/src/main/java/modtweaker2/mods/auracascade/aura/AuraBracketHandler.java b/src/main/java/modtweaker2/mods/auracascade/aura/AuraBracketHandler.java deleted file mode 100644 index d773a5f..0000000 --- a/src/main/java/modtweaker2/mods/auracascade/aura/AuraBracketHandler.java +++ /dev/null @@ -1,85 +0,0 @@ -package modtweaker2.mods.auracascade.aura; - -import java.util.List; - -import minetweaker.IBracketHandler; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.BracketHandler; -import minetweaker.api.item.IngredientAny; -import pixlepix.auracascade.data.AuraQuantity; -import pixlepix.auracascade.data.EnumAura; -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 AuraBracketHandler implements IBracketHandler { - - public static IAuraStack getAura(String name) { - EnumAura aura = EnumAura.valueOf(name); - if (aura != null) { - return new MCAuraStack(new AuraQuantity(aura, 1)); - } else { - return null; - } - } - - private final IZenSymbol symbolAny; - private final IJavaMethod method; - - public AuraBracketHandler() { - symbolAny = MineTweakerAPI.getJavaStaticFieldSymbol(IngredientAny.class, "INSTANCE"); - method = MineTweakerAPI.getJavaMethod(AuraBracketHandler.class, "getAura", String.class); - } - - @Override - public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { - // any symbol - if (tokens.size() == 1 && tokens.get(0).getValue().equals("*")) { - return symbolAny; - } - - if (tokens.size() > 2) { - if (tokens.get(0).getValue().equals("aura") && tokens.get(1).getValue().equals(":")) { - return find(environment, tokens, 2, tokens.size()); - } - } - - return null; - } - - private IZenSymbol find(IEnvironmentGlobal environment, List tokens, int startIndex, int endIndex) { - //StringBuilder valueBuilder = new StringBuilder(); - - for (EnumAura a : EnumAura.values()) { - for (int i = startIndex; i < endIndex; i++) { - Token token = tokens.get(i); - if (a.name().equals(token.getValue())) { - return new AuraReferenceSymbol(environment, token.getValue()); - } - } - } - - return null; - } - - private class AuraReferenceSymbol implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final String name; - - public AuraReferenceSymbol(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)); - } - } -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/auracascade/aura/IAuraDefinition.java b/src/main/java/modtweaker2/mods/auracascade/aura/IAuraDefinition.java deleted file mode 100644 index 9a4fc83..0000000 --- a/src/main/java/modtweaker2/mods/auracascade/aura/IAuraDefinition.java +++ /dev/null @@ -1,19 +0,0 @@ -package modtweaker2.mods.auracascade.aura; - -import stanhebben.zenscript.annotations.OperatorType; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenGetter; -import stanhebben.zenscript.annotations.ZenOperator; - -@ZenClass("modtweaker.auraCascade.IAuraDefinition") -public interface IAuraDefinition { - - @ZenOperator(OperatorType.MUL) - public IAuraStack asAura(int amount); - - @ZenGetter("name") - public String getName(); - - @ZenGetter("displayName") - public String getDisplayName(); -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/auracascade/aura/IAuraStack.java b/src/main/java/modtweaker2/mods/auracascade/aura/IAuraStack.java deleted file mode 100644 index 66fa51e..0000000 --- a/src/main/java/modtweaker2/mods/auracascade/aura/IAuraStack.java +++ /dev/null @@ -1,28 +0,0 @@ -package modtweaker2.mods.auracascade.aura; - -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.auraCascade.IAuraStack") -public interface IAuraStack { - @ZenGetter("definition") - public IAuraDefinition getDefinition(); - - @ZenGetter("name") - public String getName(); - - @ZenGetter("displayName") - public String getDisplayName(); - - @ZenGetter("amount") - public int getAmount(); - - @ZenOperator(OperatorType.MUL) - @ZenMethod - public IAuraStack withAmount(int amount); - - public Object getInternal(); -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/auracascade/aura/MCAuraDefinition.java b/src/main/java/modtweaker2/mods/auracascade/aura/MCAuraDefinition.java deleted file mode 100644 index 8bda113..0000000 --- a/src/main/java/modtweaker2/mods/auracascade/aura/MCAuraDefinition.java +++ /dev/null @@ -1,27 +0,0 @@ -package modtweaker2.mods.auracascade.aura; - -import pixlepix.auracascade.data.AuraQuantity; - - -public class MCAuraDefinition implements IAuraDefinition { - private final AuraQuantity aura; - - public MCAuraDefinition(AuraQuantity aura) { - this.aura = aura; - } - - @Override - public String getName() { - return aura.getType().name; - } - - @Override - public String getDisplayName() { - return aura.getType().name; - } - - @Override - public IAuraStack asAura(int amount) { - return new MCAuraStack(new AuraQuantity(aura.getType(), aura.getNum())); - } -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/auracascade/aura/MCAuraStack.java b/src/main/java/modtweaker2/mods/auracascade/aura/MCAuraStack.java deleted file mode 100644 index b710d6b..0000000 --- a/src/main/java/modtweaker2/mods/auracascade/aura/MCAuraStack.java +++ /dev/null @@ -1,43 +0,0 @@ -package modtweaker2.mods.auracascade.aura; - -import pixlepix.auracascade.data.AuraQuantity; - - -public class MCAuraStack implements IAuraStack { - private final AuraQuantity aura; - - public MCAuraStack(AuraQuantity aura) { - this.aura = aura; - } - - @Override - public IAuraDefinition getDefinition() { - return new MCAuraDefinition(aura); - } - - @Override - public String getName() { - return aura.getType().name(); - } - - @Override - public String getDisplayName() { - return aura.getType().name(); - } - - @Override - public int getAmount() { - return aura.getNum(); - } - - @Override - public IAuraStack withAmount(int amount) { - AuraQuantity result = new AuraQuantity(aura.getType(), amount); - return new MCAuraStack(result); - } - - @Override - public Object getInternal() { - return aura; - } -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/auracascade/commands/AuraLogger.java b/src/main/java/modtweaker2/mods/auracascade/commands/AuraLogger.java deleted file mode 100644 index 24d5d1e..0000000 --- a/src/main/java/modtweaker2/mods/auracascade/commands/AuraLogger.java +++ /dev/null @@ -1,28 +0,0 @@ -package modtweaker2.mods.auracascade.commands; - -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import modtweaker2.ModTweaker2; -import pixlepix.auracascade.data.EnumAura; - -public class AuraLogger implements ICommandFunction { - - @Override - public void execute(String[] arguments, IPlayer player) { - - - System.out.println("Aura Types: " + EnumAura.values().length); - MineTweakerAPI.logCommand("Aura Types: " + EnumAura.values().length); - for (EnumAura aura : EnumAura.values()) { - ModTweaker2.logger.info("Aura Type: " + aura.name() + "."); - MineTweakerAPI.logCommand("Aura Type: " + aura.name() + "."); - - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/auracascade/handlers/Pylon.java b/src/main/java/modtweaker2/mods/auracascade/handlers/Pylon.java deleted file mode 100644 index 6dc2544..0000000 --- a/src/main/java/modtweaker2/mods/auracascade/handlers/Pylon.java +++ /dev/null @@ -1,86 +0,0 @@ -package modtweaker2.mods.auracascade.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.auracascade.AuraCascadeHelper; -import modtweaker2.mods.auracascade.aura.IAuraStack; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import pixlepix.auracascade.data.recipe.PylonRecipe; -import pixlepix.auracascade.data.recipe.PylonRecipeComponent; -import pixlepix.auracascade.data.recipe.PylonRecipeRegistry; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.auraCascade.Pylon") -public class Pylon { - - protected static final String name = "Aura Cascade Pylon"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(IItemStack ouput, IAuraStack stack, IItemStack input) { - addRecipe(ouput, stack, input, stack, input, stack, input, stack, input); - } - - @ZenMethod - public static void addRecipe(IItemStack ouput, IAuraStack aura1, IItemStack input1, IAuraStack aura2, IItemStack input2, IAuraStack aura3, IItemStack input3, IAuraStack aura4, IItemStack input4) { - List recipes = new LinkedList(); - - recipes.add(new PylonRecipe(toStack(ouput), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura1), toStack(input1)), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura2), toStack(input2)), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura3), toStack(input3)), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura1), toStack(input4)))); - - MineTweakerAPI.apply(new Add(recipes)); - } - - private static class Add extends BaseListAddition { - - public Add(List recipes) { - super(Pylon.name, PylonRecipeRegistry.recipes, recipes); - } - - @Override - protected String getRecipeInfo(PylonRecipe recipe) { - return LogHelper.getStackDescription(recipe.result); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - List recipes = new LinkedList(); - - for (PylonRecipe r : PylonRecipeRegistry.recipes) { - if (output.matches(toIItemStack(r.result))) { - recipes.add(r); - } - } - - // Check if we found the recipes and apply the action - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Pylon.name, output.toString())); - } - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(Pylon.name, PylonRecipeRegistry.recipes, recipes); - } - - @Override - protected String getRecipeInfo(PylonRecipe recipe) { - return LogHelper.getStackDescription(recipe.result); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/Botania.java b/src/main/java/modtweaker2/mods/botania/Botania.java deleted file mode 100644 index 0797b23..0000000 --- a/src/main/java/modtweaker2/mods/botania/Botania.java +++ /dev/null @@ -1,34 +0,0 @@ -package modtweaker2.mods.botania; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.botania.handlers.Apothecary; -import modtweaker2.mods.botania.handlers.Brew; -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.PureDaisy; -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(Brew.class); - MineTweakerAPI.registerClass(ElvenTrade.class); - MineTweakerAPI.registerClass(ManaInfusion.class); - MineTweakerAPI.registerClass(Orechid.class); - MineTweakerAPI.registerClass(PureDaisy.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))); - } -} diff --git a/src/main/java/modtweaker2/mods/botania/BotaniaHelper.java b/src/main/java/modtweaker2/mods/botania/BotaniaHelper.java deleted file mode 100644 index 124a523..0000000 --- a/src/main/java/modtweaker2/mods/botania/BotaniaHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -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 catagories=BotaniaAPI.getAllCategories(); - for(int i=0;i entries=BotaniaAPI.getAllEntries(); - for(int i=0;i 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")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/commands/BotaniaLogger.java b/src/main/java/modtweaker2/mods/botania/commands/BotaniaLogger.java deleted file mode 100644 index 39fae4f..0000000 --- a/src/main/java/modtweaker2/mods/botania/commands/BotaniaLogger.java +++ /dev/null @@ -1,104 +0,0 @@ -package modtweaker2.mods.botania.commands; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StringHelper; -import net.minecraft.item.ItemStack; -import vazkii.botania.api.BotaniaAPI; -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.RecipePureDaisy; -import vazkii.botania.api.recipe.RecipeRuneAltar; - -public class BotaniaLogger implements ICommandFunction { - - private static final List validArguments = new LinkedList(); - - static { - validArguments.add("Apothecary"); - validArguments.add("Brew"); - validArguments.add("ElvenTrade"); - validArguments.add("ManaInfusion"); - validArguments.add("PureDaisy"); - validArguments.add("RuneAltar"); - } - - @Override - public void execute(String[] arguments, IPlayer player) { - List args = StringHelper.toLowerCase(Arrays.asList(arguments)); - - if(!validArguments.containsAll(args)) { - if(player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", "))); - } - } else { - if(args.isEmpty() || args.contains("Apothecary")) { - for(RecipePetals recipe : BotaniaAPI.petalRecipes) { - MineTweakerAPI.logCommand(String.format("mods.botania.Apothecary.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.getOutput()), - LogHelper.getListDescription(recipe.getInputs()) // Need to resolve "petalXXX" to an item - )); - } - } - - if(args.isEmpty() || args.contains("Brew")) { - for(RecipeBrew recipe : BotaniaAPI.brewRecipes) { - MineTweakerAPI.logCommand(String.format("mods.botania.Brew.addRecipe(%s, \"%s\");", - LogHelper.getListDescription(recipe.getInputs()), - recipe.getBrew().getKey())); - } - } - - if(args.isEmpty() || args.contains("ElvenTrade")) { - for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) { - MineTweakerAPI.logCommand(String.format("mods.botania.ElvenTrade.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.getOutput()), - LogHelper.getListDescription(recipe.getInputs() - ))); - } - } - - if(args.isEmpty() || args.contains("ManaInfusion")) { - for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) { - MineTweakerAPI.logCommand(String.format("mods.botania.ManaInfusion.add%s(%s, %s, %d);", - recipe.isAlchemy() ? "Alchemy" : recipe.isConjuration() ? "Conjuration" : "Infusion", - LogHelper.getStackDescription(recipe.getOutput()), - LogHelper.getStackDescription(recipe.getInput()), - recipe.getManaToConsume() - )); - } - } - - if(args.isEmpty() || args.contains("PureDaisy")) { - for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) { - MineTweakerAPI.logCommand(String.format("mods.botania.PureDaisy.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta())))); - } - } - - if(args.isEmpty() || args.contains("RuneAltar")) { - for(RecipeRuneAltar recipe : BotaniaAPI.runeAltarRecipes) { - MineTweakerAPI.logCommand(String.format("mods.botania.RuneAltar.addRecipe(%s, %s, %d);", - LogHelper.getStackDescription(recipe.getOutput()), - LogHelper.getListDescription(recipe.getInputs()), - recipe.getManaUsage() - )); - } - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/commands/BotaniaOrechidLogger.java b/src/main/java/modtweaker2/mods/botania/commands/BotaniaOrechidLogger.java deleted file mode 100644 index 402dd3a..0000000 --- a/src/main/java/modtweaker2/mods/botania/commands/BotaniaOrechidLogger.java +++ /dev/null @@ -1,27 +0,0 @@ -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 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")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/handlers/Apothecary.java b/src/main/java/modtweaker2/mods/botania/handlers/Apothecary.java deleted file mode 100644 index d61b4ae..0000000 --- a/src/main/java/modtweaker2/mods/botania/handlers/Apothecary.java +++ /dev/null @@ -1,88 +0,0 @@ -package modtweaker2.mods.botania.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toObjects; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -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; - -@ZenClass("mods.botania.Apothecary") -public class Apothecary { - - protected static final String name = "Botania Petal"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @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) { - addRecipe(toIItemStack(ItemBlockSpecialFlower.ofType(output)), input); - } - - private static class Add extends BaseListAddition { - public Add(RecipePetals recipe) { - super("Botania Petal", BotaniaAPI.petalRecipes); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(RecipePetals recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - // Get list of existing recipes, matching with parameter - LinkedList result = new LinkedList(); - - for(RecipePetals entry : BotaniaAPI.petalRecipes) { - if(entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) { - result.add(entry); - } - } - - // Check if we found the recipes and apply the action - if(!result.isEmpty()) { - MineTweakerAPI.apply(new Remove(result)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Apothecary.name, output.toString())); - } - } - - @ZenMethod - public static void removeRecipe(String output) { - removeRecipe(toIItemStack(ItemBlockSpecialFlower.ofType(output))); - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(Apothecary.name, BotaniaAPI.petalRecipes, recipes); - } - - @Override - public String getRecipeInfo(RecipePetals recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/handlers/Brew.java b/src/main/java/modtweaker2/mods/botania/handlers/Brew.java deleted file mode 100644 index e325dda..0000000 --- a/src/main/java/modtweaker2/mods/botania/handlers/Brew.java +++ /dev/null @@ -1,88 +0,0 @@ -package modtweaker2.mods.botania.handlers; - -import java.util.LinkedList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StringHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import vazkii.botania.api.BotaniaAPI; -import vazkii.botania.api.recipe.RecipeBrew; - -@ZenClass("mods.botania.Brew") -public class Brew { - - public static final String name = "Botania Brew"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(IIngredient[] inputItems, String brewName) { - if(inputItems == null || inputItems.length == 0 || brewName == null || brewName.length() == 0) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(!BotaniaAPI.brewMap.containsKey(brewName)) { - LogHelper.logError(String.format("Unknown brew name \"%s\" for %s recipe.", brewName, name)); - } - - RecipeBrew recipe = new RecipeBrew(BotaniaAPI.brewMap.get(brewName), InputHelper.toObjects(inputItems)); - - MineTweakerAPI.apply(new Add(recipe)); - } - - private static class Add extends BaseListAddition { - - protected Add(RecipeBrew recipe) { - super(Brew.name, BotaniaAPI.brewRecipes); - recipes.add(recipe); - } - - @Override - protected String getRecipeInfo(RecipeBrew recipe) { - return recipe.getBrew().getKey(); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(String brewName) { - List recipes = new LinkedList(); - Matcher matcher = Pattern.compile(StringHelper.wildcardToRegex(brewName)).matcher(""); - - for(RecipeBrew recipe : BotaniaAPI.brewRecipes) { - matcher.reset(recipe.getBrew().getKey()); - if(matcher.matches()) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s. Command ignored!", name, brewName)); - } - } - - public static class Remove extends BaseListRemoval { - - protected Remove(List recipes) { - super(Brew.name, BotaniaAPI.brewRecipes, recipes); - } - - @Override - protected String getRecipeInfo(RecipeBrew recipe) { - return recipe.getBrew().getKey(); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/handlers/ElvenTrade.java b/src/main/java/modtweaker2/mods/botania/handlers/ElvenTrade.java deleted file mode 100644 index 78cfcde..0000000 --- a/src/main/java/modtweaker2/mods/botania/handlers/ElvenTrade.java +++ /dev/null @@ -1,77 +0,0 @@ -package modtweaker2.mods.botania.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toObjects; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import vazkii.botania.api.BotaniaAPI; -import vazkii.botania.api.recipe.RecipeElvenTrade; - -@ZenClass("mods.botania.ElvenTrade") -public class ElvenTrade { - - protected static final String name = "Botania Eleven Trade"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @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(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(RecipeElvenTrade recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - // Get list of existing recipes, matching with parameter - LinkedList recipes = new LinkedList(); - - for(RecipeElvenTrade entry : BotaniaAPI.elvenTradeRecipes) { - if(entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) { - recipes.add(entry); - } - } - - // Check if we found the recipes and apply the action - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ElvenTrade.name, output.toString())); - } - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes, recipes); - } - - @Override - public String getRecipeInfo(RecipeElvenTrade recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/handlers/Lexicon.java b/src/main/java/modtweaker2/mods/botania/handlers/Lexicon.java deleted file mode 100644 index b0b910e..0000000 --- a/src/main/java/modtweaker2/mods/botania/handlers/Lexicon.java +++ /dev/null @@ -1,472 +0,0 @@ -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 net.minecraft.item.ItemStack; -import net.minecraft.init.Blocks; -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 recipes=new ArrayList(); - for(int i=0;ilexiconEntry.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 recipes=new ArrayList(); - for(int i=0;ilexiconEntry.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 recipes=new ArrayList(); - for(int i=0;ilexiconEntry.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 recipes=new ArrayList(); - for(int i=0;ilexiconEntry.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 recipes=new ArrayList(); - for(int i=0;ilexiconEntry.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 recipes=new ArrayList(); - for(int i=0;ilexiconEntry.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 recipes=new ArrayList(); - for(int i=0;ilexiconEntry.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, IItemStack stack) { - LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(catagory); - if(lexiconCategory==null) - { - MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+catagory); - return; - } - LexiconEntry lexiconEntry=new LexiconEntry(entry,lexiconCategory); - lexiconEntry.setIcon(toStack(stack)); - 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() { - public Add(RecipeManaInfusion recipe) { - super(ManaInfusion.name, BotaniaAPI.manaInfusionRecipes); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(RecipeManaInfusion recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - // Get list of existing recipes, matching with parameter - List recipes = new LinkedList(); - - for (RecipeManaInfusion r : BotaniaAPI.manaInfusionRecipes) { - if (r.getOutput() != null && matches(output, toIItemStack(r.getOutput()))) { - recipes.add(r); - } - } - - // Check if we found the recipes and apply the action - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ManaInfusion.name, output.toString())); - } - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(ManaInfusion.name, BotaniaAPI.manaInfusionRecipes, recipes); - } - - @Override - public String getRecipeInfo(RecipeManaInfusion recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/handlers/Orechid.java b/src/main/java/modtweaker2/mods/botania/handlers/Orechid.java deleted file mode 100644 index fa83f86..0000000 --- a/src/main/java/modtweaker2/mods/botania/handlers/Orechid.java +++ /dev/null @@ -1,113 +0,0 @@ -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; - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/handlers/PureDaisy.java b/src/main/java/modtweaker2/mods/botania/handlers/PureDaisy.java deleted file mode 100644 index 2c4fdd6..0000000 --- a/src/main/java/modtweaker2/mods/botania/handlers/PureDaisy.java +++ /dev/null @@ -1,93 +0,0 @@ -package modtweaker2.mods.botania.handlers; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraft.block.Block; -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.RecipePureDaisy; - -@ZenClass("mods.botania.PureDaisy") -public class PureDaisy { - - public static final String name = "Botania PureDaisy"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(IIngredient blockInput, IItemStack blockOutput) { - if(blockInput == null || blockOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - Object input = InputHelper.toObject(blockInput); - - if(input == null || (input instanceof ItemStack && !InputHelper.isABlock((ItemStack)input))) { - LogHelper.logError(String.format("Input must be a block or an oredict entry.")); - return; - } - - if(input instanceof ItemStack) input = Block.getBlockFromItem(((ItemStack)input).getItem()); - ItemStack output = InputHelper.toStack(blockOutput); - - RecipePureDaisy recipe = new RecipePureDaisy(input, Block.getBlockFromItem(output.getItem()), output.getItemDamage()); - - MineTweakerAPI.apply(new Add(recipe)); - } - - private static class Add extends BaseListAddition { - public Add(RecipePureDaisy recipe) { - super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes); - recipes.add(recipe); - } - - @Override - protected String getRecipeInfo(RecipePureDaisy recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta())); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - List recipes = new LinkedList(); - - for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) { - IItemStack out = InputHelper.toIItemStack(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta())); - - if(StackHelper.matches(output, out)) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - - } - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes, recipes); - } - - @Override - protected String getRecipeInfo(RecipePureDaisy recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/handlers/RuneAltar.java b/src/main/java/modtweaker2/mods/botania/handlers/RuneAltar.java deleted file mode 100644 index 51bf2eb..0000000 --- a/src/main/java/modtweaker2/mods/botania/handlers/RuneAltar.java +++ /dev/null @@ -1,78 +0,0 @@ -package modtweaker2.mods.botania.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toObjects; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import vazkii.botania.api.BotaniaAPI; -import vazkii.botania.api.recipe.RecipeRuneAltar; - -@ZenClass("mods.botania.RuneAltar") -public class RuneAltar { - - protected static final String name = "Botania Rune Altar"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @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(RuneAltar.name, BotaniaAPI.runeAltarRecipes); - - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(RecipeRuneAltar recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - // Get list of existing recipes, matching with parameter - List recipes = new LinkedList(); - - for (RecipeRuneAltar r : BotaniaAPI.runeAltarRecipes) { - if (r != null && r.getOutput() != null && matches(output, toIItemStack(r.getOutput()))) { - recipes.add(r); - } - } - - // Check if we found the recipes and apply the action - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ElvenTrade.name, output.toString())); - } - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(RuneAltar.name, BotaniaAPI.runeAltarRecipes, recipes); - } - - @Override - public String getRecipeInfo(RecipeRuneAltar recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/AddCategory.java b/src/main/java/modtweaker2/mods/botania/lexicon/AddCategory.java deleted file mode 100644 index 9747066..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/AddCategory.java +++ /dev/null @@ -1,44 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/AddEntry.java b/src/main/java/modtweaker2/mods/botania/lexicon/AddEntry.java deleted file mode 100644 index b3c4068..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/AddEntry.java +++ /dev/null @@ -1,45 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/AddPage.java b/src/main/java/modtweaker2/mods/botania/lexicon/AddPage.java deleted file mode 100644 index af5f0cf..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/AddPage.java +++ /dev/null @@ -1,50 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/AddRecipeMapping.java b/src/main/java/modtweaker2/mods/botania/lexicon/AddRecipeMapping.java deleted file mode 100644 index 90b3f67..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/AddRecipeMapping.java +++ /dev/null @@ -1,49 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/RemoveCategory.java b/src/main/java/modtweaker2/mods/botania/lexicon/RemoveCategory.java deleted file mode 100644 index edbea43..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/RemoveCategory.java +++ /dev/null @@ -1,44 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/RemoveEntry.java b/src/main/java/modtweaker2/mods/botania/lexicon/RemoveEntry.java deleted file mode 100644 index 4c6cf13..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/RemoveEntry.java +++ /dev/null @@ -1,45 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/RemovePage.java b/src/main/java/modtweaker2/mods/botania/lexicon/RemovePage.java deleted file mode 100644 index a971984..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/RemovePage.java +++ /dev/null @@ -1,48 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/RemoveRecipeMapping.java b/src/main/java/modtweaker2/mods/botania/lexicon/RemoveRecipeMapping.java deleted file mode 100644 index e1b7e2a..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/RemoveRecipeMapping.java +++ /dev/null @@ -1,51 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/SetCategoryIcon.java b/src/main/java/modtweaker2/mods/botania/lexicon/SetCategoryIcon.java deleted file mode 100644 index 491d1af..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/SetCategoryIcon.java +++ /dev/null @@ -1,48 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/SetCategoryPriority.java b/src/main/java/modtweaker2/mods/botania/lexicon/SetCategoryPriority.java deleted file mode 100644 index 2c049c3..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/SetCategoryPriority.java +++ /dev/null @@ -1,47 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/SetEntryKnowledgeType.java b/src/main/java/modtweaker2/mods/botania/lexicon/SetEntryKnowledgeType.java deleted file mode 100644 index aa438c5..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/SetEntryKnowledgeType.java +++ /dev/null @@ -1,48 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconCategoryLogger.java b/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconCategoryLogger.java deleted file mode 100644 index 64a502d..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconCategoryLogger.java +++ /dev/null @@ -1,27 +0,0 @@ -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 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")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconEntryLogger.java b/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconEntryLogger.java deleted file mode 100644 index 4eb4534..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconEntryLogger.java +++ /dev/null @@ -1,42 +0,0 @@ -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 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")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconKnowledgeTypesLogger.java b/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconKnowledgeTypesLogger.java deleted file mode 100644 index 60b67c0..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconKnowledgeTypesLogger.java +++ /dev/null @@ -1,26 +0,0 @@ -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 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")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconPageLogger.java b/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconPageLogger.java deleted file mode 100644 index 870ca9a..0000000 --- a/src/main/java/modtweaker2/mods/botania/lexicon/commands/LexiconPageLogger.java +++ /dev/null @@ -1,47 +0,0 @@ -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 entries; - List 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")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/chisel/Chisel.java b/src/main/java/modtweaker2/mods/chisel/Chisel.java deleted file mode 100644 index e113be5..0000000 --- a/src/main/java/modtweaker2/mods/chisel/Chisel.java +++ /dev/null @@ -1,11 +0,0 @@ -package modtweaker2.mods.chisel; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.chisel.handlers.Groups; - -public class Chisel { - public Chisel() { - MineTweakerAPI.registerClass(Groups.class); - } - -} diff --git a/src/main/java/modtweaker2/mods/chisel/ChiselHelper.java b/src/main/java/modtweaker2/mods/chisel/ChiselHelper.java deleted file mode 100644 index 90215c4..0000000 --- a/src/main/java/modtweaker2/mods/chisel/ChiselHelper.java +++ /dev/null @@ -1,158 +0,0 @@ -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 variations = Lists.newArrayList(); - - public CarvingGroup(String name) { - this.name = name; - } - - public List getVariations() { - return Lists.newArrayList(variations); - } - - @Override - public void addVariation(ICarvingVariation variation) { - variations.add(variation); - Collections.sort(variations, new Comparator() { - - @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; - } - } -} diff --git a/src/main/java/modtweaker2/mods/chisel/commands/ChiselGroupLogger.java b/src/main/java/modtweaker2/mods/chisel/commands/ChiselGroupLogger.java deleted file mode 100644 index 55dd684..0000000 --- a/src/main/java/modtweaker2/mods/chisel/commands/ChiselGroupLogger.java +++ /dev/null @@ -1,27 +0,0 @@ -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 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")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/chisel/commands/ChiselVariationLogger.java b/src/main/java/modtweaker2/mods/chisel/commands/ChiselVariationLogger.java deleted file mode 100644 index 61817eb..0000000 --- a/src/main/java/modtweaker2/mods/chisel/commands/ChiselVariationLogger.java +++ /dev/null @@ -1,57 +0,0 @@ -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 variations=new HashMap(); - List 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 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")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/chisel/handlers/Groups.java b/src/main/java/modtweaker2/mods/chisel/handlers/Groups.java deleted file mode 100644 index e59eb5c..0000000 --- a/src/main/java/modtweaker2/mods/chisel/handlers/Groups.java +++ /dev/null @@ -1,233 +0,0 @@ -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; - } - } - -} diff --git a/src/main/java/modtweaker2/mods/exnihilo/ExNihilo.java b/src/main/java/modtweaker2/mods/exnihilo/ExNihilo.java deleted file mode 100644 index 62991ed..0000000 --- a/src/main/java/modtweaker2/mods/exnihilo/ExNihilo.java +++ /dev/null @@ -1,16 +0,0 @@ -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); - } -} diff --git a/src/main/java/modtweaker2/mods/exnihilo/ExNihiloHelper.java b/src/main/java/modtweaker2/mods/exnihilo/ExNihiloHelper.java deleted file mode 100644 index d4eca5b..0000000 --- a/src/main/java/modtweaker2/mods/exnihilo/ExNihiloHelper.java +++ /dev/null @@ -1,13 +0,0 @@ -package modtweaker2.mods.exnihilo; - -import java.util.Map; - -import modtweaker2.helpers.ReflectionHelper; -import exnihilo.registries.HeatRegistry; -import exnihilo.utils.ItemInfo; - -public class ExNihiloHelper { - public static Map getHeatMap() { - return ReflectionHelper.>getStaticObject(HeatRegistry.class, "heatmap"); - } -} diff --git a/src/main/java/modtweaker2/mods/exnihilo/commands/ExNihiloLogger.java b/src/main/java/modtweaker2/mods/exnihilo/commands/ExNihiloLogger.java deleted file mode 100644 index fe9c06c..0000000 --- a/src/main/java/modtweaker2/mods/exnihilo/commands/ExNihiloLogger.java +++ /dev/null @@ -1,99 +0,0 @@ -package modtweaker2.mods.exnihilo.commands; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StringHelper; -import modtweaker2.mods.exnihilo.ExNihiloHelper; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import exnihilo.registries.CompostRegistry; -import exnihilo.registries.CrucibleRegistry; -import exnihilo.registries.HammerRegistry; -import exnihilo.registries.SieveRegistry; -import exnihilo.registries.helpers.Compostable; -import exnihilo.registries.helpers.Meltable; -import exnihilo.registries.helpers.SiftingResult; -import exnihilo.registries.helpers.Smashable; -import exnihilo.utils.ItemInfo; - -public class ExNihiloLogger implements ICommandFunction { - - private static final List validArguments = new LinkedList(); - - static { - validArguments.add("Composting"); - validArguments.add("Crucible"); - validArguments.add("Hammer"); - validArguments.add("Sieve"); - } - - @Override - public void execute(String[] arguments, IPlayer player) { - List args = StringHelper.toLowerCase(Arrays.asList(arguments)); - - if(!validArguments.containsAll(args)) { - if(player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", "))); - } - } else { - if(args.isEmpty() || args.contains("Composting")) { - for(Entry recipe : CompostRegistry.entries.entrySet()) { - MineTweakerAPI.logCommand(String.format("mods.exnihilo.Composting.addRecipe(%s, %s, \"%s\");", - LogHelper.getStackDescription(recipe.getKey().getStack()), - recipe.getValue().value, - Integer.toHexString(recipe.getValue().color.toInt()).substring(2))); - } - } - - if(args.isEmpty() || args.contains("Crucible")) { - for(Meltable recipe : CrucibleRegistry.entries.values()) { - MineTweakerAPI.logCommand(String.format("mods.exnihilo.Crucible.addRecipe(%s, %s);", - LogHelper.getStackDescription(new ItemStack(recipe.block, 1, recipe.meta)), - LogHelper.getStackDescription(new FluidStack(recipe.fluid, (int)recipe.fluidVolume)))); - } - - for(Entry recipe : ExNihiloHelper.getHeatMap().entrySet()) { - MineTweakerAPI.logCommand(String.format("mods.exnihilo.Crucible.addHeatSource(%s, %s);", - LogHelper.getStackDescription(recipe.getKey().getStack()), - recipe.getValue())); - } - } - - if(args.isEmpty() || args.contains("Hammer")) { - for(Entry> entry : HammerRegistry.getRewards().entrySet()) { - for(Smashable recipe : entry.getValue()) { - MineTweakerAPI.logCommand(String.format("mods.exnihilo.Hammer.addRecipe(%s, %s, %s, %s);", - LogHelper.getStackDescription(entry.getKey().getStack()), - LogHelper.getStackDescription(new ItemStack(recipe.item, 1, recipe.meta)), - recipe.chance, - recipe.luckMultiplier)); - } - } - } - - if(args.isEmpty() || args.contains("Sieve")) { - for(Entry> entry : SieveRegistry.getSiftables().entrySet()) { - for(SiftingResult recipe : entry.getValue()) { - MineTweakerAPI.logCommand(String.format("mods.exnihilo.Sieve.addRecipe(%s, %s, %s);", - LogHelper.getStackDescription(entry.getKey().getStack()), - LogHelper.getStackDescription(new ItemStack(recipe.item, 1, recipe.meta)), - recipe.rarity)); - } - } - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } - } -} diff --git a/src/main/java/modtweaker2/mods/exnihilo/handlers/Compost.java b/src/main/java/modtweaker2/mods/exnihilo/handlers/Compost.java deleted file mode 100644 index 04c4457..0000000 --- a/src/main/java/modtweaker2/mods/exnihilo/handlers/Compost.java +++ /dev/null @@ -1,92 +0,0 @@ -package modtweaker2.mods.exnihilo.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -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; -import exnihilo.utils.ItemInfo; - - -@ZenClass("mods.exnihilo.Composting") -public class Compost { - - public static final String name = "ExNihilo Composting"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(IItemStack input, double value, @Optional String hex) { - if(input == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - hex = (hex == null || hex.equals("")) ? "35A82A" : hex; - - Map recipes = new HashMap(); - - recipes.put( - new ItemInfo(toStack(input)), - new Compostable(Math.min(1.0F, (float)value), new Color(hex))); - - MineTweakerAPI.apply(new Add(recipes)); - } - - private static class Add extends BaseMapAddition { - public Add(Map recipes) { - super(Compost.name, CompostRegistry.entries, recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(recipe.getKey().getStack()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input) { - Map recipes = new HashMap(); - - for(Entry recipe : CompostRegistry.entries.entrySet()) { - if(matches(input, toIItemStack(recipe.getKey().getStack()))) { - recipes.put(recipe.getKey(), recipe.getValue()); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipes found for %s. Command ignored!", Compost.name, input.toString())); - } - - } - - private static class Remove extends BaseMapRemoval { - public Remove(Map recipes) { - super(Compost.name, CompostRegistry.entries, recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(recipe.getKey().getStack()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/exnihilo/handlers/Crucible.java b/src/main/java/modtweaker2/mods/exnihilo/handlers/Crucible.java deleted file mode 100644 index 851d76f..0000000 --- a/src/main/java/modtweaker2/mods/exnihilo/handlers/Crucible.java +++ /dev/null @@ -1,176 +0,0 @@ -package modtweaker2.mods.exnihilo.handlers; - -import static modtweaker2.helpers.InputHelper.isABlock; -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.exnihilo.ExNihiloHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import exnihilo.registries.CrucibleRegistry; -import exnihilo.registries.helpers.Meltable; -import exnihilo.utils.ItemInfo; - -@ZenClass("mods.exnihilo.Crucible") -public class Crucible { - - public static final String nameMelting = "ExNihilo Crucible (Melting)"; - public static final String nameHeatSource = "ExNihilo Crucible (Heat source)"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /************************************************ Crucible Melting ************************************************/ - //Adding a Ex Nihilo Crucible recipe - @ZenMethod - public static void addRecipe(IItemStack input, ILiquidStack fluid) { - if(input == null || fluid == null) { - LogHelper.logError(String.format("Required parameters missing for %s recipe.", nameMelting)); - return; - } - - if(!isABlock(input)) { - LogHelper.logError(String.format("Input item for %s recipe must be a block.", nameMelting)); - return; - } - - Map recipes = new HashMap(); - Block theBlock = Block.getBlockFromItem(toStack(input).getItem()); - int theMeta = toStack(input).getItemDamage(); - - recipes.put( - theBlock + ":" + theMeta, - new Meltable(theBlock, theMeta, 2000, toFluid(fluid).getFluid(), toFluid(fluid).amount, theBlock)); - - MineTweakerAPI.apply(new AddRecipe(recipes)); - } - - //Passes the list to the map list implementation, and adds the recipe - private static class AddRecipe extends BaseMapAddition { - public AddRecipe(Map recipes) { - super(nameMelting, CrucibleRegistry.entries, recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.getValue().block, 1, recipe.getValue().meta)); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //Removing a Ex Nihilo Crucible recipe - @ZenMethod - public static void removeRecipe(IIngredient output) { - Map recipes = new HashMap(); - - for(Entry entry : CrucibleRegistry.entries.entrySet()) { - FluidStack fluid = new FluidStack(entry.getValue().fluid, (int)entry.getValue().fluidVolume); - if(matches(output, toILiquidStack(fluid))) { - recipes.put(entry.getKey(), entry.getValue()); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveRecipe(recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s. Command ignored!", Crucible.nameMelting, output.toString())); - } - } - - //Removes a recipe, will always remove the key, so all should be good - private static class RemoveRecipe extends BaseMapRemoval { - public RemoveRecipe(Map recipes) { - super(nameMelting, CrucibleRegistry.entries, recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.getValue().block, 1, recipe.getValue().meta)); - } - } - - /********************************************** Crucible Heat Sources **********************************************/ - //Adding a Ex Nihilo Crucible heat source - @ZenMethod - public static void addHeatSource(IItemStack input, double value) { - if(input == null) { - LogHelper.logError(String.format("Required parameters missing for %s recipe.", nameMelting)); - return; - } - - if(!isABlock(input)) { - LogHelper.logError(String.format("Input item for %s recipe must be a block.", nameMelting)); - return; - } - - Map recipes = new HashMap(); - recipes.put(new ItemInfo(toStack(input)), (float)value); - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new AddHeatSource(recipes)); - } - } - - //Passes the list to the base map implementation, and adds the recipe - private static class AddHeatSource extends BaseMapAddition - { - public AddHeatSource(Map recipes) { - super(Crucible.nameHeatSource, ExNihiloHelper.getHeatMap(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(recipe.getKey().getStack()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //Removing a Ex Nihilo Crucible heat source - @ZenMethod - public static void removeHeatSource(IIngredient output) { - Map recipes = new HashMap(); - - for(Entry entry : ExNihiloHelper.getHeatMap().entrySet()) { - if(matches(output, toIItemStack(entry.getKey().getStack()))) { - recipes.put(entry.getKey(), entry.getValue()); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveHeatSource(recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s. Command ignored!", Crucible.nameMelting, output.toString())); - } - } - - //Removes a recipe, will always remove the key, so all should be good - private static class RemoveHeatSource extends BaseMapRemoval - { - public RemoveHeatSource(Map recipes) { - super(Crucible.nameHeatSource, ExNihiloHelper.getHeatMap(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(recipe.getKey().getStack()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/exnihilo/handlers/Hammer.java b/src/main/java/modtweaker2/mods/exnihilo/handlers/Hammer.java deleted file mode 100644 index 0986297..0000000 --- a/src/main/java/modtweaker2/mods/exnihilo/handlers/Hammer.java +++ /dev/null @@ -1,249 +0,0 @@ -package modtweaker2.mods.exnihilo.handlers; - -import static modtweaker2.helpers.InputHelper.isABlock; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import exnihilo.registries.HammerRegistry; -import exnihilo.registries.helpers.Smashable; -import exnihilo.utils.ItemInfo; - -@ZenClass("mods.exnihilo.Hammer") -public class Hammer { - - public static final String name = "ExNihilo Hammer"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(IItemStack input, IItemStack output, double chance, double luck) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s recipe.", name)); - return; - } - - addRecipe(input, new IItemStack[] { output }, new double[] { chance }, new double[] { luck }); - } - - @ZenMethod - public static void addRecipe(IItemStack input, IItemStack[] output, double[] chance, double[] luck) { - if(input == null || output == null || chance == null || luck == null) { - LogHelper.logError(String.format("Required parameters missing for %s recipe.", name)); - return; - } - - if(!isABlock(input)) { - LogHelper.logError(String.format("Input item for %s recipe must be a block.", name)); - return; - } - - if(output.length == 0 || output.length != chance.length || output.length != luck.length) { - LogHelper.logError(String.format("Number of items in arrays are different or null (%d, %d, %d)", output.length, chance.length, luck.length)); - return; - } - - Map> recipes = new HashMap>(); - ArrayList list = new ArrayList(); - ItemInfo itemInfo = new ItemInfo(toStack(input)); - recipes.put(itemInfo, list); - - for(int i = 0; i < output.length; i++) { - ItemStack out = toStack(output[i]); - list.add(new Smashable(Block.getBlockFromItem(itemInfo.getItem()), itemInfo.getMeta(), out.getItem(), out.getItemDamage(), (float)chance[i], (float)luck[i])); - } - - MineTweakerAPI.apply(new Add(recipes)); - } - - private static class Add extends BaseMapAddition> { - public Add(Map> recipes) { - super(Hammer.name, HammerRegistry.getRewards(), recipes); - } - - public void apply() { - for(Entry> entry : recipes.entrySet()) { - if(!map.containsKey(entry.getKey())) { - // no recipe for input available, add new entry - map.put(entry.getKey(), new ArrayList(entry.getValue())); - } else { - // recipes already available, add to present list - ArrayList list = map.get(entry.getKey()); - - // store old Smashable objects if present - ArrayList backup = new ArrayList(); - for(Smashable recipe : entry.getValue()) { - backup.addAll(removeFromList(list, recipe)); - } - - if(!backup.isEmpty()) { - LogHelper.logWarning(String.format("Overwritten %d %s recipe outputs for %s.", backup.size(), Hammer.name, LogHelper.getStackDescription(entry.getKey().getStack()))); - overwritten.put(entry.getKey(), backup); - } - - // add new Smashable objects - list.addAll(entry.getValue()); - } - - successful.put(entry.getKey(), entry.getValue()); - } - } - - public void undo() { - // remove all recipes - for(Entry> entry : successful.entrySet()) { - ArrayList list = map.get(entry.getKey()); - for(Smashable recipe : entry.getValue()) { - removeFromList(list, recipe); - } - } - - // re-add overwritten recipes - for(Entry> entry : overwritten.entrySet()) { - map.get(entry.getKey()).addAll(entry.getValue()); - } - - // remove empty entries - for(Iterator>> it = map.entrySet().iterator(); it.hasNext(); ) { - Entry> entry = it.next(); - if(entry.getValue().isEmpty()) { - it.remove(); - } - } - } - - @Override - protected String getRecipeInfo(Entry> recipe) { - return LogHelper.getStackDescription(recipe.getKey().getStack()) + " (" + recipe.getValue().size() + " entries)"; - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @Deprecated - @ZenMethod - public static void removeRecipe(IItemStack inputBlock, int inputBlockMeta, IItemStack outputItem, int outputItemMeta) { - removeRecipe(toIItemStack(new ItemStack(toStack(inputBlock).getItem(), 1, inputBlockMeta)), toIItemStack(new ItemStack(toStack(outputItem).getItem(), 1, outputItemMeta))); - } - - @ZenMethod - public static void removeRecipe(IIngredient input, @Optional IIngredient output) { - if(input == null) { - LogHelper.logError(String.format("Required parameters missing for %s recipe.", name)); - return; - } - - if(output == null) { - output = IngredientAny.INSTANCE; - } - - Map> recipes = new HashMap>(); - - for(Entry> entry : HammerRegistry.getRewards().entrySet()) { - if(input.matches(toIItemStack(entry.getKey().getStack()))) { - ArrayList list = entry.getValue(); - ArrayList toRemove = new ArrayList(); - - for(Smashable recipe : list) { - ItemStack item = new ItemStack(recipe.item, 1, recipe.meta); - - if(matches(output, toIItemStack(item))) { - toRemove.add(recipe); - } - } - - if(!toRemove.isEmpty()) { - recipes.put(entry.getKey(), toRemove); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipes found for %s and %s. Command ignored!", name, input.toString(), output.toString())); - } - } - - // Removes a recipe, apply is never the same for anything, so will always - // need to override it - private static class Remove extends BaseMapRemoval> { - - public Remove(Map> recipes) { - super(Hammer.name, HammerRegistry.getRewards(), recipes); - } - - @Override - public void apply() { - for(Entry> entry : recipes.entrySet()) { - ArrayList list = map.get(entry.getKey()); - - for(Smashable recipe : entry.getValue()) { - removeFromList(list, recipe); - } - - successful.put(entry.getKey(), entry.getValue()); - } - - // remove empty entries - for(Iterator>> it = map.entrySet().iterator(); it.hasNext(); ) { - Entry> entry = it.next(); - if(entry.getValue().isEmpty()) { - it.remove(); - } - } - } - - @Override - public void undo() { - for(Entry> entry : successful.entrySet()) { - if(!map.containsKey(entry.getKey())) { - map.put(entry.getKey(), new ArrayList(entry.getValue())); - } else { - map.get(entry.getKey()).addAll(entry.getValue()); - } - } - } - - @Override - protected String getRecipeInfo(Entry> recipe) { - return LogHelper.getStackDescription(recipe.getKey().getStack()) + " (" + recipe.getValue().size() + " entries)"; - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - public static ArrayList removeFromList(ArrayList list, Smashable s) { - ArrayList removed = new ArrayList(); - ItemInfo toRemove = new ItemInfo(s.item, s.meta); - for(Iterator it = list.iterator(); it.hasNext(); ) { - Smashable itS = it.next(); - ItemInfo item = new ItemInfo(itS.item, itS.meta); - - if(item.equals(toRemove)) { - removed.add(itS); - it.remove(); - } - } - - return removed; - } -} diff --git a/src/main/java/modtweaker2/mods/exnihilo/handlers/Sieve.java b/src/main/java/modtweaker2/mods/exnihilo/handlers/Sieve.java deleted file mode 100644 index 1d06552..0000000 --- a/src/main/java/modtweaker2/mods/exnihilo/handlers/Sieve.java +++ /dev/null @@ -1,267 +0,0 @@ -package modtweaker2.mods.exnihilo.handlers; - -import static modtweaker2.helpers.InputHelper.isABlock; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import exnihilo.registries.SieveRegistry; -import exnihilo.registries.helpers.SiftingResult; -import exnihilo.utils.ItemInfo; - -@ZenClass("mods.exnihilo.Sieve") -public class Sieve { - - public static final String name = "ExNihilo Sieve"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // Adding a Ex Nihilo Sieve recipe - @ZenMethod - public static void addRecipe(IItemStack input, IItemStack output, int rarity) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s recipe.", name)); - return; - } - - addRecipe(input, new IItemStack[] { output }, new int[] { rarity }); - } - - @ZenMethod - public static void addRecipe(IItemStack input, IItemStack[] output, int[] rarity) { - if(input == null || output == null || rarity == null) { - LogHelper.logError(String.format("Required parameters missing for %s recipe.", name)); - return; - } - - if(!isABlock(input)) { - LogHelper.logError(String.format("Input item for %s recipe must be a block.", name)); - return; - } - - if(output.length == 0 || output.length != rarity.length) { - LogHelper.logError(String.format("Number of items in arrays are different or null (%d, %d)", output.length, rarity.length)); - return; - } - - Map> recipes = new HashMap>(); - ArrayList list = new ArrayList(); - ItemInfo itemInfo = new ItemInfo(toStack(input)); - recipes.put(itemInfo, list); - - for(int i = 0; i < output.length; i++) { - ItemStack out = toStack(output[i]); - list.add(new SiftingResult(out.getItem(), out.getItemDamage(), rarity[i])); - } - - MineTweakerAPI.apply(new Add(recipes)); - } - - private static class Add extends BaseMapAddition> { - - public Add(Map> recipes) { - super(Sieve.name, SieveRegistry.getSiftables(), recipes); - } - - @Override - public void apply() { - for(Entry> entry : recipes.entrySet()) { - if(!map.containsKey(entry.getKey())) { - // no recipe for input available, add new entry - map.put(entry.getKey(), new ArrayList(entry.getValue())); - } else { - // recipes already available, add to present list - ArrayList list = map.get(entry.getKey()); - - // store old SiftingResult objects if present - ArrayList backup = new ArrayList(); - for(SiftingResult recipe : entry.getValue()) { - backup.addAll(removeFromList(list, recipe)); - } - - if(!backup.isEmpty()) { - LogHelper.logWarning(String.format("Overwritten %d %s recipe outputs for %s.", backup.size(), name, LogHelper.getStackDescription(entry.getKey().getStack()))); - overwritten.put(entry.getKey(), backup); - } - - // add new SiftingResult objects - list.addAll(entry.getValue()); - } - - successful.put(entry.getKey(), entry.getValue()); - } - } - - @Override - public void undo() { - // remove all recipes - for(Entry> entry : successful.entrySet()) { - ArrayList list = map.get(entry.getKey()); - for(SiftingResult recipe : entry.getValue()) { - removeFromList(list, recipe); - } - } - - // re-add overwritten recipes - for(Entry> entry : overwritten.entrySet()) { - map.get(entry.getKey()).addAll(entry.getValue()); - } - - // remove empty entries - for(Iterator>> it = map.entrySet().iterator(); it.hasNext(); ) { - Entry> entry = it.next(); - if(entry.getValue().isEmpty()) { - it.remove(); - } - } - } - - @Override - protected String getRecipeInfo(Entry> recipe) { - return LogHelper.getStackDescription(recipe.getKey().getStack()) + " (" + recipe.getValue().size() + " entries)"; - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @Deprecated - @ZenMethod - public static void removeRecipe(IItemStack input, IItemStack output) { - removeRecipe((IIngredient)input, (IIngredient)output); - } - - @Deprecated - @ZenMethod - public static void removeRewardFromAllBlocks(IItemStack output) - { - removeRecipe(IngredientAny.INSTANCE, (IIngredient)output); - } - - @Deprecated - @ZenMethod - public static void removeAllRewardsFromBlock(IItemStack output) - { - removeRecipe((IIngredient)output, IngredientAny.INSTANCE); - } - - @ZenMethod - public static void removeRecipe(IIngredient input, @Optional IIngredient output) { - if(input == null) { - LogHelper.logError(String.format("Required parameters missing for %s recipe.", name)); - return; - } - - if(output == null) { - output = IngredientAny.INSTANCE; - } - - Map> recipes = new HashMap>(); - - for(Entry> entry : SieveRegistry.getSiftables().entrySet()) { - if(input.matches(toIItemStack(entry.getKey().getStack()))) { - ArrayList list = entry.getValue(); - ArrayList toRemove = new ArrayList(); - - for(SiftingResult recipe : list) { - ItemStack item = new ItemStack(recipe.item, 1, recipe.meta); - - if(matches(output, toIItemStack(item))) { - toRemove.add(recipe); - } - } - - if(!toRemove.isEmpty()) { - recipes.put(entry.getKey(), toRemove); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipes found for %s and %s. Command ignored!", name, input.toString(), output.toString())); - } - } - - - - // Removes a recipe, apply is never the same for anything, so will always - // need to override it - private static class Remove extends BaseMapRemoval> { - public Remove(Map> recipes) { - super(Sieve.name, SieveRegistry.getSiftables(), recipes); - } - - @Override - public void apply() { - for(Entry> entry : recipes.entrySet()) { - ArrayList list = map.get(entry.getKey()); - - for(SiftingResult recipe : entry.getValue()) { - removeFromList(list, recipe); - } - - successful.put(entry.getKey(), entry.getValue()); - } - - // remove empty entries - for(Iterator>> it = map.entrySet().iterator(); it.hasNext(); ) { - Entry> entry = it.next(); - if(entry.getValue().isEmpty()) { - it.remove(); - } - } - } - - @Override - public void undo() { - for(Entry> entry : successful.entrySet()) { - if(!map.containsKey(entry.getKey())) { - map.put(entry.getKey(), new ArrayList(entry.getValue())); - } else { - map.get(entry.getKey()).addAll(entry.getValue()); - } - } - } - - @Override - protected String getRecipeInfo(Entry> recipe) { - return LogHelper.getStackDescription(recipe.getKey().getStack()) + " (" + recipe.getValue().size() + " entries)"; - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - public static ArrayList removeFromList(ArrayList list, SiftingResult s) { - ArrayList removed = new ArrayList(); - ItemInfo toRemove = new ItemInfo(s.item, s.meta); - for(Iterator it = list.iterator(); it.hasNext(); ) { - SiftingResult itS = it.next(); - ItemInfo item = new ItemInfo(itS.item, itS.meta); - - if(item.equals(toRemove)) { - removed.add(itS); - it.remove(); - } - } - - return removed; - } -} diff --git a/src/main/java/modtweaker2/mods/extendedworkbench/ExtendedWorkbench.java b/src/main/java/modtweaker2/mods/extendedworkbench/ExtendedWorkbench.java deleted file mode 100644 index 0e23edf..0000000 --- a/src/main/java/modtweaker2/mods/extendedworkbench/ExtendedWorkbench.java +++ /dev/null @@ -1,10 +0,0 @@ -package modtweaker2.mods.extendedworkbench; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.extendedworkbench.handlers.ExtendedCrafting; - -public class ExtendedWorkbench { - public ExtendedWorkbench() { - MineTweakerAPI.registerClass(ExtendedCrafting.class); - } -} diff --git a/src/main/java/modtweaker2/mods/extendedworkbench/handlers/ExtendedCrafting.java b/src/main/java/modtweaker2/mods/extendedworkbench/handlers/ExtendedCrafting.java deleted file mode 100644 index 7db7b57..0000000 --- a/src/main/java/modtweaker2/mods/extendedworkbench/handlers/ExtendedCrafting.java +++ /dev/null @@ -1,82 +0,0 @@ -package modtweaker2.mods.extendedworkbench.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.InputHelper.toStacks; - -import java.util.Arrays; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseCraftingAddition; -import modtweaker2.utils.BaseCraftingRemoval; -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 net.minecraft.item.crafting.IRecipe; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.extendedworkbench") -public class ExtendedCrafting { - - public static final String name = "Extended Workbench"; - - @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 BaseCraftingAddition { - public Add(IExtendedRecipe recipe) { - super(ExtendedCrafting.name, ExtendedCraftingManager.getInstance().getRecipeList()); - recipes.add(recipe); - } - } - - 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(IIngredient output) { - List recipes = BaseCraftingRemoval.getRecipes(ExtendedCraftingManager.getInstance().getRecipeList(), output); - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new BaseCraftingRemoval(ExtendedCrafting.name, ExtendedCraftingManager.getInstance().getRecipeList(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ExtendedCrafting.name, output)); - } - } -} diff --git a/src/main/java/modtweaker2/mods/extraUtils/ExtraUtils.java b/src/main/java/modtweaker2/mods/extraUtils/ExtraUtils.java deleted file mode 100644 index 3f2febf..0000000 --- a/src/main/java/modtweaker2/mods/extraUtils/ExtraUtils.java +++ /dev/null @@ -1,12 +0,0 @@ -package modtweaker2.mods.extraUtils; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.appeng.handlers.Grind; -import modtweaker2.mods.extraUtils.handlers.QED; - -public class ExtraUtils { - - public ExtraUtils() { - MineTweakerAPI.registerClass(QED.class); - } -} diff --git a/src/main/java/modtweaker2/mods/extraUtils/handlers/QED.java b/src/main/java/modtweaker2/mods/extraUtils/handlers/QED.java deleted file mode 100644 index 2321e73..0000000 --- a/src/main/java/modtweaker2/mods/extraUtils/handlers/QED.java +++ /dev/null @@ -1,74 +0,0 @@ -package modtweaker2.mods.extraUtils.handlers; - -import java.util.LinkedList; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraft.item.crafting.IRecipe; -import net.minecraftforge.oredict.ShapedOreRecipe; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import com.rwtema.extrautils.tileentity.enderconstructor.EnderConstructorRecipesHandler; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.StackHelper.matches; - -@ZenClass("mods.extraUtils.QED") -public class QED { - - public static final String name = "ExtraUtilities Q.E.D."; - - @ZenMethod - public static void addShapedRecipe(IItemStack output, IIngredient[][] recipe) { - MineTweakerAPI.apply(new Add(new ShapedOreRecipe(InputHelper.toStack(output), InputHelper.toShapedObjects(recipe)))); - } - - private static class Add extends BaseListAddition { - - public Add(IRecipe recipe) { - super("QED", EnderConstructorRecipesHandler.recipes); - recipes.add(recipe); - } - - @Override - protected String getRecipeInfo(IRecipe recipe) { - return recipe.toString(); - } - } - - @ZenMethod - public static void removeRecipe(IIngredient output) { - LinkedList recipes = new LinkedList(); - - for (IRecipe recipe : EnderConstructorRecipesHandler.recipes) { - if (recipe != null && recipe.getRecipeOutput() != null && matches(output, toIItemStack(recipe.getRecipeOutput()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", QED.name, LogHelper.getStackDescription(output))); - } - } - - public static class Remove extends BaseListRemoval { - - protected Remove(LinkedList stacks) { - super("QED", EnderConstructorRecipesHandler.recipes, stacks); - } - - @Override - protected String getRecipeInfo(IRecipe recipe) { - return recipe.toString(); - } - } - -} diff --git a/src/main/java/modtweaker2/mods/factorization/Factorization.java b/src/main/java/modtweaker2/mods/factorization/Factorization.java deleted file mode 100644 index 34af896..0000000 --- a/src/main/java/modtweaker2/mods/factorization/Factorization.java +++ /dev/null @@ -1,14 +0,0 @@ -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); - } -} diff --git a/src/main/java/modtweaker2/mods/factorization/FactorizationHelper.java b/src/main/java/modtweaker2/mods/factorization/FactorizationHelper.java deleted file mode 100644 index 0a576bb..0000000 --- a/src/main/java/modtweaker2/mods/factorization/FactorizationHelper.java +++ /dev/null @@ -1,51 +0,0 @@ -package modtweaker2.mods.factorization; - -import static modtweaker2.helpers.ReflectionHelper.getStaticObject; - -import java.util.List; - -import modtweaker2.helpers.ReflectionHelper; -import net.minecraft.item.ItemStack; - -public class FactorizationHelper { - @SuppressWarnings("rawtypes") - public static List lacerator = null; - @SuppressWarnings("rawtypes") - public static List slag = null; - @SuppressWarnings("rawtypes") - public static List crystallizer = null; - - static { - try { - lacerator = getStaticObject(Class.forName("factorization.oreprocessing.TileEntityGrinder"), "recipes"); - slag = ReflectionHelper.getObject(getStaticObject(Class.forName("factorization.oreprocessing.TileEntitySlagFurnace"), "recipes"), "list"); - crystallizer = ReflectionHelper.getObject(getStaticObject(Class.forName("factorization.oreprocessing.TileEntityCrystallizer"), "recipes"), "list"); - } catch (Exception e) {} - } - - private FactorizationHelper() {} - - public static Object getLaceratorRecipe(Object input, ItemStack output, float probability) { - return ReflectionHelper.getInstance(ReflectionHelper.getConstructor("factorization.oreprocessing.TileEntityGrinder$GrinderRecipe", Object.class, ItemStack.class, float.class), - input, - output, - probability); - } - - public static Object getSlagFurnaceRecipe(ItemStack input, float chance1, ItemStack output1, float chance2, ItemStack output2) { - return ReflectionHelper.getInstance(ReflectionHelper.getConstructor("factorization.oreprocessing.TileEntitySlagFurnace$SmeltingResult", ItemStack.class, float.class, ItemStack.class, float.class, ItemStack.class), - input, - chance1, - output1, - chance2, - output2); - } - - public static Object getCrystallizerRecipe(ItemStack input, ItemStack output, ItemStack solution, float output_count) { - return ReflectionHelper.getInstance(ReflectionHelper.getConstructor("factorization.oreprocessing.TileEntityCrystallizer$CrystalRecipe", ItemStack.class, ItemStack.class, float.class, ItemStack.class), - input, - output, - output_count, - solution); - } -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/factorization/commands/FactorizationLogger.java b/src/main/java/modtweaker2/mods/factorization/commands/FactorizationLogger.java deleted file mode 100644 index ba06923..0000000 --- a/src/main/java/modtweaker2/mods/factorization/commands/FactorizationLogger.java +++ /dev/null @@ -1,73 +0,0 @@ -package modtweaker2.mods.factorization.commands; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.helpers.StringHelper; -import modtweaker2.mods.factorization.FactorizationHelper; -import net.minecraft.item.ItemStack; - -public class FactorizationLogger implements ICommandFunction { - - private static final List validArguments = new LinkedList(); - - static { - validArguments.add("Crystallizer"); - validArguments.add("Lacerator"); - validArguments.add("SlagFurnace"); - } - - @Override - public void execute(String[] arguments, IPlayer player) { - List args = StringHelper.toLowerCase(Arrays.asList(arguments)); - - if(!validArguments.containsAll(args)) { - if(player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", "))); - } - } else { - if(args.isEmpty() || args.contains("Crystallizer")) { - for(Object recipe : FactorizationHelper.crystallizer) { - MineTweakerAPI.logCommand(String.format("mods.factorization.Crystallizer.addRecipe(%s, %s, %s, %s);", - LogHelper.getStackDescription(ReflectionHelper.getObject(recipe, "input")), - LogHelper.getStackDescription(ReflectionHelper.getObject(recipe, "output")), - LogHelper.getStackDescription(ReflectionHelper.getObject(recipe, "solution")), - ReflectionHelper.getObject(recipe, "output_count"))); - } - } - - if(args.isEmpty() || args.contains("Lacerator")) { - for(Object recipe : FactorizationHelper.lacerator) { - MineTweakerAPI.logCommand(String.format("mods.factorization.Lacerator.addRecipe(%s, %s, %s);", - ReflectionHelper.getObject(recipe, "oreName") != null ? - LogHelper.getStackDescription(ReflectionHelper.getObject(recipe, "oreName")) : - LogHelper.getStackDescription(ReflectionHelper.getObject(recipe, "itemstack")), - LogHelper.getStackDescription(ReflectionHelper.getObject(recipe, "output")), - ReflectionHelper.getObject(recipe, "probability"))); - } - } - - if(args.isEmpty() || args.contains("SlagFurnace")) { - for(Object recipe : FactorizationHelper.slag) { - MineTweakerAPI.logCommand(String.format("mods.factorization.SlagFurnace.addRecipe(%s, %s, %s, %s, %s);", - LogHelper.getStackDescription(ReflectionHelper.getObject(recipe, "input")), - LogHelper.getStackDescription(ReflectionHelper.getObject(recipe, "output2")), - ReflectionHelper.getObject(recipe, "prob2"), - LogHelper.getStackDescription(ReflectionHelper.getObject(recipe, "output1")), - ReflectionHelper.getObject(recipe, "prob1"))); - } - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/factorization/handlers/Crystallizer.java b/src/main/java/modtweaker2/mods/factorization/handlers/Crystallizer.java deleted file mode 100644 index 39e8166..0000000 --- a/src/main/java/modtweaker2/mods/factorization/handlers/Crystallizer.java +++ /dev/null @@ -1,82 +0,0 @@ -package modtweaker2.mods.factorization.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.factorization.FactorizationHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - - -@ZenClass("mods.factorization.Crystallizer") -public class Crystallizer { - - public static final String name = "Factorization 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(recipe)); - } - - private static class Add extends BaseListAddition { - @SuppressWarnings("unchecked") - public Add(Object recipe) { - super(Crystallizer.name, FactorizationHelper.crystallizer); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(Object recipe) { - return LogHelper.getStackDescription((ItemStack)ReflectionHelper.getObject(recipe, "output")); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - List recipes = new LinkedList(); - - for (Object r : FactorizationHelper.crystallizer) { - if (r != null) { - ItemStack out = (ItemStack) ReflectionHelper.getObject(r, "output");; - if (out != null && matches(output, toIItemStack(out))) { - recipes.add(r); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Crystallizer.name, output.toString())); - } - } - - private static class Remove extends BaseListRemoval { - @SuppressWarnings("unchecked") - public Remove(List recipes) { - super(Crystallizer.name, FactorizationHelper.crystallizer, recipes); - } - - @Override - public String getRecipeInfo(Object recipe) { - return LogHelper.getStackDescription((ItemStack)ReflectionHelper.getObject(recipe, "output")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/factorization/handlers/Lacerator.java b/src/main/java/modtweaker2/mods/factorization/handlers/Lacerator.java deleted file mode 100644 index c19e906..0000000 --- a/src/main/java/modtweaker2/mods/factorization/handlers/Lacerator.java +++ /dev/null @@ -1,81 +0,0 @@ -package modtweaker2.mods.factorization.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toObject; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.factorization.FactorizationHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.factorization.Lacerator") -public class Lacerator { - - public static final String name = "Factorization Lacerator"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(IIngredient input, IItemStack output, double probability) { - Object recipe = FactorizationHelper.getLaceratorRecipe(toObject(input), toStack(output), (float) probability); - MineTweakerAPI.apply(new Add(recipe)); - } - - private static class Add extends BaseListAddition { - @SuppressWarnings("unchecked") - public Add(Object recipe) { - super(Lacerator.name, FactorizationHelper.lacerator); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(Object recipe) { - return LogHelper.getStackDescription((ItemStack) ReflectionHelper.getObject(recipe, "output")); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - List recipes = new LinkedList(); - for (Object r : FactorizationHelper.lacerator) { - if(r != null) { - ItemStack out = (ItemStack) ReflectionHelper.getObject(r, "output"); - if (output != null && matches(output, toIItemStack(out))) { - recipes.add(r); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored", Lacerator.name, output.toString())); - } - } - - private static class Remove extends BaseListRemoval { - @SuppressWarnings("unchecked") - public Remove(List recipes) { - super(Lacerator.name, FactorizationHelper.lacerator, recipes); - } - - @Override - public String getRecipeInfo(Object recipe) { - return LogHelper.getStackDescription((ItemStack) ReflectionHelper.getObject(recipe, "output")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/factorization/handlers/SlagFurnace.java b/src/main/java/modtweaker2/mods/factorization/handlers/SlagFurnace.java deleted file mode 100644 index 9675b69..0000000 --- a/src/main/java/modtweaker2/mods/factorization/handlers/SlagFurnace.java +++ /dev/null @@ -1,82 +0,0 @@ -package modtweaker2.mods.factorization.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.factorization.FactorizationHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.factorization.SlagFurnace") -public class SlagFurnace { - - public static final String name = "Factorization Slag Furnace"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(IItemStack input, IItemStack output1, double chance1, IItemStack output2, double chance2) { - 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 { - @SuppressWarnings("unchecked") - public Add(ItemStack input, Object recipe) { - super(SlagFurnace.name, FactorizationHelper.slag); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(Object recipe) { - return LogHelper.getStackDescription((ItemStack) ReflectionHelper.getObject(recipe, "input")); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input) { - List recipes = new LinkedList(); - - for(Object r : FactorizationHelper.slag) { - if(r != null) { - ItemStack in = (ItemStack) ReflectionHelper.getObject(r, "input"); - - if(matches(input, toIItemStack(in))) { - recipes.add(r); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", SlagFurnace.name, input)); - } - } - - private static class Remove extends BaseListRemoval { - @SuppressWarnings("unchecked") - public Remove(List recipes) { - super(SlagFurnace.name, FactorizationHelper.slag, recipes); - } - - @Override - public String getRecipeInfo(Object recipe) { - return LogHelper.getStackDescription((ItemStack) ReflectionHelper.getObject(recipe, "input")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/Forestry.java b/src/main/java/modtweaker2/mods/forestry/Forestry.java deleted file mode 100644 index 6ff297b..0000000 --- a/src/main/java/modtweaker2/mods/forestry/Forestry.java +++ /dev/null @@ -1,22 +0,0 @@ -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); - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/ForestryListAddition.java b/src/main/java/modtweaker2/mods/forestry/ForestryListAddition.java deleted file mode 100644 index b16e17c..0000000 --- a/src/main/java/modtweaker2/mods/forestry/ForestryListAddition.java +++ /dev/null @@ -1,55 +0,0 @@ -package modtweaker2.mods.forestry; - -import java.util.ArrayList; -import java.util.List; - -import forestry.api.recipes.ICraftingProvider; -import forestry.api.recipes.IForestryRecipe; - -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListAddition; - -public abstract class ForestryListAddition> extends BaseListAddition { - private final C craftingProvider; - - protected ForestryListAddition(String name, C craftingProvider) { - super(name, new ArrayList(craftingProvider.recipes())); - this.craftingProvider = craftingProvider; - } - - protected ForestryListAddition(String name, C craftingProvider, List recipes) { - super(name, new ArrayList(craftingProvider.recipes()), recipes); - this.craftingProvider = craftingProvider; - } - - @Override - protected abstract String getRecipeInfo(T recipe); - - @Override - public final void apply() { - for (T recipe : recipes) { - if (recipe != null) { - if (craftingProvider.addRecipe(recipe)) { - successful.add(recipe); - } else { - LogHelper.logError(String.format("Error adding %s Recipe for %s", name, getRecipeInfo(recipe))); - } - } else { - LogHelper.logError(String.format("Error removing %s Recipe: null object", name)); - } - } - } - - @Override - public final void undo() { - for (T recipe : successful) { - if (recipe != null) { - if (!craftingProvider.removeRecipe(recipe)) { - LogHelper.logError(String.format("Error removing %s Recipe for %s", name, this.getRecipeInfo(recipe))); - } - } else { - LogHelper.logError(String.format("Error removing %s Recipe: null object", name)); - } - } - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/ForestryListRemoval.java b/src/main/java/modtweaker2/mods/forestry/ForestryListRemoval.java deleted file mode 100644 index 5681b92..0000000 --- a/src/main/java/modtweaker2/mods/forestry/ForestryListRemoval.java +++ /dev/null @@ -1,50 +0,0 @@ -package modtweaker2.mods.forestry; - -import java.util.ArrayList; -import java.util.List; - -import forestry.api.recipes.ICraftingProvider; -import forestry.api.recipes.IForestryRecipe; - -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListRemoval; - -public abstract class ForestryListRemoval> extends BaseListRemoval { - private final C craftingProvider; - - public ForestryListRemoval(String name, C craftingProvider, List recipes) { - super(name, new ArrayList(craftingProvider.recipes()), recipes); - this.craftingProvider = craftingProvider; - } - - @Override - protected abstract String getRecipeInfo(T recipe); - - @Override - public final void apply() { - for (T recipe : recipes) { - if (recipe != null) { - if (craftingProvider.removeRecipe(recipe)) { - successful.add(recipe); - } else { - LogHelper.logError(String.format("Error removing %s Recipe for %s", name, getRecipeInfo(recipe))); - } - } else { - LogHelper.logError(String.format("Error removing %s Recipe: null object", name)); - } - } - } - - @Override - public final void undo() { - for (T recipe : successful) { - if (recipe != null) { - if (!craftingProvider.addRecipe(recipe)) { - LogHelper.logError(String.format("Error restoring %s Recipe for %s", name, getRecipeInfo(recipe))); - } - } else { - LogHelper.logError(String.format("Error restoring %s Recipe: null object", name)); - } - } - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/handlers/Carpenter.java b/src/main/java/modtweaker2/mods/forestry/handlers/Carpenter.java deleted file mode 100644 index ad42de8..0000000 --- a/src/main/java/modtweaker2/mods/forestry/handlers/Carpenter.java +++ /dev/null @@ -1,146 +0,0 @@ -package modtweaker2.mods.forestry.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.InputHelper.toStacks; -import static modtweaker2.helpers.InputHelper.toShapedObjects; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.forestry.ForestryListAddition; -import modtweaker2.mods.forestry.ForestryListRemoval; -import modtweaker2.mods.forestry.recipes.CarpenterRecipe; -import net.minecraft.item.ItemStack; - -import modtweaker2.mods.forestry.recipes.DescriptiveRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import forestry.api.recipes.ICarpenterManager; -import forestry.api.recipes.ICarpenterRecipe; -import forestry.api.recipes.IDescriptiveRecipe; -import forestry.api.recipes.RecipeManagers; - -@ZenClass("mods.forestry.Carpenter") -public class Carpenter { - - public static final String name = "Forestry Carpenter"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a shaped recipe for the Carpenter - * - * @param output recipe output - * @param ingredients recipe ingredients - * @param packagingTime time per crafting operation - * @optionalParam box recipes casting item (optional) - */ - @ZenMethod - public static void addRecipe(IItemStack output, IIngredient[][] ingredients, int packagingTime, @Optional IItemStack box) { - IDescriptiveRecipe craftRecipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false); - MineTweakerAPI.apply(new Add(new CarpenterRecipe(packagingTime, null, toStack(box), craftRecipe))); - } - - /** - * Adds a shaped recipe for the Carpenter - * - * @param output recipe output - * @param ingredients recipe ingredients - * @param fluidInput recipe fluid amount - * @param packagingTime time per crafting operation - * @optionalParam box recipes casting item (optional) - */ - @ZenMethod - public static void addRecipe(IItemStack output, IIngredient[][] ingredients, ILiquidStack fluidInput, int packagingTime, @Optional IItemStack box) { - IDescriptiveRecipe craftRecipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false); - MineTweakerAPI.apply(new Add(new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe))); - } - - @Deprecated - @ZenMethod - public static void addRecipe(int packagingTime, ILiquidStack fluidInput, IItemStack[] ingredients, IItemStack box, IItemStack output) { - IDescriptiveRecipe craftRecipe = new DescriptiveRecipe(3, 3, toShapedObjects(transform(ingredients, 3)), toStack(output), false); - MineTweakerAPI.apply(new Add(new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe))); - } - - private static IItemStack[][] transform(IItemStack[] arr, int N) { - int M = (arr.length + N - 1) / N; - IItemStack[][] mat = new IItemStack[M][]; - int start = 0; - for (int r = 0; r < M; r++) { - int L = Math.min(N, arr.length - start); - mat[r] = java.util.Arrays.copyOfRange(arr, start, start + L); - start += L; - } - return mat; - } - - private static class Add extends ForestryListAddition { - - public Add(ICarpenterRecipe recipe) { - super(Carpenter.name, RecipeManagers.carpenterManager); - recipes.add(recipe); - } - - @Override - protected String getRecipeInfo(ICarpenterRecipe recipe) { - return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Removes a recipe for the Carpenter - * - * @param output = item output - * @optionalParam liquid = liquid input - */ - @ZenMethod - public static void removeRecipe(IIngredient output, @Optional IIngredient liquid) { - List recipes = new LinkedList(); - - for(ICarpenterRecipe recipe : RecipeManagers.carpenterManager.recipes()) { - if (recipe != null) { - ItemStack recipeResult = recipe.getCraftingGridRecipe().getRecipeOutput(); - if (recipeResult != null && matches(output, toIItemStack(recipeResult))) { - if (liquid != null) { - if (matches(liquid, toILiquidStack(recipe.getFluidResource()))) - recipes.add(recipe); - } else { - recipes.add(recipe); - } - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Carpenter.name, output.toString())); - } - } - - private static class Remove extends ForestryListRemoval { - - public Remove(List recipes) { - super(Carpenter.name, RecipeManagers.carpenterManager, recipes); - } - - @Override - protected String getRecipeInfo(ICarpenterRecipe recipe) { - return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/handlers/Centrifuge.java b/src/main/java/modtweaker2/mods/forestry/handlers/Centrifuge.java deleted file mode 100644 index dd3a3c3..0000000 --- a/src/main/java/modtweaker2/mods/forestry/handlers/Centrifuge.java +++ /dev/null @@ -1,111 +0,0 @@ -package modtweaker2.mods.forestry.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.forestry.ForestryListAddition; -import modtweaker2.mods.forestry.ForestryListRemoval; -import modtweaker2.mods.forestry.recipes.CentrifugeRecipe; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import forestry.api.recipes.ICentrifugeManager; -import forestry.api.recipes.ICentrifugeRecipe; -import forestry.api.recipes.RecipeManagers; - - -@ZenClass("mods.forestry.Centrifuge") -public class Centrifuge { - - public static final String name = "Forestry Centrifuge"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a recipe for the Centrifuge - * - * @param output List of items to produce with associated chance - * @param ingredient item input - * @param timePerItem time per item to process - */ - @ZenMethod - public static void addRecipe(WeightedItemStack[] output, IItemStack ingredient, int timePerItem) { - Map products = new HashMap(); - for (WeightedItemStack product : output) { - products.put(toStack(product.getStack()), product.getChance()); - } - MineTweakerAPI.apply(new Add(new CentrifugeRecipe(timePerItem, toStack(ingredient), products))); - } - - @ZenMethod - @Deprecated - public static void addRecipe(int timePerItem, IItemStack itemInput, IItemStack[] output, int[] chances) { - Map products = new HashMap(); - int i = 0; - for (IItemStack product : output) { - products.put(toStack(product), ((float) chances[i] / 100)); - i++; - } - MineTweakerAPI.apply(new Add(new CentrifugeRecipe(timePerItem, toStack(itemInput), products))); - } - - private static class Add extends ForestryListAddition { - public Add(ICentrifugeRecipe recipe) { - super(Centrifuge.name, RecipeManagers.centrifugeManager); - recipes.add(recipe); - } - - @Override - protected String getRecipeInfo(ICentrifugeRecipe recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Removes a recipe for the Centrifuge - * - * @param input item input - */ - @ZenMethod - public static void removeRecipe(IIngredient input) { - List recipes = new LinkedList(); - - for(ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) { - if(recipe != null && matches(input, toIItemStack(recipe.getInput()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Centrifuge.name, input.toString())); - } - } - - private static class Remove extends ForestryListRemoval { - - public Remove(List recipes) { - super(Centrifuge.name, RecipeManagers.centrifugeManager, recipes); - } - - @Override - protected String getRecipeInfo(ICentrifugeRecipe recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/handlers/Fermenter.java b/src/main/java/modtweaker2/mods/forestry/handlers/Fermenter.java deleted file mode 100644 index b1d5ab4..0000000 --- a/src/main/java/modtweaker2/mods/forestry/handlers/Fermenter.java +++ /dev/null @@ -1,176 +0,0 @@ -package modtweaker2.mods.forestry.handlers; - -import static modtweaker2.helpers.InputHelper.getFluid; -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.forestry.ForestryListAddition; -import modtweaker2.mods.forestry.ForestryListRemoval; -import modtweaker2.mods.forestry.recipes.FermenterRecipe; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; - -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import forestry.api.fuels.FermenterFuel; -import forestry.api.fuels.FuelManager; -import forestry.api.recipes.IFermenterManager; -import forestry.api.recipes.IFermenterRecipe; -import forestry.api.recipes.RecipeManagers; - -@ZenClass("mods.forestry.Fermenter") -public class Fermenter { - - public static final String name = "Forestry Fermenter"; - public static final String nameFuel = name + " (Fuel)"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a fermenter recipe. Amount of fluid output is calculated: fermentationValue * fluidOutputModifier - * Note: the actual consumption of fluid input depends on the fermentation fuel - * - * @param fluidOutput type of fluid produced - * @param resource organic item - * @param fluidInput type of fluid required in input - * @param fermentationValue amount of inputFluid on organic item requires - * @param fluidOutputModifier Output multiplier (this is usually a from the input fluid - */ - @ZenMethod - public static void addRecipe(ILiquidStack fluidOutput, IItemStack resource, ILiquidStack fluidInput, int fermentationValue, float fluidOutputModifier) { - MineTweakerAPI.apply(new Add(new FermenterRecipe(toStack(resource), fermentationValue, fluidOutputModifier, getFluid(fluidOutput), toFluid(fluidInput)))); - } - - @Deprecated - @ZenMethod - public static void addRecipe(IItemStack resource, ILiquidStack fluidInput, int fermentationValue, float fluidOutputModifier, ILiquidStack fluidOutput) { - MineTweakerAPI.apply(new Add(new FermenterRecipe(toStack(resource), fermentationValue, fluidOutputModifier, getFluid(fluidOutput), toFluid(fluidInput)))); - } - - private static class Add extends ForestryListAddition { - public Add(IFermenterRecipe recipe) { - super(Fermenter.name, RecipeManagers.fermenterManager); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(IFermenterRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input) { - List recipes = new LinkedList(); - - for(IFermenterRecipe recipe : RecipeManagers.fermenterManager.recipes()) { - // check for input items - if(recipe != null && recipe.getResource() != null && matches(input, toIItemStack(recipe.getResource()))) { - recipes.add(recipe); - } - - // check for input liquids - if(recipe != null && recipe.getResource() != null && matches(input, toILiquidStack(recipe.getFluidResource()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Fermenter.name, input.toString())); - } - } - - private static class Remove extends ForestryListRemoval { - - public Remove(List recipes) { - super(Fermenter.name, RecipeManagers.fermenterManager, recipes); - } - - @Override - protected String getRecipeInfo(IFermenterRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds fermenter fuel. - * Note: the actual consumption of fluid input depends on the fermentation fuel - * - * @param item Item that is a valid fuel for the fermenter - * @param fermentPerCycle How much is fermented per work cycle, i.e. how much fluid of the input is consumed. - * @param burnDuration Amount of work cycles a single item of this fuel lasts before expiring. - */ - @ZenMethod - public static void addFuel(IItemStack item, int fermentPerCycle, int burnDuration) { - MineTweakerAPI.apply(new AddFuel(new FermenterFuel(toStack(item), fermentPerCycle, burnDuration))); - } - - private static class AddFuel extends BaseMapAddition { - public AddFuel(FermenterFuel fuelEntry) { - super(Fermenter.nameFuel, FuelManager.fermenterFuel); - recipes.put(fuelEntry.item, fuelEntry); - } - - @Override - public String getRecipeInfo(Entry fuelEntry) { - return LogHelper.getStackDescription(fuelEntry.getKey()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Removes a fermenter fuel. - * - * @param fermenterItem Item that is a valid fuel for the fermenter - */ - @ZenMethod - public static void removeFuel(IIngredient fermenterItem) { - Map fuelItems = new HashMap(); - - for(Entry fuelItem : FuelManager.fermenterFuel.entrySet()) { - if(fuelItem != null && matches(fermenterItem, toIItemStack(fuelItem.getValue().item))) { - fuelItems.put(fuelItem.getKey(), fuelItem.getValue()); - } - } - - if(!fuelItems.isEmpty()) { - MineTweakerAPI.apply(new RemoveFuel(fuelItems)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Fermenter.name, fermenterItem.toString())); - } - } - - private static class RemoveFuel extends BaseMapRemoval { - public RemoveFuel(Map recipes) { - super(Fermenter.nameFuel, FuelManager.fermenterFuel, recipes); - } - - @Override - public String getRecipeInfo(Entry fuelEntry) { - return LogHelper.getStackDescription(fuelEntry.getKey()); - } - } -} - diff --git a/src/main/java/modtweaker2/mods/forestry/handlers/Moistener.java b/src/main/java/modtweaker2/mods/forestry/handlers/Moistener.java deleted file mode 100644 index 96fe102..0000000 --- a/src/main/java/modtweaker2/mods/forestry/handlers/Moistener.java +++ /dev/null @@ -1,163 +0,0 @@ -package modtweaker2.mods.forestry.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import net.minecraft.item.ItemStack; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.forestry.ForestryListAddition; -import modtweaker2.mods.forestry.ForestryListRemoval; -import modtweaker2.mods.forestry.recipes.MoistenerRecipe; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import forestry.api.fuels.FuelManager; -import forestry.api.fuels.MoistenerFuel; -import forestry.api.recipes.IMoistenerManager; -import forestry.api.recipes.IMoistenerRecipe; -import forestry.api.recipes.RecipeManagers; - -@ZenClass("mods.forestry.Moistener") -public class Moistener { - - public static final String name = "Forestry Moistener"; - public static final String nameFuel = name + " (Fuel)"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a recipe for the Moistener - * - * @param output recipe output - * @param resource organic item - * @param timePerItem time per item to process - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack resource, int timePerItem) { - MineTweakerAPI.apply(new Add(new MoistenerRecipe(toStack(resource), toStack(output), timePerItem))); - } - - @Deprecated - @ZenMethod - public static void addRecipe(int timePerItem, IItemStack resource, IItemStack product) { - MineTweakerAPI.apply(new Add(new MoistenerRecipe(toStack(resource), toStack(product), timePerItem))); - } - - private static class Add extends ForestryListAddition { - public Add(IMoistenerRecipe recipe) { - super(Moistener.name, RecipeManagers.moistenerManager); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(IMoistenerRecipe recipe) { - return LogHelper.getStackDescription(recipe.getProduct()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - List recipes = new LinkedList(); - for (IMoistenerRecipe recipe : RecipeManagers.moistenerManager.recipes()) { - if (recipe != null && recipe.getProduct() != null && matches(output, toIItemStack(recipe.getProduct()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Moistener.name, output.toString())); - } - } - - private static class Remove extends ForestryListRemoval { - public Remove(List recipes) { - super(Moistener.name, RecipeManagers.moistenerManager, recipes); - } - - @Override - public String getRecipeInfo(IMoistenerRecipe recipe) { - return LogHelper.getStackDescription(recipe.getProduct()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds moistener fuel. - * - * @param item The item to use - * @param product The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch) - * @param moistenerValue How much this item contributes to the final product of the moistener (i.e. mycelium) - * @param stage What stage this product represents. Resources with lower stage value will be consumed first. (First Stage is 0) - */ - @ZenMethod - public static void addFuel(IItemStack item, IItemStack product, int moistenerValue, int stage) { - if(stage >= 0) { - MineTweakerAPI.apply(new AddFuel(new MoistenerFuel(toStack(item), toStack(product), moistenerValue, stage))); - } else { - LogHelper.logWarning(String.format("No %s Recipe add for %s. Stage parameter must positive!", Moistener.name, item.toString())); - } - } - - private static class AddFuel extends BaseMapAddition { - public AddFuel(MoistenerFuel fuelEntry) { - super(Moistener.nameFuel, FuelManager.moistenerResource); - recipes.put(fuelEntry.item, fuelEntry); - } - - @Override - public String getRecipeInfo(Entry fuelEntry) { - return LogHelper.getStackDescription(fuelEntry.getKey()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Removes a moistener fuel. - * - * @param moistenerItem Item that is a valid fuel for the moistener - */ - @ZenMethod - public static void removeFuel(IIngredient moistenerItem) { - Map fuelItems = new HashMap(); - - for(Entry fuelItem : FuelManager.moistenerResource.entrySet()) { - if(fuelItem != null && matches(moistenerItem, toIItemStack(fuelItem.getValue().item))) { - fuelItems.put(fuelItem.getKey(), fuelItem.getValue()); - } - } - - if(!fuelItems.isEmpty()) { - MineTweakerAPI.apply(new RemoveFuel(fuelItems)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Moistener.name, moistenerItem.toString())); - } - } - - private static class RemoveFuel extends BaseMapRemoval { - public RemoveFuel(Map recipes) { - super(Moistener.nameFuel, FuelManager.moistenerResource, recipes); - } - - @Override - public String getRecipeInfo(Entry fuelEntry) { - return LogHelper.getStackDescription(fuelEntry.getKey()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/handlers/Squeezer.java b/src/main/java/modtweaker2/mods/forestry/handlers/Squeezer.java deleted file mode 100644 index 3ae8f5e..0000000 --- a/src/main/java/modtweaker2/mods/forestry/handlers/Squeezer.java +++ /dev/null @@ -1,132 +0,0 @@ -package modtweaker2.mods.forestry.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.InputHelper.toStacks; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import forestry.api.recipes.ISqueezerManager; -import forestry.api.recipes.ISqueezerRecipe; -import forestry.api.recipes.RecipeManagers; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.forestry.ForestryListAddition; -import modtweaker2.mods.forestry.ForestryListRemoval; -import modtweaker2.mods.forestry.recipes.SqueezerRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.forestry.Squeezer") -public class Squeezer { - - public static final String name = "Forestry Squeezer"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a recipe without additional item output - * - * @param fluidOutput recipe fluid amount - * @param ingredients recipe ingredients - * @param timePerItem time per crafting operation - */ - @ZenMethod - public static void addRecipe(ILiquidStack fluidOutput, int timePerItem, IItemStack[] ingredients) { - MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), null, 0))); - } - - /** - * Adds a recipe with additional item output - * - * @param fluidOutput recipe fluid amount - * @param itemOutput recipe output - * @param ingredients recipe ingredients - * @param timePerItem time per crafting operation - */ - @ZenMethod - public static void addRecipe(ILiquidStack fluidOutput, WeightedItemStack itemOutput, IItemStack[] ingredients, int timePerItem) { - MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), toStack(itemOutput.getStack()), (int) itemOutput.getPercent()))); - } - - @ZenMethod - @Deprecated - public static void addRecipe(int timePerItem, IItemStack[] resources, ILiquidStack liquid, IItemStack remnants, int chance) { - MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(resources), toFluid(liquid), toStack(remnants), chance))); - } - - private static class Add extends ForestryListAddition { - public Add(ISqueezerRecipe recipe) { - super(Squeezer.name, RecipeManagers.squeezerManager); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(ISqueezerRecipe recipe) { - return LogHelper.getStackDescription(recipe.getFluidOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Removes a recipe for the Centrifuge - * - * @param liquid liquid output - * @param ingredients list of ingredients - */ - @ZenMethod - public static void removeRecipe(IIngredient liquid, @Optional IIngredient[] ingredients) { - List recipes = new LinkedList(); - - for (ISqueezerRecipe r : RecipeManagers.squeezerManager.recipes()) { - if (r != null && r.getFluidOutput() != null && matches(liquid, toILiquidStack(r.getFluidOutput()))) { - // optional check for ingredients - if (ingredients != null) { - boolean matched = false; - for (int i = 0; i < ingredients.length; i++) { - if ( matches(ingredients[i], toIItemStack(r.getResources()[i])) ) - matched = true; - else { - matched = false; - // if one ingredients doesn't match abort all further checks - break; - } - } - // if some ingredient doesn't match, the last one is false - if (matched) - recipes.add(r); - } else { - recipes.add(r); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Squeezer.name, LogHelper.getStackDescription(liquid))); - } - } - - private static class Remove extends ForestryListRemoval { - public Remove(List recipes) { - super(Squeezer.name, RecipeManagers.squeezerManager, recipes); - } - - @Override - public String getRecipeInfo(ISqueezerRecipe recipe) { - return LogHelper.getStackDescription(recipe.getFluidOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/handlers/Still.java b/src/main/java/modtweaker2/mods/forestry/handlers/Still.java deleted file mode 100644 index cd7b1b5..0000000 --- a/src/main/java/modtweaker2/mods/forestry/handlers/Still.java +++ /dev/null @@ -1,109 +0,0 @@ -package modtweaker2.mods.forestry.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.forestry.ForestryListAddition; -import modtweaker2.mods.forestry.ForestryListRemoval; -import modtweaker2.mods.forestry.recipes.StillRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import forestry.api.recipes.IStillManager; -import forestry.api.recipes.IStillRecipe; -import forestry.api.recipes.RecipeManagers; - -@ZenClass("mods.forestry.Still") -public class Still { - - public static final String name = "Forestry Still"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a recipe for the Still - * - * @param fluidOutput recipe fluid amount - * @param fluidInput recipe fluid input - * @param timePerUnit time per crafting operation - */ - @ZenMethod - public static void addRecipe(ILiquidStack fluidOutput, ILiquidStack fluidInput, int timePerUnit) { - fluidOutput.amount(fluidOutput.getAmount() / 100); - fluidInput.amount(fluidInput.getAmount() / 100); - - MineTweakerAPI.apply(new Add(new StillRecipe(timePerUnit, toFluid(fluidInput), toFluid(fluidOutput)))); - } - - @Deprecated - @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 StillRecipe(timePerUnit, toFluid(input), toFluid(output)))); - } - - private static class Add extends ForestryListAddition { - public Add(IStillRecipe recipe) { - super("Forestry Still", RecipeManagers.stillManager); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(IStillRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Removes a recipe for the Still - * - * @param output = liquid output - * @optionalParam liquid = liquid input - */ - @ZenMethod - public static void removeRecipe(IIngredient output, @Optional ILiquidStack input) { - List recipes = new LinkedList(); - - for (IStillRecipe r : RecipeManagers.stillManager.recipes()) { - if (r != null && r.getOutput() != null && matches(output, toILiquidStack(r.getOutput()))) { - if (input != null) { - if (matches(input, toILiquidStack(r.getInput()))) { - recipes.add(r); - } - } - else - recipes.add(r); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Still.name, LogHelper.getStackDescription(output))); - } - } - - private static class Remove extends ForestryListRemoval { - public Remove(List recipes) { - super(Still.name, RecipeManagers.stillManager, recipes); - } - - @Override - public String getRecipeInfo(IStillRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/handlers/ThermionicFabricator.java b/src/main/java/modtweaker2/mods/forestry/handlers/ThermionicFabricator.java deleted file mode 100644 index cb5e5a7..0000000 --- a/src/main/java/modtweaker2/mods/forestry/handlers/ThermionicFabricator.java +++ /dev/null @@ -1,188 +0,0 @@ -package modtweaker2.mods.forestry.handlers; - -import static modtweaker2.helpers.InputHelper.*; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.forestry.ForestryListAddition; -import modtweaker2.mods.forestry.ForestryListRemoval; -import net.minecraftforge.fluids.FluidRegistry; - -import modtweaker2.mods.forestry.recipes.DescriptiveRecipe; -import modtweaker2.mods.forestry.recipes.FabricatorRecipe; -import modtweaker2.mods.forestry.recipes.FabricatorSmeltingRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import forestry.api.recipes.IDescriptiveRecipe; -import forestry.api.recipes.IFabricatorManager; -import forestry.api.recipes.IFabricatorSmeltingManager; -import forestry.api.recipes.IFabricatorSmeltingRecipe; -import forestry.api.recipes.RecipeManagers; -import forestry.api.recipes.IFabricatorRecipe; - -@ZenClass("mods.forestry.ThermionicFabricator") -public class ThermionicFabricator { - - public static final String nameSmelting = "Forestry Thermionic Fabricator (Smelting)"; - public static final String nameCasting = "Forestry Thermionic Fabricator (Casting)"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a smelting recipe for the Thermionic Fabricator - * - * @param fluidOutput recipe fluid amount - * @param itemInput recipe input input - * @param meltingPoint point at where itemInput melts down - */ - @ZenMethod - public static void addSmelting(int fluidOutput, IItemStack itemInput, int meltingPoint) { - //The machines internal tank accept only liquid glass, therefor this function only accept the amount and hardcode the fluid to glass - MineTweakerAPI.apply(new AddSmelting(new FabricatorSmeltingRecipe(toStack(itemInput), FluidRegistry.getFluidStack("glass", fluidOutput), meltingPoint))); - } - - @Deprecated - @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 AddSmelting(new FabricatorSmeltingRecipe(toStack(itemInput), FluidRegistry.getFluidStack("glass", fluidOutput), meltingPoint))); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a casting recipe for the Thermionic Fabricator - * - * @param output recipe output item - * @param ingredients list of input items - * @param fluidInput recipe fluid input - * @param plan recipe plan item - */ - @ZenMethod - public static void addCast(IItemStack output, IIngredient[][] ingredients, int fluidInput, @Optional IItemStack plan) { - IDescriptiveRecipe recipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false); - MineTweakerAPI.apply(new AddCast(new FabricatorRecipe(toStack(plan), FluidRegistry.getFluidStack("glass", fluidInput), recipe))); - } - - @Deprecated - @ZenMethod - public static void addCast(ILiquidStack fluidInput, IIngredient[][] ingredients, IItemStack plan, IItemStack output) { - IDescriptiveRecipe recipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false); - MineTweakerAPI.apply(new AddCast(new FabricatorRecipe(toStack(plan), toFluid(fluidInput), recipe))); - } - - /* - Implements the actions to add a recipe - Since the machine has two crafting Steps, this is a constructors for both - */ - private static class AddSmelting extends ForestryListAddition { - - public AddSmelting(IFabricatorSmeltingRecipe recipe) { - super(ThermionicFabricator.nameSmelting, RecipeManagers.fabricatorSmeltingManager); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(IFabricatorSmeltingRecipe recipe) { - return LogHelper.getStackDescription(recipe.getResource()); - } - } - - private static class AddCast extends ForestryListAddition { - - public AddCast(IFabricatorRecipe recipe) { - super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(IFabricatorRecipe recipe) { - return LogHelper.getStackDescription(recipe.getRecipeOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeSmelting(IIngredient itemInput) { - List recipes = new LinkedList(); - - for (IFabricatorSmeltingRecipe r : RecipeManagers.fabricatorSmeltingManager.recipes()) { - if (r != null && r.getResource() != null && matches(itemInput, toIItemStack(r.getResource()))) { - recipes.add(r); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveSmelting(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, itemInput.toString())); - } - } - - @ZenMethod - public static void removeCast(IIngredient product) { - List recipes = new LinkedList(); - - for (IFabricatorRecipe r : RecipeManagers.fabricatorManager.recipes()) { - if (r != null && r.getRecipeOutput() != null && matches(product, toIItemStack(r.getRecipeOutput()))) { - recipes.add(r); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveCasts(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, product.toString())); - } - } - - @Deprecated - @ZenMethod - public static void removeCasts(IIngredient product) { - List recipes = new LinkedList(); - - for (IFabricatorRecipe r : RecipeManagers.fabricatorManager.recipes()) { - if (r != null && r.getRecipeOutput() != null && matches(product, toIItemStack(r.getRecipeOutput()))) { - recipes.add(r); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveCasts(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, product.toString())); - } - } - - private static class RemoveSmelting extends ForestryListRemoval { - public RemoveSmelting(List recipes) { - super(ThermionicFabricator.nameSmelting, RecipeManagers.fabricatorSmeltingManager, recipes); - } - - @Override - public String getRecipeInfo(IFabricatorSmeltingRecipe recipe) { - return LogHelper.getStackDescription(recipe.getResource()); - } - } - - private static class RemoveCasts extends ForestryListRemoval { - public RemoveCasts(List recipes) { - super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager, recipes); - } - - @Override - public String getRecipeInfo(IFabricatorRecipe recipe) { - return LogHelper.getStackDescription(recipe.getRecipeOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/recipes/CarpenterRecipe.java b/src/main/java/modtweaker2/mods/forestry/recipes/CarpenterRecipe.java deleted file mode 100644 index 26a11b5..0000000 --- a/src/main/java/modtweaker2/mods/forestry/recipes/CarpenterRecipe.java +++ /dev/null @@ -1,48 +0,0 @@ -package modtweaker2.mods.forestry.recipes; - -import javax.annotation.Nullable; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.FluidStack; - -import forestry.api.recipes.ICarpenterRecipe; -import forestry.api.recipes.IDescriptiveRecipe; - -public class CarpenterRecipe implements ICarpenterRecipe { - - private final int packagingTime; - @Nullable - private final FluidStack liquid; - @Nullable - private final ItemStack box; - private final IDescriptiveRecipe internal; - - public CarpenterRecipe(int packagingTime, @Nullable FluidStack liquid, @Nullable ItemStack box, IDescriptiveRecipe internal) { - this.packagingTime = packagingTime; - this.liquid = liquid; - this.box = box; - this.internal = internal; - } - - public int getPackagingTime() { - return packagingTime; - } - - @Override - @Nullable - public ItemStack getBox() { - return box; - } - - @Override - @Nullable - public FluidStack getFluidResource() { - return liquid; - } - - @Override - public IDescriptiveRecipe getCraftingGridRecipe() { - return internal; - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/recipes/CentrifugeRecipe.java b/src/main/java/modtweaker2/mods/forestry/recipes/CentrifugeRecipe.java deleted file mode 100644 index 96718e8..0000000 --- a/src/main/java/modtweaker2/mods/forestry/recipes/CentrifugeRecipe.java +++ /dev/null @@ -1,64 +0,0 @@ -package modtweaker2.mods.forestry.recipes; - -import com.google.common.collect.ImmutableMap; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import net.minecraft.item.ItemStack; - -import forestry.api.recipes.ICentrifugeRecipe; - -public class CentrifugeRecipe implements ICentrifugeRecipe { - - private final int processingTime; - private final ItemStack input; - private final Map outputs; - - public CentrifugeRecipe(int processingTime, ItemStack input, Map outputs) { - this.processingTime = processingTime; - this.input = input; - this.outputs = outputs; - - for (ItemStack item : outputs.keySet()) { - if (item == null) { - throw new IllegalArgumentException("Tried to register a null product of " + input); - } - } - } - - @Override - public ItemStack getInput() { - return input; - } - - @Override - public int getProcessingTime() { - return processingTime; - } - - @Override - public Collection getProducts(Random random) { - List products = new ArrayList(); - - for (Map.Entry entry : this.outputs.entrySet()) { - float probability = entry.getValue(); - - if (probability >= 1.0) { - products.add(entry.getKey().copy()); - } else if (random.nextFloat() < probability) { - products.add(entry.getKey().copy()); - } - } - - return products; - } - - @Override - public Map getAllProducts() { - return ImmutableMap.copyOf(outputs); - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/recipes/DescriptiveRecipe.java b/src/main/java/modtweaker2/mods/forestry/recipes/DescriptiveRecipe.java deleted file mode 100644 index 70906ff..0000000 --- a/src/main/java/modtweaker2/mods/forestry/recipes/DescriptiveRecipe.java +++ /dev/null @@ -1,71 +0,0 @@ -package modtweaker2.mods.forestry.recipes; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import net.minecraftforge.oredict.ShapedOreRecipe; - -import forestry.api.recipes.IDescriptiveRecipe; - -public class DescriptiveRecipe implements IDescriptiveRecipe { - - private final int width; - private final int height; - private final ShapedOreRecipe recipe; - private final boolean preserveNBT; - - public DescriptiveRecipe(int width, int height, Object[] ingredients, ItemStack output, boolean preserveNBT) { - this.width = width; - this.height = height; - this.recipe = new ShapedOreRecipe(output, ingredients); - this.preserveNBT = preserveNBT; - } - - @Override - public int getWidth() { - return width; - } - - @Override - public int getHeight() { - return height; - } - - @Override - public ItemStack getRecipeOutput() { - return recipe.getRecipeOutput(); - } - - @Override - public Object[] getIngredients() { - return recipe.getInput(); - } - - @Override - public boolean preserveNBT() { - return preserveNBT; - } - - @Override - public boolean matches(InventoryCrafting inventoryCrafting, World world) { - return recipe.matches(inventoryCrafting, world); - } - - @Override - @Deprecated - public boolean matches(IInventory inventoryCrafting, World world) { - return false; - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) { - return recipe.getCraftingResult(inventoryCrafting); - } - - @Override - public int getRecipeSize() { - return width * height; - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/recipes/FabricatorRecipe.java b/src/main/java/modtweaker2/mods/forestry/recipes/FabricatorRecipe.java deleted file mode 100644 index bf64037..0000000 --- a/src/main/java/modtweaker2/mods/forestry/recipes/FabricatorRecipe.java +++ /dev/null @@ -1,77 +0,0 @@ -package modtweaker2.mods.forestry.recipes; - -import javax.annotation.Nullable; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.FluidStack; - -import forestry.api.recipes.IDescriptiveRecipe; -import forestry.api.recipes.IFabricatorRecipe; - -public class FabricatorRecipe implements IFabricatorRecipe { - - private final ItemStack plan; - private final FluidStack molten; - private final IDescriptiveRecipe internal; - - public FabricatorRecipe(ItemStack plan, FluidStack molten, ItemStack result, boolean preservesNbt, Object[] ingredients) { - this(plan, molten, new DescriptiveRecipe(3, 3, ingredients, result, preservesNbt)); - } - - public FabricatorRecipe(ItemStack plan, FluidStack molten, IDescriptiveRecipe internal) { - this.plan = plan; - this.molten = molten; - this.internal = internal; - } - - @Override - @Deprecated - public boolean matches(@Nullable ItemStack plan, ItemStack[][] resources) { - return false; - } - - @Override - public Object[] getIngredients() { - return internal.getIngredients(); - } - - @Override - public int getWidth() { - return internal.getWidth(); - } - - @Override - public int getHeight() { - return internal.getHeight(); - } - - @Override - public boolean preservesNbt() { - return internal.preserveNBT(); - } - - @Override - @Nullable - public ItemStack getPlan() { - return plan; - } - - @Override - public FluidStack getLiquid() { - return molten; - } - - @Override - @Deprecated - public ItemStack getCraftingResult(IInventory craftingInventory) { - return getRecipeOutput(); - } - - @Override - public ItemStack getRecipeOutput() { - return internal.getRecipeOutput(); - } - -} diff --git a/src/main/java/modtweaker2/mods/forestry/recipes/FabricatorSmeltingRecipe.java b/src/main/java/modtweaker2/mods/forestry/recipes/FabricatorSmeltingRecipe.java deleted file mode 100644 index 3fe3ef3..0000000 --- a/src/main/java/modtweaker2/mods/forestry/recipes/FabricatorSmeltingRecipe.java +++ /dev/null @@ -1,38 +0,0 @@ -package modtweaker2.mods.forestry.recipes; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.FluidStack; - -import forestry.api.recipes.IFabricatorSmeltingRecipe; - -public class FabricatorSmeltingRecipe implements IFabricatorSmeltingRecipe { - private final ItemStack resource; - private final FluidStack product; - private final int meltingPoint; - - public FabricatorSmeltingRecipe(ItemStack resource, FluidStack molten, int meltingPoint) { - if (resource == null) { - throw new IllegalArgumentException("Resource cannot be null"); - } - if (molten == null) { - throw new IllegalArgumentException("Molten cannot be null"); - } - - this.resource = resource; - this.product = molten; - this.meltingPoint = meltingPoint; - } - - public ItemStack getResource() { - return resource; - } - - public FluidStack getProduct() { - return product; - } - - public int getMeltingPoint() { - return meltingPoint; - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/recipes/FermenterRecipe.java b/src/main/java/modtweaker2/mods/forestry/recipes/FermenterRecipe.java deleted file mode 100644 index 50f79d4..0000000 --- a/src/main/java/modtweaker2/mods/forestry/recipes/FermenterRecipe.java +++ /dev/null @@ -1,68 +0,0 @@ -package modtweaker2.mods.forestry.recipes; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import forestry.api.recipes.IFermenterRecipe; - -public class FermenterRecipe implements IFermenterRecipe { - - private final ItemStack resource; - private final int fermentationValue; - private final float modifier; - private final Fluid output; - private final FluidStack fluidResource; - - public FermenterRecipe(ItemStack resource, int fermentationValue, float modifier, Fluid output, FluidStack fluidResource) { - if (resource == null) { - throw new NullPointerException("Fermenter Resource cannot be null!"); - } - - if (output == null) { - throw new NullPointerException("Fermenter Output cannot be null!"); - } - - if (fluidResource == null) { - throw new NullPointerException("Fermenter Liquid cannot be null!"); - } - - // assume that fermenter recipes want to use Forestry's honey and not the legacy "fluid.honey" - if (fluidResource.getFluid().getName().equals("fluid.honey")) { - fluidResource = new FluidStack(FluidRegistry.getFluid("fluid.for.honey"), fluidResource.amount); - } - - this.resource = resource; - this.fermentationValue = fermentationValue; - this.modifier = modifier; - this.output = output; - this.fluidResource = fluidResource; - } - - @Override - public ItemStack getResource() { - return resource; - } - - @Override - public FluidStack getFluidResource() { - return fluidResource; - } - - @Override - public int getFermentationValue() { - return fermentationValue; - } - - @Override - public float getModifier() { - return modifier; - } - - @Override - public Fluid getOutput() { - return output; - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/recipes/MoistenerRecipe.java b/src/main/java/modtweaker2/mods/forestry/recipes/MoistenerRecipe.java deleted file mode 100644 index 926838a..0000000 --- a/src/main/java/modtweaker2/mods/forestry/recipes/MoistenerRecipe.java +++ /dev/null @@ -1,30 +0,0 @@ -package modtweaker2.mods.forestry.recipes; - -import net.minecraft.item.ItemStack; - -import forestry.api.recipes.IMoistenerRecipe; - -public class MoistenerRecipe implements IMoistenerRecipe { - - private final int timePerItem; - private final ItemStack resource; - private final ItemStack product; - - public MoistenerRecipe(ItemStack resource, ItemStack product, int timePerItem) { - this.timePerItem = timePerItem; - this.resource = resource; - this.product = product; - } - - public int getTimePerItem() { - return timePerItem; - } - - public ItemStack getResource() { - return resource; - } - - public ItemStack getProduct() { - return product; - } -} diff --git a/src/main/java/modtweaker2/mods/forestry/recipes/SqueezerRecipe.java b/src/main/java/modtweaker2/mods/forestry/recipes/SqueezerRecipe.java deleted file mode 100644 index 54c37cb..0000000 --- a/src/main/java/modtweaker2/mods/forestry/recipes/SqueezerRecipe.java +++ /dev/null @@ -1,50 +0,0 @@ -package modtweaker2.mods.forestry.recipes; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.FluidStack; - -import forestry.api.recipes.ISqueezerRecipe; - -public class SqueezerRecipe implements ISqueezerRecipe { - - private final int processingTime; - private final ItemStack[] resources; - private final FluidStack fluidOutput; - private final ItemStack remnants; - private final float remnantsChance; - - public SqueezerRecipe(int processingTime, ItemStack[] resources, FluidStack fluidOutput, ItemStack remnants, float remnantsChance) { - this.processingTime = processingTime; - this.resources = resources; - this.fluidOutput = fluidOutput; - this.remnants = remnants; - this.remnantsChance = remnantsChance; - } - - @Override - public ItemStack[] getResources() { - return resources; - } - - @Override - public ItemStack getRemnants() { - return remnants; - } - - @Override - public float getRemnantsChance() { - return remnantsChance; - } - - @Override - public FluidStack getFluidOutput() { - return fluidOutput; - } - - @Override - public int getProcessingTime() { - return processingTime; - } - -} diff --git a/src/main/java/modtweaker2/mods/forestry/recipes/StillRecipe.java b/src/main/java/modtweaker2/mods/forestry/recipes/StillRecipe.java deleted file mode 100644 index 49df0a4..0000000 --- a/src/main/java/modtweaker2/mods/forestry/recipes/StillRecipe.java +++ /dev/null @@ -1,38 +0,0 @@ -package modtweaker2.mods.forestry.recipes; - -import net.minecraftforge.fluids.FluidStack; - -import forestry.api.recipes.IStillRecipe; - -public class StillRecipe implements IStillRecipe { - private final int timePerUnit; - private final FluidStack input; - private final FluidStack output; - - public StillRecipe(int timePerUnit, FluidStack input, FluidStack output) { - this.timePerUnit = timePerUnit; - if (input == null) { - throw new IllegalArgumentException("Still recipes need an input. Input was null."); - } - if (output == null) { - throw new IllegalArgumentException("Still recipes need an output. Output was null."); - } - this.input = input; - this.output = output; - } - - @Override - public int getCyclesPerUnit() { - return timePerUnit; - } - - @Override - public FluidStack getInput() { - return input; - } - - @Override - public FluidStack getOutput() { - return output; - } -} diff --git a/src/main/java/modtweaker2/mods/fsp/FSPHelper.java b/src/main/java/modtweaker2/mods/fsp/FSPHelper.java deleted file mode 100644 index 2182866..0000000 --- a/src/main/java/modtweaker2/mods/fsp/FSPHelper.java +++ /dev/null @@ -1,16 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/fsp/Steamcraft.java b/src/main/java/modtweaker2/mods/fsp/Steamcraft.java deleted file mode 100644 index 26d8ac0..0000000 --- a/src/main/java/modtweaker2/mods/fsp/Steamcraft.java +++ /dev/null @@ -1,12 +0,0 @@ -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); - } -} diff --git a/src/main/java/modtweaker2/mods/fsp/handlers/Crucible.java b/src/main/java/modtweaker2/mods/fsp/handlers/Crucible.java deleted file mode 100644 index 3686437..0000000 --- a/src/main/java/modtweaker2/mods/fsp/handlers/Crucible.java +++ /dev/null @@ -1,160 +0,0 @@ -package modtweaker2.mods.fsp.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; -import static modtweaker2.mods.fsp.FSPHelper.getLiquid; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.Item; -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; - -@ZenClass("mods.fsp.Crucible") -public class Crucible { - - public static final String nameLiquid = "FSP Crucible (Liquid)"; - public static final String nameMelting = "FSP Crucible (Liquid)"; - public static final String nameDunking = "FSP Crucible (Dunking)"; - - @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(nameLiquid, SteamcraftRegistry.liquids); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(CrucibleLiquid recipe) { - return 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, MutablePair> { - public AddMelting(ItemStack stack, MutablePair key, MutablePair recipe) { - super(nameMelting, SteamcraftRegistry.smeltThings); - map.put(key, recipe); - } - - @Override - protected String getRecipeInfo(Entry, MutablePair> recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right)); - } - } - - @ZenMethod - public static void removeMelting(IIngredient input) { - Map, MutablePair> recipes = new HashMap, MutablePair>(); - - for(Entry, MutablePair> entry : SteamcraftRegistry.smeltThings.entrySet()) { - if(matches(input, toIItemStack(new ItemStack(entry.getKey().left, 1, entry.getKey().right)))) { - recipes.put(entry.getKey(), entry.getValue()); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMelting(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipes found for %s", Crucible.nameMelting, input)); - } - } - - private static class RemoveMelting extends BaseMapRemoval, MutablePair> { - public RemoveMelting(Map, MutablePair> recipes) { - super(nameMelting, SteamcraftRegistry.smeltThings, recipes); - } - - @Override - protected String getRecipeInfo(Entry, MutablePair> recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right)); - } - } - - @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(new Tuple3(stack.getItem(), stack.getItemDamage(), fluid), MutablePair.of(volume, toStack(output)))); - } - } - - private static class AddDunking extends BaseMapAddition> { - public AddDunking(Tuple3 key, MutablePair recipe) { - super(Crucible.nameDunking, SteamcraftRegistry.dunkThings); - recipes.put(key, recipe); - } - - @Override - public String getRecipeInfo(Entry> recipe) { - return LogHelper.getStackDescription(recipe.getValue().right); - } - } - - @ZenMethod - public static void removeDunking(IIngredient input, String liquid) { - Map> recipes = new HashMap>(); - - for(Entry> recipe : SteamcraftRegistry.dunkThings.entrySet()) { - if(recipe.getValue() != null && recipe.getValue().right != null && matches(input, toIItemStack(recipe.getValue().right))) { - if(((CrucibleLiquid)recipe.getKey().third).equals(getLiquid(liquid))) { - recipes.put(recipe.getKey(), recipe.getValue()); - } - } - - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveDunking(recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", Crucible.nameDunking, input.toString(), liquid)); - } - } - - private static class RemoveDunking extends BaseMapRemoval> { - public RemoveDunking(Map> recipes) { - super(Crucible.nameDunking, SteamcraftRegistry.dunkThings, recipes); - } - - @Override - public String getRecipeInfo(Entry> recipe) { - return LogHelper.getStackDescription(recipe.getValue().right); - } - } -} diff --git a/src/main/java/modtweaker2/mods/fsp/handlers/Furnace.java b/src/main/java/modtweaker2/mods/fsp/handlers/Furnace.java deleted file mode 100644 index f93b7f6..0000000 --- a/src/main/java/modtweaker2/mods/fsp/handlers/Furnace.java +++ /dev/null @@ -1,75 +0,0 @@ -package modtweaker2.mods.fsp.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.Item; -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; - -@ZenClass("mods.fsp.Furnace") -public class Furnace { - - public static final String name = "FSP Furnace (Steamed Foods)"; - - @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, MutablePair> { - public AddSteamFood(ItemStack stack, MutablePair key, MutablePair recipe) { - super(Furnace.name, SteamcraftRegistry.steamedFoods); - recipes.put(key, recipe); - } - - @Override - public String getRecipeInfo(Entry, MutablePair> recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right)); - } - } - - @ZenMethod - public static void removeSteamFood(IIngredient input) { - Map, MutablePair> recipes = new HashMap, MutablePair>(); - - for(Entry, MutablePair> recipe : SteamcraftRegistry.steamedFoods.entrySet()) { - if(matches(input, toIItemStack(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right)))) { - recipes.put(recipe.getKey(), recipe.getValue()); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveSteamFood(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Furnace.name, input.toString())); - } - } - - private static class RemoveSteamFood extends BaseMapRemoval, MutablePair> { - public RemoveSteamFood(Map, MutablePair> recipes) { - super(Furnace.name, SteamcraftRegistry.steamedFoods, recipes); - } - - @Override - public String getRecipeInfo(Entry, MutablePair> recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right)); - } - } -} diff --git a/src/main/java/modtweaker2/mods/ic2c/IC2C.java b/src/main/java/modtweaker2/mods/ic2c/IC2C.java deleted file mode 100644 index 91559e6..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/IC2C.java +++ /dev/null @@ -1,32 +0,0 @@ -package modtweaker2.mods.ic2c; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.ic2c.mods.BlastFurnace; -import modtweaker2.mods.ic2c.mods.BlockCutter; -import modtweaker2.mods.ic2c.mods.Centrifuge; -import modtweaker2.mods.ic2c.mods.Compressor; -import modtweaker2.mods.ic2c.mods.Extractor; -import modtweaker2.mods.ic2c.mods.Macerator; -import modtweaker2.mods.ic2c.mods.MetalFormerCutting; -import modtweaker2.mods.ic2c.mods.MetalFormerExtruding; -import modtweaker2.mods.ic2c.mods.MetalFormerRolling; -import modtweaker2.mods.ic2c.mods.OreWashing; -import modtweaker2.mods.ic2c.mods.Recycler; - -public class IC2C { - - public IC2C() { - MineTweakerAPI.registerClass(BlastFurnace.class); - MineTweakerAPI.registerClass(BlockCutter.class); - MineTweakerAPI.registerClass(Centrifuge.class); - MineTweakerAPI.registerClass(Compressor.class); - MineTweakerAPI.registerClass(Extractor.class); - MineTweakerAPI.registerClass(Macerator.class); - MineTweakerAPI.registerClass(MetalFormerCutting.class); - MineTweakerAPI.registerClass(MetalFormerExtruding.class); - MineTweakerAPI.registerClass(MetalFormerRolling.class); - MineTweakerAPI.registerClass(OreWashing.class); - MineTweakerAPI.registerClass(Recycler.class); - - } -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/BlastFurnace.java b/src/main/java/modtweaker2/mods/ic2c/mods/BlastFurnace.java deleted file mode 100644 index 438193d..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/BlastFurnace.java +++ /dev/null @@ -1,69 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.BlastFurnace") -public class BlastFurnace { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("BlastFurnace", Recipes.blastfurance.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.blastfurance.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("BlastFurnace", Recipes.blastfurance.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/BlockCutter.java b/src/main/java/modtweaker2/mods/ic2c/mods/BlockCutter.java deleted file mode 100644 index 93b4dc4..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/BlockCutter.java +++ /dev/null @@ -1,69 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.BlockCutter") -public class BlockCutter { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("BlockCutter", Recipes.blockcutter.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.blockcutter.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("BlockCutter", Recipes.blockcutter.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/Centrifuge.java b/src/main/java/modtweaker2/mods/ic2c/mods/Centrifuge.java deleted file mode 100644 index ee8ebc3..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/Centrifuge.java +++ /dev/null @@ -1,69 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.Centrifuge") -public class Centrifuge { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("Centrifuge", Recipes.centrifuge.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.centrifuge.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("Centrifuge", Recipes.centrifuge.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/Compressor.java b/src/main/java/modtweaker2/mods/ic2c/mods/Compressor.java deleted file mode 100644 index 8627a23..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/Compressor.java +++ /dev/null @@ -1,69 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.Compressor") -public class Compressor { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("Compressor", Recipes.compressor.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.compressor.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("Compressor", Recipes.compressor.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/Extractor.java b/src/main/java/modtweaker2/mods/ic2c/mods/Extractor.java deleted file mode 100644 index f3881a7..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/Extractor.java +++ /dev/null @@ -1,70 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.Extractor") -public class Extractor { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("Extractor", Recipes.extractor.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.extractor.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("Extractor", Recipes.extractor.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/Macerator.java b/src/main/java/modtweaker2/mods/ic2c/mods/Macerator.java deleted file mode 100644 index 2aece42..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/Macerator.java +++ /dev/null @@ -1,70 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.Macerator") -public class Macerator { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("Macerator", Recipes.macerator.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.macerator.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("Macerator", Recipes.macerator.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/MetalFormerCutting.java b/src/main/java/modtweaker2/mods/ic2c/mods/MetalFormerCutting.java deleted file mode 100644 index ab90ef5..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/MetalFormerCutting.java +++ /dev/null @@ -1,69 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.MetalFormerCutting") -public class MetalFormerCutting { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("MetalFormerCutting", Recipes.metalformerCutting.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.metalformerCutting.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("MetalFormerCutting", Recipes.metalformerCutting.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/MetalFormerExtruding.java b/src/main/java/modtweaker2/mods/ic2c/mods/MetalFormerExtruding.java deleted file mode 100644 index d82a5b3..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/MetalFormerExtruding.java +++ /dev/null @@ -1,69 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.MetalFormerExtruding") -public class MetalFormerExtruding { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("MetalFormerExtruding", Recipes.metalformerExtruding.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.metalformerExtruding.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("MetalFormerExtruding", Recipes.metalformerExtruding.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/MetalFormerRolling.java b/src/main/java/modtweaker2/mods/ic2c/mods/MetalFormerRolling.java deleted file mode 100644 index 3d26580..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/MetalFormerRolling.java +++ /dev/null @@ -1,69 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.MetalFormerRolling") -public class MetalFormerRolling { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("MetalFormerRolling", Recipes.metalformerRolling.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.metalformerRolling.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("MetalFormerRolling", Recipes.metalformerRolling.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/OreWashing.java b/src/main/java/modtweaker2/mods/ic2c/mods/OreWashing.java deleted file mode 100644 index 09e5700..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/OreWashing.java +++ /dev/null @@ -1,69 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.OreWashing") -public class OreWashing { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("OreWashing", Recipes.oreWashing.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.oreWashing.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("OreWashing", Recipes.oreWashing.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/ic2c/mods/Recycler.java b/src/main/java/modtweaker2/mods/ic2c/mods/Recycler.java deleted file mode 100644 index d109e0d..0000000 --- a/src/main/java/modtweaker2/mods/ic2c/mods/Recycler.java +++ /dev/null @@ -1,69 +0,0 @@ -package modtweaker2.mods.ic2c.mods; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.ic2classic.Recycler") -public class Recycler { - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input) { - MineTweakerAPI.apply(new Add(InputHelper.toStack(output), InputHelper.toStack(input))); - } - - private static class Add extends BaseMapAddition { - - protected Add(ItemStack output, ItemStack input) { - super("Recycler", Recipes.recycler.getRecipes()); - recipes.put(new RecipeInputItemStack(input), new RecipeOutput(null, output)); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - - @ZenMethod - public static void removeRecipe(IItemStack output) { - LinkedHashMap recipes = new LinkedHashMap(); - for (Entry set : Recipes.recycler.getRecipes().entrySet()) { - for (ItemStack stack : set.getValue().items) { - if (stack.isItemEqual(InputHelper.toStack(output))) { - recipes.put(set.getKey(), set.getValue()); - } - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseMapRemoval { - - protected Remove(Map recipes) { - super("Recycler", Recipes.recycler.getRecipes(), recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return recipe.toString(); - } - - } - -} diff --git a/src/main/java/modtweaker2/mods/mariculture/Mariculture.java b/src/main/java/modtweaker2/mods/mariculture/Mariculture.java deleted file mode 100644 index 5e53e2a..0000000 --- a/src/main/java/modtweaker2/mods/mariculture/Mariculture.java +++ /dev/null @@ -1,18 +0,0 @@ -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); - } -} diff --git a/src/main/java/modtweaker2/mods/mariculture/MaricultureHelper.java b/src/main/java/modtweaker2/mods/mariculture/MaricultureHelper.java deleted file mode 100644 index 2db7fd3..0000000 --- a/src/main/java/modtweaker2/mods/mariculture/MaricultureHelper.java +++ /dev/null @@ -1,50 +0,0 @@ -package modtweaker2.mods.mariculture; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import mariculture.api.core.FuelInfo; -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> 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; - } -} diff --git a/src/main/java/modtweaker2/mods/mariculture/handlers/Anvil.java b/src/main/java/modtweaker2/mods/mariculture/handlers/Anvil.java deleted file mode 100644 index 29680ef..0000000 --- a/src/main/java/modtweaker2/mods/mariculture/handlers/Anvil.java +++ /dev/null @@ -1,77 +0,0 @@ -package modtweaker2.mods.mariculture.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mariculture.api.core.IAnvilHandler.RecipeAnvil; -import mariculture.api.core.MaricultureHandlers; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.mariculture.MaricultureHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mariculture.Anvil") -public class Anvil { - - public static final String name = "Mariculture Anvil"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @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()); - recipes.put(MaricultureHelper.getKey(recipe.input), recipe); - } - - @Override - public String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(recipe.getValue().output); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //Removing a Mariculture Anvil recipe - @ZenMethod - public static void removeRecipe(IIngredient input) { - Map recipes = new HashMap(); - - for(Entry recipe : MaricultureHandlers.anvil.getRecipes().entrySet()) { - if(recipe != null && recipe.getValue() != null && recipe.getValue().input != null && matches(input, toIItemStack(recipe.getValue().input))) { - recipes.put(recipe.getKey(), recipe.getValue()); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Anvil.name, input.toString())); - } - } - - private static class Remove extends BaseMapRemoval { - public Remove(Map recipes) { - super("Mariculture Anvil", MaricultureHandlers.anvil.getRecipes(), recipes); - } - - @Override - public String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(recipe.getValue().output); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mariculture/handlers/Casting.java b/src/main/java/modtweaker2/mods/mariculture/handlers/Casting.java deleted file mode 100644 index 091dd31..0000000 --- a/src/main/java/modtweaker2/mods/mariculture/handlers/Casting.java +++ /dev/null @@ -1,108 +0,0 @@ -package modtweaker2.mods.mariculture.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mariculture.api.core.MaricultureHandlers; -import mariculture.api.core.RecipeCasting; -import mariculture.api.core.RecipeCasting.RecipeNuggetCasting; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.mariculture.MaricultureHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mariculture.Casting") -public class Casting { - - public static final String name = "Mariculture Casting"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @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(Casting.name, map); - recipes.put(MaricultureHelper.getKey(recipe.fluid), recipe); - } - - @Override - public String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(recipe.getValue().output); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeNuggetRecipe(IIngredient ingredient) { - removeRecipe(ingredient, MaricultureHandlers.casting.getNuggetRecipes()); - } - - @ZenMethod - public static void removeIngotRecipe(IIngredient ingredient) { - removeRecipe(ingredient, MaricultureHandlers.casting.getIngotRecipes()); - } - - @ZenMethod - public static void removeBlockRecipe(IIngredient ingredient) { - removeRecipe(ingredient, MaricultureHandlers.casting.getBlockRecipes()); - } - - public static void removeRecipe(IIngredient ingredient, HashMap map) { - Map recipes = new HashMap(); - - for(Entry recipe : map.entrySet()) { - if(recipe != null && recipe.getValue() != null) { - if(recipe.getValue().fluid != null && matches(ingredient, toILiquidStack(recipe.getValue().fluid))) { - recipes.put(recipe.getKey(), recipe.getValue()); - } - - if(recipe.getValue().output != null && matches(ingredient, toIItemStack(recipe.getValue().output))) { - recipes.put(recipe.getKey(), recipe.getValue()); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(map, recipes)); - } - } - - private static class Remove extends BaseMapRemoval { - public Remove(Map map, Map recipes) { - super(Casting.name, map, recipes); - } - - @Override - public String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(recipe.getValue().output); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mariculture/handlers/Crucible.java b/src/main/java/modtweaker2/mods/mariculture/handlers/Crucible.java deleted file mode 100644 index a11a738..0000000 --- a/src/main/java/modtweaker2/mods/mariculture/handlers/Crucible.java +++ /dev/null @@ -1,165 +0,0 @@ -package modtweaker2.mods.mariculture.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import mariculture.api.core.FuelInfo; -import mariculture.api.core.MaricultureHandlers; -import mariculture.api.core.RecipeSmelter; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.mariculture.MaricultureHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.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 { - - public static final String nameSmelting = "Mariculture Crucible (Smelting)"; - public static final String nameFuel = "Mariculture Crucible (Fuel)"; - - /********************************************** 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(Crucible.nameSmelting, MaricultureHandlers.crucible.getRecipes()); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(RecipeSmelter recipe) { - return LogHelper.getStackDescription(recipe.input); - } - } - - // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // Removing a Mariculture Crucible recipe - @ZenMethod - public static void removeRecipe(IIngredient input) { - List recipes = new LinkedList(); - - for (RecipeSmelter r : MaricultureHandlers.crucible.getRecipes()) { - if (r != null) { - if (r.input != null && matches(input, toIItemStack(r.input))) { - recipes.add(r); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveRecipe(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored", Crucible.nameSmelting, input.toString())); - } - - } - - private static class RemoveRecipe extends BaseListRemoval { - public RemoveRecipe(List recipes) { - super(Crucible.nameSmelting, MaricultureHandlers.crucible.getRecipes(), recipes); - } - - @Override - public String getRecipeInfo(RecipeSmelter recipe) { - return LogHelper.getStackDescription(recipe.input); - } - } - - /********************************************** 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(Crucible.nameFuel, MaricultureHelper.fuels); - recipes.put(MaricultureHelper.getKey(o), info); - } - - @Override - public String getRecipeInfo(Entry recipe) { - return (String) recipe.getKey(); - } - } - - // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - @ZenMethod - public static void removeFuel(IItemStack fuel) { - removeFuelEntry(fuel); - } - - @ZenMethod - public static void removeFuel(ILiquidStack fuel) { - removeFuelEntry(fuel); - } - - @ZenMethod - public static void removeFuel(String fuel) { - removeFuelEntry(fuel); - } - - public static void removeFuelEntry(Object o) { - String key = MaricultureHelper.getKey(o); - Map recipes = new HashMap(); - - for(Entry entry : MaricultureHelper.fuels.entrySet()) { - if(key.matches((String)entry.getKey())) { - recipes.put(key, entry.getValue()); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveFuel(recipes)); - } - } - - // Removes a recipe, will always remove the key, so all should be good - private static class RemoveFuel extends BaseMapRemoval { - public RemoveFuel(Map recipes) { - super(Crucible.nameFuel, MaricultureHelper.fuels, recipes); - } - - @Override - public String getRecipeInfo(Entry recipe) { - return (String) recipe.getKey(); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mariculture/handlers/Fishing.java b/src/main/java/modtweaker2/mods/mariculture/handlers/Fishing.java deleted file mode 100644 index 6d1a749..0000000 --- a/src/main/java/modtweaker2/mods/mariculture/handlers/Fishing.java +++ /dev/null @@ -1,160 +0,0 @@ -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.utils.BaseUndoable; -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 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 BaseUndoable { - private final Loot loot; - - public AddLoot(Loot loot, String description) { - super("Fishing Loot - " + description); - this.loot = loot; - } - - @Override - public void apply() { - ArrayList list = MaricultureHelper.loot.get(loot.rarity); - list.add(loot); - MaricultureHelper.loot.put(loot.rarity, list); - success = true; - } - - @Override - public void undo() { - ArrayList 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 BaseUndoable { - private HashMap 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); - success = true; - } - - //Performs the apply function on all rarity types - public void apply(Rarity rarity) { - ArrayList 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 entry : loot.entrySet()) { - undo(entry.getKey(), entry.getValue()); - } - } - - //Undoes the action on the applicable rarities - public void undo(Rarity rarity, Loot l) { - ArrayList list = MaricultureHelper.loot.get(rarity); - list.add(l); - MaricultureHelper.loot.put(rarity, list); - } - - @Override - public String getRecipeInfo() { - return stack.getDisplayName(); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mariculture/handlers/Vat.java b/src/main/java/modtweaker2/mods/mariculture/handlers/Vat.java deleted file mode 100644 index fa43000..0000000 --- a/src/main/java/modtweaker2/mods/mariculture/handlers/Vat.java +++ /dev/null @@ -1,156 +0,0 @@ -package modtweaker2.mods.mariculture.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import mariculture.api.core.MaricultureHandlers; -import mariculture.api.core.RecipeVat; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mariculture.Vat") -public class Vat { - - public static final String name = "Mariculture 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()); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(RecipeVat recipe) { - if(recipe.outputItem != null) { - return LogHelper.getStackDescription(recipe.outputItem); - } else { - return LogHelper.getStackDescription(recipe.outputFluid); - } - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // Removing a Mariculture Vat recipe - @ZenMethod - public static void removeRecipe(IIngredient ingredient) { - List recipes = new LinkedList(); - - for(RecipeVat r : MaricultureHandlers.vat.getRecipes()) { - if(r != null) { - if(r.outputItem != null && matches(ingredient, toIItemStack(r.outputItem))) { - recipes.add(r); - } - else if(r.outputFluid != null && matches(ingredient, toILiquidStack(r.outputFluid))) { - recipes.add(r); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipes found for %s. Command ignored!", Vat.name, ingredient.toString())); - } - } - - @ZenMethod - public static void removeRecipe(IIngredient outputItem, IIngredient outputFluid) { - List recipes = new LinkedList(); - - for (RecipeVat r : MaricultureHandlers.vat.getRecipes()) { - if (r != null) { - if (r.outputItem != null && matches(outputItem, toIItemStack(r.outputItem))) { - if (r.outputFluid != null && matches(outputFluid, toILiquidStack(r.outputFluid))) { - recipes.add(r); - } - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipes found for %s and %s. Command ignored!", Vat.name, outputItem.toString(), outputFluid.toString())); - } - } - - // 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(List recipes) { - super("Mariculture Vat", MaricultureHandlers.vat.getRecipes(), recipes); - } - - @Override - public String getRecipeInfo(RecipeVat recipe) { - if(recipe.outputItem != null) { - return LogHelper.getStackDescription(recipe.outputItem); - } else { - return LogHelper.getStackDescription(recipe.outputFluid); - } - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/Mekanism.java b/src/main/java/modtweaker2/mods/mekanism/Mekanism.java deleted file mode 100644 index 4c92ce4..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/Mekanism.java +++ /dev/null @@ -1,47 +0,0 @@ -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.EnergizedSmelter; -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.mods.mekanism.handlers.SolarEvaporation; -import modtweaker2.mods.mekanism.handlers.SolarNeutronActivator; -import modtweaker2.utils.TweakerPlugin; - -public class Mekanism extends TweakerPlugin { - public Mekanism() { - MineTweakerAPI.registerBracketHandler(new GasBracketHandler()); - MineTweakerAPI.registerClass(ChemicalCrystallizer.class); - MineTweakerAPI.registerClass(ChemicalDissolution.class); - MineTweakerAPI.registerClass(ChemicalInfuser.class); - MineTweakerAPI.registerClass(ChemicalInjection.class); - MineTweakerAPI.registerClass(ChemicalOxidizer.class); - MineTweakerAPI.registerClass(ChemicalWasher.class); - MineTweakerAPI.registerClass(Combiner.class); - MineTweakerAPI.registerClass(Compressor.class); - MineTweakerAPI.registerClass(Crusher.class); - MineTweakerAPI.registerClass(EnergizedSmelter.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(SolarEvaporation.class); - MineTweakerAPI.registerClass(SolarNeutronActivator.class); - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/MekanismHelper.java b/src/main/java/modtweaker2/mods/mekanism/MekanismHelper.java deleted file mode 100644 index 07a64a7..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/MekanismHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -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; - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/commands/GasLogger.java b/src/main/java/modtweaker2/mods/mekanism/commands/GasLogger.java deleted file mode 100644 index 6d6e49a..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/commands/GasLogger.java +++ /dev/null @@ -1,38 +0,0 @@ -package modtweaker2.mods.mekanism.commands; - -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 COMPARATOR = new Compare(); - - private static class Compare implements Comparator { - @Override - public int compare(Gas o1, Gas o2) { - return o1.getName().compareTo(o2.getName()); - } - } - - @Override - public void execute(String[] arguments, IPlayer player) { - List 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.getLocalizedName()); - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/commands/MekanismLogger.java b/src/main/java/modtweaker2/mods/mekanism/commands/MekanismLogger.java deleted file mode 100644 index 72140da..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/commands/MekanismLogger.java +++ /dev/null @@ -1,238 +0,0 @@ -package modtweaker2.mods.mekanism.commands; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; - -import mekanism.api.gas.GasStack; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.ChemicalInfuserRecipe; -import mekanism.common.recipe.machines.CombinerRecipe; -import mekanism.common.recipe.machines.CrusherRecipe; -import mekanism.common.recipe.machines.CrystallizerRecipe; -import mekanism.common.recipe.machines.DissolutionRecipe; -import mekanism.common.recipe.machines.EnrichmentRecipe; -import mekanism.common.recipe.machines.InjectionRecipe; -import mekanism.common.recipe.machines.MetallurgicInfuserRecipe; -import mekanism.common.recipe.machines.OxidationRecipe; -import mekanism.common.recipe.machines.PressurizedRecipe; -import mekanism.common.recipe.machines.PurificationRecipe; -import mekanism.common.recipe.machines.SawmillRecipe; -import mekanism.common.recipe.machines.SeparatorRecipe; -import mekanism.common.recipe.machines.SmeltingRecipe; -import mekanism.common.recipe.machines.SolarEvaporationRecipe; -import mekanism.common.recipe.machines.SolarNeutronRecipe; -import mekanism.common.recipe.machines.WasherRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StringHelper; - -public class MekanismLogger implements ICommandFunction { - - private static final List validArguments = new LinkedList(); - - static { - validArguments.add("Combiner"); - validArguments.add("Compressor"); - validArguments.add("Crusher"); - validArguments.add("Crystallizer"); - validArguments.add("Dissolution"); - validArguments.add("Enrichment"); - validArguments.add("SolarEvaporation"); - validArguments.add("Infuser"); - validArguments.add("Injection"); - validArguments.add("SolarNeutronActivator"); - validArguments.add("Oxidizer"); - validArguments.add("Purification"); - validArguments.add("Reaction"); - validArguments.add("Sawmill"); - validArguments.add("Separator"); - validArguments.add("Washer"); - } - - @SuppressWarnings({ "unchecked" }) - @Override - public void execute(String[] arguments, IPlayer player) { - List args = StringHelper.toLowerCase(Arrays.asList(arguments)); - - if(!validArguments.containsAll(args)) { - if(player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", "))); - } - } else { - if(args.isEmpty() || args.contains("Crystallizer")) { - for(CrystallizerRecipe recipe : (Collection)Recipe.CHEMICAL_CRYSTALLIZER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.chemical.Crystallizer.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Dissolution")) { - for(DissolutionRecipe recipe : (Collection)Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.chemical.Dissolution.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Infuser")) { - for(ChemicalInfuserRecipe recipe : (Collection)Recipe.CHEMICAL_INFUSER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.chemical.Infuser.addRecipe(%s, %s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.leftGas), - LogHelper.getStackDescription(recipe.recipeInput.rightGas), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Injection")) { - for(InjectionRecipe recipe : (Collection)Recipe.CHEMICAL_INJECTION_CHAMBER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.chemical.Injection.addRecipe(%s, %s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.itemStack), - LogHelper.getStackDescription(new GasStack(recipe.recipeInput.gasType, 1)), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Oxidizer")) { - for(OxidationRecipe recipe : (Collection)Recipe.CHEMICAL_OXIDIZER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.chemical.Oxidizer.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Washer")) { - for(WasherRecipe recipe : (Collection)Recipe.CHEMICAL_WASHER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.chemical.Washer.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Combiner")) { - for(CombinerRecipe recipe : (Collection)Recipe.COMBINER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Combiner.addRecipe(%s, %s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.itemStack), - LogHelper.getStackDescription(recipe.recipeOutput.output), - LogHelper.getStackDescription(new GasStack(recipe.recipeInput.gasType, 1)))); - } - } - - if(args.isEmpty() || args.contains("Compressor")) { - for(CombinerRecipe recipe : (Collection)Recipe.COMBINER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Compressor.addRecipe(%s, %s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.itemStack), - LogHelper.getStackDescription(new GasStack(recipe.recipeInput.gasType, 1)), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Crusher")) { - for(CrusherRecipe recipe : (Collection)Recipe.CRUSHER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Crusher.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Smelter")) { - for(SmeltingRecipe recipe : (Collection)Recipe.ENERGIZED_SMELTER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Smelter.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Enrichment")) { - for(EnrichmentRecipe recipe : (Collection)Recipe.ENRICHMENT_CHAMBER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Enrichment.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Infuser")) { - for(MetallurgicInfuserRecipe recipe : (Collection)Recipe.METALLURGIC_INFUSER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Infuser.addRecipe(\"%s\", %d, %s, %s);", - recipe.getInput().infuse.type.name, - recipe.getInput().infuse.amount, - LogHelper.getStackDescription(recipe.recipeInput.inputStack), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Purification")) { - for(PurificationRecipe recipe : (Collection)Recipe.PURIFICATION_CHAMBER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Purification.addRecipe(%s, %s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.itemStack), - LogHelper.getStackDescription(new GasStack(recipe.recipeInput.gasType, 1)), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("Reaction")) { - for(PressurizedRecipe recipe : (Collection)Recipe.PRESSURIZED_REACTION_CHAMBER.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Reaction.addRecipe(%s, %s, %s, %s, %s, %s, %d);", - LogHelper.getStackDescription(recipe.recipeInput.getSolid()), - LogHelper.getStackDescription(recipe.recipeInput.getFluid()), - LogHelper.getStackDescription(recipe.recipeInput.getGas()), - LogHelper.getStackDescription(recipe.recipeOutput.getItemOutput()), - LogHelper.getStackDescription(recipe.recipeOutput.getGasOutput()), - recipe.extraEnergy, - recipe.ticks)); - } - } - - if(args.isEmpty() || args.contains("Sawmill")) { - for(SawmillRecipe recipe : (Collection)Recipe.PRECISION_SAWMILL.get().values()) { - if(recipe.getOutput().hasSecondary()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Sawmill.addRecipe(%s, %s, %s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.primaryOutput), - LogHelper.getStackDescription(recipe.recipeOutput.secondaryOutput), - recipe.recipeOutput.secondaryChance)); - } else { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Sawmill.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.primaryOutput))); - } - } - } - - if(args.isEmpty() || args.contains("Separator")) { - for(SeparatorRecipe recipe : (Collection)Recipe.ELECTROLYTIC_SEPARATOR.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.Separator.addRecipe(%s, %s, %s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - recipe.energyUsage, - LogHelper.getStackDescription(recipe.recipeOutput.leftGas), - LogHelper.getStackDescription(recipe.recipeOutput.rightGas))); - } - } - - if(args.isEmpty() || args.contains("SolarEvaporation")) { - for(SolarEvaporationRecipe recipe : (Collection)Recipe.SOLAR_EVAPORATION_PLANT.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.SolarEvaporation.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if(args.isEmpty() || args.contains("SolarNeutronActivator")) { - for(SolarNeutronRecipe recipe : (Collection)Recipe.SOLAR_NEUTRON_ACTIVATOR.get().values()) { - MineTweakerAPI.logCommand(String.format("mods.mekanism.SolarNeutronActivator.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.recipeInput.ingredient), - LogHelper.getStackDescription(recipe.recipeOutput.output))); - } - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/gas/GasBracketHandler.java b/src/main/java/modtweaker2/mods/mekanism/gas/GasBracketHandler.java deleted file mode 100644 index 17f721c..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/gas/GasBracketHandler.java +++ /dev/null @@ -1,85 +0,0 @@ -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 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 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)); - } - } -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/mekanism/gas/IGasDefinition.java b/src/main/java/modtweaker2/mods/mekanism/gas/IGasDefinition.java deleted file mode 100644 index 693865a..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/gas/IGasDefinition.java +++ /dev/null @@ -1,18 +0,0 @@ -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(); -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/mekanism/gas/IGasStack.java b/src/main/java/modtweaker2/mods/mekanism/gas/IGasStack.java deleted file mode 100644 index 9e37d33..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/gas/IGasStack.java +++ /dev/null @@ -1,29 +0,0 @@ -package modtweaker2.mods.mekanism.gas; - -import minetweaker.api.item.IIngredient; -import stanhebben.zenscript.annotations.OperatorType; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenGetter; -import stanhebben.zenscript.annotations.ZenMethod; -import stanhebben.zenscript.annotations.ZenOperator; - -@ZenClass("modtweaker.gas.IGasStack") -public interface IGasStack extends IIngredient { - @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(); -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/mekanism/gas/MCGasDefinition.java b/src/main/java/modtweaker2/mods/mekanism/gas/MCGasDefinition.java deleted file mode 100644 index aa6b716..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/gas/MCGasDefinition.java +++ /dev/null @@ -1,28 +0,0 @@ -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)); - } -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/mekanism/gas/MCGasStack.java b/src/main/java/modtweaker2/mods/mekanism/gas/MCGasStack.java deleted file mode 100644 index 20f43dd..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/gas/MCGasStack.java +++ /dev/null @@ -1,135 +0,0 @@ -package modtweaker2.mods.mekanism.gas; - -import java.util.List; - -import mekanism.api.gas.GasStack; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemCondition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IItemTransformer; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.player.IPlayer; - - -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; - } - - @Override - public String toString() { - return ""; - } - - @Override - public IIngredient amount(int amount) { - return withAmount(amount); - } - - @Override - public IItemStack applyTransform(IItemStack arg0, IPlayer arg1) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean contains(IIngredient arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public List getItems() { - // TODO Auto-generated method stub - return null; - } - - @Override - public List getLiquids() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getMark() { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean hasTransformers() { - // TODO Auto-generated method stub - return false; - } - - @Override - public IIngredient marked(String arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean matches(IItemStack arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean matches(ILiquidStack arg0) { - // TODO Auto-generated method stub - return false; - } - - @Override - public IIngredient only(IItemCondition arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIngredient or(IIngredient arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IIngredient transform(IItemTransformer arg0) { - // TODO Auto-generated method stub - return null; - } - - -} \ No newline at end of file diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalCrystallizer.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalCrystallizer.java deleted file mode 100644 index 4579638..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalCrystallizer.java +++ /dev/null @@ -1,80 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.GasInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.CrystallizerRecipe; -import mekanism.common.recipe.machines.MachineRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.chemical.Crystallizer") -public class ChemicalCrystallizer { - - public static final String name = "Mekanism Crusher"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IGasStack gasInput, IItemStack itemOutput) { - if(gasInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - CrystallizerRecipe recipe = new CrystallizerRecipe(toGas(gasInput), toStack(itemOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.CHEMICAL_CRYSTALLIZER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient gasInput) { - if(itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(gasInput == null) gasInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.CHEMICAL_CRYSTALLIZER.get()).entrySet()) { - IGasStack inputGas = new MCGasStack(entry.getKey().ingredient); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(itemOutput, outputItem)) continue; - if(!StackHelper.matches(gasInput, inputGas)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.CHEMICAL_CRYSTALLIZER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, gasInput.toString(), itemOutput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalDissolution.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalDissolution.java deleted file mode 100644 index fb7cae8..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalDissolution.java +++ /dev/null @@ -1,80 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.DissolutionRecipe; -import mekanism.common.recipe.machines.MachineRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.chemical.Dissolution") -public class ChemicalDissolution { - - public static final String name = "Mekanism Dissolution"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IGasStack gasOutput) { - if(itemInput == null || gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - DissolutionRecipe recipe = new DissolutionRecipe(toStack(itemInput), toGas(gasOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient itemInput) { - if(gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemInput == null) itemInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get()).entrySet()) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient); - IGasStack outputGas = new MCGasStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(gasOutput, outputGas)) continue; - if(!StackHelper.matches(itemInput, inputItem)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, gasOutput.toString(), itemInput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInfuser.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInfuser.java deleted file mode 100644 index 4cdda78..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInfuser.java +++ /dev/null @@ -1,80 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ChemicalPairInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.ChemicalInfuserRecipe; -import mekanism.common.recipe.machines.MachineRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.chemical.Infuser") -public class ChemicalInfuser { - - public static final String name = "Mekanism Infuser"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IGasStack leftGasInput, IGasStack rightGasInput, IGasStack gasOutput) { - if(leftGasInput == null || rightGasInput == null || gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - ChemicalInfuserRecipe recipe = new ChemicalInfuserRecipe(toGas(leftGasInput), toGas(rightGasInput), toGas(gasOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.CHEMICAL_INFUSER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient leftGasInput, @Optional IIngredient rightGasInput) { - if(gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(leftGasInput == null) leftGasInput = IngredientAny.INSTANCE; - if(rightGasInput == null) rightGasInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.CHEMICAL_INFUSER.get()).entrySet()) { - IGasStack inputGasLeft = new MCGasStack(entry.getKey().leftGas); - IGasStack inputGasRight = new MCGasStack(entry.getKey().rightGas); - IGasStack outputGas = new MCGasStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(gasOutput, outputGas)) continue; - if(!StackHelper.matches(leftGasInput, inputGasLeft)) continue; - if(!StackHelper.matches(rightGasInput, inputGasRight)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.CHEMICAL_INFUSER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", name, gasOutput.toString(), leftGasInput.toString(), rightGasInput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInjection.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInjection.java deleted file mode 100644 index 844b2a3..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInjection.java +++ /dev/null @@ -1,88 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.api.gas.GasStack; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.AdvancedMachineInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.InjectionRecipe; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.outputs.ItemStackOutput; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.chemical.Injection") -public class ChemicalInjection { - - public static final String name = "Mekanism Injection"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) { - if(itemInput == null || gasInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - AdvancedMachineInput input = new AdvancedMachineInput(toStack(itemInput), toGas(gasInput).getGas()); - ItemStackOutput output = new ItemStackOutput(toStack(itemOutput)); - - InjectionRecipe recipe = new InjectionRecipe(input, output); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.CHEMICAL_INJECTION_CHAMBER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @ZenMethod - public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional IIngredient gasInput) { - if(itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemInput == null) itemInput = IngredientAny.INSTANCE; - if(gasInput == null) gasInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.CHEMICAL_INJECTION_CHAMBER.get()).entrySet()) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().itemStack); - IGasStack inputGas = new MCGasStack(new GasStack(entry.getKey().gasType, 1)); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(itemOutput, outputItem)) continue; - if(!StackHelper.matches(itemInput, inputItem)) continue; - if(!StackHelper.matches(gasInput, inputGas)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.CHEMICAL_INJECTION_CHAMBER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", name, itemOutput.toString(), itemInput.toString(), gasInput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalOxidizer.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalOxidizer.java deleted file mode 100644 index a9c3d01..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalOxidizer.java +++ /dev/null @@ -1,80 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.OxidationRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.chemical.Oxidizer") -public class ChemicalOxidizer { - - public static final String name = "Mekanism Oxidizer"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IGasStack gasOutput) { - if(itemInput == null || gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - OxidationRecipe recipe = new OxidationRecipe(toStack(itemInput), toGas(gasOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.CHEMICAL_OXIDIZER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient itemInput) { - if(gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemInput == null) itemInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.CHEMICAL_OXIDIZER.get()).entrySet()) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient); - IGasStack outputGas = new MCGasStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(itemInput, inputItem)) continue; - if(!StackHelper.matches(gasOutput, outputGas)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.CHEMICAL_OXIDIZER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, gasOutput.toString(), itemInput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalWasher.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalWasher.java deleted file mode 100644 index 2abaf57..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalWasher.java +++ /dev/null @@ -1,77 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.GasInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.WasherRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.chemical.Washer") -public class ChemicalWasher { - - public static final String name = "Mekanism Washer"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IGasStack gasInput, IGasStack gasOutput) { - if(gasInput == null || gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - WasherRecipe recipe = new WasherRecipe(toGas(gasInput), toGas(gasOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.CHEMICAL_WASHER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient gasOutput, @Optional IIngredient gasInput) { - if(gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(gasInput == null) gasInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.CHEMICAL_WASHER.get()).entrySet()) { - IGasStack inputGas = new MCGasStack(entry.getKey().ingredient); - IGasStack outputGas = new MCGasStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(gasInput, inputGas)) continue; - if(!StackHelper.matches(gasOutput, outputGas)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.CHEMICAL_WASHER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, gasOutput.toString(), gasInput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Combiner.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Combiner.java deleted file mode 100644 index f107a32..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Combiner.java +++ /dev/null @@ -1,99 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.api.gas.GasStack; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.AdvancedMachineInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.CombinerRecipe; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.outputs.ItemStackOutput; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Combiner") -public class Combiner { - - public static final String name = "Mekanism Combiner"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - @SuppressWarnings({ "unchecked" }) - @ZenMethod - public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) { - if(itemInput == null || gasInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - AdvancedMachineInput input = new AdvancedMachineInput(toStack(itemInput), toGas(gasInput).getGas()); - ItemStackOutput output = new ItemStackOutput(toStack(itemOutput)); - CombinerRecipe recipe = new CombinerRecipe(input, output); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.COMBINER.get(), recipe)); - } - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { - if(itemInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - CombinerRecipe recipe = new CombinerRecipe(toStack(itemInput), toStack(itemOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.COMBINER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @ZenMethod - public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional IIngredient gasInput) { - if(itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(gasInput == null) gasInput = IngredientAny.INSTANCE; - if(itemInput == null) itemInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.COMBINER.get()).entrySet()) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().itemStack); - IGasStack inputGas = new MCGasStack(new GasStack(entry.getKey().gasType, 1)); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().getOutput().output); - - if(!StackHelper.matches(itemInput, inputItem)) continue; - if(!StackHelper.matches(gasInput, inputGas)) continue; - if(!StackHelper.matches(itemOutput, outputItem)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.COMBINER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", name, itemInput.toString(), gasInput.toString(), itemOutput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Compressor.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Compressor.java deleted file mode 100644 index 2ed1c45..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Compressor.java +++ /dev/null @@ -1,101 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.api.gas.GasStack; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.AdvancedMachineInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.OsmiumCompressorRecipe; -import mekanism.common.recipe.outputs.ItemStackOutput; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Compressor") -public class Compressor { - - public static final String name = "Mekanism Compressor"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { - if(itemInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - OsmiumCompressorRecipe recipe = new OsmiumCompressorRecipe(toStack(itemInput), toStack(itemOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.OSMIUM_COMPRESSOR.get(), recipe)); - } - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) { - if(itemInput == null || gasInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - AdvancedMachineInput input = new AdvancedMachineInput(toStack(itemInput), toGas(gasInput).getGas()); - ItemStackOutput output = new ItemStackOutput(toStack(itemOutput)); - - OsmiumCompressorRecipe recipe = new OsmiumCompressorRecipe(input, output); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.OSMIUM_COMPRESSOR.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional IIngredient gasInput) { - if(itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemInput == null) itemInput = IngredientAny.INSTANCE; - if(gasInput == null) gasInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.OSMIUM_COMPRESSOR.get()).entrySet()) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().itemStack); - IGasStack inputGas = new MCGasStack(new GasStack(entry.getKey().gasType, 1)); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().getOutput().output); - - if(!StackHelper.matches(itemInput, inputItem)) continue; - if(!StackHelper.matches(gasInput, inputGas)) continue; - if(!StackHelper.matches(itemOutput, outputItem)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.OSMIUM_COMPRESSOR.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", name, itemInput.toString(), gasInput.toString(), itemOutput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Crusher.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Crusher.java deleted file mode 100644 index c8026e2..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Crusher.java +++ /dev/null @@ -1,77 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.CrusherRecipe; -import mekanism.common.recipe.machines.MachineRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Crusher") -public class Crusher { - - public static final String name = "Mekanism Crusher"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { - if(itemInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - CrusherRecipe recipe = new CrusherRecipe(toStack(itemInput), toStack(itemOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.CRUSHER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput) { - if(itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemInput == null) itemInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.CRUSHER.get()).entrySet() ) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(itemOutput, outputItem)) continue; - if(!StackHelper.matches(itemInput, inputItem)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.CRUSHER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, itemInput.toString(), itemOutput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/EnergizedSmelter.java b/src/main/java/modtweaker2/mods/mekanism/handlers/EnergizedSmelter.java deleted file mode 100644 index ea34432..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/EnergizedSmelter.java +++ /dev/null @@ -1,77 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.SmeltingRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Smelter") -public class EnergizedSmelter { - - public static final String name = "Mekanism Smelter"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { - if(itemInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - SmeltingRecipe recipe = new SmeltingRecipe(toStack(itemInput), toStack(itemOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.ENERGIZED_SMELTER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient itemInput, @Optional IIngredient itemOutput) { - if(itemInput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemOutput == null) itemOutput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.ENERGIZED_SMELTER.get()).entrySet() ) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(itemInput, inputItem)) continue; - if(!StackHelper.matches(itemOutput, outputItem)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.ENERGIZED_SMELTER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, itemInput.toString(), itemOutput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Enrichment.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Enrichment.java deleted file mode 100644 index 80bf1cb..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Enrichment.java +++ /dev/null @@ -1,78 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.EnrichmentRecipe; -import mekanism.common.recipe.machines.MachineRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Enrichment") -public class Enrichment { - - public static final String name = "Mekanism Enrichment"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { - if(itemInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - EnrichmentRecipe recipe = new EnrichmentRecipe(toStack(itemInput), toStack(itemOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.ENRICHMENT_CHAMBER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient itemInput, @Optional IIngredient itemOutput) { - if(itemInput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemOutput == null) itemOutput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.ENRICHMENT_CHAMBER.get()).entrySet() ) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(itemOutput, outputItem)) continue; - if(!StackHelper.matches(itemInput, inputItem)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.ENRICHMENT_CHAMBER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, itemInput.toString(), itemOutput.toString())); - } - } - -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Infuser.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Infuser.java deleted file mode 100644 index a13d787..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Infuser.java +++ /dev/null @@ -1,85 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.api.infuse.InfuseRegistry; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.InfusionInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.MetallurgicInfuserRecipe; -import mekanism.common.recipe.outputs.ItemStackOutput; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Infuser") -public class Infuser { - - public static final String name = "Mekanism Infuser"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(String infuseType, int infuseAmount, IItemStack itemInput, IItemStack itemOutput) { - if(itemInput == null || itemOutput == null || infuseType == null || infuseType.isEmpty()) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - InfusionInput input = new InfusionInput(InfuseRegistry.get(infuseType), infuseAmount, toStack(itemInput)); - ItemStackOutput output = new ItemStackOutput(toStack(itemOutput)); - - MetallurgicInfuserRecipe recipe = new MetallurgicInfuserRecipe(input, output); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.METALLURGIC_INFUSER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional String infuseType) { - if(itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemInput == null) itemInput = IngredientAny.INSTANCE; - if(infuseType == null) infuseType = ""; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.METALLURGIC_INFUSER.get()).entrySet() ) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().inputStack); - String typeInfuse = entry.getKey().infuse.type.name; - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(itemOutput, outputItem)) continue; - if(!StackHelper.matches(itemInput, inputItem)) continue; - if(!infuseType.isEmpty() && !infuseType.equalsIgnoreCase(typeInfuse)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.METALLURGIC_INFUSER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, itemInput.toString(), itemOutput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Purification.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Purification.java deleted file mode 100644 index baf3263..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Purification.java +++ /dev/null @@ -1,101 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.api.gas.GasStack; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.AdvancedMachineInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.PurificationRecipe; -import mekanism.common.recipe.outputs.ItemStackOutput; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Purification") -public class Purification { - - public static final String name = "Mekanism Purification"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) { - if(itemInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - PurificationRecipe recipe = new PurificationRecipe(toStack(itemInput), toStack(itemOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.PURIFICATION_CHAMBER.get(), recipe)); - } - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) { - if(itemInput == null || gasInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - AdvancedMachineInput input = new AdvancedMachineInput(toStack(itemInput), toGas(gasInput).getGas()); - ItemStackOutput output = new ItemStackOutput(toStack(itemOutput)); - - PurificationRecipe recipe = new PurificationRecipe(input, output); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.PURIFICATION_CHAMBER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @ZenMethod - public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional IIngredient gasInput) { - if(itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemInput == null) itemInput = IngredientAny.INSTANCE; - if(gasInput == null) gasInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.PURIFICATION_CHAMBER.get()).entrySet()) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().itemStack); - IGasStack inputGas = new MCGasStack(new GasStack(entry.getKey().gasType, 1)); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(itemOutput, outputItem)) continue; - if(!StackHelper.matches(itemInput, inputItem)) continue; - if(!StackHelper.matches(gasInput, inputGas)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.PURIFICATION_CHAMBER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", name, itemOutput.toString(), itemInput.toString(), gasInput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Reaction.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Reaction.java deleted file mode 100644 index d11d3c2..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Reaction.java +++ /dev/null @@ -1,95 +0,0 @@ -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 java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.inputs.PressurizedInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.PressurizedRecipe; -import mekanism.common.recipe.outputs.PressurizedOutput; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Reaction") -public class Reaction { - - public static final String name = "Mekanism Reaction"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, ILiquidStack liquidInput, IGasStack gasInput, IItemStack itemOutput, IGasStack gasOutput, double energy, int duration) { - if(itemInput == null || liquidInput == null || gasInput == null || itemOutput == null || gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - PressurizedInput input = new PressurizedInput(toStack(itemInput), toFluid(liquidInput), toGas(gasInput)); - PressurizedOutput output = new PressurizedOutput(toStack(itemOutput), toGas(gasOutput)); - - PressurizedRecipe recipe = new PressurizedRecipe(input, output, energy, duration); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.PRESSURIZED_REACTION_CHAMBER.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient itemOutput, IIngredient gasOutput, @Optional IIngredient itemInput, @Optional IIngredient liquidInput, @Optional IIngredient gasInput) { - if(itemOutput == null || gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemInput == null) itemInput = IngredientAny.INSTANCE; - if(liquidInput == null) liquidInput = IngredientAny.INSTANCE; - if(gasInput == null) gasInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.PRESSURIZED_REACTION_CHAMBER.get()).entrySet() ) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().getSolid()); - ILiquidStack inputLiquid = InputHelper.toILiquidStack(entry.getKey().getFluid()); - IGasStack inputGas = new MCGasStack(entry.getKey().getGas()); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.getItemOutput()); - IGasStack outputGas = new MCGasStack(entry.getValue().recipeOutput.getGasOutput()); - - if(!StackHelper.matches(itemInput, inputItem)) continue; - if(!StackHelper.matches(liquidInput, inputLiquid)) continue; - if(!StackHelper.matches(gasInput, inputGas)) continue; - if(!StackHelper.matches(itemOutput, outputItem)) continue; - if(!StackHelper.matches(gasOutput, outputGas)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.PRESSURIZED_REACTION_CHAMBER.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s, %s, %s, %s and %s. Command ignored!", name, itemOutput.toString(), gasOutput.toString(), itemInput.toString(), liquidInput.toString(), gasInput.toString())); - } - } - -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Sawmill.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Sawmill.java deleted file mode 100644 index e4953c7..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Sawmill.java +++ /dev/null @@ -1,85 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ItemStackInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.SawmillRecipe; -import mekanism.common.recipe.outputs.ChanceOutput; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Sawmill") -public class Sawmill { - - public static final String name = "Mekanism Sawmill"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IItemStack itemInput, IItemStack itemOutput, @Optional IItemStack optionalItemOutput, @Optional double optionalChance) { - if(itemInput == null || itemOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - ItemStackInput input = new ItemStackInput(toStack(itemInput)); - ChanceOutput output = optionalItemOutput == null ? new ChanceOutput(toStack(itemOutput)) : - new ChanceOutput(toStack(itemOutput), toStack(optionalItemOutput), optionalChance); - - SawmillRecipe recipe = new SawmillRecipe(input, output); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.PRECISION_SAWMILL.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient itemInput, @Optional IIngredient itemOutput, @Optional IIngredient optionalItemOutput) { - if(itemInput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(itemOutput == null) itemOutput = IngredientAny.INSTANCE; - if(optionalItemOutput == null) optionalItemOutput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.PRECISION_SAWMILL.get()).entrySet() ) { - IItemStack inputItem = InputHelper.toIItemStack(entry.getKey().ingredient); - IItemStack outputItem = InputHelper.toIItemStack(entry.getValue().recipeOutput.primaryOutput); - IItemStack outputItemOptional = InputHelper.toIItemStack(entry.getValue().recipeOutput.secondaryOutput); - - if(!StackHelper.matches(itemOutput, outputItem)) continue; - if(!StackHelper.matches(itemInput, inputItem)) continue; - if(!StackHelper.matches(optionalItemOutput, outputItemOptional)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.PRECISION_SAWMILL.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, itemInput.toString(), itemOutput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Separator.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Separator.java deleted file mode 100644 index 09c2b7d..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Separator.java +++ /dev/null @@ -1,83 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.FluidInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.SeparatorRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IngredientAny; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.Separator") -public class Separator { - - public static final String name = "Mekanism Separator"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(ILiquidStack liquidInput, double energy, IGasStack leftGasOutput, IGasStack rightGasOutput) { - if(liquidInput == null || leftGasOutput == null || rightGasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - SeparatorRecipe recipe = new SeparatorRecipe(toFluid(liquidInput), energy, toGas(leftGasOutput), toGas(rightGasOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.ELECTROLYTIC_SEPARATOR.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @ZenMethod - public static void removeRecipe(IIngredient liquidInput, @Optional IIngredient leftGasInput, @Optional IIngredient rightGasInput) { - if(liquidInput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(leftGasInput == null) leftGasInput = IngredientAny.INSTANCE; - if(rightGasInput == null) leftGasInput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.ELECTROLYTIC_SEPARATOR.get()).entrySet() ) { - ILiquidStack inputLiquid = InputHelper.toILiquidStack(entry.getKey().ingredient); - IGasStack outputItemLeft = new MCGasStack(entry.getValue().recipeOutput.leftGas); - IGasStack outputItemRight = new MCGasStack(entry.getValue().recipeOutput.rightGas); - - if(!StackHelper.matches(liquidInput, inputLiquid)) continue; - if(!StackHelper.matches(leftGasInput, outputItemLeft)) continue; - if(!StackHelper.matches(rightGasInput, outputItemRight)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.ELECTROLYTIC_SEPARATOR.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s, %s and %s. Command ignored!", name, liquidInput.toString(), leftGasInput.toString(), rightGasInput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/SolarEvaporation.java b/src/main/java/modtweaker2/mods/mekanism/handlers/SolarEvaporation.java deleted file mode 100644 index e20268b..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/SolarEvaporation.java +++ /dev/null @@ -1,77 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.FluidInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.SolarEvaporationRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IngredientAny; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.SolarEvaporation") -public class SolarEvaporation { - - public static final String name = "Mekanism Solar Evaporation"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(ILiquidStack liquidInput, ILiquidStack liquidOutput) { - if(liquidInput == null || liquidOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - SolarEvaporationRecipe recipe = new SolarEvaporationRecipe(toFluid(liquidInput), toFluid(liquidOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.SOLAR_EVAPORATION_PLANT.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient liquidInput, @Optional IIngredient liquidOutput) { - if(liquidInput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(liquidOutput == null) liquidOutput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.SOLAR_EVAPORATION_PLANT.get()).entrySet() ) { - ILiquidStack inputLiquid = InputHelper.toILiquidStack(entry.getKey().ingredient); - ILiquidStack outputLiquid = InputHelper.toILiquidStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(liquidInput, inputLiquid)) continue; - if(!StackHelper.matches(liquidOutput, outputLiquid)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.SOLAR_EVAPORATION_PLANT.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, liquidInput.toString(), liquidOutput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/SolarNeutronActivator.java b/src/main/java/modtweaker2/mods/mekanism/handlers/SolarNeutronActivator.java deleted file mode 100644 index a3f9742..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/SolarNeutronActivator.java +++ /dev/null @@ -1,77 +0,0 @@ -package modtweaker2.mods.mekanism.handlers; - -import static modtweaker2.mods.mekanism.MekanismHelper.toGas; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.GasInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.SolarNeutronRecipe; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IngredientAny; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.mekanism.gas.IGasStack; -import modtweaker2.mods.mekanism.gas.MCGasStack; -import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.mekanism.SolarNeutronActivator") -public class SolarNeutronActivator { - - public static final String name = "Mekanism Solar Evaporation"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings("unchecked") - @ZenMethod - public static void addRecipe(IGasStack gasInput, IGasStack gasOutput) { - if(gasInput == null || gasOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - SolarNeutronRecipe recipe = new SolarNeutronRecipe(toGas(gasInput), toGas(gasOutput)); - - MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.SOLAR_NEUTRON_ACTIVATOR.get(), recipe)); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ZenMethod - public static void removeRecipe(IIngredient gasInput, @Optional IIngredient gasOutput) { - if(gasInput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(gasOutput == null) gasOutput = IngredientAny.INSTANCE; - - Map recipes = new HashMap(); - - for(Entry entry : ((Map)Recipe.SOLAR_NEUTRON_ACTIVATOR.get()).entrySet() ) { - IGasStack inputGas = new MCGasStack(entry.getKey().ingredient); - IGasStack outputGas = new MCGasStack(entry.getValue().recipeOutput.output); - - if(!StackHelper.matches(gasInput, inputGas)) continue; - if(!StackHelper.matches(gasOutput, outputGas)) continue; - - recipes.put(entry.getKey(), entry.getValue()); - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.SOLAR_NEUTRON_ACTIVATOR.get(), recipes)); - } else { - LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, gasInput.toString(), gasOutput.toString())); - } - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/util/AddMekanismRecipe.java b/src/main/java/modtweaker2/mods/mekanism/util/AddMekanismRecipe.java deleted file mode 100644 index aa6ac56..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/util/AddMekanismRecipe.java +++ /dev/null @@ -1,52 +0,0 @@ -package modtweaker2.mods.mekanism.util; - -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.outputs.ChanceOutput; -import mekanism.common.recipe.outputs.ChemicalPairOutput; -import mekanism.common.recipe.outputs.FluidOutput; -import mekanism.common.recipe.outputs.GasOutput; -import mekanism.common.recipe.outputs.ItemStackOutput; -import mekanism.common.recipe.outputs.MachineOutput; -import mekanism.common.recipe.outputs.PressurizedOutput; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseMapAddition; - -@SuppressWarnings("rawtypes") -public class AddMekanismRecipe extends BaseMapAddition { - public AddMekanismRecipe(String name, Map map, Map recipes) { - super(name, map, recipes); - } - - public AddMekanismRecipe(String name, Map map, MachineRecipe recipe) { - super(name, map); - - recipes.put(recipe.getInput(), recipe); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - MachineOutput output = recipe.getValue().recipeOutput; - - if(output instanceof ItemStackOutput) { - return LogHelper.getStackDescription(((ItemStackOutput)output).output); - } else if (output instanceof GasOutput) { - return LogHelper.getStackDescription(((GasOutput)output).output); - } else if (output instanceof FluidOutput) { - return LogHelper.getStackDescription(((FluidOutput)output).output); - } else if (output instanceof ChemicalPairOutput) { - return "[" + LogHelper.getStackDescription(((ChemicalPairOutput)output).leftGas) + ", " + - LogHelper.getStackDescription(((ChemicalPairOutput)output).rightGas) + "]"; - } else if (output instanceof ChanceOutput) { - return LogHelper.getStackDescription(((ChanceOutput)output).primaryOutput); - } else if (output instanceof PressurizedOutput) { - return "[" + LogHelper.getStackDescription(((PressurizedOutput)output).getItemOutput()) + ", " + - LogHelper.getStackDescription(((PressurizedOutput)output).getGasOutput()) + "]"; - } - - return null; - } -} diff --git a/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java b/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java deleted file mode 100644 index 53880f2..0000000 --- a/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java +++ /dev/null @@ -1,46 +0,0 @@ -package modtweaker2.mods.mekanism.util; - -import java.util.Map; -import java.util.Map.Entry; - -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.outputs.ChanceOutput; -import mekanism.common.recipe.outputs.ChemicalPairOutput; -import mekanism.common.recipe.outputs.FluidOutput; -import mekanism.common.recipe.outputs.GasOutput; -import mekanism.common.recipe.outputs.ItemStackOutput; -import mekanism.common.recipe.outputs.MachineOutput; -import mekanism.common.recipe.outputs.PressurizedOutput; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseMapRemoval; - -@SuppressWarnings("rawtypes") -public class RemoveMekanismRecipe extends BaseMapRemoval { - public RemoveMekanismRecipe(String name, Map map, Map recipes) { - super(name, map, recipes); - } - - @Override - protected String getRecipeInfo(Entry recipe) { - MachineOutput output = recipe.getValue().recipeOutput; - - if(output instanceof ItemStackOutput) { - return LogHelper.getStackDescription(((ItemStackOutput)output).output); - } else if (output instanceof GasOutput) { - return LogHelper.getStackDescription(((GasOutput)output).output); - } else if (output instanceof FluidOutput) { - return LogHelper.getStackDescription(((FluidOutput)output).output); - } else if (output instanceof ChemicalPairOutput) { - return "[" + LogHelper.getStackDescription(((ChemicalPairOutput)output).leftGas) + ", " + - LogHelper.getStackDescription(((ChemicalPairOutput)output).rightGas) + "]"; - } else if (output instanceof ChanceOutput) { - return LogHelper.getStackDescription(((ChanceOutput)output).primaryOutput); - } else if (output instanceof PressurizedOutput) { - return "[" + LogHelper.getStackDescription(((PressurizedOutput)output).getItemOutput()) + ", " + - LogHelper.getStackDescription(((PressurizedOutput)output).getGasOutput()) + "]"; - } - - return null; - } -} diff --git a/src/main/java/modtweaker2/mods/metallurgy/Metallurgy.java b/src/main/java/modtweaker2/mods/metallurgy/Metallurgy.java deleted file mode 100644 index 77f7eac..0000000 --- a/src/main/java/modtweaker2/mods/metallurgy/Metallurgy.java +++ /dev/null @@ -1,12 +0,0 @@ -package modtweaker2.mods.metallurgy; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.metallurgy.handlers.Alloyer; -import modtweaker2.mods.metallurgy.handlers.Crusher; - -public class Metallurgy { - public Metallurgy() { - MineTweakerAPI.registerClass(Alloyer.class); - MineTweakerAPI.registerClass(Crusher.class); - } -} diff --git a/src/main/java/modtweaker2/mods/metallurgy/MetallurgyHelper.java b/src/main/java/modtweaker2/mods/metallurgy/MetallurgyHelper.java deleted file mode 100644 index 52f2b5a..0000000 --- a/src/main/java/modtweaker2/mods/metallurgy/MetallurgyHelper.java +++ /dev/null @@ -1,50 +0,0 @@ -package modtweaker2.mods.metallurgy; - -import java.util.ArrayList; -import java.util.HashMap; - -import modtweaker2.helpers.ReflectionHelper; -import net.minecraft.item.ItemStack; - -import com.teammetallurgy.metallurgy.recipes.AlloyerRecipes; -import com.teammetallurgy.metallurgy.recipes.AlloyerRecipes.AlloyRecipe; -import com.teammetallurgy.metallurgy.recipes.CrusherRecipes; - -public class MetallurgyHelper { - public static ArrayList alloyerRecipes = null; - public static HashMap crusherMetaList = null; - public static HashMap crusherInputList = null; - - static { - try { - alloyerRecipes = ReflectionHelper.getFinalObject(AlloyerRecipes.getInstance(), "recipes"); - crusherMetaList = ReflectionHelper.getFinalObject(CrusherRecipes.getInstance(), "metaList"); - crusherInputList = ReflectionHelper.getFinalObject(CrusherRecipes.getInstance(), "inputList"); - } catch (Exception e) { - } - } - - private MetallurgyHelper() { - } - - public static String getCrusherKey(ItemStack input) { - return input.getUnlocalizedName(); - } - - // Returns a Drying Recipe, using reflection as the constructor is not - // visible - public static AlloyRecipe getAlloyRecipe(ItemStack first, ItemStack base, ItemStack result) { - try { - // Constructor constructor = - // AlloyRecipe.class.getDeclaredConstructor(ItemStack.class, - // ItemStack.class, ItemStack.class); - // constructor.setAccessible(true); - // return (AlloyRecipe) constructor.newInstance(first, base, - // result); - return AlloyerRecipes.getInstance().new AlloyRecipe(first, base, result); - } catch (Exception e) { - e.printStackTrace(); - throw new NullPointerException("Failed to instantiate AlloyRecipe"); - } - } -} diff --git a/src/main/java/modtweaker2/mods/metallurgy/handlers/Alloyer.java b/src/main/java/modtweaker2/mods/metallurgy/handlers/Alloyer.java deleted file mode 100644 index 35db6b3..0000000 --- a/src/main/java/modtweaker2/mods/metallurgy/handlers/Alloyer.java +++ /dev/null @@ -1,70 +0,0 @@ -package modtweaker2.mods.metallurgy.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.metallurgy.MetallurgyHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import com.teammetallurgy.metallurgy.recipes.AlloyerRecipes.AlloyRecipe; - -@ZenClass("mods.metallurgy.Alloyer") -public class Alloyer { - - public static final String name = "Metallurgy Alloyer"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(IItemStack first, IItemStack base, IItemStack result) { - MineTweakerAPI.apply(new Add(MetallurgyHelper.getAlloyRecipe(toStack(first), toStack(base), toStack(result)))); - } - - private static class Add extends BaseListAddition { - public Add(AlloyRecipe recipe) { - super(Alloyer.name, MetallurgyHelper.alloyerRecipes); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(AlloyRecipe recipe) { - return LogHelper.getStackDescription(recipe.getCraftingResult()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - List recipes = new LinkedList(); - - for (AlloyRecipe r : MetallurgyHelper.alloyerRecipes) { - if (r != null && r.getCraftingResult() != null && matches(output, toIItemStack(r.getCraftingResult()))) { - recipes.add(r); - } - } - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(Alloyer.name, MetallurgyHelper.alloyerRecipes, recipes); - } - - @Override - public String getRecipeInfo(AlloyRecipe recipe) { - return LogHelper.getStackDescription(recipe.getCraftingResult()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/metallurgy/handlers/Crusher.java b/src/main/java/modtweaker2/mods/metallurgy/handlers/Crusher.java deleted file mode 100644 index d966083..0000000 --- a/src/main/java/modtweaker2/mods/metallurgy/handlers/Crusher.java +++ /dev/null @@ -1,137 +0,0 @@ -package modtweaker2.mods.metallurgy.handlers; - -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.areEqual; - -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.metallurgy.MetallurgyHelper; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.metallurgy.Crusher") -public class Crusher { - //Adding a Metallurgy Crusher Recipe - @ZenMethod - public static void addRecipe(IItemStack input, IItemStack output) { - MineTweakerAPI.apply(new Add(toStack(input), toStack(output))); - } - - private static class Add extends BaseMapAddition { - private final ItemStack stack; - - public Add(ItemStack input, ItemStack output) { - super("Metallurgy Crusher", MetallurgyHelper.crusherMetaList); - this.stack = input; - recipes.put(MetallurgyHelper.getCrusherKey(input), output); - } - - @Override - public void apply() { - super.apply(); - for(Entry recipe : successful.entrySet()) { - addToInput(stack, recipe.getValue()); - } - } - - @Override - public void undo() { - super.undo(); - for(Entry recipe : successful.entrySet()) { - removeFromInput(stack, recipe.getValue()); - } - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(stack); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //Removing a Metallurgy Crusher recipe - @ZenMethod - public static void removeRecipe(IItemStack input) { - MineTweakerAPI.apply(new Remove(toStack(input))); - } - - private static class Remove extends BaseMapRemoval { - private ItemStack stack; - - public Remove(ItemStack stack) { - super("Metallurgy Crusher", MetallurgyHelper.crusherMetaList); - - recipes.put(MetallurgyHelper.getCrusherKey(stack), MetallurgyHelper.crusherMetaList.get(MetallurgyHelper.getCrusherKey(stack))); - this.stack = stack; - } - - @Override - public void apply() { - super.apply(); - for(Entry recipe : successful.entrySet()) { - removeFromInput(stack, recipe.getValue()); - } - } - - @Override - public void undo() { - super.undo(); - for(Entry recipe : successful.entrySet()) { - addToInput(stack, recipe.getValue()); - } - } - - @Override - protected String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(stack); - } - } - - //Helper Methods - private static void addToInput(ItemStack input, ItemStack output) { - ItemStack[] inputList = MetallurgyHelper.crusherInputList.get(output.getUnlocalizedName()); - if (inputList == null) { - inputList = new ItemStack[1]; - inputList[0] = input; - } else { - ItemStack[] newList = new ItemStack[inputList.length + 1]; - for (int i = 0; i < inputList.length; i++) { - newList[i] = inputList[i]; - } - - newList[inputList.length] = input; - - inputList = newList; - } - - MetallurgyHelper.crusherInputList.put(output.getUnlocalizedName(), inputList); - } - - private static void removeFromInput(ItemStack input, ItemStack output) { - boolean switched = false; - ItemStack[] inputList = MetallurgyHelper.crusherInputList.get(output.getUnlocalizedName()); - ItemStack[] newList = new ItemStack[inputList.length - 1]; - if (newList.length >= 1) { - for (int i = 0; i < newList.length; i++) { - if (switched || (areEqual(inputList[i], input))) { - switched = true; - newList[i] = inputList[i + 1]; - } else newList[i] = inputList[i]; - } - } else newList = null; - - inputList = newList; - if (inputList == null || inputList.length <= 0) { - MetallurgyHelper.crusherInputList.remove(output.getUnlocalizedName()); - } else { - MetallurgyHelper.crusherInputList.put(output.getUnlocalizedName(), inputList); - } - } -} diff --git a/src/main/java/modtweaker2/mods/pneumaticcraft/PneumaticCraft.java b/src/main/java/modtweaker2/mods/pneumaticcraft/PneumaticCraft.java deleted file mode 100644 index b5bd5fb..0000000 --- a/src/main/java/modtweaker2/mods/pneumaticcraft/PneumaticCraft.java +++ /dev/null @@ -1,12 +0,0 @@ -package modtweaker2.mods.pneumaticcraft; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.pneumaticcraft.handlers.Assembly; -import modtweaker2.mods.pneumaticcraft.handlers.Pressure; - -public class PneumaticCraft { - public PneumaticCraft() { - MineTweakerAPI.registerClass(Assembly.class); - MineTweakerAPI.registerClass(Pressure.class); - } -} diff --git a/src/main/java/modtweaker2/mods/pneumaticcraft/handlers/Assembly.java b/src/main/java/modtweaker2/mods/pneumaticcraft/handlers/Assembly.java deleted file mode 100644 index 529be79..0000000 --- a/src/main/java/modtweaker2/mods/pneumaticcraft/handlers/Assembly.java +++ /dev/null @@ -1,117 +0,0 @@ -package modtweaker2.mods.pneumaticcraft.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.areEqual; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraft.item.ItemStack; -import pneumaticCraft.api.recipe.AssemblyRecipe; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.pneumaticcraft.Assembly") -public class Assembly { - - public static final String name = "PneumaticCraft Assembly"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addDrillRecipe(IItemStack input, IItemStack output) { - addRecipe(input, output, AssemblyRecipe.drillRecipes); - } - - @ZenMethod - public static void addLaserRecipe(IItemStack input, IItemStack output) { - addRecipe(input, output, AssemblyRecipe.laserRecipes); - } - - @ZenMethod - public static void addLaserDrillRecipe(IItemStack input, IItemStack output) { - addRecipe(input, output, AssemblyRecipe.drillLaserRecipes); - } - - public static void addRecipe(IItemStack input, IItemStack output, List list) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - ItemStack in = toStack(input); - - for(AssemblyRecipe recipe : list) { - if(areEqual(recipe.getInput(), in)) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(in))); - return; - } - } - - MineTweakerAPI.apply(new Add(new AssemblyRecipe(toStack(input), toStack(output)), list)); - } - - private static class Add extends BaseListAddition { - public Add(AssemblyRecipe recipe, List list) { - super(Assembly.name, list); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(AssemblyRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeDrillRecipe(IIngredient output) { - removeRecipe(AssemblyRecipe.drillRecipes, output); - } - - @ZenMethod - public static void removeLaserRecipe(IIngredient output) { - removeRecipe(AssemblyRecipe.laserRecipes, output); - } - - @ZenMethod - public static void removeLaserDrillRecipe(IIngredient output) { - removeRecipe(AssemblyRecipe.drillLaserRecipes, output); - } - - public static void removeRecipe(List list, IIngredient output) { - List recipes = new LinkedList(); - - for (AssemblyRecipe r : list) { - if (r.getOutput() != null && matches(output, toIItemStack(r.getOutput()))) { - recipes.add(r); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(list, recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", name, output.toString())); - } - } - - private static class Remove extends BaseListRemoval { - public Remove(List list, List recipes) { - super(Assembly.name, list, recipes); - } - - @Override - public String getRecipeInfo(AssemblyRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/pneumaticcraft/handlers/Pressure.java b/src/main/java/modtweaker2/mods/pneumaticcraft/handlers/Pressure.java deleted file mode 100644 index 615fdd0..0000000 --- a/src/main/java/modtweaker2/mods/pneumaticcraft/handlers/Pressure.java +++ /dev/null @@ -1,85 +0,0 @@ -package modtweaker2.mods.pneumaticcraft.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStacks; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraft.item.ItemStack; -import pneumaticCraft.api.recipe.PressureChamberRecipe; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.pneumaticcraft.Pressure") -public class Pressure { - - public static final String name = "PneumaticCraft Pressure Chamber"; - - @ZenMethod - public static void addRecipe(IItemStack[] input, double pressure, IItemStack[] output, boolean asBlock) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - MineTweakerAPI.apply(new Add(new PressureChamberRecipe(toStacks(input), (float) pressure, toStacks(output), asBlock))); - } - - private static class Add extends BaseListAddition { - public Add(PressureChamberRecipe recipe) { - super(Pressure.name, PressureChamberRecipe.chamberRecipes); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(PressureChamberRecipe recipe) { - return LogHelper.getStackDescription(recipe.output[0]); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient[] output) { - List recipes = new LinkedList(); - - for (PressureChamberRecipe r : PressureChamberRecipe.chamberRecipes) { - if(r != null) { - boolean matches = true; - for (IIngredient ingredient : output) { - for(ItemStack stack : r.output) { - if (!matches(ingredient, toIItemStack(stack))) { - matches = false; - break; - } - } - } - - if (matches) { - recipes.add(r); - } - } - } - - MineTweakerAPI.apply(new Remove(recipes)); - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(Pressure.name, PressureChamberRecipe.chamberRecipes, recipes); - } - - @Override - public String getRecipeInfo(PressureChamberRecipe recipe) { - return LogHelper.getStackDescription(recipe.output[0]); - } - } -} diff --git a/src/main/java/modtweaker2/mods/railcraft/Railcraft.java b/src/main/java/modtweaker2/mods/railcraft/Railcraft.java deleted file mode 100644 index 15670d9..0000000 --- a/src/main/java/modtweaker2/mods/railcraft/Railcraft.java +++ /dev/null @@ -1,16 +0,0 @@ -package modtweaker2.mods.railcraft; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.railcraft.handlers.BlastFurnace; -import modtweaker2.mods.railcraft.handlers.CokeOven; -import modtweaker2.mods.railcraft.handlers.RockCrusher; -import modtweaker2.mods.railcraft.handlers.RollingMachine; - -public class Railcraft { - public Railcraft() { - MineTweakerAPI.registerClass(BlastFurnace.class); - MineTweakerAPI.registerClass(CokeOven.class); - MineTweakerAPI.registerClass(RockCrusher.class); - MineTweakerAPI.registerClass(RollingMachine.class); - } -} diff --git a/src/main/java/modtweaker2/mods/railcraft/RailcraftHelper.java b/src/main/java/modtweaker2/mods/railcraft/RailcraftHelper.java deleted file mode 100644 index 8f829f7..0000000 --- a/src/main/java/modtweaker2/mods/railcraft/RailcraftHelper.java +++ /dev/null @@ -1,66 +0,0 @@ -package modtweaker2.mods.railcraft; - -import java.util.ArrayList; -import java.util.List; - -import mods.railcraft.api.crafting.IBlastFurnaceRecipe; -import mods.railcraft.api.crafting.ICokeOvenRecipe; -import mods.railcraft.api.crafting.IRockCrusherRecipe; -import mods.railcraft.api.crafting.RailcraftCraftingManager; -import mods.railcraft.common.util.crafting.BlastFurnaceCraftingManager; -import mods.railcraft.common.util.crafting.BlastFurnaceCraftingManager.BlastFurnaceRecipe; -import mods.railcraft.common.util.crafting.CokeOvenCraftingManager.CokeOvenRecipe; -import mods.railcraft.common.util.crafting.RockCrusherCraftingManager.CrusherRecipe; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraftforge.fluids.FluidStack; - -public class RailcraftHelper { - public static List furnace = null; - public static List oven = null; - public static List crusher = null; - public static List rolling = null; - public static List fuels = null; - static { - try { - furnace = RailcraftCraftingManager.blastFurnace.getRecipes(); - oven = RailcraftCraftingManager.cokeOven.getRecipes(); - crusher = RailcraftCraftingManager.rockCrusher.getRecipes(); - rolling = RailcraftCraftingManager.rollingMachine.getRecipeList(); - - fuels = new ArrayList(RailcraftCraftingManager.blastFurnace.getFuels()); - ReflectionHelper.setPrivateValue(BlastFurnaceCraftingManager.class, RailcraftCraftingManager.blastFurnace, "fuels", fuels); - - } catch (Exception e) { LogHelper.logError("Error in RailcraftHelper", e); } - } - - private RailcraftHelper() {} - - public static IBlastFurnaceRecipe getBlastFurnaceRecipe(ItemStack input, boolean matchDamage, boolean matchNBT, int cookTime, ItemStack output) { - return ReflectionHelper.getInstance(ReflectionHelper.getConstructor(BlastFurnaceRecipe.class,ItemStack.class, boolean.class, boolean.class, int.class, ItemStack.class), - input, - matchDamage, - matchNBT, - cookTime, - output); - } - - public static ICokeOvenRecipe getCokeOvenRecipe(ItemStack input, boolean matchDamage, boolean matchNBT, ItemStack output, FluidStack fluidOutput, int cookTime) { - return ReflectionHelper.getInstance(ReflectionHelper.getConstructor(CokeOvenRecipe.class, ItemStack.class, boolean.class, boolean.class, ItemStack.class, FluidStack.class, int.class), - input, - matchDamage, - matchNBT, - output, - fluidOutput, - cookTime); - } - - public static IRockCrusherRecipe getRockCrusherRecipe(ItemStack stack, boolean matchDamage, boolean matchNBT) { - return ReflectionHelper.getInstance(ReflectionHelper.getConstructor(CrusherRecipe.class, ItemStack.class, boolean.class, boolean.class), - stack, - matchDamage, - matchNBT); - } -} diff --git a/src/main/java/modtweaker2/mods/railcraft/commands/RailcraftLogger.java b/src/main/java/modtweaker2/mods/railcraft/commands/RailcraftLogger.java deleted file mode 100644 index 183eb95..0000000 --- a/src/main/java/modtweaker2/mods/railcraft/commands/RailcraftLogger.java +++ /dev/null @@ -1,110 +0,0 @@ -package modtweaker2.mods.railcraft.commands; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Map.Entry; - -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import mods.railcraft.api.crafting.IBlastFurnaceRecipe; -import mods.railcraft.api.crafting.ICokeOvenRecipe; -import mods.railcraft.api.crafting.IRockCrusherRecipe; -import mods.railcraft.api.crafting.RailcraftCraftingManager; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.helpers.StringHelper; -import modtweaker2.mods.railcraft.RailcraftHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; - -public class RailcraftLogger implements ICommandFunction { - - private static final List validArguments = new LinkedList(); - - static { - validArguments.add("BlastFurnace"); - validArguments.add("CokeOven"); - validArguments.add("RockCrusher"); - validArguments.add("RollingMachine"); - } - - @Override - public void execute(String[] arguments, IPlayer player) { - List args = StringHelper.toLowerCase(Arrays.asList(arguments)); - - if(!validArguments.containsAll(args)) { - if(player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", "))); - } - } else { - if(args.isEmpty() || args.contains("BlastFurnace")) { - for(IBlastFurnaceRecipe recipe : RailcraftHelper.furnace) { - MineTweakerAPI.logCommand(String.format("mods.railcraft.BlastFurnace.addRecipe(%s, %s, %s, %d, %s);", - LogHelper.getStackDescription(recipe.getInput()), - ReflectionHelper.getObject(recipe, "matchDamage"), - ReflectionHelper.getObject(recipe, "matchNBT"), - recipe.getCookTime(), - LogHelper.getStackDescription(recipe.getOutput()))); - } - } - - if(args.isEmpty() || args.contains("CokeOven")) { - for(ICokeOvenRecipe recipe : RailcraftCraftingManager.cokeOven.getRecipes()) { - MineTweakerAPI.logCommand(String.format("mods.railcraft.CokeOven.addRecipe(%s, %s, %s, %s, %s, %d);", - LogHelper.getStackDescription(recipe.getInput()), - ReflectionHelper.getObject(recipe, "matchDamage"), - ReflectionHelper.getObject(recipe, "matchNBT"), - LogHelper.getStackDescription(recipe.getOutput()), - LogHelper.getStackDescription(recipe.getFluidOutput()), - recipe.getCookTime())); - } - } - - if(args.isEmpty() || args.contains("RockCrusher")) { - for(IRockCrusherRecipe recipe : RailcraftHelper.crusher) { - MineTweakerAPI.logCommand(String.format("mods.railcraft.RockCrusher.addRecipe(%s, %s, %s, %s);", - LogHelper.getStackDescription(recipe.getInput()), - ReflectionHelper.getObject(recipe, "matchDamage"), - ReflectionHelper.getObject(recipe, "matchNBT"), - getRockCrusherOutputDescription(recipe.getOutputs()))); - } - } - - if(args.isEmpty() || args.contains("RollingMachine")) { - for(IRecipe recipe : RailcraftHelper.rolling) { - MineTweakerAPI.logCommand(String.format("mods.railcraft.RollingMachine.addRecipe(%s, %s);", - LogHelper.getStackDescription(recipe.getRecipeOutput()), - LogHelper.getCraftingDescription(recipe))); - } - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } - } - - private Object getRockCrusherOutputDescription(List> outputs) { - if(outputs.isEmpty()) { - return "[], []"; - } - - StringBuilder sb = new StringBuilder(); - sb.append('['); - for(Entry entry : outputs) { - sb.append(LogHelper.getStackDescription(entry.getKey())).append(", "); - } - sb.setLength(sb.length() - 2); - sb.append("], ["); - for(Entry entry : outputs) { - sb.append(entry.getValue()).append(", "); - } - sb.setLength(sb.length() - 2); - sb.append("]"); - - return sb.toString(); - } -} diff --git a/src/main/java/modtweaker2/mods/railcraft/handlers/BlastFurnace.java b/src/main/java/modtweaker2/mods/railcraft/handlers/BlastFurnace.java deleted file mode 100644 index c9f709d..0000000 --- a/src/main/java/modtweaker2/mods/railcraft/handlers/BlastFurnace.java +++ /dev/null @@ -1,191 +0,0 @@ -package modtweaker2.mods.railcraft.handlers; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import mods.railcraft.api.crafting.IBlastFurnaceRecipe; -import modtweaker2.helpers.InputHelper; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StackHelper; -import modtweaker2.mods.railcraft.RailcraftHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraftforge.oredict.OreDictionary; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import java.util.LinkedList; -import java.util.List; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -@ZenClass("mods.railcraft.BlastFurnace") -public class BlastFurnace { - - public static final String name = "Railcraft Blast Furnace"; - public static final String nameFuel = "Railcraft Blast Furnace (Fuel)"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Add a recipe for the Blast Furnace - * - * @param output ItemStack result - * @param input ItemStack input - * @param cookTime time per item to process - * @param matchEmptyNBT Set this to true, if you want to match only input items strictly without NBT Data) - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int cookTime, @Optional Boolean matchEmptyNBT) { - if (matchEmptyNBT == null) - if (toStack(input).stackTagCompound == null) - matchEmptyNBT = false; - else - matchEmptyNBT = true; - - if (input.getDamage() == OreDictionary.WILDCARD_VALUE) - MineTweakerAPI.apply(new Add(RailcraftHelper.getBlastFurnaceRecipe(toStack(input), false, matchEmptyNBT, cookTime, toStack(output)))); - else - MineTweakerAPI.apply(new Add(RailcraftHelper.getBlastFurnaceRecipe(toStack(input), true, matchEmptyNBT, cookTime, toStack(output)))); - } - - @Deprecated - @ZenMethod - public static void addRecipe(IItemStack input, boolean matchDamage, boolean matchNBT, int cookTime, IItemStack output) { - if (input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - MineTweakerAPI.apply(new Add(RailcraftHelper.getBlastFurnaceRecipe(toStack(input), matchDamage, matchNBT, cookTime, toStack(output)))); - } - - private static class Add extends BaseListAddition { - @SuppressWarnings("unchecked") - public Add(IBlastFurnaceRecipe recipe) { - super(BlastFurnace.name, (List) RailcraftHelper.furnace); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(IBlastFurnaceRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - if (output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - List recipes = new LinkedList(); - - for (IBlastFurnaceRecipe r : RailcraftHelper.furnace) { - if (r != null && r.getOutput() != null && matches(output, toIItemStack(r.getOutput()))) { - recipes.add(r); - } - } - - if (!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", BlastFurnace.name, output.toString())); - } - } - - private static class Remove extends BaseListRemoval { - @SuppressWarnings("unchecked") - public Remove(List recipes) { - super(BlastFurnace.name, (List) RailcraftHelper.furnace, recipes); - } - - @Override - public String getRecipeInfo(IBlastFurnaceRecipe recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addFuel(IIngredient itemInput) { - if (itemInput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - List fuels = new LinkedList(); - - for (IItemStack item : itemInput.getItems()) { - - boolean match = false; - - for (ItemStack fuel : RailcraftHelper.fuels) { - if (StackHelper.matches(item, InputHelper.toIItemStack(fuel))) { - match = true; - break; - } - } - - if (!match && TileEntityFurnace.isItemFuel(InputHelper.toStack(item))) { - fuels.add(InputHelper.toStack(item)); - } - } - - if (!fuels.isEmpty()) { - MineTweakerAPI.apply(new AddFuels(fuels)); - } else { - LogHelper.logWarning(String.format("No %s added.", nameFuel)); - } - } - - private static class AddFuels extends BaseListAddition { - public AddFuels(List fuels) { - super(BlastFurnace.nameFuel, RailcraftHelper.fuels, fuels); - } - - @Override - protected String getRecipeInfo(ItemStack recipe) { - return LogHelper.getStackDescription(recipe); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeFuel(IIngredient itemInput) { - List fuels = new LinkedList(); - - for (ItemStack fuel : RailcraftHelper.fuels) { - if (StackHelper.matches(itemInput, InputHelper.toIItemStack(fuel))) { - fuels.add(fuel); - } - } - - if (!fuels.isEmpty()) { - MineTweakerAPI.apply(new RemoveFuels(fuels)); - } else { - LogHelper.logWarning(String.format("No %s found for argument %s.", nameFuel, itemInput.toString())); - } - } - - private static class RemoveFuels extends BaseListRemoval { - public RemoveFuels(List fuels) { - super(BlastFurnace.nameFuel, RailcraftHelper.fuels, fuels); - } - - @Override - protected String getRecipeInfo(ItemStack recipe) { - return LogHelper.getStackDescription(recipe); - } - } -} diff --git a/src/main/java/modtweaker2/mods/railcraft/handlers/CokeOven.java b/src/main/java/modtweaker2/mods/railcraft/handlers/CokeOven.java deleted file mode 100644 index 5ff8859..0000000 --- a/src/main/java/modtweaker2/mods/railcraft/handlers/CokeOven.java +++ /dev/null @@ -1,132 +0,0 @@ -package modtweaker2.mods.railcraft.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import mods.railcraft.api.crafting.ICokeOvenRecipe; -import mods.railcraft.api.crafting.RailcraftCraftingManager; -import mods.railcraft.common.util.crafting.CokeOvenCraftingManager.CokeOvenRecipe; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.railcraft.RailcraftHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraftforge.oredict.OreDictionary; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.railcraft.CokeOven") -public class CokeOven { - - public static final String name = "Railcraft Coke Oven"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Adds a recipe for the Coke Oven - * - * @param itemOutput ItemStack result - * @param fluidOutput FluidStack result - * @param ingredient item input - * @param timePerItem time per item to process - */ - @ZenMethod - public static void addRecipe(IItemStack itemOutput, ILiquidStack fluidOutput, IItemStack ingredient, int timePerItem) { - boolean matchEmptyNBT; - if (toStack(ingredient).stackTagCompound == null) - matchEmptyNBT = false; - else - matchEmptyNBT = true; - - if (ingredient.getDamage() == OreDictionary.WILDCARD_VALUE) - MineTweakerAPI.apply(new Add( new CokeOvenRecipe(toStack(ingredient), false, matchEmptyNBT, toStack(itemOutput), toFluid(fluidOutput), timePerItem) )); - else - MineTweakerAPI.apply(new Add( new CokeOvenRecipe(toStack(ingredient), true, matchEmptyNBT, toStack(itemOutput), toFluid(fluidOutput), timePerItem) )); - } - /** - * Adds a recipe for the Coke Oven (Use this, if you want to have an Input strictly without NBT Data) - * - * @param itemOutput ItemStack result - * @param fluidOutput FluidStack result - * @param ingredient item input - * @param matchEmptyNBT should the input only match an item with no NBT Data - * @param timePerItem time per item to process - */ - @ZenMethod - public static void addRecipe(IItemStack itemOutput, ILiquidStack fluidOutput, IItemStack ingredient, boolean matchEmptyNBT, int timePerItem) { - if (ingredient.getDamage() == OreDictionary.WILDCARD_VALUE) - MineTweakerAPI.apply(new Add( new CokeOvenRecipe(toStack(ingredient), false, matchEmptyNBT, toStack(itemOutput), toFluid(fluidOutput), timePerItem) )); - else - MineTweakerAPI.apply(new Add( new CokeOvenRecipe(toStack(ingredient), true, matchEmptyNBT, toStack(itemOutput), toFluid(fluidOutput), timePerItem) )); - } - - /** - * Adds a recipe for the Coke Oven - * - * @param ingredient item input - * @param matchDamage should the recipe compare NBT Data - * @param matchNBT should the recipe compare NBT Data - * @param itemOutput ItemStack result - * @param fluidOutput FluidStack result - * @param cookTime time per item to process - */ - @Deprecated - @ZenMethod - public static void addRecipe(IItemStack input, boolean matchDamage, boolean matchNBT, IItemStack output, ILiquidStack fluidOutput, int cookTime) { - MineTweakerAPI.apply(new Add( new CokeOvenRecipe(toStack(input), matchDamage, matchNBT, toStack(output), toFluid(fluidOutput), cookTime) )); - } - - private static class Add extends BaseListAddition { - - @SuppressWarnings("unchecked") - public Add(ICokeOvenRecipe recipe) { - super(CokeOven.name, (List)RailcraftCraftingManager.cokeOven.getRecipes()); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(ICokeOvenRecipe recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient output) { - List recipes = new LinkedList(); - - for (ICokeOvenRecipe r : RailcraftHelper.oven) { - if (r.getOutput() != null && matches(output, toIItemStack(r.getOutput()))) { - recipes.add(r); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", CokeOven.name, output.toString())); - } - } - - private static class Remove extends BaseListRemoval { - - @SuppressWarnings("unchecked") - public Remove(List recipes) { - super(CokeOven.name, (List)RailcraftHelper.oven, recipes); - } - - @Override - public String getRecipeInfo(ICokeOvenRecipe recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/railcraft/handlers/RockCrusher.java b/src/main/java/modtweaker2/mods/railcraft/handlers/RockCrusher.java deleted file mode 100644 index 7a97319..0000000 --- a/src/main/java/modtweaker2/mods/railcraft/handlers/RockCrusher.java +++ /dev/null @@ -1,116 +0,0 @@ -package modtweaker2.mods.railcraft.handlers; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import mods.railcraft.api.crafting.IRockCrusherRecipe; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.railcraft.RailcraftHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraftforge.oredict.OreDictionary; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import java.util.LinkedList; -import java.util.List; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -@ZenClass("mods.railcraft.RockCrusher") -public class RockCrusher { - - public static final String name = "Railcraft Rock Crusher"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Add a recipe for the Rock Crusher - * - * @param output WeightedItemStack Array of outputs - * @param input ItemStack input - * @param matchEmptyNBT Set this to true, if you want to match only input items strictly without NBT Data) - */ - @ZenMethod - public static void addRecipe(WeightedItemStack[] output, IItemStack input, @Optional Boolean matchEmptyNBT) { - if (matchEmptyNBT == null) - if (toStack(input).stackTagCompound == null) - matchEmptyNBT = false; - else - matchEmptyNBT = true; - - IRockCrusherRecipe recipe; - if (input.getDamage() == OreDictionary.WILDCARD_VALUE) - recipe = RailcraftHelper.getRockCrusherRecipe(toStack(input), false, matchEmptyNBT); - else - recipe = RailcraftHelper.getRockCrusherRecipe(toStack(input), true, matchEmptyNBT); - - for (int i = 0; i < output.length; i++) { - recipe.addOutput(toStack(output[i].getStack()), output[i].getChance()); - } - - MineTweakerAPI.apply(new Add(recipe)); - } - - @Deprecated - @ZenMethod - public static void addRecipe(IItemStack input, boolean matchDamage, boolean matchNBT, IItemStack[] output, double[] chances) { - IRockCrusherRecipe recipe = RailcraftHelper.getRockCrusherRecipe(toStack(input), matchDamage, matchNBT); - - for (int i = 0; i < output.length; i++) { - recipe.addOutput(toStack(output[i]), (float) chances[i]); - } - - MineTweakerAPI.apply(new Add(recipe)); - } - - private static class Add extends BaseListAddition { - - @SuppressWarnings("unchecked") - public Add(IRockCrusherRecipe recipe) { - super(RockCrusher.name, (List) RailcraftHelper.crusher); - recipes.add(recipe); - } - - @Override - public String getRecipeInfo(IRockCrusherRecipe recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input) { - List recipes = new LinkedList(); - - for (IRockCrusherRecipe r : RailcraftHelper.crusher) { - if (r.getInput() != null && matches(input, toIItemStack(r.getInput()))) { - recipes.add(r); - } - } - - if (!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", RockCrusher.name, input.toString())); - } - } - - private static class Remove extends BaseListRemoval { - - @SuppressWarnings("unchecked") - public Remove(List recipes) { - super("Rock Crusher", (List) RailcraftHelper.crusher, recipes); - } - - @Override - public String getRecipeInfo(IRockCrusherRecipe recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } -} diff --git a/src/main/java/modtweaker2/mods/railcraft/handlers/RollingMachine.java b/src/main/java/modtweaker2/mods/railcraft/handlers/RollingMachine.java deleted file mode 100644 index bf45c75..0000000 --- a/src/main/java/modtweaker2/mods/railcraft/handlers/RollingMachine.java +++ /dev/null @@ -1,64 +0,0 @@ -package modtweaker2.mods.railcraft.handlers; - -import static modtweaker2.helpers.InputHelper.toObjects; -import static modtweaker2.helpers.InputHelper.toShapedObjects; -import static modtweaker2.helpers.InputHelper.toStack; - -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.railcraft.RailcraftHelper; -import modtweaker2.utils.BaseCraftingAddition; -import modtweaker2.utils.BaseCraftingRemoval; -import net.minecraft.item.crafting.IRecipe; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.railcraft.Rolling") -public class RollingMachine { - - public static final String name = "Railcraft Rolling Machine"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addShaped(IItemStack output, IIngredient[][] ingredients) { - MineTweakerAPI.apply(new Add(new ShapedOreRecipe(toStack(output), toShapedObjects(ingredients)))); - } - - @ZenMethod - public static void addShapeless(IItemStack output, IIngredient[] ingredients) { - MineTweakerAPI.apply(new Add(new ShapelessOreRecipe(toStack(output), toObjects(ingredients)))); - } - - private static class Add extends BaseCraftingAddition { - public Add(IRecipe recipe) { - super(RollingMachine.name, RailcraftHelper.rolling); - recipes.add(recipe); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient ingredient) { - List recipes = BaseCraftingRemoval.getRecipes(RailcraftHelper.rolling, ingredient); - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipes found for %s. Command ignored!", RollingMachine.name, ingredient.toString())); - } - } - - private static class Remove extends BaseCraftingRemoval { - public Remove(List recipes) { - super(RollingMachine.name, RailcraftHelper.rolling, recipes); - } - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/TConstruct.java b/src/main/java/modtweaker2/mods/tconstruct/TConstruct.java deleted file mode 100644 index 45b888f..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/TConstruct.java +++ /dev/null @@ -1,20 +0,0 @@ -package modtweaker2.mods.tconstruct; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.tconstruct.handlers.Casting; -import modtweaker2.mods.tconstruct.handlers.Drying; -import modtweaker2.mods.tconstruct.handlers.Modifiers; -import modtweaker2.mods.tconstruct.handlers.Smeltery; -import modtweaker2.mods.tconstruct.handlers.TiCTweaks; -import modtweaker2.mods.tconstruct.handlers.ToolStats; - -public class TConstruct { - public TConstruct() { - MineTweakerAPI.registerClass(Casting.class); - MineTweakerAPI.registerClass(Drying.class); - MineTweakerAPI.registerClass(Smeltery.class); - MineTweakerAPI.registerClass(Modifiers.class); - MineTweakerAPI.registerClass(TiCTweaks.class); - MineTweakerAPI.registerClass(ToolStats.class); - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/TConstructHelper.java b/src/main/java/modtweaker2/mods/tconstruct/TConstructHelper.java deleted file mode 100644 index 8bc028c..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/TConstructHelper.java +++ /dev/null @@ -1,70 +0,0 @@ -package modtweaker2.mods.tconstruct; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import mantle.utils.ItemMetaWrapper; -import modtweaker2.helpers.ReflectionHelper; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import tconstruct.library.TConstructRegistry; -import tconstruct.library.crafting.AlloyMix; -import tconstruct.library.crafting.CastingRecipe; -import tconstruct.library.crafting.DryingRackRecipes.DryingRecipe; -import tconstruct.library.crafting.ModifyBuilder; -import tconstruct.library.crafting.PatternBuilder.ItemKey; -import tconstruct.library.modifier.ItemModifier; -import tconstruct.library.tools.ToolMaterial; - -public class TConstructHelper { - public static HashMap mappings = new HashMap(); - public static List alloys = null; - public static ArrayList basinCasting = null; - public static ArrayList tableCasting = null; - public static Map smeltingList = null; - public static Map temperatureList = null; - public static Map renderIndex = null; - public static Map fuelList = null; - public static List modifiers = null; - public static List modifiers_clone = null; - - static { - try { - alloys = tconstruct.library.crafting.Smeltery.getAlloyList(); - smeltingList = tconstruct.library.crafting.Smeltery.getSmeltingList(); - temperatureList = tconstruct.library.crafting.Smeltery.getTemperatureList(); - renderIndex = tconstruct.library.crafting.Smeltery.getRenderIndex(); - basinCasting = TConstructRegistry.getBasinCasting().getCastingRecipes(); - tableCasting = TConstructRegistry.getTableCasting().getCastingRecipes(); - modifiers = ModifyBuilder.instance.itemModifiers; - modifiers_clone = new ArrayList(modifiers); - - for (Map.Entry entry : TConstructRegistry.toolMaterials.entrySet()) { - mappings.put(entry.getValue().materialName, entry.getKey()); - } - - fuelList = ReflectionHelper.getObject(tconstruct.library.crafting.Smeltery.instance, "smelteryFuels"); - } catch (Exception e) {} - } - - private TConstructHelper() {} - - public static int getIDFromString(String material) { - if (!mappings.containsKey(material)) { - return -1; - } else return mappings.get(material); - } - - //Returns a Drying Recipe, using reflection as the constructor is not visible - public static DryingRecipe getDryingRecipe(ItemStack input, int time, ItemStack output) { - return ReflectionHelper.getInstance(ReflectionHelper.getConstructor(DryingRecipe.class, ItemStack.class, int.class, ItemStack.class), - input, - time, - output); - } - -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/commands/MaterialLogger.java b/src/main/java/modtweaker2/mods/tconstruct/commands/MaterialLogger.java deleted file mode 100644 index 788b5b9..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/commands/MaterialLogger.java +++ /dev/null @@ -1,22 +0,0 @@ -package modtweaker2.mods.tconstruct.commands; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import tconstruct.library.TConstructRegistry; -import tconstruct.library.tools.ToolMaterial; - -import java.util.Map; - -import static modtweaker2.helpers.LogHelper.logPrinted; - -public class MaterialLogger implements ICommandFunction { - @Override - public void execute(String[] arguments, IPlayer player) { - MineTweakerAPI.logCommand(TConstructRegistry.toolMaterialStrings.entrySet().size() + " Materials:"); - for (Map.Entry entry : TConstructRegistry.toolMaterialStrings.entrySet()) { - MineTweakerAPI.logCommand(entry.getKey()); - } - logPrinted(player); - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/commands/ModifierLogger.java b/src/main/java/modtweaker2/mods/tconstruct/commands/ModifierLogger.java deleted file mode 100644 index d6b772c..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/commands/ModifierLogger.java +++ /dev/null @@ -1,21 +0,0 @@ -package modtweaker2.mods.tconstruct.commands; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import modtweaker2.mods.tconstruct.TConstructHelper; -import tconstruct.library.modifier.ItemModifier; - -import static modtweaker2.helpers.LogHelper.logPrinted; - -public class ModifierLogger implements ICommandFunction{ - @Override - public void execute(String[] arguments, IPlayer player) { - MineTweakerAPI.logCommand(TConstructHelper.modifiers.size() + " Tinker's Construct modifiers:"); - for (ItemModifier modifier : TConstructHelper.modifiers) { - if (!modifier.key.equals("")) - MineTweakerAPI.logCommand(modifier.key); - } - logPrinted(player); - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/commands/TConstructLogger.java b/src/main/java/modtweaker2/mods/tconstruct/commands/TConstructLogger.java deleted file mode 100644 index 58fff47..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/commands/TConstructLogger.java +++ /dev/null @@ -1,103 +0,0 @@ -package modtweaker2.mods.tconstruct.commands; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Map.Entry; - -import mantle.utils.ItemMetaWrapper; -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StringHelper; -import modtweaker2.mods.tconstruct.TConstructHelper; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import tconstruct.library.crafting.AlloyMix; -import tconstruct.library.crafting.CastingRecipe; -import tconstruct.library.crafting.DryingRackRecipes; -import tconstruct.library.crafting.DryingRackRecipes.DryingRecipe; - -public class TConstructLogger implements ICommandFunction { - private static final List validArguments = new LinkedList(); - - static { - validArguments.add("Casting"); - validArguments.add("Drying"); - validArguments.add("Smeltery"); - } - - @Override - public void execute(String[] arguments, IPlayer player) { - List args = StringHelper.toLowerCase(Arrays.asList(arguments)); - - if(!validArguments.containsAll(args)) { - if(player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", "))); - } - } else { - if(args.isEmpty() || args.contains("Casting")) { - for(CastingRecipe recipe : TConstructHelper.basinCasting) { - MineTweakerAPI.logCommand(String.format("mods.tconstruct.Casting.addBasinRecipe(%s, %s, %s, %s, %d);", - LogHelper.getStackDescription(recipe.output), - LogHelper.getStackDescription(recipe.castingMetal), - LogHelper.getStackDescription(recipe.cast), - recipe.consumeCast, - recipe.coolTime)); - } - - for(CastingRecipe recipe : TConstructHelper.tableCasting) { - MineTweakerAPI.logCommand(String.format("mods.tconstruct.Casting.addTableRecipe(%s, %s, %s, %s, %d);", - LogHelper.getStackDescription(recipe.output), - LogHelper.getStackDescription(recipe.castingMetal), - LogHelper.getStackDescription(recipe.cast), - recipe.consumeCast, - recipe.coolTime)); - } - } - - if(args.isEmpty() || args.contains("Drying")) { - for(DryingRecipe recipe : DryingRackRecipes.recipes) { - MineTweakerAPI.logCommand(String.format("mods.tconstruct.Drying.addRecipe(%s, %s, %d);", - LogHelper.getStackDescription(recipe.input), - LogHelper.getStackDescription(recipe.result), - recipe.time)); - } - } - - if(args.isEmpty() || args.contains("Smeltery")) { - - for(Entry recipe : TConstructHelper.smeltingList.entrySet()) { - int temperature = TConstructHelper.temperatureList.get(recipe.getKey()); - ItemStack renderItem = TConstructHelper.renderIndex.get(recipe.getKey()); - - MineTweakerAPI.logCommand(String.format("mods.tconstruct.Smeltery.addMelting(%s, %s, %d, %s);", - LogHelper.getStackDescription(new ItemStack(recipe.getKey().item, 1, recipe.getKey().meta)), - LogHelper.getStackDescription(recipe.getValue()), - temperature, - LogHelper.getStackDescription(renderItem))); - } - - for(AlloyMix recipe : TConstructHelper.alloys) { - MineTweakerAPI.logCommand(String.format("mods.tconstruct.Smeltery.addAlloy(%s, %s);", - LogHelper.getStackDescription(recipe.result), - LogHelper.getListDescription(recipe.mixers))); - } - - for(Entry fuel : TConstructHelper.fuelList.entrySet()) { - MineTweakerAPI.logCommand(String.format("mods.tconstruct.Smeltery.addFuel(%s, %d, %d);", - LogHelper.getStackDescription(new FluidStack(fuel.getKey(), 1)), - fuel.getValue()[0], - fuel.getValue()[1])); - } - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/handlers/Casting.java b/src/main/java/modtweaker2/mods/tconstruct/handlers/Casting.java deleted file mode 100644 index 62b656e..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/handlers/Casting.java +++ /dev/null @@ -1,133 +0,0 @@ -package modtweaker2.mods.tconstruct.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.tconstruct.TConstructHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import tconstruct.library.crafting.CastingRecipe; - -@ZenClass("mods.tconstruct.Casting") -public class Casting { - - protected static final String name = "TConstruct Casting"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addBasinRecipe(IItemStack output, ILiquidStack metal, @Optional IItemStack cast, @Optional boolean consume, int delay) { - if(metal == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - MineTweakerAPI.apply(new Add(new CastingRecipe(toStack(output), toFluid(metal), toStack(cast), consume, delay, null), TConstructHelper.basinCasting)); - } - - @ZenMethod - public static void addTableRecipe(IItemStack output, ILiquidStack metal, @Optional IItemStack cast, @Optional boolean consume, int delay) { - if(metal == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - MineTweakerAPI.apply(new Add(new CastingRecipe(toStack(output), toFluid(metal), toStack(cast), consume, delay, null), TConstructHelper.tableCasting)); - } - - //Passes the list to the base list implementation, and adds the recipe - private static class Add extends BaseListAddition { - public Add(CastingRecipe recipe, ArrayList list) { - super(Casting.name, list); - - this.recipes.add(recipe); - } - - @Override - protected String getRecipeInfo(CastingRecipe recipe) { - return LogHelper.getStackDescription(recipe.output); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeTableRecipe(IIngredient output, @Optional IIngredient material, @Optional IIngredient cast) { - removeRecipe(output, material, cast, TConstructHelper.tableCasting); - } - - @ZenMethod - public static void removeBasinRecipe(IIngredient output, @Optional IIngredient material, @Optional IIngredient cast) { - - removeRecipe(output, material, cast, TConstructHelper.basinCasting); - } - - public static void removeRecipe(IIngredient output, IIngredient material, IIngredient cast, List list) { - if(output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(material == null) { - material = IngredientAny.INSTANCE; - } - - if(cast == null) { - cast = IngredientAny.INSTANCE; - } - - List recipes = new LinkedList(); - - for(CastingRecipe recipe : list) { - if(recipe != null) { - if (!matches(output, toIItemStack(recipe.output))) { - continue; - } - - if (!matches(material, toILiquidStack(recipe.castingMetal))) { - continue; - } - - if(!matches(cast, toIItemStack(recipe.cast))) { - continue; - } - - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(list, recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for output %s, material %s and cast %s. Command ignored!", Casting.name, output.toString(), material.toString(), cast.toString())); - } - } - - // Removes all matching recipes, apply is never the same for anything, so will always need to override it - private static class Remove extends BaseListRemoval { - public Remove(List list, List recipes) { - super(Casting.name, list, recipes); - } - - @Override - protected String getRecipeInfo(CastingRecipe recipe) { - return LogHelper.getStackDescription(recipe.output); - } - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/handlers/Drying.java b/src/main/java/modtweaker2/mods/tconstruct/handlers/Drying.java deleted file mode 100644 index de8baff..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/handlers/Drying.java +++ /dev/null @@ -1,82 +0,0 @@ -package modtweaker2.mods.tconstruct.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.tconstruct.TConstructHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import tconstruct.library.crafting.DryingRackRecipes; -import tconstruct.library.crafting.DryingRackRecipes.DryingRecipe; - -@ZenClass("mods.tconstruct.Drying") -public class Drying { - - protected static final String name = "TConstruct Drying Rack"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(IItemStack input, IItemStack output, int time) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - MineTweakerAPI.apply(new Add(TConstructHelper.getDryingRecipe(toStack(input), time, toStack(output)))); - } - - //Passes the list to the base list implementation, and adds the recipe - private static class Add extends BaseListAddition { - public Add(DryingRecipe recipe) { - super(Drying.name, DryingRackRecipes.recipes); - this.recipes.add(recipe); - } - - @Override - protected String getRecipeInfo(DryingRecipe recipe) { - return LogHelper.getStackDescription(recipe.result); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //Removing a TConstruct Drying Rack recipe - @ZenMethod - public static void removeRecipe(IIngredient ingredient) { - List recipes = new LinkedList(); - - for (DryingRecipe recipe : DryingRackRecipes.recipes) { - if (recipe != null && recipe.result != null && ingredient.matches(toIItemStack(recipe.result))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Drying.name, ingredient.toString())); - } - } - - //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(List list) { - super(Drying.name, DryingRackRecipes.recipes, list); - } - - @Override - protected String getRecipeInfo(DryingRecipe recipe) { - return LogHelper.getStackDescription(recipe.result); - } - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/handlers/Modifiers.java b/src/main/java/modtweaker2/mods/tconstruct/handlers/Modifiers.java deleted file mode 100644 index 3778718..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/handlers/Modifiers.java +++ /dev/null @@ -1,48 +0,0 @@ -package modtweaker2.mods.tconstruct.handlers; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.tconstruct.TConstructHelper; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import tconstruct.library.modifier.ItemModifier; - -@ZenClass("mods.tconstruct.Modifiers") -public class Modifiers { - - protected static final String name = "TConstruct Modifier"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void remove(String mod) { - List recipes = new LinkedList(); - - for (ItemModifier recipe : TConstructHelper.modifiers) { - if (recipe.key.equals(mod)) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Modifiers.name, mod)); - } - } - - private static class Remove extends BaseListRemoval{ - public Remove(List recipes) { - super(Modifiers.name, TConstructHelper.modifiers, recipes); - } - - @Override - protected String getRecipeInfo(ItemModifier recipe) { - return recipe.key; - } - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/handlers/Smeltery.java b/src/main/java/modtweaker2/mods/tconstruct/handlers/Smeltery.java deleted file mode 100644 index 09db6e4..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/handlers/Smeltery.java +++ /dev/null @@ -1,300 +0,0 @@ -package modtweaker2.mods.tconstruct.handlers; - -import static modtweaker2.helpers.InputHelper.isABlock; -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toFluids; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import mantle.utils.ItemMetaWrapper; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.tconstruct.TConstructHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import modtweaker2.utils.BaseMapAddition; -import modtweaker2.utils.BaseMapRemoval; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import tconstruct.library.crafting.AlloyMix; - -@ZenClass("mods.tconstruct.Smeltery") -public class Smeltery { - - public static final String nameFuel = "TConstruct Smeltery - Fuel"; - public static final String nameMelting = "TConstruct Smeltery - Melting"; - public static final String nameAlloy = "TConstruct Smeltery - Alloy"; - - /********************************************** TConstruct Alloy Recipes **********************************************/ - - // Adding a TConstruct Alloy recipe - @ZenMethod - public static void addAlloy(ILiquidStack output, ILiquidStack[] input) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", nameAlloy)); - return; - } - - MineTweakerAPI.apply(new AddAlloy(new AlloyMix(toFluid(output), new ArrayList(Arrays.asList(toFluids(input)))))); - } - - // Passes the list to the base list implementation, and adds the recipe - private static class AddAlloy extends BaseListAddition { - public AddAlloy(AlloyMix recipe) { - super("TConstruct Smeltery - Alloy", TConstructHelper.alloys); - this.recipes.add(recipe); - } - - @Override - protected String getRecipeInfo(AlloyMix recipe) { - return LogHelper.getStackDescription(recipe.result); - } - } - - // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // Removing a TConstruct Alloy recipe - @ZenMethod - public static void removeAlloy(IIngredient output) { - List recipes = new LinkedList(); - - for(AlloyMix r : TConstructHelper.alloys) { - if(r != null && matches(output, toILiquidStack(r.result))) { - recipes.add(r); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveAlloy(recipes)); - } else { - LogHelper.logError(String.format("No %s recipes found for %s. Command ignored!", nameAlloy, output.toString())); - } - - } - - // Removes a recipe, apply is never the same for anything, so will always - // need to override it - private static class RemoveAlloy extends BaseListRemoval { - public RemoveAlloy(List recipes) { - super(nameAlloy, TConstructHelper.alloys, recipes); - } - - @Override - protected String getRecipeInfo(AlloyMix recipe) { - return LogHelper.getStackDescription(recipe.result); - } - } - - /********************************************** TConstruct Melting Recipes **********************************************/ - - // Adding a TConstruct Melting recipe - @ZenMethod - public static void addMelting(IIngredient input, ILiquidStack output, int temp, @Optional IItemStack block) { - - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", nameMelting)); - return; - } - - List recipes = new LinkedList(); - - for(IItemStack in : input.getItems()) { - if(block == null && !isABlock(toStack(in))) { - LogHelper.logWarning(String.format("Item %s is not a block and no block renderer is provided for %s recipe. Input ignored!", in.toString(), nameMelting)); - } else { - recipes.add(new MeltingRecipe(toStack(in), toFluid(output), temp, block == null ? toStack(in) : toStack(block))); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new AddMelting(recipes)); - } else { - LogHelper.logError(String.format("No %s recipes could be added for input %s.", nameMelting, input.toString())); - } - } - - private static class AddMelting extends BaseListAddition { - - public AddMelting(List recipes) { - super(nameMelting, null, recipes); - } - - @Override - public void apply() { - for(MeltingRecipe recipe : recipes) { - tconstruct.library.crafting.Smeltery.addMelting(recipe.input, recipe.getRendererBlock(), recipe.getRendererMeta(), recipe.temperature, recipe.fluid); - successful.add(recipe); - } - } - - @Override - public void undo() { - for(MeltingRecipe recipe : successful) { - TConstructHelper.smeltingList.remove(recipe.meta); - TConstructHelper.temperatureList.remove(recipe.meta); - TConstructHelper.renderIndex.remove(recipe.meta); - } - } - - @Override - public String getRecipeInfo(MeltingRecipe recipe) { - return LogHelper.getStackDescription(recipe.input); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // Removing a TConstruct Melting recipe - @ZenMethod - public static void removeMelting(IIngredient input) { - List recipes = new LinkedList(); - - for(ItemMetaWrapper meta : TConstructHelper.smeltingList.keySet()) { - ItemStack in = new ItemStack(meta.item, 1, meta.meta); - if(matches(input, toIItemStack(in))) { - recipes.add(new MeltingRecipe( - in, - TConstructHelper.smeltingList.get(meta), - TConstructHelper.temperatureList.get(meta), - TConstructHelper.renderIndex.get(meta))); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveMelting(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", nameMelting, input.toString())); - } - } - - private static class RemoveMelting extends BaseListRemoval { - - public RemoveMelting(List recipes) { - super(nameMelting, null, recipes); - } - - @Override - public void apply() { - for(MeltingRecipe recipe : recipes) { - TConstructHelper.smeltingList.remove(recipe.meta); - TConstructHelper.temperatureList.remove(recipe.meta); - TConstructHelper.renderIndex.remove(recipe.meta); - - successful.add(recipe); - } - } - - @Override - public void undo() { - for(MeltingRecipe recipe : successful) { - tconstruct.library.crafting.Smeltery.addMelting(recipe.input, recipe.getRendererBlock(), recipe.getRendererMeta(), recipe.temperature, recipe.fluid); - } - } - - @Override - public String getRecipeInfo(MeltingRecipe recipe) { - return LogHelper.getStackDescription(recipe.input); - } - } - - protected static class MeltingRecipe { - public final ItemMetaWrapper meta; - public final ItemStack input; - public final FluidStack fluid; - public final Integer temperature; - public final ItemStack renderer; - - protected MeltingRecipe(ItemStack input, FluidStack fluid, int temperature, ItemStack renderer) { - this.input = input; - this.fluid = fluid; - this.temperature = temperature; - this.renderer = renderer; - this.meta = new ItemMetaWrapper(input); - } - - public Block getRendererBlock() { - return Block.getBlockFromItem(renderer.getItem()); - } - - public int getRendererMeta() { - return renderer.getItemDamage(); - } - } - - /********************************************** TConstruct Fuel Recipes **********************************************/ - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeFuel(IIngredient input) { - Map recipes = new HashMap(); - - for(Entry fuel : TConstructHelper.fuelList.entrySet()) { - if(fuel != null && fuel.getKey() != null && matches(input, toILiquidStack(new FluidStack(fuel.getKey(), 1)))) { - recipes.put(fuel.getKey(), fuel.getValue()); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new RemoveFuel(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe for %s found. Command ignored!", Smeltery.nameFuel, input.toString())); - } - } - - public static class RemoveFuel extends BaseMapRemoval { - public RemoveFuel(Map recipes) { - super(Smeltery.nameFuel, TConstructHelper.fuelList, recipes); - } - - @Override - public String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(new FluidStack(recipe.getKey(), 1)); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addFuel(ILiquidStack liquid, int power, int duration) { - if(liquid == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", nameFuel)); - return; - } - - Map recipes = new HashMap(); - - recipes.put(toFluid(liquid).getFluid(), new Integer[] {power, duration}); - - MineTweakerAPI.apply(new AddFuel(recipes)); - } - - public static class AddFuel extends BaseMapAddition { - public AddFuel(Map recipes) { - super(Smeltery.nameFuel, TConstructHelper.fuelList, recipes); - } - - @Override - public String getRecipeInfo(Entry recipe) { - return LogHelper.getStackDescription(new FluidStack(recipe.getKey(), 1)); - } - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/handlers/TiCTweaks.java b/src/main/java/modtweaker2/mods/tconstruct/handlers/TiCTweaks.java deleted file mode 100644 index 4cd4eff..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/handlers/TiCTweaks.java +++ /dev/null @@ -1,118 +0,0 @@ -package modtweaker2.mods.tconstruct.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.mods.tconstruct.TConstructHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import tconstruct.library.crafting.PatternBuilder; -import tconstruct.library.crafting.PatternBuilder.ItemKey; - -@ZenClass("mods.tconstruct.Tweaks") -public class TiCTweaks { - - // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - /** Disabling for 0.5, will do this properly for 0.6 **/ - // Tweaks for enabling / disabling Patterns - /* - * @ZenMethod public static void removePattern(IItemStack stack) { - * MineTweakerAPI.apply(new DisablePattern(toStack(stack))); } - * - * private static class DisablePattern implements IUndoableAction { private - * String key; private MaterialSet set; private List list; private ItemStack - * stack; private final ItemStack disable; - * - * public DisablePattern(ItemStack disable) { this.disable = disable; } - * - * //Loops through the pattern mappings to find an entry with the same - * material name - * - * @Override public void apply() { for (Entry entry : - * TConstructRegistry.patternPartMapping.entrySet()) { ItemStack check = - * entry.getValue(); if (check.isItemEqual(disable)) { list = - * entry.getKey(); stack = entry.getValue(); break; } } - * - * TConstructRegistry.patternPartMapping.remove(list); } - * - * @Override public boolean canUndo() { return true; } - * - * @Override public void undo() { - * TConstructRegistry.patternPartMapping.put(list, stack); } - * - * @Override public String describe() { return - * "Disabling creation of the pattern for: " + disable.getDisplayName(); } - * - * @Override public String describeUndo() { return - * "Enabling creation of the pattern for: " + disable.getDisplayName(); } - * - * @Override public Object getOverrideKey() { return null; } } - */ - - // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRepairMaterial(IItemStack stack, String material, int value) { - ItemStack input = toStack(stack); - MineTweakerAPI.apply(new Add(PatternBuilder.instance.new ItemKey(input.getItem(), input.getItemDamage(), value, material))); - } - - // Tweaks for setting repair materials - private static class Add extends BaseListAddition { - public Add(ItemKey recipe) { - super("Repair Material", PatternBuilder.instance.materials); - recipes.add(recipe); - } - - @Override - protected String getRecipeInfo(ItemKey recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.item, 1, recipe.damage)); - } - } - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRepairMaterial(IIngredient output, @Optional String material) { - - List recipes = new LinkedList(); - - for (ItemKey recipe : PatternBuilder.instance.materials) { - IItemStack clone = toIItemStack(new ItemStack(recipe.item, 1, recipe.damage)); - if ((material != null && material.equalsIgnoreCase(recipe.key)) || (material == null)) { - if (output.matches(clone)) { - recipes.add(recipe); - } - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } - } - - // 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(List recipes) { - super("Repair Material", PatternBuilder.instance.materials, recipes); - } - - @Override - protected String getRecipeInfo(ItemKey recipe) { - return LogHelper.getStackDescription(new ItemStack(recipe.item, 1, recipe.damage)); - } - } -} diff --git a/src/main/java/modtweaker2/mods/tconstruct/handlers/ToolStats.java b/src/main/java/modtweaker2/mods/tconstruct/handlers/ToolStats.java deleted file mode 100644 index a84f006..0000000 --- a/src/main/java/modtweaker2/mods/tconstruct/handlers/ToolStats.java +++ /dev/null @@ -1,266 +0,0 @@ -package modtweaker2.mods.tconstruct.handlers; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.tconstruct.TConstructHelper; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import tconstruct.library.TConstructRegistry; -import tconstruct.library.tools.ArrowMaterial; -import tconstruct.library.tools.BowMaterial; -import tconstruct.library.tools.ToolMaterial; - -@ZenClass("mods.tconstruct.ToolStats") -public class ToolStats { - /** - * @deprecated - */ - @java.lang.Deprecated - @ZenMethod - public static void set(String material, @Optional String name, int level, int durability, int speed, int damage, double handle, int reinforced, double stonebound, String style, String ability) { - if (name == null) name = material + " "; - MineTweakerAPI.apply(new SetToolStats(material, "", new ToolMaterial(material, name, level, durability, speed, damage, (float) handle, reinforced, (float) stonebound, style, 0xFFFFFF))); - } - - /** - * @deprecated - */ - @java.lang.Deprecated - @ZenMethod - public static void set(String material, @Optional String name, int level, int durability, int speed, int damage, double handle, int reinforced, double stonebound, String style, int primaryColor) { - if (name == null) name = material + " "; - MineTweakerAPI.apply(new SetToolStats(material, "", new ToolMaterial(material, name, level, durability, speed, damage, (float) handle, reinforced, (float) stonebound, style, primaryColor))); - } - - @ZenMethod - public static void setStats(String material, @Optional String name, int level, int durability, int speed, int damage, double handle, int reinforced, double stonebound, String style, int primaryColor) { - if (name == null) name = material + " "; - MineTweakerAPI.apply(new SetToolStats(material, "", new ToolMaterial(material, name, level, durability, speed, damage, (float) handle, reinforced, (float) stonebound, style, primaryColor))); - } - - @ZenMethod - public static void setDisplayName(String material, String name) { - MineTweakerAPI.apply(new SetToolStats(material, "displayName", name)); - } - - @ZenMethod - public static void setHarvestLevel(String material, int value) { - MineTweakerAPI.apply(new SetToolStats(material, "harvestLevel", value)); - } - - @ZenMethod - public static void setDurability(String material, int value) { - MineTweakerAPI.apply(new SetToolStats(material, "durability", value)); - } - - @ZenMethod - public static void setSpeed(String material, int value) { - MineTweakerAPI.apply(new SetToolStats(material, "miningspeed", value)); - } - - @ZenMethod - public static void setDamage(String material, int value) { - MineTweakerAPI.apply(new SetToolStats(material, "attack", value)); - } - - @ZenMethod - public static void setHandleModifier(String material, double value) { - MineTweakerAPI.apply(new SetToolStats(material, "handleModifier", (float) value)); - } - - @ZenMethod - public static void setReinforcedLevel(String material, int value) { - MineTweakerAPI.apply(new SetToolStats(material, "reinforced", value)); - } - - @ZenMethod - public static void setStoneboundLevel(String material, double value) { - MineTweakerAPI.apply(new SetToolStats(material, "stonebound", (float) value)); - } - - @ZenMethod - public static void setStyle(String material, String name) { - MineTweakerAPI.apply(new SetToolStats(material, "tipStyle", name)); - } - - @ZenMethod - public static void setAbility(String material, String name) { - MineTweakerAPI.apply(new SetToolStats(material, "ability", name)); - } - - //Sets various variables with reflection, making my life partially easier :D - private static class SetToolStats implements IUndoableAction { - protected int id; - protected Object old; - protected Object fresh; - protected final String material; - protected final String field; - protected final Object value; - - public SetToolStats(String material, String field, Object value) { - this.material = material; - this.field = field; - this.value = value; - } - - @Override - public void apply() { - old = TConstructRegistry.toolMaterialStrings.get(material); - id = TConstructHelper.getIDFromString(material); - if (id != -1 && old != null) { - if (value instanceof ToolMaterial) { - fresh = (ToolMaterial) value; - } else { - ToolMaterial t = (ToolMaterial) old; - fresh = new ToolMaterial(t.materialName, t.localizationString, t.harvestLevel, t.durability, t.miningspeed, t.attack, t.handleModifier, t.reinforced, t.stonebound, t.tipStyle, t.primaryColor); - ReflectionHelper.setPrivateValue(ToolMaterial.class, fresh, field, value); - } - - TConstructRegistry.toolMaterials.put(id, (ToolMaterial) fresh); - TConstructRegistry.toolMaterialStrings.put(material, (ToolMaterial) fresh); - } - } - - @Override - public boolean canUndo() { - return TConstructRegistry.toolMaterialStrings != null && id != -1 && old != null; - } - - @Override - public void undo() { - TConstructRegistry.toolMaterials.put(id, (ToolMaterial) old); - TConstructRegistry.toolMaterialStrings.put(material, (ToolMaterial) old); - } - - @Override - public String describe() { - return "Changing material stats field : + " + field + " for " + material; - } - - @Override - public String describeUndo() { - return "Undoing change of material stats field : + " + field + " for " + material; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////// - - //Bow Stats - @ZenMethod - public static void setBowStats(String material, int durability, int drawspeed, double flightspeed) { - MineTweakerAPI.apply(new SetBowStats(material, "", new BowMaterial(durability, drawspeed, (float) flightspeed))); - } - - @ZenMethod - public static void setBowDurability(String material, int value) { - MineTweakerAPI.apply(new SetBowStats(material, "durability", value)); - } - - @ZenMethod - public static void setBowDrawspeed(String material, int value) { - MineTweakerAPI.apply(new SetBowStats(material, "drawspeed", value)); - } - - @ZenMethod - public static void setBowFlightSpeed(String material, double value) { - MineTweakerAPI.apply(new SetBowStats(material, "flightSpeedMax", (float) value)); - } - - // Bow Stats - private static class SetBowStats extends SetToolStats { - public SetBowStats(String material, String field, Object value) { - super(material, field, value); - } - - @Override - public void apply() { - id = TConstructHelper.getIDFromString(material); - old = TConstructRegistry.bowMaterials.get(id); - if (id != -1 && old != null) { - if (value instanceof BowMaterial) { - fresh = (BowMaterial) value; - } else { - BowMaterial b = (BowMaterial) old; - fresh = new BowMaterial(b.durability, b.drawspeed, b.flightSpeedMax); - ReflectionHelper.setPrivateValue(BowMaterial.class, fresh, field, value); - } - - TConstructRegistry.bowMaterials.put(id, (BowMaterial) fresh); - } - } - - @Override - public boolean canUndo() { - return TConstructRegistry.bowMaterials != null && id != -1 && old != null; - } - - @Override - public void undo() { - TConstructRegistry.bowMaterials.put(id, (BowMaterial) old); - } - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////// - - //Arrow Stats - @ZenMethod - public static void setArrowStats(String material, double mass, double breakChance, double accuracy) { - MineTweakerAPI.apply(new SetArrowStats(material, "", new ArrowMaterial((float) mass, (float) breakChance, (float) accuracy))); - } - - @ZenMethod - public static void setArrowMass(String material, double value) { - MineTweakerAPI.apply(new SetArrowStats(material, "mass", (float) value)); - } - - @ZenMethod - public static void setArrowBreakChance(String material, double value) { - MineTweakerAPI.apply(new SetArrowStats(material, "breakChance", (float) value)); - } - - @ZenMethod - public static void setArrowAccuracy(String material, double value) { - MineTweakerAPI.apply(new SetArrowStats(material, "accuracy", (float) value)); - } - - // Bow Stats - private static class SetArrowStats extends SetToolStats { - public SetArrowStats(String material, String field, Object value) { - super(material, field, value); - } - - @Override - public void apply() { - id = TConstructHelper.getIDFromString(material); - old = TConstructRegistry.arrowMaterials.get(id); - if (id != -1 && old != null) { - if (value instanceof ArrowMaterial) { - fresh = (ArrowMaterial) value; - } else { - ArrowMaterial a = (ArrowMaterial) old; - fresh = new ArrowMaterial(a.mass, a.breakChance, a.accuracy); - ReflectionHelper.setPrivateValue(ArrowMaterial.class, fresh, field, value); - } - - TConstructRegistry.arrowMaterials.put(id, (ArrowMaterial) fresh); - } - } - - @Override - public boolean canUndo() { - return TConstructRegistry.arrowMaterials != null && id != -1 && old != null; - } - - @Override - public void undo() { - TConstructRegistry.arrowMaterials.put(id, (ArrowMaterial) old); - } - } -} diff --git a/src/main/java/modtweaker2/mods/thaumcraft/ThaumcraftHelper.java b/src/main/java/modtweaker2/mods/thaumcraft/ThaumcraftHelper.java index abaadeb..0184c14 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/ThaumcraftHelper.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/ThaumcraftHelper.java @@ -32,7 +32,7 @@ public class ThaumcraftHelper { public static AspectList parseAspects(AspectList list, String str) { AspectList output=new AspectList(); if (list != null) - for(Aspect aspect : list.getAspectsSortedAmount()) + for(Aspect aspect : list.getAspectsSortedByAmount()) { if(aspect!=null) output.add(aspect, list.getAmount(aspect)); @@ -51,7 +51,7 @@ public class ThaumcraftHelper { public static AspectList removeAspects(AspectList list, String str) { AspectList output=new AspectList(); if (list != null) - for(Aspect aspect : list.getAspectsSortedAmount()) + for(Aspect aspect : list.getAspectsSortedByAmount()) { if(aspect!=null) output.add(aspect, list.getAmount(aspect)); @@ -99,7 +99,7 @@ public class ThaumcraftHelper { { System.out.println(aspects); String output=""; - for(Aspect aspect : aspects.getAspectsSortedAmount()) + for(Aspect aspect : aspects.getAspectsSortedByAmount()) { if(aspect!=null) output+=aspect.getName()+" "+aspects.getAmount(aspect)+","; diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Aspects.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Aspects.java index ad11a57..50b9083 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Aspects.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Aspects.java @@ -21,13 +21,11 @@ public class Aspects { /** Add/Remove/Set Aspects for items **/ @ZenMethod public static void add(IItemStack stack, String aspects) { - MineTweakerAPI.apply(new Add(toStack(stack), aspects, false)); } @ZenMethod public static void set(IItemStack stack, String aspects) { - MineTweakerAPI.apply(new Add(toStack(stack), aspects, true)); } @@ -48,7 +46,7 @@ public class Aspects { @Override public void apply() { - oldList = ThaumcraftApiHelper.getObjectAspects(stack); + oldList = new AspectList(stack); if (!replace) newList = ThaumcraftHelper.parseAspects(oldList, aspects); else @@ -95,7 +93,7 @@ public class Aspects { @Override public void apply() { - oldList = ThaumcraftApiHelper.getObjectAspects(stack); + oldList = new AspectList(stack); if (oldList != null) { newList = ThaumcraftHelper.removeAspects(oldList, aspects); ThaumcraftApi.objectTags.put(Arrays.asList(stack.getItem(), stack.getItemDamage()), newList); diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Crucible.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Crucible.java index f362ab0..bf6da11 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Crucible.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Crucible.java @@ -26,7 +26,7 @@ public class Crucible { public static final String name = "Thaumcraft Crucible"; @ZenMethod - public static void addRecipe(String key, IItemStack result, IIngredient catalyst, String aspects) { + public static void addRecipe(String key[], IItemStack result, IIngredient catalyst, String aspects) { MineTweakerAPI.apply(new Add(new CrucibleRecipe(key, toStack(result), toObject(catalyst), ThaumcraftHelper.parseAspects(aspects)))); } diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Infusion.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Infusion.java index f242d4e..2920fd1 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Infusion.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Infusion.java @@ -45,7 +45,7 @@ public class Infusion { @ZenMethod public static void addEnchantment(String key, int enchantID, int instability, String aspects, IItemStack[] recipe) { - MineTweakerAPI.apply(new AddEnchant(new InfusionEnchantmentRecipe(key, Enchantment.enchantmentsList[enchantID], instability, ThaumcraftHelper.parseAspects(aspects), toStacks(recipe)))); + MineTweakerAPI.apply(new AddEnchant(new InfusionEnchantmentRecipe(key, Enchantment.getEnchantmentById(enchantID), instability, ThaumcraftHelper.parseAspects(aspects), toStacks(recipe)))); } private static class Add extends BaseListAddition { @@ -101,7 +101,7 @@ public class Infusion { @ZenMethod public static void removeEnchant(int id) { List recipes = new LinkedList(); - Enchantment ench = Enchantment.enchantmentsList[id]; + Enchantment ench = Enchantment.getEnchantmentById(id); for (Object recipe : ThaumcraftApi.getCraftingRecipes()) { if (recipe instanceof InfusionEnchantmentRecipe) { diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Loot.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Loot.java index 4a67908..00bd29d 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Loot.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Loot.java @@ -19,79 +19,79 @@ import thaumcraft.api.internal.WeightedRandomLoot; @ZenClass("mods.thaumcraft.Loot") public class Loot { - + public static final String name = "Thaumcraft LootBag"; - + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - @ZenMethod - public static void addCommonLoot(IItemStack stack, int weight) { - MineTweakerAPI.apply(new Add(WeightedRandomLoot.lootBagCommon, new WeightedRandomLoot(InputHelper.toStack(stack), weight))); - } + @ZenMethod + public static void addCommonLoot(IItemStack stack, int weight) { + MineTweakerAPI.apply(new Add(WeightedRandomLoot.lootBagCommon, new WeightedRandomLoot(InputHelper.toStack(stack), weight))); + } - @ZenMethod - public static void addUncommonLoot(IItemStack stack, int weight) { - MineTweakerAPI.apply(new Add(WeightedRandomLoot.lootBagUncommon, new WeightedRandomLoot(InputHelper.toStack(stack), weight))); - } + @ZenMethod + public static void addUncommonLoot(IItemStack stack, int weight) { + MineTweakerAPI.apply(new Add(WeightedRandomLoot.lootBagUncommon, new WeightedRandomLoot(InputHelper.toStack(stack), weight))); + } - @ZenMethod - public static void addRareLoot(IItemStack stack, int weight) { - MineTweakerAPI.apply(new Add(WeightedRandomLoot.lootBagRare, new WeightedRandomLoot(InputHelper.toStack(stack), weight))); - } + @ZenMethod + public static void addRareLoot(IItemStack stack, int weight) { + MineTweakerAPI.apply(new Add(WeightedRandomLoot.lootBagRare, new WeightedRandomLoot(InputHelper.toStack(stack), weight))); + } + + public static class Add extends BaseListAddition { + public Add(List list, WeightedRandomLoot recipe) { + super(Loot.name, list); + recipes.add(recipe); + } - public static class Add extends BaseListAddition { - public Add(List list, WeightedRandomLoot recipe) { - super(Loot.name, list); - recipes.add(recipe); - } - @Override protected String getRecipeInfo(WeightedRandomLoot recipe) { return LogHelper.getStackDescription(recipe.item); } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + } - @ZenMethod - public static void removeCommonLoot(IIngredient stack) { - removeLoot(WeightedRandomLoot.lootBagCommon, stack); - } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - @ZenMethod - public static void removeUncommonLoot(IIngredient stack) { - removeLoot(WeightedRandomLoot.lootBagUncommon, stack); - } + @ZenMethod + public static void removeCommonLoot(IIngredient stack) { + removeLoot(WeightedRandomLoot.lootBagCommon, stack); + } - @ZenMethod - public static void removeRareLoot(IIngredient stack) { - removeLoot(WeightedRandomLoot.lootBagRare, stack); - } - - public static void removeLoot(List list, IIngredient ingredient) { - List recipes = new LinkedList(); - - for (WeightedRandomLoot loot : list) { - if (matches(ingredient, toIItemStack(loot.item))) { - recipes.add(loot); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(list, recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored.", Loot.name, ingredient.toString())); - } - } + @ZenMethod + public static void removeUncommonLoot(IIngredient stack) { + removeLoot(WeightedRandomLoot.lootBagUncommon, stack); + } - public static class Remove extends BaseListRemoval { - public Remove(List list, List recipes) { - super(Loot.name, list, recipes); - } - - @Override - protected String getRecipeInfo(WeightedRandomLoot recipe) { - return LogHelper.getStackDescription(recipe.item); - } - } + @ZenMethod + public static void removeRareLoot(IIngredient stack) { + removeLoot(WeightedRandomLoot.lootBagRare, stack); + } + + public static void removeLoot(List list, IIngredient ingredient) { + List recipes = new LinkedList(); + + for (WeightedRandomLoot loot : list) { + if (matches(ingredient, toIItemStack(loot.item))) { + recipes.add(loot); + } + } + + if (!recipes.isEmpty()) { + MineTweakerAPI.apply(new Remove(list, recipes)); + } else { + LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored.", Loot.name, ingredient.toString())); + } + } + + public static class Remove extends BaseListRemoval { + public Remove(List list, List recipes) { + super(Loot.name, list, recipes); + } + + @Override + protected String getRecipeInfo(WeightedRandomLoot recipe) { + return LogHelper.getStackDescription(recipe.item); + } + } } diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Research.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Research.java index 10bc287..56ff472 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Research.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Research.java @@ -28,6 +28,7 @@ import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import thaumcraft.api.ThaumcraftApiHelper; +import thaumcraft.api.research.ResearchHelper; import thaumcraft.api.research.ResearchItem; import thaumcraft.api.research.ResearchPage.PageType; @@ -36,24 +37,24 @@ public class Research { private static final ResourceLocation defaultBackground = new ResourceLocation("thaumcraft", "textures/gui/gui_researchback.png"); @ZenMethod - public static void addTab(String key, String iconDomain, String iconPath) { - addTab(key, iconDomain, iconPath, null, null); + public static void addTab(String key, String researchKey, String iconDomain, String iconPath) { + addTab(key,researchKey, iconDomain, iconPath, null, null); } @ZenMethod - public static void addTab(String key, String iconDomain, String iconPath, String backDomain, String backPath) { + public static void addTab(String key,String researchKey, String iconDomain, String iconPath, String backDomain, String backPath) { ResourceLocation icon = new ResourceLocation(iconDomain, iconPath); ResourceLocation background; if (backPath == null) background = defaultBackground; else background = new ResourceLocation(backDomain, backPath); - addTab(key, icon, background); + addTab(key, researchKey, icon, background); } - private static void addTab(String key, ResourceLocation icon, ResourceLocation background) { + private static void addTab(String key, String researchKey, ResourceLocation icon, ResourceLocation background) { - MineTweakerAPI.apply(new AddTab(key, icon, background)); + MineTweakerAPI.apply(new AddTab(key, researchKey, icon, background)); } @ZenMethod @@ -126,7 +127,7 @@ public class Research { @ZenMethod public static void addEnchantmentPage(String key, int i) { - MineTweakerAPI.apply(new AddPage(key, PageType.INFUSION_ENCHANTMENT, Enchantment.enchantmentsList[i])); + MineTweakerAPI.apply(new AddPage(key, PageType.INFUSION_ENCHANTMENT, Enchantment.getEnchantmentById(i))); } @ZenMethod @@ -227,8 +228,7 @@ public class Research { @ZenMethod public static boolean hasResearched(IPlayer player, String key) { - - return ThaumcraftApiHelper.isResearchComplete(player.getName(), key); + return ResearchHelper.isResearchComplete(player.getName(), key); } public static enum SetType { diff --git a/src/main/java/modtweaker2/mods/thaumcraft/recipe/MTInfusionRecipe.java b/src/main/java/modtweaker2/mods/thaumcraft/recipe/MTInfusionRecipe.java index f617085..48fbf5f 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/recipe/MTInfusionRecipe.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/recipe/MTInfusionRecipe.java @@ -9,6 +9,7 @@ import net.minecraftforge.oredict.OreDictionary; import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.InfusionRecipe; +import thaumcraft.api.research.ResearchHelper; public class MTInfusionRecipe extends InfusionRecipe { private final boolean fuzzyCentre; @@ -20,44 +21,45 @@ public class MTInfusionRecipe extends InfusionRecipe { this.fuzzyRecipe = fuzzyRecipe; } - @Override - public boolean matches(ArrayList input, ItemStack central, World world, EntityPlayer player) { - if (getRecipeInput() == null) return false; - - if (research.length() > 0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) { - return false; - } - - ItemStack i2 = central.copy(); - if (getRecipeInput().getItemDamage() == OreDictionary.WILDCARD_VALUE) { - i2.setItemDamage(OreDictionary.WILDCARD_VALUE); - } - - if (!areItemStacksEqual(i2, getRecipeInput(), fuzzyCentre)) return false; - - ArrayList ii = new ArrayList(); - for (ItemStack is : input) { - ii.add(is.copy()); - } - - for (int j = 0; j < getComponents().length; j++) { - ItemStack comp = getComponents()[j]; - boolean b = false; - for (int a = 0; a < ii.size(); a++) { - i2 = ii.get(a).copy(); - if (comp.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - i2.setItemDamage(OreDictionary.WILDCARD_VALUE); - } - - if (areItemStacksEqual(i2, comp, fuzzyRecipe[j])) { - ii.remove(a); - b = true; - break; - } - } - if (!b) return false; - } - - return ii.size() == 0 ? true : false; - } +// @Override +// public boolean matches(ArrayList input, ItemStack central, World world, EntityPlayer player) { +// if (getRecipeInput() == null) return false; +// +// if (research.length > 0 && !ResearchHelper.isResearchComplete(player.getName(), research)) { +// return false; +// } +// +// ItemStack i2 = central.copy(); +// ItemStack recInput = (ItemStack)getRecipeInput(); +// if (recInput.getItemDamage() == OreDictionary.WILDCARD_VALUE) { +// i2.setItemDamage(OreDictionary.WILDCARD_VALUE); +// } +// +//// if (!areItemStacksEqual(i2, recInput, fuzzyCentre)) return false; +// +// ArrayList ii = new ArrayList(); +// for (ItemStack is : input) { +// ii.add(is.copy()); +// } +// +// for (int j = 0; j < getComponents().length; j++) { +// ItemStack comp = (ItemStack)getComponents()[j]; +// boolean b = false; +// for (int a = 0; a < ii.size(); a++) { +// i2 = ii.get(a).copy(); +// if (comp.getItemDamage() == OreDictionary.WILDCARD_VALUE) { +// i2.setItemDamage(OreDictionary.WILDCARD_VALUE); +// } +// +// if (areItemStacksEqual(i2, comp, fuzzyRecipe[j])) { +// ii.remove(a); +// b = true; +// break; +// } +// } +// if (!b) return false; +// } +// +// return ii.size() == 0 ? true : false; +// } } diff --git a/src/main/java/modtweaker2/mods/thaumcraft/research/AddResearch.java b/src/main/java/modtweaker2/mods/thaumcraft/research/AddResearch.java index e8be769..0d0d41a 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/research/AddResearch.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/research/AddResearch.java @@ -22,12 +22,12 @@ public class AddResearch implements IUndoableAction { @Override public void apply() { - if (itemTriggers != null) { - research = research.setItemTriggers(itemTriggers); - } - if (entityTriggers != null) { - research = research.setEntityTriggers(entityTriggers); - } +// if (itemTriggers != null) { +// research = research.settrsetItemTriggers(itemTriggers); +// } +// if (entityTriggers != null) { +// research = research.setEntityTriggers(entityTriggers); +// } research.registerResearchItem(); } diff --git a/src/main/java/modtweaker2/mods/thaumcraft/research/AddTab.java b/src/main/java/modtweaker2/mods/thaumcraft/research/AddTab.java index 83085a6..fb25839 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/research/AddTab.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/research/AddTab.java @@ -5,11 +5,13 @@ import net.minecraft.util.ResourceLocation; import thaumcraft.api.research.ResearchCategories; public class AddTab implements IUndoableAction { + String key; String tab; ResourceLocation icon; ResourceLocation background; - public AddTab(String research, ResourceLocation pic, ResourceLocation back) { + public AddTab(String key, String research, ResourceLocation pic, ResourceLocation back) { + this.key = key; icon = pic; background = back; tab = research; @@ -17,7 +19,7 @@ public class AddTab implements IUndoableAction { @Override public void apply() { - ResearchCategories.registerCategory(tab, icon, background); + ResearchCategories.registerCategory(key, tab, icon, background); } @Override diff --git a/src/main/java/modtweaker2/mods/thaumcraft/research/SetResearch.java b/src/main/java/modtweaker2/mods/thaumcraft/research/SetResearch.java index 13cdd3c..82e4179 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/research/SetResearch.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/research/SetResearch.java @@ -31,8 +31,8 @@ public class SetResearch implements IUndoableAction { else if (type == SetType.SPIKE) research.setSpecial(); else if (type == SetType.SECONDARY) research.setSecondary(); else if (type == SetType.STUB) research.setStub(); - else if (type == SetType.VIRTUAL) research.setVirtual(); - else if (type == SetType.CONCEAL) research.setConcealed(); +// else if (type == SetType.VIRTUAL) research.setsetVirtual(); +// else if (type == SetType.CONCEAL) research.setConcealed(); applied = true; } else { try { @@ -75,8 +75,8 @@ public class SetResearch implements IUndoableAction { else if (type == SetType.SPIKE) research.setSpecial(); else if (type == SetType.SECONDARY) research.setSecondary(); else if (type == SetType.STUB) research.setStub(); - else if (type == SetType.VIRTUAL) research.setVirtual(); - else if (type == SetType.CONCEAL) research.setConcealed(); +// else if (type == SetType.VIRTUAL) research.setVirtual(); +// else if (type == SetType.CONCEAL) research.setConcealed(); } else { try { Field target = null; diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/ThermalExpansion.java b/src/main/java/modtweaker2/mods/thermalexpansion/ThermalExpansion.java deleted file mode 100644 index fc1f304..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/ThermalExpansion.java +++ /dev/null @@ -1,23 +0,0 @@ -package modtweaker2.mods.thermalexpansion; - -import minetweaker.MineTweakerAPI; -import modtweaker2.mods.thermalexpansion.handlers.Crucible; -import modtweaker2.mods.thermalexpansion.handlers.Furnace; -import modtweaker2.mods.thermalexpansion.handlers.Insolator; -import modtweaker2.mods.thermalexpansion.handlers.Pulverizer; -import modtweaker2.mods.thermalexpansion.handlers.Sawmill; -import modtweaker2.mods.thermalexpansion.handlers.Smelter; -import modtweaker2.mods.thermalexpansion.handlers.Transposer; - -public class ThermalExpansion { - - public ThermalExpansion(){ - MineTweakerAPI.registerClass(Crucible.class); - MineTweakerAPI.registerClass(Furnace.class); - MineTweakerAPI.registerClass(Insolator.class); - MineTweakerAPI.registerClass(Pulverizer.class); - MineTweakerAPI.registerClass(Sawmill.class); - MineTweakerAPI.registerClass(Smelter.class); - MineTweakerAPI.registerClass(Transposer.class); - } -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/ThermalHelper.java b/src/main/java/modtweaker2/mods/thermalexpansion/ThermalHelper.java deleted file mode 100644 index 8b4b867..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/ThermalHelper.java +++ /dev/null @@ -1,259 +0,0 @@ -package modtweaker2.mods.thermalexpansion; - -import static modtweaker2.helpers.ReflectionHelper.getConstructor; -import static modtweaker2.helpers.StackHelper.areEqualOrNull; - -import java.lang.reflect.Constructor; - -import modtweaker2.helpers.LogHelper; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import cofh.thermalexpansion.util.crafting.CrucibleManager.RecipeCrucible; -import cofh.thermalexpansion.util.crafting.FurnaceManager.RecipeFurnace; -import cofh.thermalexpansion.util.crafting.InsolatorManager.RecipeInsolator; -import cofh.thermalexpansion.util.crafting.PulverizerManager.RecipePulverizer; -import cofh.thermalexpansion.util.crafting.SawmillManager.RecipeSawmill; -import cofh.thermalexpansion.util.crafting.SmelterManager.RecipeSmelter; -import cofh.thermalexpansion.util.crafting.TransposerManager.RecipeTransposer; - -public class ThermalHelper { - public static Constructor crucibleRecipe; - public static Constructor furanceRecipe; - public static Constructor insolatorRecipe; - public static Constructor pulverizerRecipe; - public static Constructor sawmillRecipe; - public static Constructor smelterRecipe; - public static Constructor transposerRecipe; - - static { - try { - crucibleRecipe = getConstructor(RecipeCrucible.class, ItemStack.class, FluidStack.class, int.class); - furanceRecipe = getConstructor(RecipeFurnace.class, ItemStack.class, ItemStack.class, int.class); - insolatorRecipe = getConstructor(RecipeInsolator.class, ItemStack.class, ItemStack.class, ItemStack.class, ItemStack.class, int.class, int.class); - pulverizerRecipe = getConstructor(RecipePulverizer.class, ItemStack.class, ItemStack.class, ItemStack.class, int.class, int.class); - sawmillRecipe = getConstructor(RecipeSawmill.class, ItemStack.class, ItemStack.class, ItemStack.class, int.class, int.class); - smelterRecipe = getConstructor(RecipeSmelter.class, ItemStack.class, ItemStack.class, ItemStack.class, ItemStack.class, int.class, int.class); - transposerRecipe = getConstructor(RecipeTransposer.class, ItemStack.class, ItemStack.class, FluidStack.class, int.class, int.class); - } catch (Exception e) { LogHelper.logError("Exception getting constructor for Thermal Expansion recipes!", e); } - } - - public static boolean equals(RecipeCrucible r1, RecipeCrucible r2) { - if(r1 == r2) { - return true; - } - - if(r1 == null || r2 == null) { - return false; - } - - if(!areEqualOrNull(r1.getInput(), r2.getInput())) { - return false; - } - - if(r1.getEnergy() != r2.getEnergy()) { - return false; - } - - if(!areEqualOrNull(r1.getOutput(), r2.getOutput())) { - return false; - } - - return true; - } - - public static boolean equals(RecipeFurnace r1, RecipeFurnace r2) { - if(r1 == r2) { - return true; - } - - if(r1 == null || r2 == null) { - return false; - } - - if(!areEqualOrNull(r1.getInput(), r2.getInput())) { - return false; - } - - if(r1.getEnergy() != r2.getEnergy()) { - return false; - } - - if(!areEqualOrNull(r1.getOutput(), r2.getOutput())) { - return false; - } - - return true; - } - - public static boolean equals(RecipePulverizer r1, RecipePulverizer r2) { - if(r1 == r2) { - return true; - } - - if(r1 == null || r2 == null) { - return false; - } - - if(!areEqualOrNull(r1.getInput(), r2.getInput())) { - return false; - } - - if(r1.getEnergy() != r2.getEnergy()) { - return false; - } - - if(!areEqualOrNull(r1.getPrimaryOutput(), r2.getPrimaryOutput())) { - return false; - } - - if(!areEqualOrNull(r1.getSecondaryOutput(), r2.getSecondaryOutput())) { - return false; - } - - if(r1.getSecondaryOutput() != null && r2.getSecondaryOutput() != null && - r1.getSecondaryOutputChance() != r2.getSecondaryOutputChance()) { - return false; - } - - return true; - } - - public static boolean equals(RecipeSawmill r1, RecipeSawmill r2) { - if(r1 == r2) { - return true; - } - - if(r1 == null || r2 == null) { - return false; - } - - if(!areEqualOrNull(r1.getInput(), r2.getInput())) { - return false; - } - - if(r1.getEnergy() != r2.getEnergy()) { - return false; - } - - if(!areEqualOrNull(r1.getPrimaryOutput(), r2.getPrimaryOutput())) { - return false; - } - - if(!areEqualOrNull(r1.getSecondaryOutput(), r2.getSecondaryOutput())) { - return false; - } - - if(r1.getSecondaryOutput() != null && r2.getSecondaryOutput() != null && - r1.getSecondaryOutputChance() != r2.getSecondaryOutputChance()) { - return false; - } - - return true; - } - - public static boolean equals(RecipeSmelter r1, RecipeSmelter r2) { - if(r1 == r2) { - return true; - } - - if(r1 == null || r2 == null) { - return false; - } - - if(!areEqualOrNull(r1.getPrimaryInput(), r2.getPrimaryInput())) { - return false; - } - - if(!areEqualOrNull(r1.getSecondaryInput(), r2.getSecondaryInput())) { - return false; - } - - if(r1.getEnergy() != r2.getEnergy()) { - return false; - } - - if(!areEqualOrNull(r1.getPrimaryOutput(), r2.getPrimaryOutput())) { - return false; - } - - if(!areEqualOrNull(r1.getSecondaryOutput(), r2.getSecondaryOutput())) { - return false; - } - - if(r1.getSecondaryOutput() != null && r2.getSecondaryOutput() != null && - r1.getSecondaryOutputChance() != r2.getSecondaryOutputChance()) { - return false; - } - - return true; - } - - public static boolean equals(RecipeInsolator r1, RecipeInsolator r2) { - if(r1 == r2) { - return true; - } - - if(r1 == null || r2 == null) { - return false; - } - - if(!areEqualOrNull(r1.getPrimaryInput(), r2.getPrimaryInput())) { - return false; - } - - if(!areEqualOrNull(r1.getSecondaryInput(), r2.getSecondaryInput())) { - return false; - } - - if(r1.getEnergy() != r2.getEnergy()) { - return false; - } - - if(!areEqualOrNull(r1.getPrimaryOutput(), r2.getPrimaryOutput())) { - return false; - } - - if(!areEqualOrNull(r1.getSecondaryOutput(), r2.getSecondaryOutput())) { - return false; - } - - if(r1.getSecondaryOutput() != null && r2.getSecondaryOutput() != null && - r1.getSecondaryOutputChance() != r2.getSecondaryOutputChance()) { - return false; - } - - return true; - } - - public static boolean equals(RecipeTransposer r1, RecipeTransposer r2) { - if(r1 == r2) { - return true; - } - - if(r1 == null || r2 == null) { - return false; - } - - if(!areEqualOrNull(r1.getInput(), r2.getInput())) { - return false; - } - - if(r1.getEnergy() != r2.getEnergy()) { - return false; - } - - if(!areEqualOrNull(r1.getOutput(), r2.getOutput())) { - return false; - } - - if(!areEqualOrNull(r1.getFluid(), r2.getFluid())) { - return false; - } - - if(r1.getChance() != r2.getChance()) { - return false; - } - - return true; - } -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/commands/ThermalExpansionLogger.java b/src/main/java/modtweaker2/mods/thermalexpansion/commands/ThermalExpansionLogger.java deleted file mode 100644 index 2e923ac..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/commands/ThermalExpansionLogger.java +++ /dev/null @@ -1,168 +0,0 @@ -package modtweaker2.mods.thermalexpansion.commands; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.StringHelper; -import cofh.thermalexpansion.util.crafting.CrucibleManager; -import cofh.thermalexpansion.util.crafting.CrucibleManager.RecipeCrucible; -import cofh.thermalexpansion.util.crafting.FurnaceManager; -import cofh.thermalexpansion.util.crafting.FurnaceManager.RecipeFurnace; -import cofh.thermalexpansion.util.crafting.InsolatorManager; -import cofh.thermalexpansion.util.crafting.InsolatorManager.RecipeInsolator; -import cofh.thermalexpansion.util.crafting.PulverizerManager; -import cofh.thermalexpansion.util.crafting.PulverizerManager.RecipePulverizer; -import cofh.thermalexpansion.util.crafting.SawmillManager; -import cofh.thermalexpansion.util.crafting.SawmillManager.RecipeSawmill; -import cofh.thermalexpansion.util.crafting.SmelterManager; -import cofh.thermalexpansion.util.crafting.SmelterManager.RecipeSmelter; -import cofh.thermalexpansion.util.crafting.TransposerManager; -import cofh.thermalexpansion.util.crafting.TransposerManager.RecipeTransposer; - -public class ThermalExpansionLogger implements ICommandFunction { - private static final List validArguments = new LinkedList(); - - static { - validArguments.add("Crucible"); - validArguments.add("Furnace"); - validArguments.add("Insolator"); - validArguments.add("Pulverizer"); - validArguments.add("Sawmill"); - validArguments.add("Smelter"); - validArguments.add("Transposer"); - } - - @Override - public void execute(String[] arguments, IPlayer player) { - List args = StringHelper.toLowerCase(Arrays.asList(arguments)); - - if(!validArguments.containsAll(args)) { - if(player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", "))); - } - } else { - if(args.isEmpty() || args.contains("Crucible")) { - for(RecipeCrucible recipe : CrucibleManager.getRecipeList()) { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Crucible.addRecipe(%d, %s, %s);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(recipe.getOutput()))); - } - } - - if(args.isEmpty() || args.contains("Furnace")) { - for(RecipeFurnace recipe : FurnaceManager.getRecipeList()) { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Furnace.addRecipe(%d, %s, %s);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(recipe.getOutput()))); - } - } - - if(args.isEmpty() || args.contains("Insolator")) { - for(RecipeInsolator recipe : InsolatorManager.getRecipeList()) { - if(recipe.getSecondaryOutput() != null) { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Insolator.addRecipe(%d, %s, %s, %s, %s, %d);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getPrimaryInput()), - LogHelper.getStackDescription(recipe.getSecondaryInput()), - LogHelper.getStackDescription(recipe.getPrimaryOutput()), - LogHelper.getStackDescription(recipe.getSecondaryOutput()), - recipe.getSecondaryOutputChance())); - } else { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Insolator.addRecipe(%d, %s, %s, %s);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getPrimaryInput()), - LogHelper.getStackDescription(recipe.getSecondaryInput()), - LogHelper.getStackDescription(recipe.getPrimaryOutput()))); - } - } - } - - if(args.isEmpty() || args.contains("Pulverizer")) { - for(RecipePulverizer recipe : PulverizerManager.getRecipeList()) { - if(recipe.getSecondaryOutput() != null) { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Pulverizer.addRecipe(%d, %s, %s, %s, %d);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(recipe.getPrimaryOutput()), - LogHelper.getStackDescription(recipe.getSecondaryOutput()), - recipe.getSecondaryOutputChance())); - } else { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Pulverizer.addRecipe(%d, %s, %s);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(recipe.getPrimaryOutput()))); - } - } - } - - if(args.isEmpty() || args.contains("Sawmill")) { - for(RecipeSawmill recipe : SawmillManager.getRecipeList()) { - if(recipe.getSecondaryOutput() != null) { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Sawmill.addRecipe(%d, %s, %s, %s, %d);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(recipe.getPrimaryOutput()), - LogHelper.getStackDescription(recipe.getSecondaryOutput()), - recipe.getSecondaryOutputChance())); - } else { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Sawmill.addRecipe(%d, %s, %s);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(recipe.getPrimaryOutput()))); - } - } - } - - if(args.isEmpty() || args.contains("Smelter")) { - for(RecipeSmelter recipe : SmelterManager.getRecipeList()) { - if(recipe.getSecondaryOutput() != null) { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Smelter.addRecipe(%d, %s, %s, %s, %s, %d);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getPrimaryInput()), - LogHelper.getStackDescription(recipe.getSecondaryInput()), - LogHelper.getStackDescription(recipe.getPrimaryOutput()), - LogHelper.getStackDescription(recipe.getSecondaryOutput()), - recipe.getSecondaryOutputChance())); - } else { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Smelter.addRecipe(%d, %s, %s, %s);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getPrimaryInput()), - LogHelper.getStackDescription(recipe.getSecondaryInput()), - LogHelper.getStackDescription(recipe.getPrimaryOutput()))); - } - } - } - - if(args.isEmpty() || args.contains("Transposer")) { - for(RecipeTransposer recipe : TransposerManager.getFillRecipeList()) { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Transposer.addFillRecipe(%d, %s, %s, %s);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(recipe.getOutput()), - LogHelper.getStackDescription(recipe.getFluid()))); - } - - for(RecipeTransposer recipe : TransposerManager.getExtractionRecipeList()) { - MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Transposer.addExtractRecipe(%d, %s, %s, %s, %d);", - recipe.getEnergy(), - LogHelper.getStackDescription(recipe.getInput()), - LogHelper.getStackDescription(recipe.getOutput()), - LogHelper.getStackDescription(recipe.getFluid()), - recipe.getChance())); - } - } - - if (player != null) { - player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir")); - } - } - } -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Crucible.java b/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Crucible.java deleted file mode 100644 index 6b57c73..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Crucible.java +++ /dev/null @@ -1,176 +0,0 @@ -package modtweaker2.mods.thermalexpansion.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.thermalexpansion.ThermalHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import cofh.thermalexpansion.util.crafting.CrucibleManager; -import cofh.thermalexpansion.util.crafting.CrucibleManager.RecipeCrucible; - -@ZenClass("mods.thermalexpansion.Crucible") -public class Crucible { - - public static final String name = "Thermal Expansion Crucible"; - - @ZenMethod - public static void addRecipe(int energy, IItemStack input, ILiquidStack output) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(CrucibleManager.recipeExists(toStack(input))) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(input)))); - return; - } - - RecipeCrucible recipe = ReflectionHelper.getInstance(ThermalHelper.crucibleRecipe, toStack(input), toFluid(output), energy); - - if(recipe != null) { - MineTweakerAPI.apply(new Add(recipe)); - } else { - LogHelper.logError(String.format("Error while creating instance for %s recipe.", name)); - } - } - - private static class Add extends BaseListAddition { - - public Add(RecipeCrucible recipe) { - super(Crucible.name, null); - recipes.add(recipe); - } - - public void apply() { - for(RecipeCrucible recipe : recipes) { - boolean applied = CrucibleManager.addRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getOutput()); - - if(applied) { - successful.add(recipe); - } - } - } - - public void undo() { - for(RecipeCrucible recipe : successful) { - CrucibleManager.removeRecipe(recipe.getInput()); - } - } - - @Override - protected boolean equals(RecipeCrucible recipe, RecipeCrucible otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipeCrucible recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input) { - List recipes = new LinkedList(); - - for(RecipeCrucible recipe : CrucibleManager.getRecipeList()) { - if(recipe != null && matches(input, toIItemStack(recipe.getInput()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s.", name, input.toString())); - } - } - - private static class Remove extends BaseListRemoval { - - public Remove(List recipes) { - super(Crucible.name, null, recipes); - } - - public void apply() { - for(RecipeCrucible recipe : recipes) { - boolean removed = CrucibleManager.removeRecipe(recipe.getInput()); - - if(removed) { - successful.add(recipe); - } - } - } - - public void undo() { - for(RecipeCrucible recipe : successful) { - CrucibleManager.addRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getOutput()); - } - } - - @Override - protected boolean equals(RecipeCrucible recipe, RecipeCrucible otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipeCrucible recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void refreshRecipes() { - MineTweakerAPI.apply(new Refresh()); - } - - private static class Refresh implements IUndoableAction { - - public void apply() { - CrucibleManager.refreshRecipes(); - } - - public boolean canUndo() { - return true; - } - - public String describe() { - return "Refreshing " + Crucible.name + " recipes"; - } - - public void undo() { - } - - public String describeUndo() { - return "Ignoring undo of " + Crucible.name + " recipe refresh"; - } - - public Object getOverrideKey() { - return null; - } - } -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Furnace.java b/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Furnace.java deleted file mode 100644 index d40851a..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Furnace.java +++ /dev/null @@ -1,178 +0,0 @@ -package modtweaker2.mods.thermalexpansion.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.thermalexpansion.ThermalHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import cofh.thermalexpansion.util.crafting.FurnaceManager; -import cofh.thermalexpansion.util.crafting.FurnaceManager.RecipeFurnace; - -@ZenClass("mods.thermalexpansion.Furnace") -public class Furnace { - - public static final String name = "Thermal Expansion Furnace"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(int energy, IItemStack input, IItemStack output) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(FurnaceManager.recipeExists(toStack(input))) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(input)))); - return; - } - - RecipeFurnace recipe = ReflectionHelper.getInstance(ThermalHelper.furanceRecipe, toStack(input), toStack(output), energy); - - if(recipe != null) { - MineTweakerAPI.apply(new Add(recipe)); - } else { - LogHelper.logError(String.format("Error while creating instance for %s recipe.", name)); - } - } - - private static class Add extends BaseListAddition { - public Add(RecipeFurnace recipe) { - super(Furnace.name, null); - recipes.add(recipe); - } - - public void apply() { - for(RecipeFurnace recipe : recipes) { - boolean applied = FurnaceManager.addRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getOutput(), - false); - - if(applied) { - successful.add(recipe); - } - } - - } - - public void undo() { - for(RecipeFurnace recipe : recipes) { - FurnaceManager.removeRecipe(recipe.getInput()); - } - - } - - @Override - protected boolean equals(RecipeFurnace recipe, RecipeFurnace otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipeFurnace recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input) { - List recipes = new LinkedList(); - - for(RecipeFurnace recipe : FurnaceManager.getRecipeList()) { - if(recipe != null && matches(input, toIItemStack(recipe.getInput()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s.", name, input.toString())); - } - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(Furnace.name, null, recipes); - } - - public void apply() { - for(RecipeFurnace recipe : recipes) { - boolean removed = FurnaceManager.removeRecipe(recipe.getInput()); - - if(removed) { - successful.add(recipe); - } - } - } - - public void undo() { - for(RecipeFurnace recipe : successful) { - FurnaceManager.addRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getOutput(), - false); - } - } - - @Override - protected boolean equals(RecipeFurnace recipe, RecipeFurnace otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipeFurnace recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void refreshRecipes() { - MineTweakerAPI.apply(new Refresh()); - } - - private static class Refresh implements IUndoableAction { - - public void apply() { - FurnaceManager.refreshRecipes(); - } - - public boolean canUndo() { - return true; - } - - public String describe() { - return "Refreshing " + Furnace.name + " recipes"; - } - - public void undo() { - } - - public String describeUndo() { - return "Ignoring undo of " + Furnace.name + " recipe refresh"; - } - - public Object getOverrideKey() { - return null; - } - } -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Insolator.java b/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Insolator.java deleted file mode 100644 index 84a1f75..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Insolator.java +++ /dev/null @@ -1,194 +0,0 @@ -package modtweaker2.mods.thermalexpansion.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.thermalexpansion.ThermalHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import cofh.thermalexpansion.util.crafting.InsolatorManager; -import cofh.thermalexpansion.util.crafting.InsolatorManager.RecipeInsolator; - -@ZenClass("mods.thermalexpansion.Insolator") -public class Insolator { - - public static final String name = "Thermal Expansion Insolator"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(int energy, IItemStack secondaryInput, IItemStack primaryInput, IItemStack primaryOutput, @Optional IItemStack secondaryOutput, @Optional int secondaryChance) { - if(primaryInput == null || secondaryInput == null || primaryOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - /* TODO: Make it check for meta data - if(InsolatorManager.recipeExists(toStack(primaryInput), toStack(secondaryInput))) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s and %s. Command ignored!", name, primaryInput.toString(), secondaryInput.toString())); - return; - } - */ - - RecipeInsolator recipe = ReflectionHelper.getInstance(ThermalHelper.insolatorRecipe, toStack(primaryInput), toStack(secondaryInput), toStack(primaryOutput), toStack(secondaryOutput), secondaryChance, energy); - - if(recipe != null) { - MineTweakerAPI.apply(new Add(recipe)); - } else { - LogHelper.logError(String.format("Error while creating instance for %s recipe.", name)); - } - } - - private static class Add extends BaseListAddition { - public Add(RecipeInsolator recipe) { - super(Insolator.name, null); - recipes.add(recipe); - } - - public void apply() { - for(RecipeInsolator recipe : recipes) { - boolean applied = InsolatorManager.addRecipe( - recipe.getEnergy(), - recipe.getPrimaryInput(), - recipe.getSecondaryInput(), - recipe.getPrimaryOutput(), - recipe.getSecondaryOutput(), - recipe.getSecondaryOutputChance(), - false); - - if(applied) { - successful.add(recipe); - } - } - - } - - public void undo() { - for(RecipeInsolator recipe : recipes) { - InsolatorManager.removeRecipe(recipe.getPrimaryInput(), recipe.getSecondaryInput()); - } - - } - - @Override - protected boolean equals(RecipeInsolator recipe, RecipeInsolator otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipeInsolator recipe) { - return LogHelper.getStackDescription(recipe.getPrimaryOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input2, IIngredient input1) { - List recipes = new LinkedList(); - - for(RecipeInsolator recipe : InsolatorManager.getRecipeList()) { - if(recipe != null && matches(input1, toIItemStack(recipe.getPrimaryInput())) && matches(input2, toIItemStack(recipe.getSecondaryInput()))) { - recipes.add(recipe); - } - } - - /* TODO: Make it check for meta data - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipes found for %s and %s.", name, input1.toString(), input2.toString())); - } - */ - } - - private static class Remove extends BaseListRemoval { - - public Remove(List recipes) { - super(Insolator.name, null, recipes); - } - - @Override - public void apply() { - for(RecipeInsolator recipe : recipes) { - boolean removed = InsolatorManager.removeRecipe(recipe.getPrimaryInput(), recipe.getSecondaryInput()); - - if(removed) { - successful.add(recipe); - } - } - } - - @Override - public void undo() { - for(RecipeInsolator recipe : recipes) { - InsolatorManager.addRecipe( - recipe.getEnergy(), - recipe.getPrimaryInput(), - recipe.getSecondaryInput(), - recipe.getPrimaryOutput(), - recipe.getSecondaryOutput(), - recipe.getSecondaryOutputChance()); - } - } - - @Override - protected boolean equals(RecipeInsolator recipe, RecipeInsolator otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - public String getRecipeInfo(RecipeInsolator recipe) { - return LogHelper.getStackDescription(recipe.getPrimaryOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void refreshRecipes() { - MineTweakerAPI.apply(new Refresh()); - } - - private static class Refresh implements IUndoableAction { - - public void apply() { - InsolatorManager.refreshRecipes(); - } - - public boolean canUndo() { - return true; - } - - public String describe() { - return "Refreshing " + Insolator.name + " recipes"; - } - - public void undo() { - } - - public String describeUndo() { - return "Ignoring undo of " + Insolator.name + " recipe refresh"; - } - - public Object getOverrideKey() { - return null; - } - } - -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Pulverizer.java b/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Pulverizer.java deleted file mode 100644 index dfde51c..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Pulverizer.java +++ /dev/null @@ -1,186 +0,0 @@ -package modtweaker2.mods.thermalexpansion.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.thermalexpansion.ThermalHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import stanhebben.zenscript.annotations.Optional; -import cofh.thermalexpansion.util.crafting.PulverizerManager; -import cofh.thermalexpansion.util.crafting.PulverizerManager.RecipePulverizer; - -@ZenClass("mods.thermalexpansion.Pulverizer") -public class Pulverizer { - - public static final String name = "Thermal Expansion Pulverizer"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(int energy, IItemStack input, IItemStack output) { - addRecipe(energy, input, output, null, 0); - } - - @ZenMethod - public static void addRecipe(int energy, IItemStack input, IItemStack output, @Optional IItemStack secondary, @Optional int secondaryChance) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(PulverizerManager.recipeExists(toStack(input))) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(input)))); - return; - } - - RecipePulverizer recipe = ReflectionHelper.getInstance(ThermalHelper.pulverizerRecipe, toStack(input), toStack(output), toStack(secondary), secondaryChance, energy); - - if(recipe != null) { - MineTweakerAPI.apply(new Add(recipe)); - } else { - LogHelper.logError(String.format("Error while creating instance for %s recipe.", name)); - } - } - - private static class Add extends BaseListAddition { - public Add(RecipePulverizer recipe) { - super(Pulverizer.name, null); - recipes.add(recipe); - } - - public void apply() { - for(RecipePulverizer recipe : recipes) { - boolean applied = PulverizerManager.addRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getPrimaryOutput(), - recipe.getSecondaryOutput(), - recipe.getSecondaryOutputChance()); - - if(applied) { - successful.add(recipe); - } - } - } - - public void undo() { - for(RecipePulverizer recipe : successful) { - PulverizerManager.removeRecipe(recipe.getInput()); - } - } - - @Override - protected boolean equals(RecipePulverizer recipe, RecipePulverizer otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipePulverizer recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - - // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input) { - List recipes = new LinkedList(); - RecipePulverizer[] list = PulverizerManager.getRecipeList(); - - for(RecipePulverizer recipe : list) { - if(recipe != null && recipe.getInput() != null && matches(input, toIItemStack(recipe.getInput()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s.", name, input.toString())); - } - - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(Pulverizer.name, null, recipes); - } - - public void apply() { - for(RecipePulverizer recipe : recipes) { - boolean removed = PulverizerManager.removeRecipe(recipe.getInput()); - - if(removed) { - successful.add(recipe); - } - } - } - - public void undo() { - for(RecipePulverizer recipe : successful) { - PulverizerManager.addRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getPrimaryOutput(), - recipe.getSecondaryOutput(), - recipe.getSecondaryOutputChance()); - } - } - - @Override - protected boolean equals(RecipePulverizer recipe, RecipePulverizer otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipePulverizer recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void refreshRecipes() { - MineTweakerAPI.apply(new Refresh()); - } - - private static class Refresh implements IUndoableAction { - - public void apply() { - PulverizerManager.refreshRecipes(); - } - - public boolean canUndo() { - return true; - } - - public String describe() { - return "Refreshing " + Pulverizer.name + " recipes"; - } - - public void undo() { - } - - public String describeUndo() { - return "Ignoring undo of " + Pulverizer.name + " recipe refresh"; - } - - public Object getOverrideKey() { - return null; - } - } -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Sawmill.java b/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Sawmill.java deleted file mode 100644 index 88d8063..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Sawmill.java +++ /dev/null @@ -1,188 +0,0 @@ -package modtweaker2.mods.thermalexpansion.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.thermalexpansion.ThermalHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import stanhebben.zenscript.annotations.Optional; -import cofh.thermalexpansion.util.crafting.SawmillManager; -import cofh.thermalexpansion.util.crafting.SawmillManager.RecipeSawmill; - -@ZenClass("mods.thermalexpansion.Sawmill") -public class Sawmill { - - public static final String name = "Thermal Expansion Sawmill"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(int energy, IItemStack input, IItemStack output) { - addRecipe(energy, input, output, null, 0); - } - - @ZenMethod - public static void addRecipe(int energy, IItemStack input, IItemStack output, @Optional IItemStack secondary, @Optional int secondaryChance) { - if(input == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(SawmillManager.recipeExists(toStack(input))) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(input)))); - return; - } - - RecipeSawmill recipe = ReflectionHelper.getInstance(ThermalHelper.sawmillRecipe, toStack(input), toStack(output), toStack(secondary), secondaryChance, energy); - - if(recipe != null) { - MineTweakerAPI.apply(new Add(recipe)); - } else { - LogHelper.logError(String.format("Error while creating instance for %s recipe.", name)); - } - } - - private static class Add extends BaseListAddition { - public Add(RecipeSawmill recipe) { - super(Sawmill.name, null); - recipes.add(recipe); - } - - @Override - public void apply() { - for(RecipeSawmill recipe : recipes) { - boolean applied = SawmillManager.addRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getPrimaryOutput(), - recipe.getSecondaryOutput(), - recipe.getSecondaryOutputChance()); - - if(applied) { - successful.add(recipe); - } - } - } - - @Override - public void undo() { - for(RecipeSawmill recipe : successful) { - SawmillManager.removeRecipe(recipe.getInput()); - } - } - - @Override - protected boolean equals(RecipeSawmill recipe, RecipeSawmill otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipeSawmill recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - - } - - // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input) { - List recipes = new LinkedList(); - RecipeSawmill[] list = SawmillManager.getRecipeList(); - - for(RecipeSawmill recipe : list) { - if(recipe != null && recipe.getInput() != null && matches(input, toIItemStack(recipe.getInput()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s.", name, input.toString())); - } - } - - private static class Remove extends BaseListRemoval { - public Remove(List recipes) { - super(Sawmill.name, null, recipes); - } - - public void apply() { - for(RecipeSawmill recipe : recipes) { - boolean removed = SawmillManager.removeRecipe(recipe.getInput()); - if(removed) { - successful.add(recipe); - } - - } - } - - public void undo() { - for(RecipeSawmill recipe : successful) { - SawmillManager.addRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getPrimaryOutput(), - recipe.getSecondaryOutput(), - recipe.getSecondaryOutputChance()); - } - } - - @Override - protected boolean equals(RecipeSawmill recipe, RecipeSawmill otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipeSawmill recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void refreshRecipes() { - MineTweakerAPI.apply(new Refresh()); - } - - private static class Refresh implements IUndoableAction { - - public void apply() { - SawmillManager.refreshRecipes(); - } - - public boolean canUndo() { - return true; - } - - public String describe() { - return "Refreshing " + Sawmill.name + " recipes"; - } - - public void undo() { - } - - public String describeUndo() { - return "Ignoring undo of " + Sawmill.name + " recipe refresh"; - } - - public Object getOverrideKey() { - return null; - } - } -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Smelter.java b/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Smelter.java deleted file mode 100644 index b97c6ae..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Smelter.java +++ /dev/null @@ -1,191 +0,0 @@ -package modtweaker2.mods.thermalexpansion.handlers; - -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.thermalexpansion.ThermalHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import stanhebben.zenscript.annotations.Optional; -import cofh.thermalexpansion.util.crafting.SmelterManager; -import cofh.thermalexpansion.util.crafting.SmelterManager.RecipeSmelter; - -@ZenClass("mods.thermalexpansion.Smelter") -public class Smelter { - - public static final String name = "Thermal Expansion Smelter"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addRecipe(int energy, IItemStack input, IItemStack input2, IItemStack output) { - addRecipe(energy, input, input2, output, null, 0); - } - - @ZenMethod - public static void addRecipe(int energy, IItemStack input, IItemStack input2, IItemStack output, @Optional IItemStack output2, @Optional int chance) { - if(input == null || input2 == null || output == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(SmelterManager.recipeExists(toStack(input), toStack(input2))) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s and %s. Command ignored!", name, LogHelper.getStackDescription(toStack(input)), LogHelper.getStackDescription(toStack(input2)))); - return; - } - - RecipeSmelter recipe = ReflectionHelper.getInstance(ThermalHelper.smelterRecipe, toStack(input), toStack(input2), toStack(output), toStack(output2), chance, energy); - - if(recipe != null) { - MineTweakerAPI.apply(new Add(recipe)); - } else { - LogHelper.logError(String.format("Error while creating instance for %s recipe.", name)); - } - } - - private static class Add extends BaseListAddition { - public Add(RecipeSmelter recipe) { - super(Smelter.name, null); - recipes.add(recipe); - } - - @Override - public void apply() { - for(RecipeSmelter recipe : recipes) { - boolean applied = SmelterManager.addRecipe( - recipe.getEnergy(), - recipe.getPrimaryInput(), - recipe.getSecondaryInput(), - recipe.getPrimaryOutput(), - recipe.getSecondaryOutput(), - recipe.getSecondaryOutputChance()); - - if(applied) { - successful.add(recipe); - } - } - } - - @Override - public void undo() { - for(RecipeSmelter recipe : successful) { - SmelterManager.removeRecipe(recipe.getPrimaryInput(), recipe.getSecondaryInput()); - } - } - - @Override - protected boolean equals(RecipeSmelter recipe, RecipeSmelter otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - public String getRecipeInfo(RecipeSmelter recipe) { - return LogHelper.getStackDescription(recipe.getPrimaryOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeRecipe(IIngredient input2, IIngredient input1) { - List recipes = new LinkedList(); - - for(RecipeSmelter recipe : SmelterManager.getRecipeList()) { - if(recipe != null && matches(input1, toIItemStack(recipe.getPrimaryInput())) && matches(input2, toIItemStack(recipe.getSecondaryInput()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes)); - } else { - LogHelper.logWarning(String.format("No %s Recipes found for %s and %s.", name, input1.toString(), input2.toString())); - } - } - - private static class Remove extends BaseListRemoval { - - public Remove(List recipes) { - super(Smelter.name, null, recipes); - } - - @Override - public void apply() { - for(RecipeSmelter recipe : recipes) { - boolean removed = SmelterManager.removeRecipe(recipe.getPrimaryInput(), recipe.getSecondaryInput()); - - if(removed) { - successful.add(recipe); - } - } - } - - @Override - public void undo() { - for(RecipeSmelter recipe : recipes) { - SmelterManager.addRecipe( - recipe.getEnergy(), - recipe.getPrimaryInput(), - recipe.getSecondaryInput(), - recipe.getPrimaryOutput(), - recipe.getSecondaryOutput(), - recipe.getSecondaryOutputChance()); - } - } - - @Override - protected boolean equals(RecipeSmelter recipe, RecipeSmelter otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - public String getRecipeInfo(RecipeSmelter recipe) { - return LogHelper.getStackDescription(recipe.getPrimaryOutput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void refreshRecipes() { - MineTweakerAPI.apply(new Refresh()); - } - - private static class Refresh implements IUndoableAction { - - public void apply() { - SmelterManager.refreshRecipes(); - } - - public boolean canUndo() { - return true; - } - - public String describe() { - return "Refreshing " + Smelter.name + " recipes"; - } - - public void undo() { - } - - public String describeUndo() { - return "Ignoring undo of " + Smelter.name + " recipe refresh"; - } - - public Object getOverrideKey() { - return null; - } - } -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Transposer.java b/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Transposer.java deleted file mode 100644 index 8c6b1e1..0000000 --- a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Transposer.java +++ /dev/null @@ -1,296 +0,0 @@ -package modtweaker2.mods.thermalexpansion.handlers; - -import static modtweaker2.helpers.InputHelper.toFluid; -import static modtweaker2.helpers.InputHelper.toIItemStack; -import static modtweaker2.helpers.InputHelper.toILiquidStack; -import static modtweaker2.helpers.InputHelper.toStack; -import static modtweaker2.helpers.StackHelper.matches; - -import java.util.LinkedList; -import java.util.List; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import minetweaker.api.liquid.ILiquidStack; -import modtweaker2.helpers.LogHelper; -import modtweaker2.helpers.ReflectionHelper; -import modtweaker2.mods.thermalexpansion.ThermalHelper; -import modtweaker2.utils.BaseListAddition; -import modtweaker2.utils.BaseListRemoval; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import cofh.thermalexpansion.util.crafting.TransposerManager; -import cofh.thermalexpansion.util.crafting.TransposerManager.RecipeTransposer; - -@ZenClass("mods.thermalexpansion.Transposer") -public class Transposer { - - public static final String nameFill = "Thermal Expansion Transposer (Fill)"; - public static final String nameExtract = "Thermal Expansion Transposer (Extract)"; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void addFillRecipe(int energy, IItemStack input, IItemStack output, ILiquidStack liquid) { - if(input == null || output == null || liquid == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", nameFill)); - return; - } - - if(TransposerManager.fillRecipeExists(toStack(input), toFluid(liquid))) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s and %s. Command ignored!", Transposer.nameFill, LogHelper.getStackDescription(toStack(input)), LogHelper.getStackDescription(toFluid(liquid)))); - return; - } - - RecipeTransposer recipe = ReflectionHelper.getInstance(ThermalHelper.transposerRecipe, toStack(input), toStack(output), toFluid(liquid), energy, 100); - - if(recipe != null) { - MineTweakerAPI.apply(new Add(recipe, RecipeType.Fill)); - } else { - LogHelper.logError(String.format("Error while creating instance for %s recipe.", nameFill)); - } - } - - @ZenMethod - public static void addExtractRecipe(int energy, IItemStack input, ILiquidStack liquid, @Optional IItemStack output, @Optional int chance) { - if(input == null || output == null || liquid == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", nameExtract)); - return; - } - - if(TransposerManager.extractionRecipeExists(toStack(input), toFluid(liquid))) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s and %s. Command ignored!", Transposer.nameExtract, LogHelper.getStackDescription(toStack(input)), LogHelper.getStackDescription(toFluid(liquid)))); - return; - } - - RecipeTransposer recipe = ReflectionHelper.getInstance(ThermalHelper.transposerRecipe, toStack(input), toStack(output), toFluid(liquid), energy, 100); - - if(recipe != null) { - MineTweakerAPI.apply(new Add(recipe, RecipeType.Extract)); - } else { - LogHelper.logError(String.format("Error while creating instance for %s recipe.", nameExtract)); - } - } - - //Deprecated - @ZenMethod - public static void addExtractRecipe(int energy, IItemStack input, IItemStack output, ILiquidStack liquid, int chance) { - if(input == null || output == null || liquid == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", nameExtract)); - return; - } - - if(TransposerManager.extractionRecipeExists(toStack(input), toFluid(liquid))) { - LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s and %s. Command ignored!", Transposer.nameExtract, LogHelper.getStackDescription(toStack(input)), LogHelper.getStackDescription(toFluid(liquid)))); - return; - } - - RecipeTransposer recipe = ReflectionHelper.getInstance(ThermalHelper.transposerRecipe, toStack(input), toStack(output), toFluid(liquid), energy, 100); - - if(recipe != null) { - MineTweakerAPI.apply(new Add(recipe, RecipeType.Extract)); - } else { - LogHelper.logError(String.format("Error while creating instance for %s recipe.", nameExtract)); - } - } - - private static class Add extends BaseListAddition { - private RecipeType type; - - protected Add(RecipeTransposer recipe, RecipeType type) { - super(type == RecipeType.Fill ? Transposer.nameFill : Transposer.nameExtract, null); - this.type = type; - recipes.add(recipe); - } - - @Override - public void apply() { - for(RecipeTransposer recipe : recipes) { - boolean applied = false; - switch(type) { - case Fill: - applied = TransposerManager.addFillRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getOutput(), - recipe.getFluid(), - false); - break; - - case Extract: - applied = TransposerManager.addExtractionRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getOutput(), - recipe.getFluid(), - recipe.getChance(), - false); - break; - } - - if(applied) { - successful.add(recipe); - } - } - } - - @Override - public void undo() { - for(RecipeTransposer recipe : successful) { - switch(type) - { - case Fill: - TransposerManager.removeFillRecipe(recipe.getInput(), recipe.getFluid()); - break; - case Extract: - TransposerManager.removeExtractionRecipe(recipe.getInput()); - break; - } - } - } - - @Override - protected boolean equals(RecipeTransposer recipe, RecipeTransposer otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipeTransposer recipe) { - return LogHelper.getStackDescription(recipe.getInput()); - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void removeFillRecipe(IIngredient input, IIngredient liquid) { - removeRecipe(input, liquid, RecipeType.Fill); - } - - @ZenMethod - public static void removeExtractRecipe(IIngredient input) { - removeRecipe(input, IngredientAny.INSTANCE, RecipeType.Extract); - } - - public static void removeRecipe(IIngredient input, IIngredient liquid, RecipeType type) { - List recipes = new LinkedList(); - - for(RecipeTransposer recipe : type == RecipeType.Fill ? TransposerManager.getFillRecipeList() : TransposerManager.getExtractionRecipeList()) { - if(recipe != null && matches(input, toIItemStack(recipe.getInput())) && matches(liquid, toILiquidStack(recipe.getFluid()))) { - recipes.add(recipe); - } - } - - if(!recipes.isEmpty()) { - MineTweakerAPI.apply(new Remove(recipes, type)); - } else { - LogHelper.logWarning(String.format("No %s Recipe found for %s and %s.", type == RecipeType.Fill ? Transposer.nameFill : Transposer.nameExtract, input.toString(), liquid.toString())); - } - } - - private static class Remove extends BaseListRemoval { - private RecipeType type; - - protected Remove(List recipes, RecipeType type) { - super(type == RecipeType.Fill ? Transposer.nameFill : Transposer.nameExtract, null, recipes); - this.type = type; - } - - @Override - public void apply() { - for(RecipeTransposer recipe : recipes) { - boolean removed = false; - switch(type) { - case Fill: - removed = TransposerManager.removeFillRecipe(recipe.getInput(), recipe.getFluid()); - break; - case Extract: - removed = TransposerManager.removeExtractionRecipe(recipe.getInput()); - break; - } - - if(removed) { - successful.add(recipe); - } - } - } - - @Override - public void undo() { - for(RecipeTransposer recipe : successful) { - switch(type) { - case Fill: - TransposerManager.addFillRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getOutput(), - recipe.getFluid(), - false); - break; - - case Extract: - TransposerManager.addExtractionRecipe( - recipe.getEnergy(), - recipe.getInput(), - recipe.getOutput(), - recipe.getFluid(), - recipe.getChance(), - false); - break; - } - } - } - - @Override - protected boolean equals(RecipeTransposer recipe, RecipeTransposer otherRecipe) { - return ThermalHelper.equals(recipe, otherRecipe); - } - - @Override - protected String getRecipeInfo(RecipeTransposer recipe) { - return LogHelper.getStackDescription(recipe.getOutput()); - } - } - - protected enum RecipeType { - Fill, - Extract - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @ZenMethod - public static void refreshRecipes() { - MineTweakerAPI.apply(new Refresh()); - } - - private static class Refresh implements IUndoableAction { - - public void apply() { - TransposerManager.refreshRecipes(); - } - - public boolean canUndo() { - return true; - } - - public String describe() { - return "Refreshing " + Transposer.nameFill + " & " + Transposer.nameExtract + " recipes"; - } - - public void undo() { - } - - public String describeUndo() { - return "Ignoring undo of " + Transposer.nameFill + " & " + Transposer.nameExtract + " recipe refresh"; - } - - public Object getOverrideKey() { - return null; - } - } -} diff --git a/src/main/java/modtweaker2/utils/BaseListModification.java b/src/main/java/modtweaker2/utils/BaseListModification.java index f9798c7..0569512 100644 --- a/src/main/java/modtweaker2/utils/BaseListModification.java +++ b/src/main/java/modtweaker2/utils/BaseListModification.java @@ -59,6 +59,7 @@ public abstract class BaseListModification extends BaseUndoable { return 37 * super.hashCode() ^ (list != null ? 43 * list.hashCode() : 0); } + @SuppressWarnings("unchecked") @Override public boolean equals(Object obj) { if(obj == this) diff --git a/src/main/java/modtweaker2/utils/TweakerPlugin.java b/src/main/java/modtweaker2/utils/TweakerPlugin.java index f839e1b..e300e05 100644 --- a/src/main/java/modtweaker2/utils/TweakerPlugin.java +++ b/src/main/java/modtweaker2/utils/TweakerPlugin.java @@ -2,7 +2,7 @@ package modtweaker2.utils; import java.util.ArrayList; -import cpw.mods.fml.common.Loader; +import net.minecraftforge.fml.common.Loader; public class TweakerPlugin { private static ArrayList isLoaded = new ArrayList(); diff --git a/src/main/resources/CoFH_at.cfg b/src/main/resources/CoFH_at.cfg deleted file mode 100644 index 19fe7ac..0000000 --- a/src/main/resources/CoFH_at.cfg +++ /dev/null @@ -1,51 +0,0 @@ -# NetherOres -public net.minecraft.entity.monster.EntityPigZombie func_70835_c(Lnet/minecraft/entity/Entity;)V # becomeAngryAt -public net.minecraft.entity.monster.EntitySilverfish field_70843_d # allySummonCooldown -public-f net.minecraft.init.Blocks field_150449_bY # oreNetherQuartz - -# MineFactory Reloaded -protected net.minecraft.util.WeightedRandomFishable * # need it all -public net.minecraft.entity.EntityList field_75624_e # classToIDMapping -public net.minecraft.entity.EntityList field_75622_f # stringToIDMapping -public net.minecraft.entity.monster.EntitySlime func_70799_a(I)V # setSlimeSize -public net.minecraft.entity.monster.EntityZombie func_82228_a(I)V # startConversion -public net.minecraft.entity.EntityLivingBase field_70718_bc # recentlyHit -public-f net.minecraft.init.Blocks field_150432_aD # ice -public-f net.minecraft.init.Blocks field_150410_aZ # glass_pane -public-f net.minecraft.init.Items field_151117_aB # milkBucket -protected net.minecraft.block.Block field_149770_b # unlocalizedName -public net.minecraft.server.management.PlayerManager func_72690_a(IIZ)Lnet/minecraft/server/management/PlayerManager$PlayerInstance; # getOrCreateChunkWatcher -public net.minecraft.server.management.PlayerManager$PlayerInstance -public net.minecraft.server.management.PlayerManager$PlayerInstance field_73263_b # playersWatchingChunk -public net.minecraft.entity.EntityLiving field_70728_aV # experienceValue -public net.minecraft.entity.EntityLiving field_82174_bp # equipmentDropChances - -# Thermal Expansion -public net.minecraft.entity.Entity field_83001_bt # invulnerable -public net.minecraft.entity.Entity field_70178_ae # isImmuneToFire -public net.minecraft.entity.player.EntityPlayer field_71074_e # itemInUse -public net.minecraft.server.management.ItemInWorldManager field_73094_o #durabilityRemainingOnBlock - -# PC Core -public net.minecraft.client.gui.GuiScreen field_146289_q # fontRenderer -public net.minecraft.client.gui.inventory.GuiContainer field_147003_i # guiLeft -public net.minecraft.client.gui.inventory.GuiContainer field_147009_r # guiTop -public net.minecraft.world.WorldServer field_73068_P # allPlayersSleeping - -# CoFH Core -protected net.minecraft.inventory.Container * # senseless to have private stuff here -protected net.minecraft.client.gui.inventory.GuiContainer * # senseless to have private stuff here -protected net.minecraft.client.gui.FontRenderer func_78280_d(Ljava/lang/String;I)Ljava/lang/String; # wrapFormattedStringToWidth -protected net.minecraft.client.gui.FontRenderer func_78255_a(Ljava/lang/String;Z)V # renderStringAtPos -public net.minecraft.entity.projectile.EntityFishHook * # (nearly) literally everything is private -protected net.minecraft.entity.player.EntityPlayer field_71072_f # itemInUseCount -public net.minecraft.item.ItemPickaxe field_150915_c # blocksEffectiveAgainst -public net.minecraft.item.ItemSpade field_150916_c # blocksEffectiveAgainst -public net.minecraft.item.ItemAxe field_150917_c # blocksEffectiveAgainst -public net.minecraft.util.RegistrySimple field_82596_a # registryObjects -public-f net.minecraft.util.RegistryNamespaced field_148759_a # underlyingIntegerMap -public net.minecraft.world.World field_72998_d # collidingBoundingBoxes - -# WorldProxy -public-f net.minecraft.world.World *()V # Doesn't matter what it is, we need it public -public-f net.minecraft.world.WorldServer *()V # Doesn't matter what it is, we need it public diff --git a/src/main/resources/IMC Todo b/src/main/resources/IMC Todo deleted file mode 100644 index c106fea..0000000 --- a/src/main/resources/IMC Todo +++ /dev/null @@ -1,3 +0,0 @@ -Tinkers construct -EnderIO -Forestry \ No newline at end of file diff --git a/src/main/resources/TConstruct_at.cfg b/src/main/resources/TConstruct_at.cfg deleted file mode 100644 index 467fa4b..0000000 --- a/src/main/resources/TConstruct_at.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Tinkers Construct -- Access Transformer -# Required for any build system. -# Last update: Minecraft 1.7.2 - 2014 Feb 02 by Progwml6 -# EntityArrow - Grabbed 'em all, since so much is accessed -public net.minecraft.entity.projectile.EntityArrow field_145789_f -public net.minecraft.entity.projectile.EntityArrow field_145790_g -public net.minecraft.entity.projectile.EntityArrow field_145791_d -public net.minecraft.entity.projectile.EntityArrow field_145792_e -public net.minecraft.entity.projectile.EntityArrow field_70254_i -public net.minecraft.entity.projectile.EntityArrow field_70252_j -public net.minecraft.entity.projectile.EntityArrow field_70253_h -public net.minecraft.entity.projectile.EntityArrow field_70257_an -public net.minecraft.entity.projectile.EntityArrow field_70255_ao -public net.minecraft.entity.projectile.EntityArrow field_70256_ap -public net.minecraft.entity.projectile.EntityArrow *() #we need waaaaaaay to much in here to bother going through it -# RenderGlobal -public net.minecraft.client.renderer.RenderGlobal field_147592_B -# Blocks -public-f net.minecraft.block.Block field_149764_J -public net.minecraft.block.BlockLeavesBase field_150121_P -public net.minecraft.block.BlockRailBase$Rail func_150650_a()I -# GuiContainer -public net.minecraft.client.gui.inventory.GuiContainer field_146999_f -public net.minecraft.client.gui.inventory.GuiContainer field_147009_r -public net.minecraft.client.gui.inventory.GuiContainer field_147003_i -# GuiScreen -public net.minecraft.client.gui.GuiScreen field_146292_n #buttonList -# ThreadDownloadImageData -public net.minecraft.client.renderer.ThreadDownloadImageData field_110559_g #field_110559_g -public net.minecraft.client.renderer.ThreadDownloadImageData field_110560_d #field_110560_d -public net.minecraft.world.gen.structure.StructureVillagePieces$Village #cant make village houses w/o this -public net.minecraft.client.renderer.Tessellator field_78415_z -public net.minecraft.client.renderer.entity.RenderPlayer field_77109_a #modelBipedMain -# needs to have a space at the end of every line or SS will derp diff --git a/src/main/resources/hee_at.cfg b/src/main/resources/hee_at.cfg deleted file mode 100644 index 421fc37..0000000 --- a/src/main/resources/hee_at.cfg +++ /dev/null @@ -1,20 +0,0 @@ -# C:\Gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-10.13.0.1208\unpacked\conf - -public net.minecraft.util.RegistrySimple field_82596_a # registryObjects -public net.minecraft.util.RegistryNamespaced field_148759_a # underlyingIntegerMap -public net.minecraft.entity.EntityLivingBase field_110153_bc # lastDamage -public net.minecraft.entity.EntityLiving field_82174_bp # equipmentDropChances -public net.minecraft.entity.Entity field_70151_c # fire -public net.minecraft.entity.monster.EntityGhast field_70792_g # targetedEntity -public net.minecraft.network.NetHandlerPlayServer field_147365_f # floatingTickCount -public net.minecraft.network.NetHandlerPlayServer field_147373_o # lastPosX -public net.minecraft.network.NetHandlerPlayServer field_147382_p # lastPosY -public net.minecraft.network.NetHandlerPlayServer field_147381_q # lastPosZ -public net.minecraft.world.gen.ChunkProviderEnd field_73204_i # endRNG -public-f net.minecraft.world.biome.BiomeGenBase field_76779_k # sky -public net.minecraft.world.World field_73020_y # chunkProvider - -public net.minecraft.client.Minecraft field_147126_aw # mcMusicTicker -public net.minecraft.client.gui.inventory.GuiContainer field_146999_f # xSize -public net.minecraft.client.gui.inventory.GuiContainer field_147000_g # ySize -public net.minecraft.client.renderer.RenderGlobal field_147593_P # mapSoundPositions \ No newline at end of file diff --git a/src/main/resources/mariculture_at.cfg b/src/main/resources/mariculture_at.cfg deleted file mode 100644 index 8155760..0000000 --- a/src/main/resources/mariculture_at.cfg +++ /dev/null @@ -1,12 +0,0 @@ -public net.minecraft.client.gui.inventory.GuiContainer field_146999_f #xSize -public net.minecraft.client.gui.inventory.GuiContainer field_147000_g #ySize -public net.minecraft.entity.projectile.EntityFishHook * -public net.minecraft.util.WeightedRandomFishable * -public net.minecraft.client.renderer.EntityRenderer * -public net.minecraft.world.biome.BiomeGenMutated * -public net.minecraft.entity.item.EntityBoat * -public net.minecraft.world.gen.ChunkProviderGenerate * -public net.minecraft.inventory.Container field_94535_f -public net.minecraft.inventory.Container field_94536_g -public net.minecraft.inventory.Container field_94537_h -public net.minecraft.entity.player.EntityPlayer func_70693_a(Lnet/minecraft/entity/player/EntityPlayer;)I \ No newline at end of file diff --git a/src/main/resources/micdoodlecore_at.cfg b/src/main/resources/micdoodlecore_at.cfg deleted file mode 100644 index 3799fea..0000000 --- a/src/main/resources/micdoodlecore_at.cfg +++ /dev/null @@ -1,32 +0,0 @@ -# Micdoodle Core Access Transformer configuration file -# Fields -public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft -public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiLeft -public net.minecraft.client.gui.GuiScreen field_146292_n #buttonList -public net.minecraft.inventory.InventoryCrafting field_70465_c #eventHandler -public net.minecraft.client.renderer.entity.RenderPlayer field_77109_a #modelBipedMain -public net.minecraft.client.renderer.entity.RenderPlayer field_77108_b #modelArmorChestplate -public net.minecraft.client.renderer.entity.RenderPlayer field_77111_i #modelArmor -public net.minecraft.entity.player.EntityPlayer field_71083_bS #sleeping -public net.minecraft.entity.player.EntityPlayer field_71076_b #sleepTimer -public net.minecraft.entity.EntityLivingBase field_70718_bc #recentlyHit -public net.minecraft.entity.EntityLivingBase field_70717_bb #attackingPlayer -public net.minecraft.network.EnumConnectionState field_150761_f -public net.minecraft.network.EnumConnectionState field_150770_i -public net.minecraft.client.renderer.EntityRenderer field_78490_B #thirdPersonDistance -public net.minecraft.client.renderer.EntityRenderer field_78491_C #thirdPersonDistanceTemp -public net.minecraft.client.renderer.WorldRenderer field_78942_y #glRenderList -public net.minecraft.client.audio.MusicTicker field_147679_a -public net.minecraft.client.audio.MusicTicker field_147677_b -public net.minecraft.client.audio.MusicTicker field_147678_c -public net.minecraft.client.audio.MusicTicker field_147676_d -public net.minecraft.client.gui.GuiIngame field_73838_g #recordPlaying -# Methods -public net.minecraft.entity.player.EntityPlayer func_71053_j()V #closeScreen -public net.minecraft.entity.player.EntityPlayerMP func_71053_j()V #closeScreen -public net.minecraft.client.entity.EntityClientPlayerMP func_71053_j()V #closeScreen -public net.minecraft.client.entity.EntityPlayerSP func_71053_j()V #closeScreen -public net.minecraft.world.World func_72847_b(Lnet/minecraft/entity/Entity;)V #onEntityRemoved -public net.minecraft.client.multiplayer.WorldClient func_72847_b(Lnet/minecraft/entity/Entity;)V #onEntityRemoved -public net.minecraft.world.WorldServer func_72847_b(Lnet/minecraft/entity/Entity;)V #onEntityRemoved -public net.minecraft.entity.DataWatcher func_75691_i(I)Lnet/minecraft/entity/DataWatcher$WatchableObject; #getWatchedObject \ No newline at end of file diff --git a/src/main/resources/tfc_at.cfg b/src/main/resources/tfc_at.cfg deleted file mode 100644 index 4fb1a16..0000000 --- a/src/main/resources/tfc_at.cfg +++ /dev/null @@ -1,20 +0,0 @@ -public net.minecraft.world.gen.ChunkProviderGenerate field_147430_m -public net.minecraft.world.gen.ChunkProviderGenerate field_73220_k -public net.minecraft.world.gen.ChunkProviderGenerate field_73230_p -public net.minecraft.world.gen.ChunkProviderGenerate func_147423_a(III)V -public net.minecraft.world.gen.ChunkProviderGenerate field_147434_q -public net.minecraft.world.WorldType (ILjava/lang/String;)V -public-f net.minecraft.world.WorldType field_77137_b #Default WorldType -public-f net.minecraft.world.WorldType field_77138_c #Flat WorldType -public-f net.minecraft.world.WorldType field_77135_d #LargeBiomes WorldType -public-f net.minecraft.world.WorldType field_151360_e #Amplified WorldType -protected net.minecraft.client.gui.inventory.GuiContainer func_146977_a(Lnet.minecraft.inventory.Slot;)V -public-f net.minecraft.init.Items field_151058_ca #Items.lead -public-f net.minecraft.init.Items field_151031_f #Items.bow -public net.minecraft.entity.player.EntityPlayer field_71076_b #sleepTimer -public-f net.minecraft.init.Blocks field_150431_aC #snow_layer -public net.minecraft.client.gui.inventory.GuiContainer func_146975_c(II)Lnet/minecraft/inventory/Slot; #getSlotAtPosition -public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft -public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiTop -public net.minecraft.block.BlockDynamicLiquid func_149807_p(Lnet/minecraft/world/World;III)Z #displaceBlocks -public net.minecraft.entity.passive.EntityHorse field_110296_bG #horseChest \ No newline at end of file