本文整理汇总了Java中net.minecraft.command.ICommandManager类的典型用法代码示例。如果您正苦于以下问题:Java ICommandManager类的具体用法?Java ICommandManager怎么用?Java ICommandManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ICommandManager类属于net.minecraft.command包,在下文中一共展示了ICommandManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serverStart
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@Mod.EventHandler
public void serverStart(FMLServerStartingEvent event) {
MinecraftServer server = event.getServer();
ICommandManager command = server.getCommandManager();
ServerCommandManager serverCommand = (ServerCommandManager) command;
serverCommand.registerCommand(new CommandAlly());
serverCommand.registerCommand(new CommandAllyAccept());
serverCommand.registerCommand(new CommandAllyList());
serverCommand.registerCommand(new CommandAllyReject());
serverCommand.registerCommand(new CommandAllyRemove());
serverCommand.registerCommand(new CommandEnemy());
serverCommand.registerCommand(new CommandEnemyList());
serverCommand.registerCommand(new CommandEnemyRemove());
}
示例2: doAction
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@Override
public void doAction(World world, IStructure structure, Point3i worldPos) {
if(commands.isEmpty()) {
return;
}
MinecraftServer minecraftserver = MinecraftServer.getServer();
if(minecraftserver != null) {
Point3i wp = getWorldPosition(structure, worldPos);
InnerSender sender = new InnerSender(world, structure, wp);
ICommandManager icommandmanager = minecraftserver.getCommandManager();
boolean origValue = minecraftserver.worldServers[0].getGameRules().getGameRuleBooleanValue("commandBlockOutput");
minecraftserver.worldServers[0].getGameRules().setOrCreateGameRule("commandBlockOutput", "false");
for(String cmd : commands) {
icommandmanager.executeCommand(sender, cmd);
}
minecraftserver.worldServers[0].getGameRules().setOrCreateGameRule("commandBlockOutput", origValue + "");
}
}
示例3: func_145755_a
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
public void func_145755_a(World p_145755_1_)
{
if (p_145755_1_.isClient)
{
this.field_145764_b = 0;
}
MinecraftServer var2 = MinecraftServer.getServer();
if (var2 != null && var2.isCommandBlockEnabled())
{
ICommandManager var3 = var2.getCommandManager();
this.field_145764_b = var3.executeCommand(this, this.field_145763_e);
}
else
{
this.field_145764_b = 0;
}
}
示例4: runCommand
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@SuppressWarnings("unused")
public int runCommand(String... args) {
if (FMLCommonHandler.instance().getMinecraftServerInstance() != null &&
FMLCommonHandler.instance().getMinecraftServerInstance().isCallingFromMinecraftThread()) {
if (reduxEngine.globalObjectExists("entity") && reduxEngine.getJavaObject("entity", Entity.class) instanceof Entity) {
lastEntity = (Entity) reduxEngine.getJavaObject("entity", Entity.class);
} else {
lastEntity = null;
}
if (reduxEngine.globalObjectExists("world") && reduxEngine.getJavaObject("world", World.class) instanceof World) {
lastWorld = (World) reduxEngine.getJavaObject("world", World.class);
} else {
lastWorld = null;
}
if (reduxEngine.globalObjectExists("pos") && reduxEngine.getJavaObject("pos", BlockPos.class) instanceof BlockPos) {
lastBlockPos = (BlockPos) reduxEngine.getJavaObject("pos", BlockPos.class);
} else {
lastBlockPos = null;
}
ICommandManager manager = FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager();
manager.executeCommand(this, StringUtils.join(args));
}
return 0;
}
示例5: onServerStarting
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@EventHandler
public void onServerStarting(FMLServerStartingEvent event) {
ICommandManager manager = event.getServer().getCommandManager();
if (manager instanceof ServerCommandManager) {
((ServerCommandManager) manager).registerCommand(CommandManager.INSTANCE);
}
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
Progression.logger.log(Level.INFO, "How did a client get in the server start?");
return;
}
//Remap all relevant data, Loads in the server data
RemappingHandler.reloadServerData(JSONLoader.getServerTabData(RemappingHandler.getHostName()), false);
World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[0];
data = (PlayerSavedData) world.loadItemData(PlayerSavedData.class, MODNAME);
if (data == null) {
createWorldData();
}
}
示例6: handleCommandExecution
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
private int handleCommandExecution(ICommandManager commandManager, CommandBlockLogic commandBlockLogic, String commandStored) {
final String[] args = commandStored.split(" ");
String commandName = args[0];
if (commandName.startsWith("/")) {
commandName = commandName.substring(1);
}
CommandBlockCommandHook commandHook = (CommandBlockCommandHook) new CommandBlockCommandHook(
(net.canarymod.api.CommandBlockLogic) commandBlockLogic, args).call();
if (!commandHook.isCanceled()
&& (Configuration.getServerConfig().isCommandBlockOpped()
|| ((net.canarymod.api.CommandBlockLogic) commandBlockLogic).hasPermission("canary.command." + commandName))) {
int result = commandManager.executeCommand(commandBlockLogic, commandStored);
if (result == 0) {
// Minecraft found no command, now its our turn
Canary.getServer().consoleCommand(commandStored, (net.canarymod.api.CommandBlockLogic) commandBlockLogic);
}
return result;
}
return 0;
}
示例7: func_145755_a
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
public void func_145755_a(World p_145755_1_)
{
if (p_145755_1_.isRemote)
{
this.field_145764_b = 0;
}
MinecraftServer minecraftserver = MinecraftServer.getServer();
if (minecraftserver != null && minecraftserver.isCommandBlockEnabled())
{
ICommandManager icommandmanager = minecraftserver.getCommandManager();
this.field_145764_b = icommandmanager.executeCommand(this, this.field_145763_e);
}
else
{
this.field_145764_b = 0;
}
}
示例8: executeCommandOnPowered
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
/**
* Execute the command, called when the command block is powered.
*/
public int executeCommandOnPowered(World par1World)
{
if (par1World.isRemote)
{
return 0;
}
else
{
MinecraftServer minecraftserver = MinecraftServer.getServer();
if (minecraftserver != null && minecraftserver.isCommandBlockEnabled())
{
ICommandManager icommandmanager = minecraftserver.getCommandManager();
return icommandmanager.executeCommand(this, this.command);
}
else
{
return 0;
}
}
}
示例9: beforeServerStart
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@Mod.EventHandler
public void beforeServerStart(FMLServerAboutToStartEvent event) {
ICommandManager manager = event.getServer().getCommandManager();
if (manager instanceof CommandHandler) {
((CommandHandler) manager).registerCommand(new DebugDamageCommand());
}
}
示例10: serverStarting
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
ICommandManager commandManager = MinecraftServer.getServer().getCommandManager();
ServerCommandManager serverCommandManager = ((ServerCommandManager) commandManager);
addCommands(serverCommandManager);
}
示例11: apply
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@Override
public void apply(EntityActor actor)
{
if (!this.command.isEmpty())
{
MinecraftServer server = actor.worldObj.getMinecraftServer();
if (server != null)
{
ICommandManager manager = server.commandManager;
manager.executeCommand(new CommandSender(actor), this.command);
}
}
}
示例12: serverStart
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@EventHandler
public void serverStart(FMLServerStartingEvent event)
{
MinecraftServer server = MinecraftServer.getServer();
// Get's the current server instance
ICommandManager command = server.getCommandManager();
ServerCommandManager manager = (ServerCommandManager) command;
//manager.registerCommand(new CommandModInfo());
manager.registerCommand(new CommandChangelog());
manager.registerCommand(new CommandAbilities());
}
示例13: serverStart
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@Mod.EventHandler
public void serverStart(FMLServerStartingEvent e)
{
MinecraftServer server = getServer();
ICommandManager iCommandManager = server.getCommandManager();
ServerCommandManager serverCommandManager = (ServerCommandManager)iCommandManager;
serverCommandManager.registerCommand(new CommandHandler());
}
示例14: serverStart
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
@EventHandler
public void serverStart(FMLServerStartingEvent event)
{
//Thread.currentThread().setName("EpicProportionsMod");
MinecraftServer server = MinecraftServer.getServer();
// Get's the current server instance
ICommandManager command = server.getCommandManager();
ServerCommandManager manager = (ServerCommandManager) command;
manager.registerCommand(new CommandModInfo());
manager.registerCommand(new CommandChangelog());
}
示例15: registerCommands
import net.minecraft.command.ICommandManager; //导入依赖的package包/类
private void registerCommands(FMLServerStartingEvent event) {
MinecraftServer server = event.getServer();
ICommandManager command = server.getCommandManager();
ServerCommandManager manager = (ServerCommandManager) command;
manager.registerCommand(new CommandWallet());
manager.registerCommand(new CommandBalance());
manager.registerCommand(new CommandPay());
}