Skip to content

Commit

Permalink
Fix scoreboard not using the correct display mode in some circumstances
Browse files Browse the repository at this point in the history
  • Loading branch information
dualspiral committed Jan 14, 2018
1 parent ece0579 commit 3537712
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.spongepowered.api.scoreboard.critieria.Criterion;
import org.spongepowered.api.scoreboard.displayslot.DisplaySlot;
import org.spongepowered.api.scoreboard.objective.Objective;
import org.spongepowered.api.scoreboard.objective.displaymode.ObjectiveDisplayMode;
import org.spongepowered.api.text.Text;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
Expand Down Expand Up @@ -86,6 +87,7 @@ public abstract class MixinScoreboardLogic extends Scoreboard implements IMixinS
@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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;

import net.minecraft.scoreboard.IScoreCriteria;
import org.spongepowered.api.scoreboard.critieria.Criterion;
import org.spongepowered.api.scoreboard.objective.Objective;
import org.spongepowered.api.scoreboard.objective.displaymode.ObjectiveDisplayMode;
Expand Down Expand Up @@ -105,6 +106,8 @@ public Objective build() throws IllegalStateException {

if (this.objectiveDisplayMode != null) {
objective.setDisplayMode(this.objectiveDisplayMode);
} else if (this.criterion instanceof IScoreCriteria) {
objective.setDisplayMode((ObjectiveDisplayMode) (Object) ((IScoreCriteria) this.criterion).getRenderType());
}

return objective;
Expand Down

0 comments on commit 3537712

Please sign in to comment.