Query complete player list for Scoreboard displays (Xstoudi)

This commit is contained in:
Xavier Stouder 2022-12-07 16:21:16 +01:00 committed by GitHub
parent b23736c72c
commit 109de51400
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,11 +1,8 @@
package com.simibubi.create.content.logistics.block.display.source;
import java.util.stream.Stream;
import com.simibubi.create.content.logistics.block.display.DisplayLinkContext;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.IntAttached;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerLevel;
@ -18,6 +15,8 @@ import net.minecraft.world.scores.criteria.ObjectiveCriteria.RenderType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.stream.Stream;
public abstract class StatTrackingDisplaySource extends ScoreboardDisplaySource {
@Override
@ -33,7 +32,7 @@ public abstract class StatTrackingDisplaySource extends ScoreboardDisplaySource
scoreboard.addObjective(name, ObjectiveCriteria.DUMMY, getObjectiveDisplayName(), RenderType.INTEGER);
Objective objective = scoreboard.getObjective(name);
sLevel.players()
sLevel.getServer().getPlayerList().getPlayers()
.forEach(s -> scoreboard.getOrCreatePlayerScore(s.getScoreboardName(), objective)
.setScore(updatedScoreOf(s)));