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


Java Score.setScorePoints方法代码示例

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


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

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

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

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

示例4: func_147197_m

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
protected void func_147197_m(ICommandSender p_147197_1_, String[] p_147197_2_, int p_147197_3_)
{
    String s = p_147197_2_[p_147197_3_ - 1];
    String s1 = func_96332_d(p_147197_1_, p_147197_2_[p_147197_3_++]);
    ScoreObjective scoreobjective = this.func_147189_a(p_147197_2_[p_147197_3_++], true);
    int j = s.equalsIgnoreCase("set") ? parseInt(p_147197_1_, p_147197_2_[p_147197_3_++]) : parseIntWithMin(p_147197_1_, p_147197_2_[p_147197_3_++], 1);
    Scoreboard scoreboard = this.func_147192_d();
    Score score = scoreboard.func_96529_a(s1, scoreobjective);

    if (s.equalsIgnoreCase("set"))
    {
        score.setScorePoints(j);
    }
    else if (s.equalsIgnoreCase("add"))
    {
        score.increseScore(j);
    }
    else
    {
        score.decreaseScore(j);
    }

    func_152373_a(p_147197_1_, this, "commands.scoreboard.players.set.success", new Object[] {scoreobjective.getName(), s1, Integer.valueOf(score.getScorePoints())});
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:25,代码来源:CommandScoreboard.java

示例5: updateScorePoints

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
private void updateScorePoints(IScoreCriteria criteria, int points)
{
    for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(criteria))
    {
        Score score = this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective);
        score.setScorePoints(points);
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:9,代码来源:EntityPlayerMP.java

示例6: handleUpdateScore

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
public void handleUpdateScore(S3CPacketUpdateScore p_147250_1_)
{
    Scoreboard scoreboard = this.clientWorldController.getScoreboard();
    ScoreObjective scoreobjective = scoreboard.getObjective(p_147250_1_.func_149321_d());

    if (p_147250_1_.func_149322_f() == 0)
    {
        Score score = scoreboard.func_96529_a(p_147250_1_.func_149324_c(), scoreobjective);
        score.setScorePoints(p_147250_1_.func_149323_e());
    }
    else if (p_147250_1_.func_149322_f() == 1)
    {
        scoreboard.func_96515_c(p_147250_1_.func_149324_c());
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:16,代码来源:NetHandlerPlayClient.java

示例7: func_179672_a

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

示例8: setPlayer

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
protected void setPlayer(ICommandSender p_147197_1_, String[] p_147197_2_, int p_147197_3_) throws CommandException
{
    String s = p_147197_2_[p_147197_3_ - 1];
    int i = p_147197_3_;
    String s1 = getEntityName(p_147197_1_, p_147197_2_[p_147197_3_++]);

    if (s1.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s1, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_147197_2_[p_147197_3_++], true);
        int j = s.equalsIgnoreCase("set") ? parseInt(p_147197_2_[p_147197_3_++]) : parseInt(p_147197_2_[p_147197_3_++], 0);

        if (p_147197_2_.length > p_147197_3_)
        {
            Entity entity = func_175768_b(p_147197_1_, p_147197_2_[i]);

            try
            {
                NBTTagCompound nbttagcompound = JsonToNBT.getTagFromJson(buildString(p_147197_2_, p_147197_3_));
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                entity.writeToNBT(nbttagcompound1);

                if (!NBTUtil.func_181123_a(nbttagcompound, nbttagcompound1, true))
                {
                    throw new CommandException("commands.scoreboard.players.set.tagMismatch", new Object[] {s1});
                }
            }
            catch (NBTException nbtexception)
            {
                throw new CommandException("commands.scoreboard.players.set.tagError", new Object[] {nbtexception.getMessage()});
            }
        }

        Scoreboard scoreboard = this.getScoreboard();
        Score score = scoreboard.getValueFromObjective(s1, scoreobjective);

        if (s.equalsIgnoreCase("set"))
        {
            score.setScorePoints(j);
        }
        else if (s.equalsIgnoreCase("add"))
        {
            score.increseScore(j);
        }
        else
        {
            score.decreaseScore(j);
        }

        notifyOperators(p_147197_1_, this, "commands.scoreboard.players.set.success", new Object[] {scoreobjective.getName(), s1, Integer.valueOf(score.getScorePoints())});
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:56,代码来源:CommandScoreboard.java

示例9: addPlayerScore

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
protected void addPlayerScore(ICommandSender sender, String[] p_184918_2_, int p_184918_3_, MinecraftServer server) throws CommandException
{
    String s = p_184918_2_[p_184918_3_ - 1];
    int i = p_184918_3_;
    String s1 = getEntityName(server, sender, p_184918_2_[p_184918_3_++]);

    if (s1.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s1, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184918_2_[p_184918_3_++], true, server);
        int j = "set".equalsIgnoreCase(s) ? parseInt(p_184918_2_[p_184918_3_++]) : parseInt(p_184918_2_[p_184918_3_++], 0);

        if (p_184918_2_.length > p_184918_3_)
        {
            Entity entity = getEntity(server, sender, p_184918_2_[i]);

            try
            {
                NBTTagCompound nbttagcompound = JsonToNBT.getTagFromJson(buildString(p_184918_2_, p_184918_3_));
                NBTTagCompound nbttagcompound1 = entityToNBT(entity);

                if (!NBTUtil.areNBTEquals(nbttagcompound, nbttagcompound1, true))
                {
                    throw new CommandException("commands.scoreboard.players.set.tagMismatch", new Object[] {s1});
                }
            }
            catch (NBTException nbtexception)
            {
                throw new CommandException("commands.scoreboard.players.set.tagError", new Object[] {nbtexception.getMessage()});
            }
        }

        Scoreboard scoreboard = this.getScoreboard(server);
        Score score = scoreboard.getOrCreateScore(s1, scoreobjective);

        if ("set".equalsIgnoreCase(s))
        {
            score.setScorePoints(j);
        }
        else if ("add".equalsIgnoreCase(s))
        {
            score.increaseScore(j);
        }
        else
        {
            score.decreaseScore(j);
        }

        notifyCommandListener(sender, this, "commands.scoreboard.players.set.success", new Object[] {scoreobjective.getName(), s1, Integer.valueOf(score.getScorePoints())});
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:55,代码来源:CommandScoreboard.java

示例10: execute

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 3)
    {
        throw new WrongUsageException("commands.trigger.usage", new Object[0]);
    }
    else
    {
        EntityPlayerMP entityplayermp;

        if (sender instanceof EntityPlayerMP)
        {
            entityplayermp = (EntityPlayerMP)sender;
        }
        else
        {
            Entity entity = sender.getCommandSenderEntity();

            if (!(entity instanceof EntityPlayerMP))
            {
                throw new CommandException("commands.trigger.invalidPlayer", new Object[0]);
            }

            entityplayermp = (EntityPlayerMP)entity;
        }

        Scoreboard scoreboard = server.worldServerForDimension(0).getScoreboard();
        ScoreObjective scoreobjective = scoreboard.getObjective(args[0]);

        if (scoreobjective != null && scoreobjective.getCriteria() == IScoreCriteria.TRIGGER)
        {
            int i = parseInt(args[2]);

            if (!scoreboard.entityHasObjective(entityplayermp.getName(), scoreobjective))
            {
                throw new CommandException("commands.trigger.invalidObjective", new Object[] {args[0]});
            }
            else
            {
                Score score = scoreboard.getOrCreateScore(entityplayermp.getName(), scoreobjective);

                if (score.isLocked())
                {
                    throw new CommandException("commands.trigger.disabled", new Object[] {args[0]});
                }
                else
                {
                    if ("set".equals(args[1]))
                    {
                        score.setScorePoints(i);
                    }
                    else
                    {
                        if (!"add".equals(args[1]))
                        {
                            throw new CommandException("commands.trigger.invalidMode", new Object[] {args[1]});
                        }

                        score.increaseScore(i);
                    }

                    score.setLocked(true);

                    if (entityplayermp.interactionManager.isCreative())
                    {
                        notifyCommandListener(sender, this, "commands.trigger.success", new Object[] {args[0], args[1], args[2]});
                    }
                }
            }
        }
        else
        {
            throw new CommandException("commands.trigger.invalidObjective", new Object[] {args[0]});
        }
    }
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:80,代码来源:CommandTrigger.java


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