本文整理汇总了Java中net.minecraft.scoreboard.Scoreboard.addScoreObjective方法的典型用法代码示例。如果您正苦于以下问题:Java Scoreboard.addScoreObjective方法的具体用法?Java Scoreboard.addScoreObjective怎么用?Java Scoreboard.addScoreObjective使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.scoreboard.Scoreboard
的用法示例。
在下文中一共展示了Scoreboard.addScoreObjective方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleScoreboardObjective
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
/**
* May create a scoreboard objective, remove an objective from the scoreboard or
* update an objectives' displayname
*/
public void handleScoreboardObjective(S3BPacketScoreboardObjective packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Scoreboard scoreboard = this.clientWorldController.getScoreboard();
if (packetIn.func_149338_e() == 0) {
ScoreObjective scoreobjective = scoreboard.addScoreObjective(packetIn.func_149339_c(),
IScoreObjectiveCriteria.DUMMY);
scoreobjective.setDisplayName(packetIn.func_149337_d());
scoreobjective.setRenderType(packetIn.func_179817_d());
} else {
ScoreObjective scoreobjective1 = scoreboard.getObjective(packetIn.func_149339_c());
if (packetIn.func_149338_e() == 1) {
scoreboard.removeObjective(scoreobjective1);
} else if (packetIn.func_149338_e() == 2) {
scoreobjective1.setDisplayName(packetIn.func_149337_d());
scoreobjective1.setRenderType(packetIn.func_179817_d());
}
}
}
示例2: handleScoreboardObjective
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
/**
* May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname
*/
public void handleScoreboardObjective(S3BPacketScoreboardObjective packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Scoreboard scoreboard = this.clientWorldController.getScoreboard();
if (packetIn.func_149338_e() == 0)
{
ScoreObjective scoreobjective = scoreboard.addScoreObjective(packetIn.func_149339_c(), IScoreObjectiveCriteria.DUMMY);
scoreobjective.setDisplayName(packetIn.func_149337_d());
scoreobjective.setRenderType(packetIn.func_179817_d());
}
else
{
ScoreObjective scoreobjective1 = scoreboard.getObjective(packetIn.func_149339_c());
if (packetIn.func_149338_e() == 1)
{
scoreboard.removeObjective(scoreobjective1);
}
else if (packetIn.func_149338_e() == 2)
{
scoreobjective1.setDisplayName(packetIn.func_149337_d());
scoreobjective1.setRenderType(packetIn.func_179817_d());
}
}
}
示例3: handleScoreboardObjective
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
/**
* May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname
*/
public void handleScoreboardObjective(SPacketScoreboardObjective packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Scoreboard scoreboard = this.clientWorldController.getScoreboard();
if (packetIn.getAction() == 0)
{
ScoreObjective scoreobjective = scoreboard.addScoreObjective(packetIn.getObjectiveName(), IScoreCriteria.DUMMY);
scoreobjective.setDisplayName(packetIn.getObjectiveValue());
scoreobjective.setRenderType(packetIn.getRenderType());
}
else
{
ScoreObjective scoreobjective1 = scoreboard.getObjective(packetIn.getObjectiveName());
if (packetIn.getAction() == 1)
{
scoreboard.removeObjective(scoreobjective1);
}
else if (packetIn.getAction() == 2)
{
scoreobjective1.setDisplayName(packetIn.getObjectiveValue());
scoreobjective1.setRenderType(packetIn.getRenderType());
}
}
}
示例4: addObjective
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void addObjective(ICommandSender sender, String[] args, int index) throws CommandException
{
String s = args[index++];
String s1 = args[index++];
Scoreboard scoreboard = this.getScoreboard();
IScoreObjectiveCriteria iscoreobjectivecriteria = (IScoreObjectiveCriteria)IScoreObjectiveCriteria.INSTANCES.get(s1);
if (iscoreobjectivecriteria == null)
{
throw new WrongUsageException("commands.scoreboard.objectives.add.wrongType", new Object[] {s1});
}
else if (scoreboard.getObjective(s) != null)
{
throw new CommandException("commands.scoreboard.objectives.add.alreadyExists", new Object[] {s});
}
else if (s.length() > 16)
{
throw new SyntaxErrorException("commands.scoreboard.objectives.add.tooLong", new Object[] {s, Integer.valueOf(16)});
}
else if (s.length() == 0)
{
throw new WrongUsageException("commands.scoreboard.objectives.add.usage", new Object[0]);
}
else
{
if (args.length > index)
{
String s2 = getChatComponentFromNthArg(sender, args, index).getUnformattedText();
if (s2.length() > 32)
{
throw new SyntaxErrorException("commands.scoreboard.objectives.add.displayTooLong", new Object[] {s2, Integer.valueOf(32)});
}
if (s2.length() > 0)
{
scoreboard.addScoreObjective(s, iscoreobjectivecriteria).setDisplayName(s2);
}
else
{
scoreboard.addScoreObjective(s, iscoreobjectivecriteria);
}
}
else
{
scoreboard.addScoreObjective(s, iscoreobjectivecriteria);
}
notifyOperators(sender, this, "commands.scoreboard.objectives.add.success", new Object[] {s});
}
}
示例5: addObjective
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void addObjective(ICommandSender sender, String[] commandArgs, int argStartIndex, MinecraftServer server) throws CommandException
{
String s = commandArgs[argStartIndex++];
String s1 = commandArgs[argStartIndex++];
Scoreboard scoreboard = this.getScoreboard(server);
IScoreCriteria iscorecriteria = (IScoreCriteria)IScoreCriteria.INSTANCES.get(s1);
if (iscorecriteria == null)
{
throw new WrongUsageException("commands.scoreboard.objectives.add.wrongType", new Object[] {s1});
}
else if (scoreboard.getObjective(s) != null)
{
throw new CommandException("commands.scoreboard.objectives.add.alreadyExists", new Object[] {s});
}
else if (s.length() > 16)
{
throw new SyntaxErrorException("commands.scoreboard.objectives.add.tooLong", new Object[] {s, Integer.valueOf(16)});
}
else if (s.isEmpty())
{
throw new WrongUsageException("commands.scoreboard.objectives.add.usage", new Object[0]);
}
else
{
if (commandArgs.length > argStartIndex)
{
String s2 = getChatComponentFromNthArg(sender, commandArgs, argStartIndex).getUnformattedText();
if (s2.length() > 32)
{
throw new SyntaxErrorException("commands.scoreboard.objectives.add.displayTooLong", new Object[] {s2, Integer.valueOf(32)});
}
if (s2.isEmpty())
{
scoreboard.addScoreObjective(s, iscorecriteria);
}
else
{
scoreboard.addScoreObjective(s, iscorecriteria).setDisplayName(s2);
}
}
else
{
scoreboard.addScoreObjective(s, iscorecriteria);
}
notifyCommandListener(sender, this, "commands.scoreboard.objectives.add.success", new Object[] {s});
}
}
示例6: addObjective
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void addObjective(ICommandSender sender, String[] p_184908_2_, int p_184908_3_, MinecraftServer server) throws CommandException
{
String s = p_184908_2_[p_184908_3_++];
String s1 = p_184908_2_[p_184908_3_++];
Scoreboard scoreboard = this.getScoreboard(server);
IScoreCriteria iscorecriteria = (IScoreCriteria)IScoreCriteria.INSTANCES.get(s1);
if (iscorecriteria == null)
{
throw new WrongUsageException("commands.scoreboard.objectives.add.wrongType", new Object[] {s1});
}
else if (scoreboard.getObjective(s) != null)
{
throw new CommandException("commands.scoreboard.objectives.add.alreadyExists", new Object[] {s});
}
else if (s.length() > 16)
{
throw new SyntaxErrorException("commands.scoreboard.objectives.add.tooLong", new Object[] {s, Integer.valueOf(16)});
}
else if (s.isEmpty())
{
throw new WrongUsageException("commands.scoreboard.objectives.add.usage", new Object[0]);
}
else
{
if (p_184908_2_.length > p_184908_3_)
{
String s2 = getChatComponentFromNthArg(sender, p_184908_2_, p_184908_3_).getUnformattedText();
if (s2.length() > 32)
{
throw new SyntaxErrorException("commands.scoreboard.objectives.add.displayTooLong", new Object[] {s2, Integer.valueOf(32)});
}
if (s2.isEmpty())
{
scoreboard.addScoreObjective(s, iscorecriteria);
}
else
{
scoreboard.addScoreObjective(s, iscorecriteria).setDisplayName(s2);
}
}
else
{
scoreboard.addScoreObjective(s, iscorecriteria);
}
notifyCommandListener(sender, this, "commands.scoreboard.objectives.add.success", new Object[] {s});
}
}