/** * Removes or sets the ScoreObjective to be displayed at a particular scoreboard position (list, sidebar, below * name) */ public void handleDisplayObjective(SPacketDisplayObjective packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Scoreboard scoreboard = this.clientWorldController.getScoreboard(); if (packetIn.getName().isEmpty()) { scoreboard.setObjectiveInDisplaySlot(packetIn.getPosition(), (ScoreObjective)null); } else { ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getName()); scoreboard.setObjectiveInDisplaySlot(packetIn.getPosition(), scoreobjective); } }
public List < Packet<? >> getCreatePackets(ScoreObjective objective) { List < Packet<? >> list = Lists. < Packet<? >> newArrayList(); list.add(new SPacketScoreboardObjective(objective, 0)); for (int i = 0; i < 19; ++i) { if (this.getObjectiveInDisplaySlot(i) == objective) { list.add(new SPacketDisplayObjective(i, objective)); } } for (Score score : this.getSortedScores(objective)) { list.add(new SPacketUpdateScore(score)); } return list; }
/** * 0 is tab menu, 1 is sidebar, 2 is below name */ public void setObjectiveInDisplaySlot(int objectiveSlot, ScoreObjective objective) { ScoreObjective scoreobjective = this.getObjectiveInDisplaySlot(objectiveSlot); super.setObjectiveInDisplaySlot(objectiveSlot, objective); if (scoreobjective != objective && scoreobjective != null) { if (this.getObjectiveDisplaySlotCount(scoreobjective) > 0) { this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketDisplayObjective(objectiveSlot, objective)); } else { this.sendDisplaySlotRemovalPackets(scoreobjective); } } if (objective != null) { if (this.addedObjectives.contains(objective)) { this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketDisplayObjective(objectiveSlot, objective)); } else { this.addObjective(objective); } } this.markSaveDataDirty(); }
public List < Packet<? >> getDestroyPackets(ScoreObjective p_96548_1_) { List < Packet<? >> list = Lists. < Packet<? >> newArrayList(); list.add(new SPacketScoreboardObjective(p_96548_1_, 1)); for (int i = 0; i < 19; ++i) { if (this.getObjectiveInDisplaySlot(i) == p_96548_1_) { list.add(new SPacketDisplayObjective(i, p_96548_1_)); } } return list; }
/** * Removes or sets the ScoreObjective to be displayed at a particular scoreboard position (list, sidebar, below * name) */ void handleDisplayObjective(SPacketDisplayObjective packetIn);