當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。