Creates a new command framework that supports trees of commands simply and easily.

Depreciated CommandMC. Many commands remain to be converted to the new system.
Added a butterfly kill command.
This commit is contained in:
CovertJaguar committed 2014-11-12 03:53:01 -08:00
1 parent 2132c4457d
commit 4a390fe967
12 files changed
+624 -178

No files matched your search

@@ -1,171 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core;
import java.util.List;
import forestry.core.utils.StringUtil;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayer;
import forestry.plugins.Plugin;
import forestry.core.config.Version;
import forestry.core.proxy.Proxies;
import forestry.core.utils.CommandMC;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.PluginManager;
import net.minecraft.util.StatCollector;
public class CommandForestry extends CommandMC {
@Override
public int compareTo(Object arg0) {
return this.getCommandName().compareTo(((ICommand) arg0).getCommandName());
}
@Override
public String getCommandName() {
return "forestry";
}
@Override
public String getCommandUsage(ICommandSender sender) {
return "/" + this.getCommandName() + " help";
}
@SuppressWarnings("rawtypes")
@Override
public List getCommandAliases() {
return null;
}
@Override
public void processCommand(ICommandSender sender, String[] arguments) {
if (arguments.length <= 0)
throw new WrongUsageException(StringUtil.localizeAndFormat("chat.help", this.getCommandUsage(sender)));
if (arguments[0].matches("version")) {
commandVersion(sender, arguments);
return;
} else if (arguments[0].matches("plugins")) {
commandPlugins(sender, arguments);
return;
} else if (arguments[0].matches("help")) {
sendChatMessage(sender, StringUtil.localizeAndFormat("chat.command.help.0", this.getCommandName()));
sendChatMessage(sender, StringUtil.localize("chat.command.help.1"));
sendChatMessage(sender, StringUtil.localize("chat.command.help.2"));
sendChatMessage(sender, StringUtil.localize("chat.command.help.3"));
sendChatMessage(sender, StringUtil.localize("chat.command.help.4"));
return;
}
throw new WrongUsageException(this.getCommandUsage(sender));
}
private void commandVersion(ICommandSender sender, String[] arguments) {
String colour = Version.isOutdated() ? "\u00A7c" : "\u00A7a";
sendChatMessage(sender, String.format(colour + StringUtil.localize("chat.version"), Version.getVersion(),
Proxies.common.getMinecraftVersion(), Version.getRecommendedVersion()));
if (Version.isOutdated())
for (String updateLine : Version.getChangelog())
sendChatMessage(sender, "\u00A79" + updateLine);
}
private void commandPlugins(ICommandSender sender, String[] arguments) {
if (arguments.length <= 1)
listPluginsForSender(sender);
else if (arguments[1].matches("info"))
listPluginInfoForSender(sender, arguments);
}
private void listPluginsForSender(ICommandSender sender) {
String pluginList = "";
for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) {
if (!pluginList.isEmpty())
pluginList += ", ";
pluginList += makeListEntry(pluginModule.instance());
}
sendChatMessage(sender, pluginList);
}
private void listPluginInfoForSender(ICommandSender sender, String[] arguments) {
if (arguments.length < 3)
throw new WrongUsageException("/" + getCommandName() + " plugins info <plugin-name>");
ForestryPlugin found = null;
for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) {
Plugin info = pluginModule.instance().getClass().getAnnotation(Plugin.class);
if (info == null)
continue;
if ((info.pluginID().equalsIgnoreCase(arguments[2]) || info.name().equalsIgnoreCase(arguments[2]))) {
found = pluginModule.instance();
break;
}
}
if (found == null)
throw new CommandException(StringUtil.localizeAndFormat("chat.plugins.error", arguments[2]));
String entry = "\u00A7c";
if (found.isAvailable())
entry = "\u00A7a";
Plugin info = found.getClass().getAnnotation(Plugin.class);
if (info != null) {
sendChatMessage(sender, entry + "Plugin: " + info.name());
if (!info.version().isEmpty())
sendChatMessage(sender, "\u00A79Version: " + info.version());
if (!info.author().isEmpty())
sendChatMessage(sender, "\u00A79Author(s): " + info.author());
if (!info.url().isEmpty())
sendChatMessage(sender, "\u00A79URL: " + info.url());
if (!info.unlocalizedDescription().isEmpty())
sendChatMessage(sender, StatCollector.translateToLocal(info.unlocalizedDescription()));
}
}
private String makeListEntry(ForestryPlugin plugin) {
String entry = "\u00A7c";
if (plugin.isAvailable())
entry = "\u00A7a";
Plugin info = plugin.getClass().getAnnotation(Plugin.class);
if (info != null) {
entry += info.pluginID();
if (!info.version().isEmpty())
entry += " (" + info.version() + ")";
} else
entry += "???";
return entry;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
if (sender instanceof EntityPlayer)
return Proxies.common.isOp((EntityPlayer) sender);
else
return sender.canCommandSenderUseCommand(4, getCommandName());
}
}
@@ -0,0 +1,112 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.commands;
import forestry.core.utils.StringUtil;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.world.World;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class CommandHelpers {
public static World getWorld(ICommandSender sender, IForestryCommand command, String[] args, int worldArgIndex) {
// Handle passed in world argument
if (worldArgIndex < args.length)
try {
int dim = Integer.parseInt(args[worldArgIndex]);
World world = MinecraftServer.getServer().worldServerForDimension(dim);
if (world != null)
return world;
} catch (Exception ex) {
throwWrongUsage(sender, command);
}
if (sender instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) sender;
return player.worldObj;
} else
return MinecraftServer.getServer().worldServerForDimension(0);
}
public static String[] getPlayers() {
return MinecraftServer.getServer().getAllUsernames();
}
public static void sendLocalizedChatMessage(ICommandSender sender, String locTag, Object... args) {
sender.addChatMessage(new ChatComponentTranslation(locTag, args));
}
public static void sendChatMessage(ICommandSender sender, String message) {
sender.addChatMessage(new ChatComponentText(message));
}
public static void throwWrongUsage(ICommandSender sender, IForestryCommand command) throws WrongUsageException {
throw new WrongUsageException(StringUtil.localizeAndFormat("chat.help", command.getCommandUsage(sender)));
}
public static void processChildCommand(ICommandSender sender, SubCommand child, String[] args) {
if (!sender.canCommandSenderUseCommand(child.getRequiredPermissionLevel(), child.getFullCommandString()))
throw new WrongUsageException(StringUtil.localize("chat.command.noperms"));
String[] newargs = new String[args.length - 1];
System.arraycopy(args, 1, newargs, 0, newargs.length);
child.processCommand(sender, newargs);
}
public static void printHelp(ICommandSender sender, IForestryCommand command) {
sendLocalizedChatMessage(sender, "for.chat.command.format", command.getCommandFormat(sender));
sendLocalizedChatMessage(sender, "for.chat.command.aliases", command.getCommandAliases().toString().replace("[", "").replace("]", ""));
sendLocalizedChatMessage(sender, "for.chat.command.permlevel", command.getRequiredPermissionLevel());
sendLocalizedChatMessage(sender, "for.chat.command." + command.getFullCommandString().replace(" ", ".") + ".help");
if (!command.getChildren().isEmpty()) {
sendLocalizedChatMessage(sender, "for.chat.command.list");
for (SubCommand child : command.getChildren()) {
sendLocalizedChatMessage(sender, "for.chat.command." + child.getFullCommandString().replace(" ", ".") + ".desc", child.getCommandName());
}
}
}
public static boolean processStandardCommands(ICommandSender sender, IForestryCommand command, String[] args) {
if (args.length >= 1) {
if (args[0].equals("help")) {
command.printHelp(sender);
return true;
}
for (SubCommand child : command.getChildren()) {
if (matches(args[0], child)) {
processChildCommand(sender, child, args);
return true;
}
}
}
return false;
}
public static boolean matches(String commandName, IForestryCommand command) {
if (commandName.equals(command.getCommandName()))
return true;
else if (command.getCommandAliases() != null)
for (String alias : command.getCommandAliases()) {
if (commandName.equals(alias))
return true;
}
return false;
}
}
@@ -0,0 +1,126 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.commands;
import forestry.core.utils.StringUtil;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.Plugin;
import forestry.plugins.PluginManager;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.StatCollector;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class CommandPlugins extends SubCommand {
public CommandPlugins() {
addChildCommand(new CommandPluginsInfo());
}
@Override
public String getCommandName() {
return "plugins";
}
@Override
public String getCommandFormat(ICommandSender sender) {
return "/" + getFullCommandString() + " [info <plugin-name>]";
}
@Override
public void processSubCommand(ICommandSender sender, String[] args) {
if (args.length == 0)
listPluginsForSender(sender);
else
CommandHelpers.throwWrongUsage(sender, this);
}
private void listPluginsForSender(ICommandSender sender) {
String pluginList = "";
for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) {
if (!pluginList.isEmpty())
pluginList += ", ";
pluginList += makeListEntry(pluginModule.instance());
}
CommandHelpers.sendChatMessage(sender, pluginList);
}
private String makeListEntry(ForestryPlugin plugin) {
String entry = "\u00A7c";
if (plugin.isAvailable())
entry = "\u00A7a";
Plugin info = plugin.getClass().getAnnotation(Plugin.class);
if (info != null) {
entry += info.pluginID();
if (!info.version().isEmpty())
entry += " (" + info.version() + ")";
} else
entry += "???";
return entry;
}
public static class CommandPluginsInfo extends SubCommand {
@Override
public String getCommandName() {
return "info";
}
@Override
public void processSubCommand(ICommandSender sender, String[] args) {
if (args.length == 1)
listPluginInfoForSender(sender, args[0]);
else
CommandHelpers.throwWrongUsage(sender, this);
}
private void listPluginInfoForSender(ICommandSender sender, String plugin) {
ForestryPlugin found = null;
for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) {
Plugin info = pluginModule.instance().getClass().getAnnotation(Plugin.class);
if (info == null)
continue;
if ((info.pluginID().equalsIgnoreCase(plugin) || info.name().equalsIgnoreCase(plugin))) {
found = pluginModule.instance();
break;
}
}
if (found == null)
throw new CommandException(StringUtil.localizeAndFormat("chat.plugins.error", plugin));
String entry = "\u00A7c";
if (found.isAvailable())
entry = "\u00A7a";
Plugin info = found.getClass().getAnnotation(Plugin.class);
if (info != null) {
CommandHelpers.sendChatMessage(sender, entry + "Plugin: " + info.name());
if (!info.version().isEmpty())
CommandHelpers.sendChatMessage(sender, "\u00A79Version: " + info.version());
if (!info.author().isEmpty())
CommandHelpers.sendChatMessage(sender, "\u00A79Author(s): " + info.author());
if (!info.url().isEmpty())
CommandHelpers.sendChatMessage(sender, "\u00A79URL: " + info.url());
if (!info.unlocalizedDescription().isEmpty())
CommandHelpers.sendChatMessage(sender, StatCollector.translateToLocal(info.unlocalizedDescription()));
}
}
}
}
@@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.commands;
import net.minecraft.command.ICommandSender;
import forestry.core.config.Version;
import forestry.core.proxy.Proxies;
import forestry.core.utils.StringUtil;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class CommandVersion extends SubCommand {
@Override
public String getCommandName() {
return "version";
}
@Override
public String getCommandFormat(ICommandSender sender) {
return "/" + getFullCommandString();
}
@Override
public void processSubCommand(ICommandSender sender, String[] args) {
String colour = Version.isOutdated() ? "\u00A7c" : "\u00A7a";
CommandHelpers.sendChatMessage(sender, String.format(colour + StringUtil.localize("chat.version"), Version.getVersion(), Proxies.common.getMinecraftVersion(), Version.getRecommendedVersion()));
if (Version.isOutdated())
for (String updateLine : Version.getChangelog()) {
CommandHelpers.sendChatMessage(sender, "\u00A79" + updateLine);
}
}
}
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.commands;
import java.util.List;
import java.util.SortedSet;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IForestryCommand extends ICommand {
String getFullCommandString();
@Override
List<String> getCommandAliases();
int getRequiredPermissionLevel();
SortedSet<SubCommand> getChildren();
String getCommandFormat(ICommandSender sender);
void printHelp(ICommandSender sender);
}
@@ -0,0 +1,91 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.commands;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class RootCommand extends CommandBase implements IForestryCommand {
public static final String ROOT_COMMAND_NAME = "forestry";
public static final String ROOT_COMMAND_ALIAS = "for";
private final SortedSet<SubCommand> children = new TreeSet<SubCommand>(new Comparator<SubCommand>() {
@Override
public int compare(SubCommand o1, SubCommand o2) {
return o1.compareTo(o2);
}
});
public void addChildCommand(SubCommand child) {
child.setParent(this);
children.add(child);
}
@Override
public SortedSet<SubCommand> getChildren() {
return children;
}
@Override
public String getCommandName() {
return ROOT_COMMAND_NAME;
}
@Override
public int getRequiredPermissionLevel() {
return 0;
}
@Override
public List<String> getCommandAliases() {
List<String> aliases = new ArrayList<String>();
aliases.add(ROOT_COMMAND_ALIAS);
return aliases;
}
@Override
public String getCommandUsage(ICommandSender sender) {
return "/" + this.getCommandName() + " help";
}
@Override
public void processCommand(ICommandSender sender, String[] args) {
if (!CommandHelpers.processStandardCommands(sender, this, args))
CommandHelpers.throwWrongUsage(sender, this);
}
@Override
public String getCommandFormat(ICommandSender sender) {
return "/" + getFullCommandString() + " <args>";
}
@Override
public String getFullCommandString() {
return getCommandName();
}
@Override
public void printHelp(ICommandSender sender) {
CommandHelpers.printHelp(sender, this);
}
}
@@ -0,0 +1,120 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.commands;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public abstract class SubCommand implements IForestryCommand {
private final List<String> aliases = new ArrayList<String>();
private IForestryCommand parent;
private final SortedSet<SubCommand> children = new TreeSet<SubCommand>(new Comparator<SubCommand>() {
@Override
public int compare(SubCommand o1, SubCommand o2) {
return o1.compareTo(o2);
}
});
public void addChildCommand(SubCommand child) {
child.setParent(this);
children.add(child);
}
void setParent(IForestryCommand parent) {
this.parent = parent;
}
@Override
public SortedSet<SubCommand> getChildren() {
return children;
}
public void addAlias(String alias) {
aliases.add(alias);
}
@Override
public List<String> getCommandAliases() {
return aliases;
}
@Override
public List addTabCompletionOptions(ICommandSender p_71516_1_, String[] p_71516_2_) {
return null;
}
@Override
public final void processCommand(ICommandSender sender, String[] args) {
if (!CommandHelpers.processStandardCommands(sender, this, args))
processSubCommand(sender, args);
}
public void processSubCommand(ICommandSender sender, String[] args) {
CommandHelpers.throwWrongUsage(sender, this);
}
@Override
public int getRequiredPermissionLevel() {
return 0;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
return sender.canCommandSenderUseCommand(getRequiredPermissionLevel(), getCommandName());
}
@Override
public boolean isUsernameIndex(String[] args, int index) {
return false;
}
@Override
public String getCommandUsage(ICommandSender sender) {
return "/" + getFullCommandString() + " help";
}
@Override
public String getCommandFormat(ICommandSender sender) {
return "/" + getFullCommandString() + " <args>";
}
@Override
public void printHelp(ICommandSender sender) {
CommandHelpers.printHelp(sender, this);
}
@Override
public String getFullCommandString() {
return parent.getFullCommandString() + " " + getCommandName();
}
public int compareTo(ICommand command) {
return this.getCommandName().compareTo(command.getCommandName());
}
@Override
public int compareTo(Object command) {
return this.compareTo((ICommand) command);
}
}
@@ -18,6 +18,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
@Deprecated
public abstract class CommandMC extends CommandBase {
protected World getWorld(ICommandSender sender, String[] arguments) {
@@ -0,0 +1,77 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.lepidopterology.commands;
import forestry.core.commands.*;
import forestry.lepidopterology.entities.EntityButterfly;
import net.minecraft.command.ICommandSender;
import net.minecraft.world.World;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class CommandButterfly extends SubCommand {
public CommandButterfly() {
addAlias("bfly");
addChildCommand(new CommandButterflyKill());
}
@Override
public String getCommandName() {
return "butterfly";
}
@Override
public String getCommandFormat(ICommandSender sender) {
return "/" + getFullCommandString() + " <args>";
}
public static class CommandButterflyKill extends SubCommand {
public CommandButterflyKill() {
addAlias("killall");
}
@Override
public String getCommandName() {
return "kill";
}
@Override
public int getRequiredPermissionLevel() {
return 2;
}
@Override
public String getCommandFormat(ICommandSender sender) {
return "/" + getFullCommandString() + " [<dimension#>]";
}
@Override
public void processSubCommand(ICommandSender sender, String[] args) {
if (args.length > 1)
CommandHelpers.throwWrongUsage(sender, this);
World world = CommandHelpers.getWorld(sender, this, args, 0);
if (world == null)
CommandHelpers.throwWrongUsage(sender, this);
else
for (Object entity : world.loadedEntityList) {
if (entity instanceof EntityButterfly)
((EntityButterfly) entity).setDead();
}
}
}
}
+12 -6
View File
@@ -23,7 +23,6 @@ import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.circuits.ChipsetManager;
import forestry.api.core.Tabs;
import forestry.api.genetics.AlleleManager;
import forestry.core.CommandForestry;
import forestry.core.CreativeTabForestry;
import forestry.core.GameMode;
import forestry.core.PickupHandlerCore;
@@ -31,6 +30,9 @@ import forestry.core.SaveEventHandlerCore;
import forestry.core.circuits.CircuitRegistry;
import forestry.core.circuits.ItemCircuitBoard;
import forestry.core.circuits.ItemSolderingIron;
import forestry.core.commands.CommandPlugins;
import forestry.core.commands.CommandVersion;
import forestry.core.commands.RootCommand;
import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryBlock;
@@ -74,11 +76,15 @@ public class PluginCore extends ForestryPlugin {
public static MachineDefinition definitionEscritoire;
// ICrashCallable for highlighting certain mods during crashes.
public static ForestryModEnvWarningCallable crashCallable;
public static RootCommand rootCommand = new RootCommand();
@Override
public void preInit() {
super.preInit();
rootCommand.addChildCommand(new CommandVersion());
rootCommand.addChildCommand(new CommandPlugins());
ChipsetManager.solderManager = new ItemSolderingIron.SolderManager();
CircuitRegistry circuitRegistry = new CircuitRegistry();
@@ -109,7 +115,7 @@ public class PluginCore extends ForestryPlugin {
OreDictionary.registerOre("oreApatite", ForestryBlock.resources.getItemStack(1, 0));
OreDictionary.registerOre("oreCopper", ForestryBlock.resources.getItemStack(1, 1));
OreDictionary.registerOre("oreTin", ForestryBlock.resources.getItemStack(1, 2));
ForestryBlock.resourceStorage.registerBlock(new BlockResourceStorageBlock(), ItemForestryBlock.class, "resourceStorage");
ForestryBlock.resourceStorage.block().setHarvestLevel("pickaxe", 0, 0);
ForestryBlock.resourceStorage.block().setHarvestLevel("pickaxe", 0, 1);
@@ -435,17 +441,17 @@ public class PluginCore extends ForestryPlugin {
// / Pipette
Proxies.common.addRecipe(ForestryItem.pipette.getItemStack(), " #", " X ", "X ", 'X', Blocks.glass_pane, '#', new ItemStack(Blocks.wool, 1, Defaults.WILDCARD));
// Storage Blocks
Proxies.common.addRecipe(ForestryBlock.resourceStorage.getItemStack(1, 0), "###", "###", "###", '#', "gemApatite");
Proxies.common.addShapelessRecipe(ForestryItem.apatite.getItemStack(9), "blockApatite");
Proxies.common.addRecipe(ForestryBlock.resourceStorage.getItemStack(1, 1), "###", "###", "###", '#', "ingotCopper");
Proxies.common.addShapelessRecipe(ForestryItem.ingotCopper.getItemStack(9), "blockCopper");
Proxies.common.addRecipe(ForestryBlock.resourceStorage.getItemStack(1, 2), "###", "###", "###", '#', "ingotTin");
Proxies.common.addShapelessRecipe(ForestryItem.ingotTin.getItemStack(9), "blockTin");
Proxies.common.addRecipe(ForestryBlock.resourceStorage.getItemStack(1, 3), "###", "###", "###", '#', "ingotBronze");
Proxies.common.addShapelessRecipe(ForestryItem.ingotBronze.getItemStack(9), "blockBronze");
}
@@ -457,7 +463,7 @@ public class PluginCore extends ForestryPlugin {
@Override
public ICommand[] getConsoleCommands() {
return new ICommand[]{new CommandForestry()};
return new ICommand[]{rootCommand};
}
@Override
@@ -48,6 +48,7 @@ import forestry.core.utils.Utils;
import forestry.lepidopterology.ButterflySpawner;
import forestry.lepidopterology.GuiHandlerLepidopterology;
import forestry.lepidopterology.MatingRecipe;
import forestry.lepidopterology.commands.CommandButterfly;
import forestry.lepidopterology.entities.EntityButterfly;
import forestry.lepidopterology.gadgets.TileLepidopteristChest;
import forestry.lepidopterology.genetics.AlleleButterflySpecies;
@@ -110,6 +111,8 @@ public class PluginLepidopterology extends ForestryPlugin {
config.save();
PluginCore.rootCommand.addChildCommand(new CommandButterfly());
Utils.registerEntity(EntityButterfly.class, "butterflyGE", 0, 0x000000, 0xffffff, 50, 1, true);
proxy.initializeRendering();
registerTemplates();