本文整理了Java中net.minecraft.entity.Entity.getDisplayName()
方法的一些代码示例,展示了Entity.getDisplayName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getDisplayName()
方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:getDisplayName
暂无
代码示例来源:origin: SquidDev-CC/plethora
@Nonnull
@Override
public ITextComponent getDisplayName() {
return entity.getDisplayName();
}
代码示例来源:origin: SquidDev-CC/plethora
private void handleMessage(Entity sender, String message) {
access.queueEvent("chat_message", sender.getDisplayName().getUnformattedText(), message, sender.getPersistentID().toString());
}
代码示例来源:origin: SquidDev-CC/plethora
private synchronized boolean handleCapture(Entity sender, String message) {
for (String pattern : patterns) {
if (LuaPattern.matches(message, pattern)) {
access.queueEvent("chat_capture", message, pattern, sender.getDisplayName().getUnformattedText(), sender.getPersistentID().toString());
return true;
}
}
return false;
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
@Override
public ITextComponent getDeathMessage(EntityLivingBase entity) {
ItemStack stack = this.entity instanceof EntityLivingBase ? ((EntityLivingBase) this.entity).getHeldItemMainhand() : null;
String deathMessage = "death.attack." + this.damageType;
String itemDeathMessage = deathMessage + ".item";
return stack != null && stack.hasDisplayName() && I18n.hasKey(itemDeathMessage) ? new TextComponentTranslation(itemDeathMessage, entity.getDisplayName(), this.entity.getDisplayName(), stack.getTextComponent()) : new TextComponentTranslation(deathMessage, entity.getDisplayName(), this.entity.getDisplayName());
}
代码示例来源:origin: CoFH/CoFHCore
public static ITextComponent getChatComponent(Object object) {
if (object instanceof ITextComponent) {
return (ITextComponent) object;
} else if (object instanceof String) {
return new TextComponentString((String) object);
} else if (object instanceof ItemStack) {
return ((ItemStack) object).getTextComponent();
} else if (object instanceof StatBase) {
return ((StatBase) object).getStatName();
} else if (object instanceof Entity) {
return ((Entity) object).getDisplayName();
} else if (object instanceof ICommandSender) {
return ((ICommandSender) object).getDisplayName();
} else {
return new TextComponentString(String.valueOf(object));
}
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
public ITextComponent func_151519_b(EntityLivingBase entity) {
String normalMsg = "death.attack." + damageType;
String itemMsg = normalMsg + ".item";
if (damageSourceEntity instanceof EntityLivingBase) {
ItemStack itemStack = ((EntityLivingBase) damageSourceEntity).getActiveItemStack();
if (itemStack != null &&
itemStack.hasDisplayName() &&
MOStringHelper.hasTranslation(itemMsg)) {
return new TextComponentTranslation(itemMsg, entity.getDisplayName().getFormattedText(), damageSourceEntity.getDisplayName().getFormattedText(), itemStack.getTextComponent());
}
}
return new TextComponentTranslation(normalMsg, entity.getDisplayName(), damageSourceEntity.getDisplayName());
}
代码示例来源:origin: McJtyMods/TheOneProbe
public static void showStandardInfo(ProbeMode mode, IProbeInfo probeInfo, Entity entity, IProbeConfig config) {
String modid = Tools.getModName(entity);
if (Tools.show(mode, config.getShowModName())) {
probeInfo.horizontal()
.entity(entity)
.vertical()
.text(NAME + entity.getDisplayName().getFormattedText())
.text(MODNAME + modid);
} else {
probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER))
.entity(entity)
.text(NAME + entity.getDisplayName().getFormattedText());
}
}
}
代码示例来源:origin: Vazkii/Psi
error("console");
else if (!(target instanceof EntityPlayer))
error("players", target.getDisplayName());
else {
EntityPlayer player = (EntityPlayer) target;
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
private void renderEntityInfo(Entity entity, RayTraceResult position, EntityPlayer player, Vec3d playerPos, float ticks) {
if (!entity.isInvisibleToPlayer(player)) {
double offset = 0.1;
Vec3d entityPos;
String name = entity.getDisplayName().getFormattedText();
List<String> infos = new ArrayList<>();
if (entity instanceof EntityLivingBase) {
entityPos = entity.getPositionEyes(ticks);
entityPos = entityPos.addVector(0, entity.getEyeHeight(), 0);
infos.add("Health: " + (healthFormater.format(((EntityLivingBase) entity).getHealth()) + " / " + ((EntityLivingBase) entity).getMaxHealth()));
GlStateManager.pushMatrix();
GlStateManager.translate(entityPos.x - playerPos.x, entityPos.y - playerPos.y, entityPos.z - playerPos.z);
GlStateManager.rotate(player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * ticks, 0, -1, 0);
GlStateManager.rotate(player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * ticks, 1, 0, 0);
GlStateManager.translate(1, 0, 0);
GlStateManager.rotate(180, 0, 0, 1);
GlStateManager.translate(-0.5, -0.5, -offset);
drawInfoPlane(0.5);
drawInfoList(name, infos);
GlStateManager.popMatrix();
}
}
}
代码示例来源:origin: FTBTeam/FTB-Utilities
@Override
public NBTTagCompound editNBT(EntityPlayerMP player, NBTTagCompound info, String[] args) throws CommandException
{
checkArgs(player, args, 1);
int id = parseInt(args[0]);
Entity entity = player.world.getEntityByID(id);
NBTTagCompound nbt = new NBTTagCompound();
if (entity != null)
{
info.setString("type", "entity");
info.setInteger("id", id);
entity.writeToNBT(nbt);
NBTTagList list = new NBTTagList();
addInfo(list, new TextComponentString("Class"), new TextComponentString(entity.getClass().getName()));
ResourceLocation key = EntityList.getKey(entity.getClass());
addInfo(list, new TextComponentString("ID"), new TextComponentString(key == null ? "null" : key.toString()));
addInfo(list, new TextComponentString("Mod"), new TextComponentString(key == null ? "null" : Loader.instance().getIndexedModList().get(key.getNamespace()).getName()));
info.setTag("text", list);
info.setString("title", ITextComponent.Serializer.componentToJson(entity.getDisplayName()));
}
return nbt;
}
}
代码示例来源:origin: SquidDev-CC/plethora
name = entity.getDisplayName();
player = (EntityPlayerMP) entity;
} else if (ConfigGameplay.Chat.allowMobs && entity != null && entity.getEntityWorld() instanceof WorldServer) {
if (owner == null) owner = PlethoraFakePlayer.PROFILE;// We include the position of the entity
name = entity.getDisplayName().createCopy();
内容来源于网络,如有侵权,请联系作者删除!