- Added /mt recipes command

- Added /mt recipes hand command
- Removed COMMAND: in front of lines generated from commands
This commit is contained in:
Stan Hebben committed 2014-10-08 23:23:17 +02:00
1 parent f5e467e9a4
commit 9fcf4b9a4e
25 files changed
+617 -42

No files matched your search

@@ -33,6 +33,7 @@ import minetweaker.api.mods.IMod;
import minetweaker.api.oredict.IOreDict;
import minetweaker.api.oredict.IOreDictEntry;
import minetweaker.api.player.IPlayer;
import minetweaker.api.recipes.ICraftingRecipe;
import minetweaker.api.recipes.IFurnaceManager;
import minetweaker.api.recipes.IRecipeManager;
import minetweaker.api.server.ICommandFunction;
@@ -180,6 +181,56 @@ public class MineTweakerImplementationAPI {
}
}));
minetweakerCommands.put("recipes", new MineTweakerCommand(
"recipes",
new String[] {
"/minetweaker recipes",
" Lists all crafting recipes in the game",
"/minetweaker recipes hand",
" Lists all crafting recipes for the item in your hand",
" Also copies the recipes to clipboard"
}, new ICommandFunction() {
@Override
public void execute(String[] arguments, IPlayer player)
{
if (arguments.length == 0) {
if (player != null) {
player.sendChat("Generating recipe list, this could take a while...");
}
MineTweakerAPI.logCommand("Recipes:");
for (ICraftingRecipe recipe : MineTweakerAPI.recipes.getAll()) {
MineTweakerAPI.logCommand(recipe.toCommandString());
}
if (player != null) {
player.sendChat("Recipe list generated; see minetweaker.log in your minecraft dir");
}
} else if (arguments[0].equals("hand") && player != null) {
IItemStack item = player.getCurrentItem();
List<ICraftingRecipe> recipes = MineTweakerAPI.recipes.getRecipesFor(item.anyAmount());
if (recipes.isEmpty()) {
player.sendChat("No crafting recipes found for that item");
} else {
StringBuilder recipesString = new StringBuilder();
for (ICraftingRecipe recipe : recipes) {
MineTweakerAPI.logCommand(recipe.toCommandString());
player.sendChat(recipe.toCommandString());
recipesString.append(recipe.toCommandString()).append("\n");
}
copyToClipboard(recipesString.toString());
}
} else {
if (player != null) {
player.sendChat("Invalid arguments for recipes command");
}
}
}
}));
minetweakerCommands.put("inventory", new MineTweakerCommand(
"inventory",
new String[] {
@@ -201,7 +252,9 @@ public class MineTweakerImplementationAPI {
"hand",
new String[] {
"/minetweaker hand",
" Outputs the name of the item in your hand"
" Outputs the name of the item in your hand",
" Also copies the name to clipboard and prints",
" oredict entries"
}, new ICommandFunction() {
@Override
public void execute(String[] arguments, IPlayer player) {