Revert "Removed unused import"

This reverts commit 6cbc1ff102.
This commit is contained in:
Zixxl 2015-07-27 08:56:20 +02:00
parent 6cbc1ff102
commit e9cdbfba92
10 changed files with 28 additions and 166 deletions

View file

@ -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")) {

View file

@ -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 {

View file

@ -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<String> validArguments = new LinkedList<String>();
static {
validArguments.add("crucible");
}
@Override
public void execute(String[] arguments, IPlayer player) {
List<String> 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"));
}
}
}
}

View file

@ -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<IArcaneRecipe> {
@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<IArcaneRecipe> {
@SuppressWarnings("unchecked")
public Remove(List<IArcaneRecipe> recipes) {
super(Arcane.name, ThaumcraftApi.getCraftingRecipes(), recipes);
}

View file

@ -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 {

View file

@ -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<CrucibleRecipe> {
@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<CrucibleRecipe> {
@SuppressWarnings("unchecked")
public Remove(List<CrucibleRecipe> recipes) {
public Remove(List<CrucibleRecipe> recipes) {
super(Crucible.name, ThaumcraftApi.getCraftingRecipes(), recipes);
}

View file

@ -49,7 +49,6 @@ public class Infusion {
}
private static class Add extends BaseListAddition<InfusionRecipe> {
@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<InfusionEnchantmentRecipe> {
@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<InfusionRecipe> {
@SuppressWarnings("unchecked")
public Remove(List<InfusionRecipe> recipes) {
super(Infusion.name, ThaumcraftApi.getCraftingRecipes(), recipes);
}
@ -141,7 +138,6 @@ public class Infusion {
}
private static class RemoveEnchant extends BaseListRemoval<InfusionEnchantmentRecipe> {
@SuppressWarnings("unchecked")
public RemoveEnchant(List<InfusionEnchantmentRecipe> recipes) {
super(Infusion.enchName, ThaumcraftApi.getCraftingRecipes(), recipes);
}

View file

@ -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());
}
}

View file

@ -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()),

View file

@ -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<RecipeInsolator> {