diff --git a/src/main/java/modtweaker2/Commands.java b/src/main/java/modtweaker2/Commands.java index 8318bbc..b352c73 100644 --- a/src/main/java/modtweaker2/Commands.java +++ b/src/main/java/modtweaker2/Commands.java @@ -22,7 +22,6 @@ import modtweaker2.mods.railcraft.commands.RailcraftLogger; import modtweaker2.mods.tconstruct.MaterialLogger; import modtweaker2.mods.tconstruct.commands.TConstructLogger; import modtweaker2.mods.thaumcraft.commands.AspectLogger; -import modtweaker2.mods.thaumcraft.commands.ThaumcraftLogger; import modtweaker2.mods.thaumcraft.research.commands.ResearchLogger; import modtweaker2.mods.thermalexpansion.commands.ThermalExpansionLogger; import modtweaker2.utils.TweakerPlugin; @@ -53,7 +52,6 @@ public class Commands { 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()); - MineTweakerAPI.server.addMineTweakerCommand("thaumcraft", new String[] { "/minetweaker thaumcraft [FILTER]", "Outputs a list of all Thaumcraft recipes."}, new ThaumcraftLogger()); } if (TweakerPlugin.isLoaded("TConstruct")) { diff --git a/src/main/java/modtweaker2/mods/thaumcraft/Thaumcraft.java b/src/main/java/modtweaker2/mods/thaumcraft/Thaumcraft.java index 01eb419..1425a46 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/Thaumcraft.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/Thaumcraft.java @@ -8,6 +8,7 @@ import modtweaker2.mods.thaumcraft.handlers.Crucible; import modtweaker2.mods.thaumcraft.handlers.Infusion; import modtweaker2.mods.thaumcraft.handlers.Loot; import modtweaker2.mods.thaumcraft.handlers.Research; +import modtweaker2.mods.thaumcraft.handlers.Test; import modtweaker2.mods.thaumcraft.handlers.Warp; public class Thaumcraft { diff --git a/src/main/java/modtweaker2/mods/thaumcraft/commands/ThaumcraftLogger.java b/src/main/java/modtweaker2/mods/thaumcraft/commands/ThaumcraftLogger.java deleted file mode 100644 index 0565e14..0000000 --- a/src/main/java/modtweaker2/mods/thaumcraft/commands/ThaumcraftLogger.java +++ /dev/null @@ -1,61 +0,0 @@ -package modtweaker2.mods.thaumcraft.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 thaumcraft.api.ThaumcraftApi; -import thaumcraft.api.crafting.CrucibleRecipe; -import thaumcraft.api.crafting.IArcaneRecipe; - -public class ThaumcraftLogger implements ICommandFunction { - - private static final List validArguments = new LinkedList(); - - static { - validArguments.add("crucible"); - } - - @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("arcane")) { - for(Object o : ThaumcraftApi.getCraftingRecipes()) { - if(o instanceof IArcaneRecipe) { - - } - } - } - - if(args.isEmpty() || args.contains("crucible")) { - for(Object o : ThaumcraftApi.getCraftingRecipes()) { - if(o instanceof CrucibleRecipe) { - CrucibleRecipe recipe = (CrucibleRecipe)o; - MineTweakerAPI.logCommand(String.format("mods.thaumcraft.Crucible(%s, %s, %s, %s);", - recipe.key, - LogHelper.getStackDescription(recipe.getRecipeOutput()), - LogHelper.getStackDescription(recipe.catalyst), - LogHelper.getStackDescription(recipe.aspects))); - } - } - } - - - 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/thaumcraft/handlers/Arcane.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Arcane.java index a48ee6b..09d35df 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Arcane.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Arcane.java @@ -14,8 +14,6 @@ import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import modtweaker2.helpers.LogHelper; import modtweaker2.mods.thaumcraft.ThaumcraftHelper; -import modtweaker2.mods.thaumcraft.aspect.AspectStack; -import modtweaker2.mods.thaumcraft.aspect.IAspectStack; import modtweaker2.utils.BaseListAddition; import modtweaker2.utils.BaseListRemoval; import net.minecraft.item.ItemStack; @@ -33,30 +31,17 @@ public class Arcane { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - @ZenMethod - public static void addShaped(String key, IItemStack output, IAspectStack[] aspects, IIngredient[][] ingredients) { - MineTweakerAPI.apply(new Add(new ShapedArcaneRecipe(key, toStack(output), AspectStack.join(ThaumcraftHelper.toStacks(aspects)), toShapedObjects(ingredients)))); - } - - @Deprecated @ZenMethod public static void addShaped(String key, IItemStack output, String aspects, IIngredient[][] ingredients) { MineTweakerAPI.apply(new Add(new ShapedArcaneRecipe(key, toStack(output), ThaumcraftHelper.parseAspects(aspects), toShapedObjects(ingredients)))); } - @ZenMethod - public static void addShapeless(String key, IItemStack output, IAspectStack[] aspects, IIngredient[] ingredients) { - MineTweakerAPI.apply(new Add(new ShapelessArcaneRecipe(key, toStack(output), AspectStack.join(ThaumcraftHelper.toStacks(aspects)), toObjects(ingredients)))); - } - - @Deprecated @ZenMethod public static void addShapeless(String key, IItemStack output, String aspects, IIngredient[] ingredients) { MineTweakerAPI.apply(new Add(new ShapelessArcaneRecipe(key, toStack(output), ThaumcraftHelper.parseAspects(aspects), toObjects(ingredients)))); } private static class Add extends BaseListAddition { - @SuppressWarnings("unchecked") public Add(IArcaneRecipe recipe) { super(Arcane.name, ThaumcraftApi.getCraftingRecipes()); recipes.add(recipe); @@ -97,7 +82,6 @@ public class Arcane { } private static class Remove extends BaseListRemoval { - @SuppressWarnings("unchecked") public Remove(List recipes) { super(Arcane.name, ThaumcraftApi.getCraftingRecipes(), recipes); } diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Aspects.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Aspects.java index 3bdc531..ad11a57 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Aspects.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Aspects.java @@ -21,12 +21,14 @@ 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)); + + 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)); + + MineTweakerAPI.apply(new Add(toStack(stack), aspects, true)); } // Adds or sets Aspects @@ -75,7 +77,8 @@ public class Aspects { @ZenMethod public static void remove(IItemStack stack, String aspects) { - MineTweakerAPI.apply(new Remove(toStack(stack), aspects)); + + MineTweakerAPI.apply(new Remove(toStack(stack), aspects)); } private static class Remove extends BaseUndoable { @@ -135,7 +138,7 @@ public class Aspects { return; } - MineTweakerAPI.apply(new AddEntity(entityName, aspects, true)); + MineTweakerAPI.apply(new AddEntity(entityName, aspects, true)); } // Adds or sets Aspects @@ -179,7 +182,7 @@ public class Aspects { } } - ////////////////////////////////////////////////////////////////////////////// + // //////////////////////////////////////////////////////////////////////////// @ZenMethod public static void removeEntity(String entityName, String aspects) { @@ -187,8 +190,8 @@ public class Aspects { MineTweakerAPI.getLogger().logError("No such entity " + entityName); return; } - - MineTweakerAPI.apply(new RemoveEntity(entityName, aspects)); + + MineTweakerAPI.apply(new RemoveEntity(entityName, aspects)); } private static class RemoveEntity extends BaseUndoable { diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Crucible.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Crucible.java index 32d8de9..f362ab0 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Crucible.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Crucible.java @@ -2,11 +2,9 @@ package modtweaker2.mods.thaumcraft.handlers; import static modtweaker2.helpers.InputHelper.toIItemStack; import static modtweaker2.helpers.InputHelper.toObject; -import static modtweaker2.helpers.InputHelper.toObjects; import static modtweaker2.helpers.InputHelper.toStack; import static modtweaker2.helpers.StackHelper.matches; -import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -15,11 +13,8 @@ import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import modtweaker2.helpers.LogHelper; import modtweaker2.mods.thaumcraft.ThaumcraftHelper; -import modtweaker2.mods.thaumcraft.aspect.AspectStack; -import modtweaker2.mods.thaumcraft.aspect.IAspectStack; import modtweaker2.utils.BaseListAddition; import modtweaker2.utils.BaseListRemoval; -import scala.actors.threadpool.Arrays; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import thaumcraft.api.ThaumcraftApi; @@ -30,42 +25,13 @@ public class Crucible { public static final String name = "Thaumcraft Crucible"; - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @Deprecated - @ZenMethod - 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)))); - } - - @ZenMethod - public static void addRecipe(String key, IItemStack itemOutput, IIngredient itemInput, IAspectStack[] aspectInput) { - addRecipe(key, itemOutput, new IIngredient[] {itemInput}, aspectInput); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) @ZenMethod - public static void addRecipe(String key, IItemStack itemOutput, IIngredient[] itemInput, IAspectStack[] aspectInput) { - if(key == null || itemOutput == null || itemInput == null || itemInput.length == 0 || aspectInput == null || aspectInput.length == 0) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - Object input; - - if(itemInput.length == 1) { - input = toObject(itemInput[0]); - } else { - input = new ArrayList(Arrays.asList(toObjects(itemInput))); - } - - MineTweakerAPI.apply(new Add(new CrucibleRecipe(key, toStack(itemOutput), input, AspectStack.join(ThaumcraftHelper.toStacks(aspectInput))))); + 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)))); } private static class Add extends BaseListAddition { - - @SuppressWarnings("unchecked") - public Add(CrucibleRecipe recipe) { + public Add(CrucibleRecipe recipe) { super(Crucible.name, ThaumcraftApi.getCraftingRecipes()); recipes.add(recipe); } @@ -76,7 +42,7 @@ public class Crucible { } } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @ZenMethod public static void removeRecipe(IIngredient output) { @@ -99,9 +65,7 @@ public class Crucible { } private static class Remove extends BaseListRemoval { - - @SuppressWarnings("unchecked") - public Remove(List recipes) { + public Remove(List recipes) { super(Crucible.name, ThaumcraftApi.getCraftingRecipes(), recipes); } diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Infusion.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Infusion.java index d33f4e3..f242d4e 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Infusion.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Infusion.java @@ -49,7 +49,6 @@ public class Infusion { } private static class Add extends BaseListAddition { - @SuppressWarnings("unchecked") public Add(InfusionRecipe recipe) { super(Infusion.name, ThaumcraftApi.getCraftingRecipes()); recipes.add(recipe); @@ -66,7 +65,6 @@ public class Infusion { } private static class AddEnchant extends BaseListAddition { - @SuppressWarnings("unchecked") public AddEnchant(InfusionEnchantmentRecipe inp) { super(Infusion.enchName, ThaumcraftApi.getCraftingRecipes()); recipes.add(inp); @@ -122,7 +120,6 @@ public class Infusion { } private static class Remove extends BaseListRemoval { - @SuppressWarnings("unchecked") public Remove(List recipes) { super(Infusion.name, ThaumcraftApi.getCraftingRecipes(), recipes); } @@ -141,7 +138,6 @@ public class Infusion { } private static class RemoveEnchant extends BaseListRemoval { - @SuppressWarnings("unchecked") public RemoveEnchant(List recipes) { super(Infusion.enchName, ThaumcraftApi.getCraftingRecipes(), recipes); } diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Test.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Test.java deleted file mode 100644 index e0c88fd..0000000 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Test.java +++ /dev/null @@ -1,15 +0,0 @@ -package modtweaker2.mods.thaumcraft.handlers; - -import minetweaker.api.item.IIngredient; -import modtweaker2.mods.thaumcraft.aspect.IAspectStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.thaumcraft.Test") -public class Test { - @ZenMethod - public static void getAspect(IAspectStack aspectStack, IIngredient ingredient) { - System.out.println(aspectStack.getName()); - - } -} diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/commands/ThermalExpansionLogger.java b/src/main/java/modtweaker2/mods/thermalexpansion/commands/ThermalExpansionLogger.java index c8e4299..ac90c1c 100644 --- a/src/main/java/modtweaker2/mods/thermalexpansion/commands/ThermalExpansionLogger.java +++ b/src/main/java/modtweaker2/mods/thermalexpansion/commands/ThermalExpansionLogger.java @@ -68,7 +68,7 @@ public class ThermalExpansionLogger implements ICommandFunction { 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);", + MineTweakerAPI.logCommand(String.format("mods.thermalexpansion.Insolator.addRecipe(%d, %s, %s, %s, %s, %d);", recipe.getEnergy(), LogHelper.getStackDescription(recipe.getPrimaryInput()), LogHelper.getStackDescription(recipe.getSecondaryInput()), diff --git a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Insolator.java b/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Insolator.java index 7f6d6b7..7c49d08 100644 --- a/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Insolator.java +++ b/src/main/java/modtweaker2/mods/thermalexpansion/handlers/Insolator.java @@ -11,7 +11,6 @@ import minetweaker.IUndoableAction; import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; import modtweaker2.helpers.LogHelper; import modtweaker2.helpers.ReflectionHelper; import modtweaker2.mods.thermalexpansion.ThermalHelper; @@ -31,31 +30,24 @@ public class Insolator { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @ZenMethod - public static void addRecipe(int energy, IItemStack primaryInput, IItemStack secondaryInput, IItemStack primaryOutput, @Optional WeightedItemStack secondaryOutput) { - if(primaryInput == null || secondaryInput == null || primaryOutput == null) { - LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name)); - return; - } - - if(InsolatorManager.recipeExists(toStack(primaryInput), toStack(secondaryInput))) { + public static void addRecipe(int energy, IItemStack primaryInput, IItemStack secondaryInput, 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; + } + + 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.getStack()), (int)(secondaryOutput != null ? secondaryOutput.getPercent() : 0), energy); - + } + + 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)); } - - } - - @Deprecated - @ZenMethod - public static void addRecipe(int energy, IItemStack primaryInput, IItemStack secondaryInput, IItemStack primaryOutput, @Optional IItemStack secondaryOutput, @Optional int secondaryChance) { - addRecipe(energy, primaryInput, secondaryInput, primaryOutput, secondaryOutput != null ? secondaryOutput.weight(secondaryChance) : null); } private static class Add extends BaseListAddition {