use of org.spongepowered.common.scoreboard.SpongeObjective in project SpongeCommon by SpongePowered.
the class MixinScoreboardLogic method addScoreObjective.
// Add objective
@Override
public ScoreObjective addScoreObjective(String name, IScoreCriteria criteria) {
SpongeObjective objective = new SpongeObjective(name, (Criterion) criteria);
objective.setDisplayMode((ObjectiveDisplayMode) (Object) criteria.getRenderType());
this.scoreboard$addObjective(objective);
return objective.getObjectiveFor(this);
}
use of org.spongepowered.common.scoreboard.SpongeObjective in project SpongeCommon by SpongePowered.
the class MixinScoreboardLogic method scoreboard$updateDisplaySlot.
public void scoreboard$updateDisplaySlot(@Nullable Objective objective, DisplaySlot displaySlot) {
if (objective != null && !objective.getScoreboards().contains(this)) {
throw new IllegalStateException("Attempting to set an objective's display slot that does not exist on this scoreboard!");
}
int index = ((SpongeDisplaySlot) displaySlot).getIndex();
this.objectiveDisplaySlots[index] = objective == null ? null : ((SpongeObjective) objective).getObjectiveFor(this);
this.sendToPlayers(new SPacketDisplayObjective(index, this.objectiveDisplaySlots[index]));
}
Aggregations