Search in sources :

Example 1 with Scoreboard

use of net.minecraft.scoreboard.Scoreboard in project takumicraft by TNTModders.

the class RenderPlayerSP method renderEntityName.

/**
 * Allows the render to do state modifications necessary before the model is rendered.
 */
/*    @Override
    protected void preRenderCallback(AbstractClientPlayer entitylivingbaseIn, float partialTickTime) {
        float f = 0.9375F;
        GlStateManager.scale(0.9375F, 0.9375F, 0.9375F);
    }*/
@Override
protected void renderEntityName(AbstractClientPlayer entityIn, double x, double y, double z, String name, double distanceSq) {
    if (distanceSq < 100.0D) {
        Scoreboard scoreboard = entityIn.getWorldScoreboard();
        ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2);
        if (scoreobjective != null) {
            Score score = scoreboard.getOrCreateScore(entityIn.getName(), scoreobjective);
            this.renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName(), x, y, z, 64);
            y += (double) ((float) this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.025F);
        }
    }
    super.renderEntityName(entityIn, x, y, z, name, distanceSq);
}
Also used : Score(net.minecraft.scoreboard.Score) ScoreObjective(net.minecraft.scoreboard.ScoreObjective) Scoreboard(net.minecraft.scoreboard.Scoreboard)

Example 2 with Scoreboard

use of net.minecraft.scoreboard.Scoreboard 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);
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) ScoreObjective(net.minecraft.scoreboard.ScoreObjective) Scoreboard(net.minecraft.scoreboard.Scoreboard) RenderGameOverlayEvent(net.minecraftforge.client.event.RenderGameOverlayEvent) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ScorePlayerTeam(net.minecraft.scoreboard.ScorePlayerTeam)

Example 3 with Scoreboard

use of net.minecraft.scoreboard.Scoreboard 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;
}
Also used : Score(net.minecraft.scoreboard.Score) ScoreObjective(net.minecraft.scoreboard.ScoreObjective) Scoreboard(net.minecraft.scoreboard.Scoreboard) ArrayList(java.util.ArrayList) ScorePlayerTeam(net.minecraft.scoreboard.ScorePlayerTeam)

Aggregations

ScoreObjective (net.minecraft.scoreboard.ScoreObjective)3 Scoreboard (net.minecraft.scoreboard.Scoreboard)3 Score (net.minecraft.scoreboard.Score)2 ScorePlayerTeam (net.minecraft.scoreboard.ScorePlayerTeam)2 ArrayList (java.util.ArrayList)1 ScaledResolution (net.minecraft.client.gui.ScaledResolution)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 RenderGameOverlayEvent (net.minecraftforge.client.event.RenderGameOverlayEvent)1