本文整理汇总了Java中net.minecraft.entity.player.EntityPlayerMP.sendMessage方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayerMP.sendMessage方法的具体用法?Java EntityPlayerMP.sendMessage怎么用?Java EntityPlayerMP.sendMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayerMP
的用法示例。
在下文中一共展示了EntityPlayerMP.sendMessage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMessage
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public IMessage onMessage(TeleportRequest message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().player;
if(Perms.isOP(player) == false){
Main.LOGGER.info(player.getName() + " tried to teleport, but was denied to do so!");
return null;
}
new RunInServerThread(new Runnable() {
@Override
public void run() {
Entity e = FMLCommonHandler.instance().getMinecraftServerInstance().getEntityFromUuid(message.uuid);
if(e == null){
player.sendMessage(new TextComponentString(TextFormatting.RED + "Woops! This tile entity no longer exists!"));
return;
}
Teleport.teleportPlayer(player, e.dimension, e.posX, e.posY, e.posZ);
}
});
return null;
}
示例2: handleOpenRequest
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@SideOnly(Side.SERVER)
public static void handleOpenRequest(BlockPos pos, EntityPlayerMP player) {
TileEntity te = player.world.getTileEntity(pos);
if (te instanceof ScriptyBlock.TEScriptyBlock) {
ScriptyBlock.TEScriptyBlock scriptyBlock = (ScriptyBlock.TEScriptyBlock) te;
if (scriptyBlock.getOwner() != null && scriptyBlock.getOwner().isEntityEqual(player)) {
player.sendMessage(new TextComponentString(scriptyBlock.getOwner().getName() + " is already using this Scripty block.").setStyle(new Style().setColor(TextFormatting.RED)));
return;
}
scriptyBlock.setOwner(player);
sendContentMessage(player, pos, scriptyBlock.getContent(), scriptyBlock.getLanguage(), scriptyBlock.isParsing());
}
}
示例3: execute
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
World world = sender.getEntityWorld();
if (!world.isRemote) {
EntityPlayerMP player = getCommandSenderAsPlayer(sender);
if (args.length <= 0) {
player.sendMessage(new TextComponentString("[ISH] /gm <gamemode>"));
return;
}
if (args[0].equals("0") || args[0].equals("s") || args[0].equals("survival")) {
player.setGameType(GameType.SURVIVAL);
player.sendMessage(new TextComponentString("[ISH] Gamemode changed: SURVIVAL"));
} else if (args[0].equals("1") || args[0].equals("c") || args[0].equals("creative")) {
player.setGameType(GameType.CREATIVE);
player.sendMessage(new TextComponentString("[ISH] Gamemode changed: CREATIVE"));
} else if (args[0].equals("2") || args[0].equals("a") || args[0].equals("adventure")) {
player.setGameType(GameType.ADVENTURE);
player.sendMessage(new TextComponentString("[ISH] Gamemode changed: ADVENTURE"));
} else if (args[0].equals("3") || args[0].equals("sp") || args[0].equals("spectator")) {
player.setGameType(GameType.SPECTATOR);
player.sendMessage(new TextComponentString("[ISH] Gamemode changed: SPECTATOR"));
} else {
player.sendMessage(new TextComponentString("[ISH] /gm <gamemode>"));
}
}
}
示例4: teleportPlayer
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
public static void teleportPlayer(EntityPlayerMP player, int dim, double x, double y, double z){
new RunInServerThread(new Runnable() {
@Override
public void run() {
if(player.dimension != dim) {
teleportPlayerToDimension(player, dim, x, y, z);
}else{
player.setPositionAndUpdate(x,y,z);
}
player.sendMessage(new TextComponentString(TextFormatting.GREEN + "Teleported to: " + TextFormatting.GRAY + " Dim: " + dim + TextFormatting.WHITE + ", " + (int) x + ", " + (int) y + ", " + (int) z));
}
});
}
示例5: sendChatToServer
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
public static void sendChatToServer(String message)
{
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
for (EntityPlayerMP aPlayerEntityList : server.getPlayerList().getPlayers())
{
EntityPlayerMP player = aPlayerEntityList;
player.sendMessage(new TextComponentString(message));
}
}
示例6: execute
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
EntityPlayerMP player = getCommandSenderAsPlayer(sender);
ItemStack held = player.getHeldItemMainhand();
if(held.isEmpty()) {
held = player.getHeldItemOffhand();
}
if(held.isEmpty()) {
player.sendMessage(new TextComponentTranslation("command.modularmachinery.hand.empty"));
return;
}
Item i = held.getItem();
StringBuilder sb = new StringBuilder();
sb.append(i.getRegistryName().toString());
if(i.getHasSubtypes()) {
sb.append("@").append(held.getItemDamage());
}
NBTTagCompound cmp = held.serializeNBT();
if(cmp.hasKey("tag")) {
String json = NBTJsonSerializer.serializeNBT(cmp.getTag("tag"));
if(!json.isEmpty()) {
sb.append(" (with nbt: ").append(json).append(" )");
}
}
String str = sb.toString();
player.sendMessage(new TextComponentString(str));
ModularMachinery.NET_CHANNEL.sendTo(new PktCopyToClipboard(str), player);
int burn = TileEntityFurnace.getItemBurnTime(held);
if(burn > 0) {
player.sendMessage(new TextComponentString("Fuel BurnTime: " + burn));
}
}
示例7: execute
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
EntityPlayerMP player = getCommandSenderAsPlayer(sender);
player.sendMessage(new TextComponentString("Testing Machines:"));
MachineRegistry.getRegistry().loadMachines(player);
player.sendMessage(new TextComponentString(""));
player.sendMessage(new TextComponentString("Testing Recipes:"));
RecipeRegistry.getRegistry().loadRecipes(player);
}
示例8: execute
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
World world = sender.getEntityWorld();
if (!world.isRemote) {
EntityPlayerMP player = getCommandSenderAsPlayer(sender);
if (args.length <= 0) {
player.sendMessage(new TextComponentString("[ISH] Usage:"));
player.sendMessage(new TextComponentString("[ISH] /ish killa (killall) - kill all mobs and drops"));
player.sendMessage(new TextComponentString("[ISH] /ish heal (healme) - heal player"));
player.sendMessage(
new TextComponentString("[ISH] /ish oheart (oneheart) - set minimal health and hunger"));
return;
}
if (args[0].equals("killa") || args[0].equals("killall")) {
server.commandManager.executeCommand(server.getServer(), "/kill @e[type=!Player]");
} else if (args[0].equals("heal") || args[0].equals("healme")) {
player.setHealth(player.getMaxHealth());
player.getFoodStats().setFoodLevel(20);
} else if (args[0].equals("oheart") || args[0].equals("oneheart")) {
player.setHealth(1.0f);
player.getFoodStats().setFoodLevel(1);
} else if (args[0].equals("help") || args[0].equals("?")) {
player.sendMessage(new TextComponentString("[ISH] Usage:"));
player.sendMessage(new TextComponentString("[ISH] /ish killa (killall) - kill all mobs and drops"));
player.sendMessage(new TextComponentString("[ISH] /ish heal (healme) - heal player"));
player.sendMessage(
new TextComponentString("[ISH] /ish oheart (oneheart) - set minimal health and hunger"));
} else if (args[0].equals("out")) {
if (args[1].equals("0")) {
server.commandManager.executeCommand(player.getCommandSenderEntity(),
"/gamerule commandBlockOutput false");
} else if (args[1].equals("1")) {
server.commandManager.executeCommand(player.getCommandSenderEntity(),
"/gamerule commandBlockOutput true");
}
} else {
player.sendMessage(new TextComponentString("[ISH] Wrong usage! Usage:"));
player.sendMessage(new TextComponentString("[ISH] /ish killa (killall) - kill all mobs and drops"));
player.sendMessage(new TextComponentString("[ISH] /ish heal (healme) - heal player"));
player.sendMessage(
new TextComponentString("[ISH] /ish oheart (oneheart) - set minimal health and hunger"));
}
}
}