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


Java Entity.getCachedUniqueIdString方法代码示例

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


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

示例1: 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

示例2: 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

示例3: removeEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void removeEntity(Entity entityIn)
{
    if (entityIn != null && !(entityIn instanceof EntityPlayer) && !entityIn.isEntityAlive())
    {
        String s = entityIn.getCachedUniqueIdString();
        this.removeObjectiveFromEntity(s, (ScoreObjective)null);
        this.removePlayerFromTeams(s);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:Scoreboard.java

示例4: executeCommand

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Attempt to execute a command. This method should return the number of times that the command was executed. If the
 * command does not exist or if the player does not have permission, 0 will be returned. A number greater than 1 can
 * be returned if a player selector is used.
 */
public int executeCommand(ICommandSender sender, String rawCommand)
{
    rawCommand = rawCommand.trim();

    if (rawCommand.startsWith("/"))
    {
        rawCommand = rawCommand.substring(1);
    }

    String[] astring = rawCommand.split(" ");
    String s = astring[0];
    astring = dropFirstString(astring);
    ICommand icommand = (ICommand)this.commandMap.get(s);
    int i = this.getUsernameIndex(icommand, astring);
    int j = 0;

    if (icommand == null)
    {
        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.notFound", new Object[0]);
        textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
        sender.addChatMessage(textcomponenttranslation);
    }
    else if (icommand.checkPermission(this.getServer(), sender))
    {
        net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, sender, astring);
        if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
        {
            if (event.getException() != null)
            {
                com.google.common.base.Throwables.propagateIfPossible(event.getException());
            }
            return 1;
        }
        if (event.getParameters() != null) astring = event.getParameters();

        if (i > -1)
        {
            List<Entity> list = EntitySelector.<Entity>matchEntities(sender, astring[i], Entity.class);
            String s1 = astring[i];
            sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size());

            for (Entity entity : list)
            {
                astring[i] = entity.getCachedUniqueIdString();

                if (this.tryExecute(sender, astring, icommand, rawCommand))
                {
                    ++j;
                }
            }

            astring[i] = s1;
        }
        else
        {
            sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, 1);

            if (this.tryExecute(sender, astring, icommand, rawCommand))
            {
                ++j;
            }
        }
    }
    else
    {
        TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.generic.permission", new Object[0]);
        textcomponenttranslation1.getStyle().setColor(TextFormatting.RED);
        sender.addChatMessage(textcomponenttranslation1);
    }

    sender.setCommandStat(CommandResultStats.Type.SUCCESS_COUNT, j);
    return j;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:79,代码来源:CommandHandler.java


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