A proper console command handler, also fix ordering of loaded mods
This commit is contained in:
parent
07437b95ae
commit
33f1e26df4
|
@ -20,5 +20,5 @@ package cpw.mods.fml.common;
|
||||||
*/
|
*/
|
||||||
public interface IConsoleHandler
|
public interface IConsoleHandler
|
||||||
{
|
{
|
||||||
public boolean handleCommand(String command);
|
public boolean handleCommand(String command, Object... data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
- else
|
- else
|
||||||
+ else if (!FMLServerHandler.instance().handleServerCommand(var2))
|
+ else if (!FMLServerHandler.instance().handleServerCommand(var2, var6.func_1_c(), var6))
|
||||||
{
|
{
|
||||||
field_22117_a.info("Unknown console command. Type \"help\" for help.");
|
field_22117_a.info("Unknown console command. Type \"help\" for help.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import net.minecraft.src.CommonRegistry;
|
||||||
import net.minecraft.src.EntityItem;
|
import net.minecraft.src.EntityItem;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayer;
|
||||||
import net.minecraft.src.IChunkProvider;
|
import net.minecraft.src.IChunkProvider;
|
||||||
|
import net.minecraft.src.ICommandListener;
|
||||||
import net.minecraft.src.IInventory;
|
import net.minecraft.src.IInventory;
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.src.ItemStack;
|
||||||
import net.minecraft.src.NetworkManager;
|
import net.minecraft.src.NetworkManager;
|
||||||
|
@ -445,10 +446,10 @@ public class FMLServerHandler implements IFMLSidedHandler
|
||||||
* @param var2
|
* @param var2
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean handleServerCommand(String command)
|
public boolean handleServerCommand(String command, String player, ICommandListener listener)
|
||||||
{
|
{
|
||||||
for (ModContainer mod : Loader.getModList()) {
|
for (ModContainer mod : Loader.getModList()) {
|
||||||
if (mod.wantsConsoleCommands() && mod.getConsoleHandler().handleCommand(command)) {
|
if (mod.wantsConsoleCommands() && mod.getConsoleHandler().handleCommand(command, player, listener)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,7 +450,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getPreDepends()
|
public List<String> getPostDepends()
|
||||||
{
|
{
|
||||||
if (dependencies == null)
|
if (dependencies == null)
|
||||||
{
|
{
|
||||||
|
@ -461,7 +461,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getPostDepends()
|
public List<String> getPreDepends()
|
||||||
{
|
{
|
||||||
if (dependencies == null)
|
if (dependencies == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,19 +84,10 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean handleCommand(String command)
|
public final boolean handleCommand(String command, Object... data)
|
||||||
{
|
{
|
||||||
return onServerCommand(command);
|
return onServerCommand(command, (String)data[0], (ICommandListener)data[1]);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @param command
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean onServerCommand(String command)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BASEMOD API
|
// BASEMOD API
|
||||||
/**
|
/**
|
||||||
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
|
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
|
||||||
|
@ -281,6 +272,15 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param command
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean onServerCommand(String command, String sender, ICommandListener listener)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Spare client junk
|
// Spare client junk
|
||||||
// -------
|
// -------
|
||||||
// void addRenderer(Map<Class<? extends Entity>, Render> renderers);
|
// void addRenderer(Map<Class<? extends Entity>, Render> renderers);
|
||||||
|
|
Loading…
Reference in New Issue