use of net.minecraft.scoreboard.IScoreCriteria in project SpongeCommon by SpongePowered.
the class SpongeObjective method getObjectiveFor.
public ScoreObjective getObjectiveFor(net.minecraft.scoreboard.Scoreboard scoreboard) {
if (this.objectives.containsKey(scoreboard)) {
return this.objectives.get(scoreboard);
}
ScoreObjective objective = new ScoreObjective(scoreboard, this.name, (IScoreCriteria) this.criterion);
// We deliberately set the fields here instead of using the methods.
// Since a new objective is being created here, we want to avoid
// sending packets until everything is in the proper state.
objective.displayName = SpongeTexts.toLegacy(this.displayName);
objective.renderType = (IScoreCriteria.EnumRenderType) (Object) this.displayMode;
((IMixinScoreObjective) objective).setSpongeObjective(this);
this.objectives.put(scoreboard, objective);
return objective;
}
use of net.minecraft.scoreboard.IScoreCriteria in project SpongeCommon by SpongePowered.
the class SpongeObjectiveBuilder method build.
@Override
public Objective build() throws IllegalStateException {
checkState(this.name != null, "Name cannot be null");
checkState(this.criterion != null, "Criterion cannot be null");
SpongeObjective objective = new SpongeObjective(this.name, this.criterion);
if (this.displayName != null) {
objective.setDisplayName(this.displayName);
}
if (this.objectiveDisplayMode != null) {
objective.setDisplayMode(this.objectiveDisplayMode);
} else if (this.criterion instanceof IScoreCriteria) {
objective.setDisplayMode((ObjectiveDisplayMode) (Object) ((IScoreCriteria) this.criterion).getRenderType());
}
return objective;
}
Aggregations