当前位置: 首页>>代码示例>>Java>>正文


Java Entity.getName方法代码示例

本文整理汇总了Java中net.minecraft.entity.Entity.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.getName方法的具体用法?Java Entity.getName怎么用?Java Entity.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.Entity的用法示例。


在下文中一共展示了Entity.getName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RenderTarget

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public RenderTarget(Entity entity) {
    this.entity = entity;
    trackEntries = EntityTrackHandler.getTrackersForEntity(entity);
    circle1 = new RenderTargetCircle();
    circle2 = new RenderTargetCircle();
    Item droppedItem = null;
    if (entity instanceof EntityLiving) {
        try {
            droppedItem = null;//TODO 1.8 EntityUtils.getLivingDrop((EntityLiving)entity);
        } catch (Throwable e) {
        }
    }
    if (droppedItem != null) {
        stat = new GuiAnimatedStat(null, entity.getName(), new ItemStack(droppedItem, 1, 0), 20, -20, 0x3000AA00, null, false);
    } else {
        stat = new GuiAnimatedStat(null, entity.getName(), "", 20, -20, 0x3000AA00, null, false);
    }
    stat.setMinDimensionsAndReset(0, 0);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:RenderTarget.java

示例2: printChat

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void printChat(int ID, LivingDeathEvent event, String item) {

        Entity killer = event.getSource().getEntity();
        EntityLivingBase target = event.getEntityLiving();

        // Thanks again 'SourceCoded' <3
        // Add to statclock weapon
        if (killer != null && killer instanceof EntityPlayer) {

            EntityPlayer player = (EntityPlayer) killer;
            String name = killer.getName();
            item = translate(item + ".name");
            player.sendMessage(new TextComponentString( name + "'s " + item + " " + translate("statclock.translate.chat") + " §6[" + translate("strange." + ID) + "]"));
        }

    }
 
开发者ID:lucidagrande,项目名称:statclock,代码行数:17,代码来源:EventStatclock.java

示例3: middleClick

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void middleClick(Entity entityHit)
{
	if(entityHit == null || !(entityHit instanceof EntityPlayer))
		return;
	
	if(!WurstClient.INSTANCE.options.middleClickFriends)
		return;
	
	String name = entityHit.getName();
	
	if(WurstClient.INSTANCE.friends.contains(name))
		WurstClient.INSTANCE.friends.remove(name);
	else
		WurstClient.INSTANCE.friends.add(name);
	
	ConfigFiles.FRIENDS.save();
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:18,代码来源:FriendsList.java

示例4: processCommand

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 1)
    {
        throw new WrongUsageException("commands.testfor.usage", new Object[0]);
    }
    else
    {
        Entity entity = func_175768_b(sender, args[0]);
        NBTTagCompound nbttagcompound = null;

        if (args.length >= 2)
        {
            try
            {
                nbttagcompound = JsonToNBT.getTagFromJson(buildString(args, 1));
            }
            catch (NBTException nbtexception)
            {
                throw new CommandException("commands.testfor.tagError", new Object[] {nbtexception.getMessage()});
            }
        }

        if (nbttagcompound != null)
        {
            NBTTagCompound nbttagcompound1 = new NBTTagCompound();
            entity.writeToNBT(nbttagcompound1);

            if (!NBTUtil.func_181123_a(nbttagcompound, nbttagcompound1, true))
            {
                throw new CommandException("commands.testfor.failure", new Object[] {entity.getName()});
            }
        }

        notifyOperators(sender, this, "commands.testfor.success", new Object[] {entity.getName()});
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:41,代码来源:CommandTestFor.java

示例5: giveTeamKillScores

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private Collection<ScoreObjective> giveTeamKillScores(Entity p_175137_1_)
{
    String s = p_175137_1_ instanceof EntityPlayer ? p_175137_1_.getName() : p_175137_1_.getCachedUniqueIdString();
    ScorePlayerTeam scoreplayerteam = this.getWorldScoreboard().getPlayersTeam(this.getName());

    if (scoreplayerteam != null)
    {
        int i = scoreplayerteam.getChatFormat().getColorIndex();

        if (i >= 0 && i < IScoreCriteria.KILLED_BY_TEAM.length)
        {
            for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreCriteria.KILLED_BY_TEAM[i]))
            {
                Score score = this.getWorldScoreboard().getOrCreateScore(s, scoreobjective);
                score.incrementScore();
            }
        }
    }

    ScorePlayerTeam scoreplayerteam1 = this.getWorldScoreboard().getPlayersTeam(s);

    if (scoreplayerteam1 != null)
    {
        int j = scoreplayerteam1.getChatFormat().getColorIndex();

        if (j >= 0 && j < IScoreCriteria.TEAM_KILL.length)
        {
            return this.getWorldScoreboard().getObjectivesFromCriteria(IScoreCriteria.TEAM_KILL[j]);
        }
    }

    return Lists.<ScoreObjective>newArrayList();
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:34,代码来源:EntityPlayer.java

示例6: entityScoreMatch

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
protected boolean entityScoreMatch(Entity entityIn, Scoreboard scoreboardIn, String objectiveStr, RandomValueRange rand)
{
    ScoreObjective scoreobjective = scoreboardIn.getObjective(objectiveStr);

    if (scoreobjective == null)
    {
        return false;
    }
    else
    {
        String s = entityIn instanceof EntityPlayerMP ? entityIn.getName() : entityIn.getCachedUniqueIdString();
        return !scoreboardIn.entityHasObjective(s, scoreobjective) ? false : rand.isInRange(scoreboardIn.getOrCreateScore(s, scoreobjective).getScorePoints());
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:EntityHasScore.java

示例7: execute

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 1)
    {
        throw new WrongUsageException("commands.testfor.usage", new Object[0]);
    }
    else
    {
        Entity entity = getEntity(server, sender, args[0]);
        NBTTagCompound nbttagcompound = null;

        if (args.length >= 2)
        {
            try
            {
                nbttagcompound = JsonToNBT.getTagFromJson(buildString(args, 1));
            }
            catch (NBTException nbtexception)
            {
                throw new CommandException("commands.testfor.tagError", new Object[] {nbtexception.getMessage()});
            }
        }

        if (nbttagcompound != null)
        {
            NBTTagCompound nbttagcompound1 = entityToNBT(entity);

            if (!NBTUtil.areNBTEquals(nbttagcompound, nbttagcompound1, true))
            {
                throw new CommandException("commands.testfor.failure", new Object[] {entity.getName()});
            }
        }

        notifyCommandListener(sender, this, "commands.testfor.success", new Object[] {entity.getName()});
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:CommandTestFor.java

示例8: processComponent

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static IChatComponent processComponent(ICommandSender commandSender, IChatComponent component, Entity entityIn) throws CommandException
{
    IChatComponent ichatcomponent = null;

    if (component instanceof ChatComponentScore)
    {
        ChatComponentScore chatcomponentscore = (ChatComponentScore)component;
        String s = chatcomponentscore.getName();

        if (PlayerSelector.hasArguments(s))
        {
            List<Entity> list = PlayerSelector.<Entity>matchEntities(commandSender, s, Entity.class);

            if (list.size() != 1)
            {
                throw new EntityNotFoundException();
            }

            s = ((Entity)list.get(0)).getName();
        }

        ichatcomponent = entityIn != null && s.equals("*") ? new ChatComponentScore(entityIn.getName(), chatcomponentscore.getObjective()) : new ChatComponentScore(s, chatcomponentscore.getObjective());
        ((ChatComponentScore)ichatcomponent).setValue(chatcomponentscore.getUnformattedTextForChat());
    }
    else if (component instanceof ChatComponentSelector)
    {
        String s1 = ((ChatComponentSelector)component).getSelector();
        ichatcomponent = PlayerSelector.matchEntitiesToChatComponent(commandSender, s1);

        if (ichatcomponent == null)
        {
            ichatcomponent = new ChatComponentText("");
        }
    }
    else if (component instanceof ChatComponentText)
    {
        ichatcomponent = new ChatComponentText(((ChatComponentText)component).getChatComponentText_TextValue());
    }
    else
    {
        if (!(component instanceof ChatComponentTranslation))
        {
            return component;
        }

        Object[] aobject = ((ChatComponentTranslation)component).getFormatArgs();

        for (int i = 0; i < aobject.length; ++i)
        {
            Object object = aobject[i];

            if (object instanceof IChatComponent)
            {
                aobject[i] = processComponent(commandSender, (IChatComponent)object, entityIn);
            }
        }

        ichatcomponent = new ChatComponentTranslation(((ChatComponentTranslation)component).getKey(), aobject);
    }

    ChatStyle chatstyle = component.getChatStyle();

    if (chatstyle != null)
    {
        ichatcomponent.setChatStyle(chatstyle.createShallowCopy());
    }

    for (IChatComponent ichatcomponent1 : component.getSiblings())
    {
        ichatcomponent.appendSibling(processComponent(commandSender, ichatcomponent1, entityIn));
    }

    return ichatcomponent;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:75,代码来源:ChatComponentProcessor.java

示例9: drawEntityTags

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void drawEntityTags(float partialTicks){
    /* ENTITIES */
    for(Map.Entry<Entity, String> e : ENTITY_NANO.entrySet()){
        GL11.glPushMatrix();

        Entity entity = e.getKey();
        double pXe;
        double pYe;
        double pZe;

        if(entity.isDead) {
            pXe = entity.posX;
            pYe = entity.posY;
            pZe = entity.posZ;
        }else{
            pXe = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
            pYe = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks;
            pZe = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
        }

        GL11.glTranslated(pXe, pYe + 2.3D, pZe);
        GL11.glRotated(-RENDER_MANAGER.playerViewY, 0.0, 1.0, 0.0);
        GL11.glRotated(RENDER_MANAGER.playerViewX, 1.0, 0.0, 0.0);
        /* Flip it! */
        GL11.glScaled(-0.015, -0.015, 0.015);


        double[] c = Graphical.heatToColor(ENTITY_HEAT.get(entity));
        GL11.glColor4d(c[0],c[1],c[2], 0.6);


        GL11.glBegin(GL11.GL_QUADS);
        String text = e.getValue();
        if(entity.isDead){
            text = text + " (" + entity.getName() + ")";
        }
        int width_plus_2 = FONT_RENDERER.getStringWidth(text) + 2;
        int height_div_2_plus_1 = (FONT_RENDERER.FONT_HEIGHT/2) + 1;
        GL11.glVertex3d(0           ,-height_div_2_plus_1,0);
        GL11.glVertex3d(0           , height_div_2_plus_1 - 1,0);
        GL11.glVertex3d(width_plus_2, height_div_2_plus_1 - 1,0);
        GL11.glVertex3d(width_plus_2,-height_div_2_plus_1,0);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glColor4d(0,0,0,1);

        FONT_RENDERER.drawString(text, 1, -FONT_RENDERER.FONT_HEIGHT/2, 0x000000);

        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPopMatrix();
    }
}
 
开发者ID:TerminatorNL,项目名称:LagGoggles,代码行数:53,代码来源:LagOverlayGui.java

示例10: renderTag

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void renderTag(Entity entity, double x, double y, double z) {
    String name = entity.getName();
    if(Wrapper.getFriends().isFriend(name)) {
    	name = "\2479" + name;
    }
    if (entity instanceof EntityLivingBase) {
    name = name + " \247a" + ((double)Math.round((((EntityLivingBase) entity).getHealth() * 100) / 100) / 2);
    }
    
    for(Friend friend: Wrapper.getFriends().friendsList) {
    	name.replace(friend.getName(), friend.getAlias());
    }
    float var13 = 1.6F;
    float var14 = (float) (0.016666668F * (Wrapper.getPlayer().getDistanceToEntity(entity)) / 2);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x, (float) y + entity.height + 0.5F, (float) z);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-RenderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(RenderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(-var14, -var14, var14);
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_LIGHTING);
    Tessellator var15 = Tessellator.getInstance();
    VertexBuffer vertexbuffer = var15.getBuffer();
    int var16 = (int) -Wrapper.getPlayer().getDistanceToEntity(entity) / (int) var13;
    if (entity.isSneaking()) {
        var16 += 4;
    } else if (var16 < -14) {
        var16 = -14;
    }

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    int var17 = Fonts.roboto18.getStringWidth(name) / 2;
    RenderUtils.drawBorderedRect(-var17 - 2, var16, var17 + 2, 11 + var16, 0.5F, 0xFF000000, 0x80000000);

    Fonts.roboto18.drawStringWithShadow(name, -var17, var16, 0xFFFFFF);
    
    Wrapper.getMinecraft().entityRenderer.disableLightmap();
    GL11.glLineWidth(1.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    
    GL11.glPopMatrix();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:49,代码来源:Nametags.java


注:本文中的net.minecraft.entity.Entity.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。