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


Java Score类代码示例

本文整理汇总了Java中net.minecraft.scoreboard.Score的典型用法代码示例。如果您正苦于以下问题:Java Score类的具体用法?Java Score怎么用?Java Score使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addToPlayerScore

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
/**
 * Adds a value to the player score. Currently not actually used and the entity passed in does nothing. Args:
 * entity, scoreToAdd
 */
public void addToPlayerScore(Entity entityIn, int amount)
{
    this.addScore(amount);
    Collection<ScoreObjective> collection = this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.totalKillCount);

    if (entityIn instanceof EntityPlayer)
    {
        this.triggerAchievement(StatList.playerKillsStat);
        collection.addAll(this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.playerKillCount));
        collection.addAll(this.func_175137_e(entityIn));
    }
    else
    {
        this.triggerAchievement(StatList.mobKillsStat);
    }

    for (ScoreObjective scoreobjective : collection)
    {
        Score score = this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective);
        score.func_96648_a();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:EntityPlayer.java

示例2: getUnformattedTextForChat

import net.minecraft.scoreboard.Score; //导入依赖的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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:ChatComponentScore.java

示例3: func_175779_n

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
protected void func_175779_n(ICommandSender p_175779_1_, String[] p_175779_2_, int p_175779_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getPlayerName(p_175779_1_, p_175779_2_[p_175779_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_175779_2_[p_175779_3_], false);

        if (scoreobjective.getCriteria() != IScoreObjectiveCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);
            score.setLocked(false);
            notifyOperators(p_175779_1_, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:CommandScoreboard.java

示例4: handleUpdateScore

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
/**
 * Either updates the score with a specified value or removes the score for an objective
 */
public void handleUpdateScore(S3CPacketUpdateScore packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Scoreboard scoreboard = this.clientWorldController.getScoreboard();
    ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName());

    if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.CHANGE)
    {
        Score score = scoreboard.getValueFromObjective(packetIn.getPlayerName(), scoreobjective);
        score.setScorePoints(packetIn.getScoreValue());
    }
    else if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.REMOVE)
    {
        if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName()))
        {
            scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective)null);
        }
        else if (scoreobjective != null)
        {
            scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:NetHandlerPlayClient.java

示例5: renderOffsetLivingLabel

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
protected void renderOffsetLivingLabel(AbstractClientPlayer entityIn, double x, double y, double z, String str, float p_177069_9_, double p_177069_10_)
{
    if (p_177069_10_ < 100.0D)
    {
        Scoreboard scoreboard = entityIn.getWorldScoreboard();
        ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2);

        if (scoreobjective != null)
        {
            Score score = scoreboard.getValueFromObjective(entityIn.getName(), scoreobjective);
            this.renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName(), x, y, z, 64);
            y += (double)((float)this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * p_177069_9_);
        }
    }

    super.renderOffsetLivingLabel(entityIn, x, y, z, str, p_177069_9_, p_177069_10_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:RenderPlayer.java

示例6: handleUpdateScore

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
/**
 * Either updates the score with a specified value or removes the score for an
 * objective
 */
public void handleUpdateScore(S3CPacketUpdateScore packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
	Scoreboard scoreboard = this.clientWorldController.getScoreboard();
	ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName());

	if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.CHANGE) {
		Score score = scoreboard.getValueFromObjective(packetIn.getPlayerName(), scoreobjective);
		score.setScorePoints(packetIn.getScoreValue());
	} else if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.REMOVE) {
		if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName())) {
			scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective) null);
		} else if (scoreobjective != null) {
			scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective);
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:NetHandlerPlayClient.java

示例7: handleUpdateScore

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
/**
 * Either updates the score with a specified value or removes the score for an objective
 */
public void handleUpdateScore(SPacketUpdateScore packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Scoreboard scoreboard = this.clientWorldController.getScoreboard();
    ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName());

    if (packetIn.getScoreAction() == SPacketUpdateScore.Action.CHANGE)
    {
        Score score = scoreboard.getOrCreateScore(packetIn.getPlayerName(), scoreobjective);
        score.setScorePoints(packetIn.getScoreValue());
    }
    else if (packetIn.getScoreAction() == SPacketUpdateScore.Action.REMOVE)
    {
        if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName()))
        {
            scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective)null);
        }
        else if (scoreobjective != null)
        {
            scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective);
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:27,代码来源:NetHandlerPlayClient.java

示例8: renderEntityName

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
protected void renderEntityName(AbstractClientPlayer entityIn, double x, double y, double z, String name, double distanceSq)
{
    if (distanceSq < 100.0D)
    {
        Scoreboard scoreboard = entityIn.getWorldScoreboard();
        ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2);

        if (scoreobjective != null)
        {
            Score score = scoreboard.getOrCreateScore(entityIn.getName(), scoreobjective);
            this.renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName(), x, y, z, 64);
            y += (double)((float)this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.025F);
        }
    }

    super.renderEntityName(entityIn, x, y, z, name, distanceSq);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:RenderPlayer.java

