use of net.minecraft.scoreboard.ScoreObjective in project ct.js by ChatTriggers.
the class Scoreboard method updateNames.
private static void updateNames() {
if (!scoreboardNames.isEmpty()) {
scoreboardNames.clear();
}
scoreboardTitle = "";
try {
net.minecraft.scoreboard.Scoreboard scoreboard = World.getWorld().getScoreboard();
ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1);
scoreboardTitle = sidebarObjective.getDisplayName();
Collection<net.minecraft.scoreboard.Score> scores = scoreboard.getSortedScores(sidebarObjective);
scoreboardNames = scores.stream().map(Score::new).collect(Collectors.toList());
} catch (Exception ignored) {
}
}
use of net.minecraft.scoreboard.ScoreObjective in project ct.js by ChatTriggers.
the class Scoreboard method setLine.
/**
* Sets a line in the scoreboard to the specified name and score.
*
* @param score the score value for this item
* @param line the string to display on said line
* @param override whether or not to remove old lines with the same score
*/
public static void setLine(int score, String line, boolean override) {
try {
net.minecraft.scoreboard.Scoreboard scoreboard = World.getWorld().getScoreboard();
ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1);
Collection<net.minecraft.scoreboard.Score> scores = scoreboard.getSortedScores(sidebarObjective);
if (override) {
for (net.minecraft.scoreboard.Score theScore : scores) {
if (theScore.getScorePoints() == score) {
scoreboard.removeObjectiveFromEntity(theScore.getPlayerName(), sidebarObjective);
}
}
}
net.minecraft.scoreboard.Score theScore = scoreboard.getValueFromObjective(line, sidebarObjective);
theScore.setScorePoints(score);
} catch (Exception ignored) {
}
}
use of net.minecraft.scoreboard.ScoreObjective in project MinecraftForge by MinecraftForge.
the class GuiIngameForge method renderPlayerList.
protected void renderPlayerList(int width, int height) {
ScoreObjective scoreobjective = this.mc.world.getScoreboard().getObjectiveInDisplaySlot(0);
NetHandlerPlayClient handler = mc.player.connection;
if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null)) {
this.overlayPlayerList.updatePlayerList(true);
if (pre(PLAYER_LIST))
return;
this.overlayPlayerList.renderPlayerlist(width, this.mc.world.getScoreboard(), scoreobjective);
post(PLAYER_LIST);
} else {
this.overlayPlayerList.updatePlayerList(false);
}
}
use of net.minecraft.scoreboard.ScoreObjective in project MinecraftForge by MinecraftForge.
the class GuiIngameForge method renderGameOverlay.
@Override
public void renderGameOverlay(float partialTicks) {
res = new ScaledResolution(mc);
eventParent = new RenderGameOverlayEvent(partialTicks, res);
int width = res.getScaledWidth();
int height = res.getScaledHeight();
renderHealthMount = mc.player.getRidingEntity() instanceof EntityLivingBase;
renderFood = mc.player.getRidingEntity() == null;
renderJumpBar = mc.player.isRidingHorse();
right_height = 39;
left_height = 39;
if (pre(ALL))
return;
fontrenderer = mc.fontRendererObj;
mc.entityRenderer.setupOverlayRendering();
GlStateManager.enableBlend();
if (Minecraft.isFancyGraphicsEnabled()) {
renderVignette(mc.player.getBrightness(partialTicks), res);
} else {
GlStateManager.enableDepth();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
}
if (renderHelmet)
renderHelmet(res, partialTicks);
if (renderPortal && !mc.player.isPotionActive(MobEffects.NAUSEA)) {
renderPortal(res, partialTicks);
}
if (renderHotbar)
renderHotbar(res, partialTicks);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
zLevel = -90.0F;
rand.setSeed((long) (updateCounter * 312871));
if (renderCrosshairs)
renderCrosshairs(partialTicks);
if (renderBossHealth)
renderBossHealth();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (this.mc.playerController.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof EntityPlayer) {
if (renderHealth)
renderHealth(width, height);
if (renderArmor)
renderArmor(width, height);
if (renderFood)
renderFood(width, height);
if (renderHealthMount)
renderHealthMount(width, height);
if (renderAir)
renderAir(width, height);
}
renderSleepFade(width, height);
if (renderJumpBar) {
renderJumpBar(width, height);
} else if (renderExperiance) {
renderExperience(width, height);
}
renderToolHighlight(res);
renderHUDText(width, height);
renderFPSGraph();
renderPotionIcons(res);
renderRecordOverlay(width, height, partialTicks);
renderSubtitles(res);
renderTitle(width, height, partialTicks);
Scoreboard scoreboard = this.mc.world.getScoreboard();
ScoreObjective objective = null;
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.player.getName());
if (scoreplayerteam != null) {
int slot = scoreplayerteam.getChatFormat().getColorIndex();
if (slot >= 0)
objective = scoreboard.getObjectiveInDisplaySlot(3 + slot);
}
ScoreObjective scoreobjective1 = objective != null ? objective : scoreboard.getObjectiveInDisplaySlot(1);
if (renderObjective && scoreobjective1 != null) {
this.renderScoreboard(scoreobjective1, res);
}
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.disableAlpha();
renderChat(width, height);
renderPlayerList(width, height);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
GlStateManager.enableAlpha();
post(ALL);
}
use of net.minecraft.scoreboard.ScoreObjective in project SpongeCommon by SpongePowered.
the class SpongeObjective method updateDisplayMode.
private void updateDisplayMode() {
for (ScoreObjective objective : this.objectives.values()) {
objective.renderType = (IScoreCriteria.EnumRenderType) (Object) this.displayMode;
objective.scoreboard.onObjectiveDisplayNameChanged(objective);
}
}
Aggregations