Search in sources :

Example 1 with GuiIngame

use of net.minecraft.client.gui.GuiIngame in project Almura by AlmuraDev.

the class OriginHUD method drawScreen.

@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    final ClientCategory category = this.config.get().client;
    this.userPanel.setAlpha(category.originHudOpacity);
    this.detailsPanel.setVisible(this.config.get().client.displayLocationWidget);
    this.detailsPanel.setAlpha(category.originHudOpacity);
    this.worldPanel.setVisible(this.config.get().client.displayWorldCompassWidget);
    if (manager.getCurrent() == null) {
        this.notificationPanel.setAlpha(Math.max(this.notificationPanel.getAlpha() - 2, 0));
        this.worldPanel.setAlpha(Math.min(this.worldPanel.getAlpha() + 2, category.originHudOpacity));
    } else {
        this.notificationPanel.setAlpha(Math.min(this.notificationPanel.getAlpha() + 5, 255));
        this.worldPanel.setAlpha(Math.max(this.worldPanel.getAlpha() - 20, 0));
        if ((this.notificationPanel.notificationTitle.getWidth()) < (this.notificationPanel.notificationLabel.getWidth())) {
            this.notificationPanel.setSize(this.notificationPanel.notificationLabel.getContentWidth() + 10, this.notificationPanel.getHeight());
        } else {
            this.notificationPanel.setSize(this.notificationPanel.notificationTitle.getContentWidth() + 10, this.notificationPanel.getHeight());
        }
    }
    // Show debug panels if necessary
    final boolean isDebugEnabled = this.client.gameSettings.showDebugInfo;
    this.debugDetailsPanel.setVisible(isDebugEnabled);
    if (isDebugEnabled) {
        // Get proper position based on what potion effects are being shown
        int yOffset = SimpleScreen.getPaddedY(this.detailsPanel, PADDING);
        if (this.client.player.getActivePotionEffects().stream().anyMatch(potion -> potion.getPotion().isBeneficial())) {
            // 24 for potion icon, 1 for padding
            yOffset += 25;
        }
        if (this.client.player.getActivePotionEffects().stream().anyMatch(potion -> !potion.getPotion().isBeneficial())) {
            // 24 for potion icon, 1 for padding
            yOffset += 25;
        }
        // Debug block panel
        this.debugBlockPanel.setPosition(0, SimpleScreen.getPaddedY(this.userPanel, PADDING));
        this.debugBlockPanel.setAlpha(category.originHudOpacity);
        // Debug details panel
        this.debugDetailsPanel.setPosition(0, yOffset);
        this.debugDetailsPanel.setAlpha(category.originHudOpacity);
    }
    // Show boss panel if necessary
    final GuiIngame guiIngame = this.client.ingameGUI;
    if (guiIngame != null) {
        this.bossBarPanel.setVisible(!((IMixinGuiBossOverlay) guiIngame.getBossOverlay()).getBossInfo().isEmpty());
        this.bossBarPanel.setAlpha(category.originHudOpacity);
    }
    // Show player list if necessary
    this.playerListPanel.setVisible(this.client.gameSettings.keyBindPlayerList.isKeyDown());
    super.drawScreen(mouseX, mouseY, partialTicks);
}
Also used : GuiIngame(net.minecraft.client.gui.GuiIngame) ClientCategory(com.almuradev.almura.core.client.config.ClientCategory)

Aggregations

ClientCategory (com.almuradev.almura.core.client.config.ClientCategory)1 GuiIngame (net.minecraft.client.gui.GuiIngame)1