本文整理汇总了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();
}
示例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());
}
}
示例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);
}
}
示例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;
}