diff --git a/src/main/java/modtweaker2/Commands.java b/src/main/java/modtweaker2/Commands.java index 46c7c8c..0bd3852 100644 --- a/src/main/java/modtweaker2/Commands.java +++ b/src/main/java/modtweaker2/Commands.java @@ -9,6 +9,7 @@ import minetweaker.api.server.ICommandFunction; import minetweaker.mc1710.MineTweakerMod; import minetweaker.util.IEventHandler; import modtweaker2.commands.EntityMappingLogger; +import modtweaker2.mods.auracascade.aura.AuraLogger; import modtweaker2.mods.botania.commands.BotaniaBrewLogger; import modtweaker2.mods.botania.commands.BotaniaOrechidLogger; import modtweaker2.mods.botania.lexicon.commands.LexiconCategoryLogger; @@ -61,11 +62,14 @@ public class Commands { registerMineTweakerCommand("chiselGroups", new String[] { "/minetweaker chiselGroups", " Outputs a list of chisel groups" }, new ChiselGroupLogger()); registerMineTweakerCommand("chiselVariations", new String[] { "/minetweaker chiselVariations", "/minetweaker chiselVariations [GROUP]", " Outputs a list of chisel variations" }, new ChiselVariationLogger()); } + if(TweakerPlugin.isLoaded("aura")){ + registerMineTweakerCommand("auras", new String[]{"/minetweaker auras", "Outputs a list of Aura Types"}, new AuraLogger()); + } } private static void registerMineTweakerCommand(String commandName, String[] usages, ICommandFunction commandFunction) { MineTweakerAPI.server.addMineTweakerCommand(commandName, usages, commandFunction); - ModTweaker2.logger.info("Registering command " + commandName + "."); + ModTweaker2.logger.info("\nRegistering command " + commandName + "."); } } diff --git a/src/main/java/modtweaker2/mods/appeng/AppliedEnergistics.java b/src/main/java/modtweaker2/mods/appeng/AppliedEnergistics.java index 2f1c637..374d09d 100644 --- a/src/main/java/modtweaker2/mods/appeng/AppliedEnergistics.java +++ b/src/main/java/modtweaker2/mods/appeng/AppliedEnergistics.java @@ -7,6 +7,6 @@ public class AppliedEnergistics { public AppliedEnergistics() { MineTweakerAPI.registerClass(Inscriber.class); - } + } } diff --git a/src/main/java/modtweaker2/mods/auracascade/aura/AuraLogger.java b/src/main/java/modtweaker2/mods/auracascade/aura/AuraLogger.java new file mode 100644 index 0000000..f53b9bd --- /dev/null +++ b/src/main/java/modtweaker2/mods/auracascade/aura/AuraLogger.java @@ -0,0 +1,31 @@ +package modtweaker2.mods.auracascade.aura; + +import java.util.Set; + +import pixlepix.auracascade.data.EnumAura; +import minetweaker.MineTweakerAPI; +import minetweaker.MineTweakerImplementationAPI; +import minetweaker.api.player.IPlayer; +import minetweaker.api.server.ICommandFunction; +import modtweaker2.ModTweaker2; +import net.minecraft.entity.EntityList; + +public class 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/mekanism/util/RemoveMekanismRecipe.java b/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java index b985a67..bda2760 100644 --- a/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java +++ b/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java @@ -17,115 +17,134 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public class RemoveMekanismRecipe extends BaseMapRemoval { - private Object tmp; + private Object tmp; - public RemoveMekanismRecipe(String string, Map map, Object key) { - super(string.toLowerCase().replace('_', ' '), map, key, null); - this.tmp = key; - } + public RemoveMekanismRecipe(String string, Map map, Object key) { + super(string.toLowerCase().replace('_', ' '), map, key, null); + this.tmp = key; + } - @Override - public void apply() { - try { - Iterator it = map.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pairs = (Map.Entry) it.next(); - Object value = pairs.getValue(); - if (value != null) { - if (tmp instanceof ItemStack && value instanceof ItemStack) { - if (areEqual(((ItemStack) tmp), (ItemStack) value)) { - key = pairs.getKey(); - break; - } - } + @Override + public void apply() { + try { + Iterator it = map.entrySet().iterator(); - if (tmp instanceof FluidStack && value instanceof FluidStack) { - if (((FluidStack) tmp).isFluidEqual((FluidStack) value)) { - key = pairs.getKey(); - break; - } - } + while (it.hasNext()) { + Map.Entry pairs = (Map.Entry) it.next(); + if (pairs != null) { + Object value = pairs.getValue(); + if (value != null && tmp != null) { + if (tmp instanceof ItemStack && value instanceof ItemStack) { + if (areEqual(((ItemStack) tmp), (ItemStack) value)) { + key = pairs.getKey(); + break; + } + } - if (tmp instanceof GasStack && value instanceof GasStack) { - if (((GasStack) tmp).isGasEqual((GasStack) value)) { - key = pairs.getKey(); - break; - } - } + if (tmp instanceof FluidStack && value instanceof FluidStack) { + if (((FluidStack) tmp).isFluidEqual((FluidStack) value)) { + key = pairs.getKey(); + break; + } + } - if (tmp instanceof ItemStack && value instanceof InfusionOutput) { - if (areEqual(((ItemStack) tmp), ((InfusionOutput) value).resource)) { - key = pairs.getKey(); - break; - } - } + if (tmp instanceof GasStack && value instanceof GasStack) { + if (((GasStack) tmp).isGasEqual((GasStack) value)) { + key = pairs.getKey(); + break; + } + } - if (tmp instanceof ChemicalPair && value instanceof ChemicalPair) { - ChemicalPair par1 = (ChemicalPair) tmp; - ChemicalPair par2 = (ChemicalPair) value; - if (par1.leftGas.isGasEqual(par2.leftGas) && par1.rightGas.isGasEqual(par2.rightGas)) { - key = pairs.getKey(); - break; - } - } + if (tmp instanceof ItemStack && value instanceof InfusionOutput) { + if (areEqual(((ItemStack) tmp), ((InfusionOutput) value).resource)) { + key = pairs.getKey(); + break; + } + } - if (tmp instanceof ChanceOutput && value instanceof ChanceOutput) { - ChanceOutput par1 = (ChanceOutput) tmp; - ChanceOutput par2 = (ChanceOutput) value; - if (areEqual(par1.primaryOutput, par2.primaryOutput)) { - if (par1.secondaryOutput == null || (par1.secondaryOutput != null && par2.secondaryOutput != null && areEqual(par1.secondaryOutput, par2.secondaryOutput))) { - key = pairs.getKey(); - break; - } - } - } + if (tmp instanceof ChemicalPair && value instanceof ChemicalPair) { + ChemicalPair par1 = (ChemicalPair) tmp; + ChemicalPair par2 = (ChemicalPair) value; + if (par1.leftGas.isGasEqual(par2.leftGas) && par1.rightGas.isGasEqual(par2.rightGas)) { + key = pairs.getKey(); + break; + } + } - if (tmp instanceof PressurizedProducts && value instanceof PressurizedRecipe) { - PressurizedProducts par1 = (PressurizedProducts) tmp; - PressurizedProducts par2 = ((PressurizedRecipe) value).products; - if (areEqual(par1.getItemOutput(), (par2.getItemOutput()))) { - if (par1.getGasOutput().isGasEqual(par2.getGasOutput())) { - key = pairs.getKey(); - break; + if (tmp instanceof ChanceOutput && value instanceof ChanceOutput) { + ChanceOutput par1 = (ChanceOutput) tmp; + ChanceOutput par2 = (ChanceOutput) value; + if (areEqual(par1.primaryOutput, par2.primaryOutput)) { + if (par1.secondaryOutput == null || (par1.secondaryOutput != null && par2.secondaryOutput != null && areEqual(par1.secondaryOutput, par2.secondaryOutput))) { + key = pairs.getKey(); + break; + } + } + } - } - } - } - } + if (tmp instanceof PressurizedProducts && value instanceof PressurizedRecipe) { + PressurizedProducts par1 = (PressurizedProducts) tmp; + PressurizedProducts par2 = ((PressurizedRecipe) value).products; + if (areEqual(par1.getItemOutput(), (par2.getItemOutput()))) { + if (par1.getGasOutput().isGasEqual(par2.getGasOutput())) { + key = pairs.getKey(); + break; - it.remove(); - } + } + } + } + } - recipe = map.get(key); + it.remove(); + } + } - } catch (Exception e) { - e.printStackTrace(); - } + recipe = map.get(key); - map.remove(key); - } + } catch (Exception e) { + e.printStackTrace(); + } - @Override - public String describe() { - if (tmp instanceof ItemStack) return "Removing " + description + " Recipe for : " + ((ItemStack) tmp).getDisplayName(); - else if (tmp instanceof FluidStack) return "Removing " + description + " Recipe for : " + ((FluidStack) tmp).getFluid().getLocalizedName(); - else if (tmp instanceof ChemicalPair) return "Removing " + description + " Recipe for : " + ((ChemicalPair) tmp).leftGas.getGas().getLocalizedName(); - else if (tmp instanceof ChanceOutput) return "Removing " + description + " Recipe for : " + ((ChanceOutput) tmp).primaryOutput.getDisplayName(); - else if (tmp instanceof GasStack) return "Removing " + description + " Recipe for : " + ((GasStack) tmp).getGas().getLocalizedName(); - else if (tmp instanceof PressurizedReactants) return "Removing " + description + " Recipe for : " + ((PressurizedReactants) tmp).getSolid().getDisplayName(); - else if (tmp instanceof InfusionOutput) return "Removing " + description + " Recipe for : " + ((InfusionOutput) tmp).resource.getDisplayName(); - else return super.getRecipeInfo(); - } + map.remove(key); + } - @Override - public String describeUndo() { - if (tmp instanceof ItemStack) return "Restoring " + description + " Recipe for : " + ((ItemStack) tmp).getDisplayName(); - else if (tmp instanceof FluidStack) return "Restoring " + description + " Recipe for : " + ((FluidStack) tmp).getFluid().getLocalizedName(); - else if (tmp instanceof ChemicalPair) return "Restoring " + description + " Recipe for : " + ((ChemicalPair) tmp).leftGas.getGas().getLocalizedName(); - else if (tmp instanceof ChanceOutput) return "Restoring " + description + " Recipe for : " + ((ChanceOutput) tmp).primaryOutput.getDisplayName(); - else if (tmp instanceof GasStack) return "Restoring " + description + " Recipe for : " + ((GasStack) tmp).getGas().getLocalizedName(); - else if (tmp instanceof PressurizedReactants) return "Restoring " + description + " Recipe for : " + ((PressurizedReactants) tmp).getSolid().getDisplayName(); - else if (tmp instanceof InfusionOutput) return "Restoring " + description + " Recipe for : " + ((InfusionOutput) tmp).resource.getDisplayName(); - else return super.getRecipeInfo(); - } + @Override + public String describe() { + if (tmp instanceof ItemStack) + return "Removing " + description + " Recipe for : " + ((ItemStack) tmp).getDisplayName(); + else if (tmp instanceof FluidStack) + return "Removing " + description + " Recipe for : " + ((FluidStack) tmp).getFluid().getLocalizedName(); + else if (tmp instanceof ChemicalPair) + return "Removing " + description + " Recipe for : " + ((ChemicalPair) tmp).leftGas.getGas().getLocalizedName(); + else if (tmp instanceof ChanceOutput) + return "Removing " + description + " Recipe for : " + ((ChanceOutput) tmp).primaryOutput.getDisplayName(); + else if (tmp instanceof GasStack) + return "Removing " + description + " Recipe for : " + ((GasStack) tmp).getGas().getLocalizedName(); + else if (tmp instanceof PressurizedReactants) + return "Removing " + description + " Recipe for : " + ((PressurizedReactants) tmp).getSolid().getDisplayName(); + else if (tmp instanceof InfusionOutput) + return "Removing " + description + " Recipe for : " + ((InfusionOutput) tmp).resource.getDisplayName(); + else + return super.getRecipeInfo(); + } + + @Override + public String describeUndo() { + if (tmp instanceof ItemStack) + return "Restoring " + description + " Recipe for : " + ((ItemStack) tmp).getDisplayName(); + else if (tmp instanceof FluidStack) + return "Restoring " + description + " Recipe for : " + ((FluidStack) tmp).getFluid().getLocalizedName(); + else if (tmp instanceof ChemicalPair) + return "Restoring " + description + " Recipe for : " + ((ChemicalPair) tmp).leftGas.getGas().getLocalizedName(); + else if (tmp instanceof ChanceOutput) + return "Restoring " + description + " Recipe for : " + ((ChanceOutput) tmp).primaryOutput.getDisplayName(); + else if (tmp instanceof GasStack) + return "Restoring " + description + " Recipe for : " + ((GasStack) tmp).getGas().getLocalizedName(); + else if (tmp instanceof PressurizedReactants) + return "Restoring " + description + " Recipe for : " + ((PressurizedReactants) tmp).getSolid().getDisplayName(); + else if (tmp instanceof InfusionOutput) + return "Restoring " + description + " Recipe for : " + ((InfusionOutput) tmp).resource.getDisplayName(); + else + return super.getRecipeInfo(); + } } diff --git a/src/main/java/modtweaker2/mods/metallurgy/handlers/Crusher.java b/src/main/java/modtweaker2/mods/metallurgy/handlers/Crusher.java index 24df5ba..e5f487d 100644 --- a/src/main/java/modtweaker2/mods/metallurgy/handlers/Crusher.java +++ b/src/main/java/modtweaker2/mods/metallurgy/handlers/Crusher.java @@ -96,7 +96,7 @@ public class Crusher { ItemStack[] inputList = MetallurgyHelper.crusherInputList.get(output.getUnlocalizedName()); ItemStack[] newList = new ItemStack[inputList.length - 1]; if (newList.length >= 1) { - for (int i = 0; i < inputList.length; i++) { + for (int i = 0; i < newList.length; i++) { if (switched || (areEqual(inputList[i], input))) { switched = true; newList[i] = inputList[i + 1]; diff --git a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Arcane.java b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Arcane.java index 933760c..97ee533 100644 --- a/src/main/java/modtweaker2/mods/thaumcraft/handlers/Arcane.java +++ b/src/main/java/modtweaker2/mods/thaumcraft/handlers/Arcane.java @@ -1,5 +1,7 @@ package modtweaker2.mods.thaumcraft.handlers; +import java.util.ArrayList; + import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; @@ -57,14 +59,18 @@ public class Arcane { @Override public void apply() { + ArrayList recipesToRemove = new ArrayList(); for (Object o : ThaumcraftApi.getCraftingRecipes()) { - if (o instanceof IArcaneRecipe) { + if (o != null && o instanceof IArcaneRecipe) { IArcaneRecipe r = (IArcaneRecipe) o; if (r.getRecipeOutput() != null && r.getRecipeOutput().isItemEqual(stack)) { - ThaumcraftApi.getCraftingRecipes().remove(r); + recipesToRemove.add(r); } } } + for (IArcaneRecipe r : recipesToRemove) { + ThaumcraftApi.getCraftingRecipes().remove(r); + } }