本文整理匯總了Java中net.minecraft.command.CommandBase.notifyCommandListener方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandBase.notifyCommandListener方法的具體用法?Java CommandBase.notifyCommandListener怎麽用?Java CommandBase.notifyCommandListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.command.CommandBase
的用法示例。
在下文中一共展示了CommandBase.notifyCommandListener方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCommandSentEvent
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
@SubscribeEvent
public void onCommandSentEvent(CommandEvent event)
{
if (event.getCommand() instanceof CommandClearInventory)
{
if (event.getParameters().length <= 1)
{
EntityPlayerMP entityplayermp = null;
try
{
entityplayermp = event.getParameters().length == 0 ? CommandBase.getCommandSenderAsPlayer(event.getSender()) : CommandBase.getPlayer(FMLCommonHandler.instance().getMinecraftServerInstance(), event.getSender(), event.getParameters()[0]);
}
catch (Throwable var9)
{
return;
}
PlayerAether playerAether = PlayerAether.get(entityplayermp);
if (playerAether != null)
{
if (playerAether.accessories.getFieldCount() != 0)
{
playerAether.accessories.clear();
CommandBase.notifyCommandListener(entityplayermp, event.getCommand(), "Cleared the accessories of " + entityplayermp.getName(), new Object[] {});
}
}
}
}
}
示例2: execute
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
public static void execute(CommandJED cmd, int dimension, String[] args, ICommandSender sender) throws CommandException
{
World world = DimensionManager.getWorld(dimension);
if (world != null)
{
BlockPos pos = null;
if (args.length == 0)
{
pos = sender instanceof EntityPlayer ? ((EntityPlayer) sender).getPosition() : null;
}
else if (args.length == 3)
{
pos = new BlockPos(CommandBase.parseInt(args[0]), CommandBase.parseInt(args[1]), CommandBase.parseInt(args[2]));
}
else if (args.length == 1 && args[0].equals("query"))
{
pos = world.getSpawnPoint();
sender.sendMessage(new TextComponentTranslation("jed.commands.setworldspawn.query",
Integer.valueOf(dimension), Integer.valueOf(pos.getX()), Integer.valueOf(pos.getY()), Integer.valueOf(pos.getZ())));
return;
}
if (pos != null)
{
world.setSpawnPoint(pos);
CommandBase.notifyCommandListener(sender, cmd, "jed.commands.setworldspawn.success",
Integer.valueOf(dimension), Integer.valueOf(pos.getX()), Integer.valueOf(pos.getY()), Integer.valueOf(pos.getZ()));
}
else
{
CommandJED.throwUsage("setworldspawn");
}
}
else
{
CommandJED.throwNumber("dimension.notloaded", Integer.valueOf(dimension));
}
}
示例3: execute
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
public static void execute(CommandJED cmd, int dimension, String[] args, ICommandSender sender) throws CommandException
{
World world = DimensionManager.getWorld(dimension);
if (world == null)
{
CommandJED.throwNumber("dimension.notloaded", Integer.valueOf(dimension));
}
if (args.length >= 1 && args.length <= 2)
{
int time = (300 + (new Random()).nextInt(600)) * 20;
if (args.length >= 2)
{
time = CommandBase.parseInt(args[1], -10000000, 10000000) * 20;
}
String cmdName = args[0];
WorldInfo worldinfo = world.getWorldInfo();
if (cmdName.equals("clear"))
{
worldinfo.setCleanWeatherTime(time);
worldinfo.setRainTime(0);
worldinfo.setThunderTime(0);
worldinfo.setRaining(false);
worldinfo.setThundering(false);
CommandBase.notifyCommandListener(sender, cmd, "jed.commands.weather.clear", Integer.valueOf(dimension));
}
else if (cmdName.equals("rain"))
{
worldinfo.setCleanWeatherTime(0);
worldinfo.setRainTime(time);
worldinfo.setThunderTime(time);
worldinfo.setRaining(true);
worldinfo.setThundering(false);
CommandBase.notifyCommandListener(sender, cmd, "jed.commands.weather.rain", Integer.valueOf(dimension));
}
else if (cmdName.equals("thunder"))
{
worldinfo.setCleanWeatherTime(0);
worldinfo.setRainTime(time);
worldinfo.setThunderTime(time);
worldinfo.setRaining(true);
worldinfo.setThundering(true);
CommandBase.notifyCommandListener(sender, cmd, "jed.commands.weather.thunder", Integer.valueOf(dimension));
}
else
{
CommandJED.throwUsage("weather");
}
}
else
{
CommandJED.throwUsage("weather");
}
}