本文整理了Java中net.minecraft.entity.Entity.sendMessage()
方法的一些代码示例,展示了Entity.sendMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.sendMessage()
方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:sendMessage
暂无
代码示例来源:origin: MrCrayfish/MrCrayfishDeviceMod
@SubscribeEvent
public void load(EntityJoinWorldEvent event)
{
if(!displayed && event.getEntity() instanceof EntityPlayer && event.getWorld().isRemote)
{
Style style = new Style();
style.setClickEvent(new ClickEvent(Action.OPEN_URL, "https://www.patreon.com/mrcrayfish"));
style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(TextFormatting.AQUA + "Open MrCrayfish's Patreon")));
event.getEntity().sendMessage(new TextComponentString(TextFormatting.RED.toString() + TextFormatting.BOLD.toString() + "MrCrayfish's Device Mod:"));
event.getEntity().sendMessage(new TextComponentString("You are using a development version of the Device Mod."));
event.getEntity().sendMessage(new TextComponentString("Please be aware that not all features are finished"));
event.getEntity().sendMessage(new TextComponentString("and may be completely changed in a future update!"));
event.getEntity().sendMessage(new TextComponentString(TextFormatting.GOLD.toString() + TextFormatting.BOLD.toString() + "> Support MrCrayfish On Patreon <").setStyle(style));
}
}
代码示例来源:origin: Ellpeck/ActuallyAdditions
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected){
if(!world.isRemote){
if(stack.hasTagCompound()){
NBTTagCompound compound = stack.getTagCompound();
if(compound.hasKey("UUIDMost")){
UUID id = compound.getUniqueId("UUID");
EntityPlayer player = world.getPlayerEntityByUUID(id);
if(player != null){
if(player.isSneaking()){
ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name");
entity.sendMessage(new TextComponentTranslation("tooltip."+ActuallyAdditions.MODID+".playerProbe.disconnect.1"));
player.sendMessage(new TextComponentTranslation("tooltip."+ActuallyAdditions.MODID+".playerProbe.notice"));
//TheAchievements.GET_UNPROBED.get(player);
}
}
else{
ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name");
entity.sendMessage(new TextComponentTranslation("tooltip."+ActuallyAdditions.MODID+".playerProbe.disconnect.2"));
}
}
}
}
}
代码示例来源:origin: gegy1000/Terrarium
private void teleport(Entity entity, Coordinate coordinate) {
int blockX = MathHelper.floor(coordinate.getBlockX());
int blockZ = MathHelper.floor(coordinate.getBlockZ());
Chunk chunk = entity.world.getChunk(blockX >> 4, blockZ >> 4);
int height = chunk.getHeightValue(blockX & 15, blockZ & 15);
entity.dismountRidingEntity();
if (entity instanceof EntityPlayerMP) {
NetHandlerPlayServer connection = ((EntityPlayerMP) entity).connection;
connection.setPlayerLocation(coordinate.getBlockX(), height + 0.5, coordinate.getBlockZ(), 180.0F, 0.0F);
}
entity.motionY = 0.0;
entity.onGround = true;
entity.sendMessage(DeferredTranslator.translate(entity, new TextComponentTranslation("commands.earth.geotp.success", coordinate.getX(), coordinate.getZ())));
}
内容来源于网络,如有侵权,请联系作者删除!