package modtweaker.mods.botania.commands; import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerImplementationAPI; import minetweaker.api.player.IPlayer; import minetweaker.api.server.ICommandFunction; import com.blamejared.mtlib.helpers.LogHelper; import com.blamejared.mtlib.helpers.StringHelper; import net.minecraft.item.ItemStack; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.recipe.*; import java.util.Arrays; import java.util.LinkedList; import java.util.List; public class BotaniaLogger implements ICommandFunction { private static final List<String> validArguments = new LinkedList<String>(); 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<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("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);", //TODO CHECK THIS LogHelper.getStackDescription(recipe.getOutputs()), 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()), //TODO CHECK THIS LogHelper.getStackDescription(new ItemStack(recipe.getOutputState().getBlock(), 1)))); } } 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")); } } } }