use of net.minecraft.scoreboard.ScoreObjective in project Hyperium by HyperiumClient.
the class MixinRenderPlayer method renderOffsetLivingLabel.
/**
* @author Sk1er
* @reason Cancel nametag render event when score is renderer
*/
@Overwrite
protected void renderOffsetLivingLabel(AbstractClientPlayer entityIn, double x, double y, double z, String str, float p_177069_9_, double p_177069_10_) {
if (p_177069_10_ < 100.0D) {
Scoreboard scoreboard = entityIn.getWorldScoreboard();
ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2);
if (scoreobjective != null) {
Score score = scoreboard.getValueFromObjective(entityIn.getName(), scoreobjective);
RenderNameTagEvent.CANCEL = true;
if (entityIn != Minecraft.getMinecraft().thePlayer) {
renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName(), x, y, z, 64);
y += (float) getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * p_177069_9_;
}
RenderNameTagEvent.CANCEL = false;
}
}
super.renderOffsetLivingLabel(entityIn, x, y, z, str, p_177069_9_, p_177069_10_);
}
use of net.minecraft.scoreboard.ScoreObjective in project ct.js by ChatTriggers.
the class TabList method getNamesByObjectives.
/**
* Gets names set in scoreboard objectives (useful for newer games)
*
* @return The formatted names
*/
public static List<String> getNamesByObjectives() {
List<String> tabNames = new ArrayList<>();
try {
Scoreboard scoreboard = World.getWorld().getScoreboard();
ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(0);
Collection<Score> scores = scoreboard.getSortedScores(sidebarObjective);
for (Score score : scores) {
ScorePlayerTeam team = scoreboard.getPlayersTeam(score.getPlayerName());
String name = ScorePlayerTeam.formatPlayerName(team, score.getPlayerName());
tabNames.add(name);
}
} catch (Exception e) {
return new ArrayList<>();
}
return tabNames;
}
Aggregations