本文整理汇总了Java中net.minecraft.scoreboard.Scoreboard.entityHasObjective方法的典型用法代码示例。如果您正苦于以下问题:Java Scoreboard.entityHasObjective方法的具体用法?Java Scoreboard.entityHasObjective怎么用?Java Scoreboard.entityHasObjective使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.scoreboard.Scoreboard
的用法示例。
在下文中一共展示了Scoreboard.entityHasObjective方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUnformattedTextForChat
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
/**
* Gets the text of this component, without any special formatting codes added, for chat. TODO: why is this two
* different methods?
*/
public String getUnformattedTextForChat()
{
MinecraftServer minecraftserver = MinecraftServer.getServer();
if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value))
{
Scoreboard scoreboard = minecraftserver.worldServerForDimension(0).getScoreboard();
ScoreObjective scoreobjective = scoreboard.getObjective(this.objective);
if (scoreboard.entityHasObjective(this.name, scoreobjective))
{
Score score = scoreboard.getValueFromObjective(this.name, scoreobjective);
this.setValue(String.format("%d", new Object[] {Integer.valueOf(score.getScorePoints())}));
}
else
{
this.value = "";
}
}
return this.value;
}
示例2: resolve
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
public void resolve(ICommandSender sender)
{
MinecraftServer minecraftserver = sender.getServer();
if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value))
{
Scoreboard scoreboard = minecraftserver.worldServerForDimension(0).getScoreboard();
ScoreObjective scoreobjective = scoreboard.getObjective(this.objective);
if (scoreboard.entityHasObjective(this.name, scoreobjective))
{
Score score = scoreboard.getOrCreateScore(this.name, scoreobjective);
this.setValue(String.format("%d", new Object[] {Integer.valueOf(score.getScorePoints())}));
}
else
{
this.value = "";
}
}
}
示例3: resolve
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
public void resolve(ICommandSender sender)
{
MinecraftServer minecraftserver = sender.getServer();
if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value))
{
Scoreboard scoreboard = minecraftserver.worldServerForDimension(0).getScoreboard();
ScoreObjective scoreobjective = scoreboard.getObjective(this.objective);
if (scoreboard.entityHasObjective(this.name, scoreobjective))
{
Score score = scoreboard.getOrCreateScore(this.name, scoreobjective);
this.setValue(String.format("%d", new Object[] {Integer.valueOf(score.getScorePoints())}));
return;
}
}
this.value = "";
}
示例4: func_175781_o
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void func_175781_o(ICommandSender p_175781_1_, String[] p_175781_2_, int p_175781_3_) throws CommandException
{
Scoreboard scoreboard = this.getScoreboard();
String s = getEntityName(p_175781_1_, p_175781_2_[p_175781_3_++]);
if (s.length() > 40)
{
throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
}
else
{
ScoreObjective scoreobjective = this.getObjective(p_175781_2_[p_175781_3_++], false);
if (!scoreboard.entityHasObjective(s, scoreobjective))
{
throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s});
}
else
{
int i = p_175781_2_[p_175781_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_175781_2_[p_175781_3_]);
++p_175781_3_;
int j = p_175781_3_ < p_175781_2_.length && !p_175781_2_[p_175781_3_].equals("*") ? parseInt(p_175781_2_[p_175781_3_], i) : Integer.MAX_VALUE;
Score score = scoreboard.getValueFromObjective(s, scoreobjective);
if (score.getScorePoints() >= i && score.getScorePoints() <= j)
{
notifyOperators(p_175781_1_, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
}
else
{
throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
}
}
}
}
示例5: entityScoreMatch
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的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());
}
}
示例6: testPlayerScore
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void testPlayerScore(ICommandSender sender, String[] p_184907_2_, int p_184907_3_, MinecraftServer server) throws CommandException
{
Scoreboard scoreboard = this.getScoreboard(server);
String s = getEntityName(server, sender, p_184907_2_[p_184907_3_++]);
if (s.length() > 40)
{
throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
}
else
{
ScoreObjective scoreobjective = this.convertToObjective(p_184907_2_[p_184907_3_++], false, server);
if (!scoreboard.entityHasObjective(s, scoreobjective))
{
throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s});
}
else
{
int i = p_184907_2_[p_184907_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_184907_2_[p_184907_3_]);
++p_184907_3_;
int j = p_184907_3_ < p_184907_2_.length && !p_184907_2_[p_184907_3_].equals("*") ? parseInt(p_184907_2_[p_184907_3_], i) : Integer.MAX_VALUE;
Score score = scoreboard.getOrCreateScore(s, scoreobjective);
if (score.getScorePoints() >= i && score.getScorePoints() <= j)
{
notifyCommandListener(sender, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
}
else
{
throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
}
}
}
}
示例7: func_179672_a
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
public void func_179672_a(final ICommandSender sender, CommandResultStats.Type resultTypeIn, int p_179672_3_)
{
String s = this.field_179675_c[resultTypeIn.getTypeID()];
if (s != null)
{
ICommandSender icommandsender = new ICommandSender()
{
public String getName()
{
return sender.getName();
}
public IChatComponent getDisplayName()
{
return sender.getDisplayName();
}
public void addChatMessage(IChatComponent component)
{
sender.addChatMessage(component);
}
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
return true;
}
public BlockPos getPosition()
{
return sender.getPosition();
}
public Vec3 getPositionVector()
{
return sender.getPositionVector();
}
public World getEntityWorld()
{
return sender.getEntityWorld();
}
public Entity getCommandSenderEntity()
{
return sender.getCommandSenderEntity();
}
public boolean sendCommandFeedback()
{
return sender.sendCommandFeedback();
}
public void setCommandStat(CommandResultStats.Type type, int amount)
{
sender.setCommandStat(type, amount);
}
};
String s1;
try
{
s1 = CommandBase.getEntityName(icommandsender, s);
}
catch (EntityNotFoundException var11)
{
return;
}
String s2 = this.field_179673_d[resultTypeIn.getTypeID()];
if (s2 != null)
{
Scoreboard scoreboard = sender.getEntityWorld().getScoreboard();
ScoreObjective scoreobjective = scoreboard.getObjective(s2);
if (scoreobjective != null)
{
if (scoreboard.entityHasObjective(s1, scoreobjective))
{
Score score = scoreboard.getValueFromObjective(s1, scoreobjective);
score.setScorePoints(p_179672_3_);
}
}
}
}
}