示例9: resolve

import net.minecraft.scoreboard.Score; //导入依赖的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 = "";
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:TextComponentScore.java

示例10: enablePlayerTrigger

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
protected void enablePlayerTrigger(ICommandSender sender, String[] p_184914_2_, int p_184914_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getPlayerName(server, sender, p_184914_2_[p_184914_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_184914_2_[p_184914_3_], false, server);

        if (scoreobjective.getCriteria() != IScoreCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getOrCreateScore(s, scoreobjective);
            score.setLocked(false);
            notifyCommandListener(sender, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:CommandScoreboard.java

示例11: resolve

import net.minecraft.scoreboard.Score; //导入依赖的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 = "";
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:TextComponentScore.java

示例12: addToPlayerScore

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
public void addToPlayerScore(Entity p_70084_1_, int p_70084_2_)
{
	addScore(p_70084_2_);
	Collection collection = getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.totalKillCount);
	if ((p_70084_1_ instanceof EntityPlayer))
	{
		addStat(StatList.playerKillsStat, 1);
		collection.addAll(getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.playerKillCount));
	}
	else
	{
		addStat(StatList.mobKillsStat, 1);
	}
	Iterator iterator = collection.iterator();
	while (iterator.hasNext())
	{
		ScoreObjective scoreobjective = (ScoreObjective)iterator.next();
		Score score = getWorldScoreboard().func_96529_a(getCommandSenderName(), scoreobjective);
		score.func_96648_a();
	}
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:22,代码来源:EntityPlayer.java

示例13: func_96449_a

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
protected void func_96449_a(AbstractClientPlayer p_96449_1_, double p_96449_2_, double p_96449_4_, double p_96449_6_, String p_96449_8_, float p_96449_9_, double p_96449_10_)
{
    if (p_96449_10_ < 100.0D)
    {
        Scoreboard scoreboard = p_96449_1_.getWorldScoreboard();
        ScoreObjective scoreobjective = scoreboard.func_96539_a(2);

        if (scoreobjective != null)
        {
            Score score = scoreboard.func_96529_a(p_96449_1_.getCommandSenderName(), scoreobjective);

            if (p_96449_1_.isPlayerSleeping())
            {
                this.func_147906_a(p_96449_1_, score.getScorePoints() + " " + scoreobjective.getDisplayName(), p_96449_2_, p_96449_4_ - 1.5D, p_96449_6_, 64);
            }
            else
            {
                this.func_147906_a(p_96449_1_, score.getScorePoints() + " " + scoreobjective.getDisplayName(), p_96449_2_, p_96449_4_, p_96449_6_, 64);
            }

            p_96449_4_ += (double)((float)this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * p_96449_9_);
        }
    }

    super.func_96449_a(p_96449_1_, p_96449_2_, p_96449_4_, p_96449_6_, p_96449_8_, p_96449_9_, p_96449_10_);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:27,代码来源:RenderPlayer.java

示例14: renderEntityName

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
@Override
protected void renderEntityName(AbstractClientPlayer entityIn, double x, double y, double z, String name, double p_188296_9_)
   {
       if (p_188296_9_ < 100.0D)
       {
           Scoreboard scoreboard = entityIn.getWorldScoreboard();
           ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2);

           if (scoreobjective != null)
           {
               Score score = scoreboard.getOrCreateScore(getFakeUsername(entityIn), scoreobjective);
               this.renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName(), x, y, z, 64);
               y += this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.025F;
           }
       }

       this.renderLivingLabel(entityIn, name, x, y, z, 64);
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:19,代码来源:RenderMiniPlayer.java

示例15: processCommand

import net.minecraft.scoreboard.Score; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void processCommand(ICommandSender player, String[] args) {
  if (args.length < 2) {
    throw new WrongUsageException("This command requires 2 args: <board> <name>");
  }

  Scoreboard board = player.getEntityWorld().getScoreboard();

  ScoreObjective obj = board.getObjective(args[0]);

  if (obj == null) {
    player.addChatMessage(new ChatComponentText("No such board " + args[0]));
  }

  Collection<Score> collection = board.func_96534_i(obj);

  for (Score score : collection) {
    if (score.getPlayerName().equals(args[1])) {
      player.addChatMessage(new ChatComponentText(args[1] + "'s score on board \"" + args[0] + "\": " + score.getScorePoints()));
      return;
    }
  }

  player.addChatMessage(new ChatComponentText("No score for " + args[1] + " on board \"" + args[0] + "\""));
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:27,代码来源:CommandScoreboardInfo.java


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