matumaka

ok time to add settings and such..please make a new file where you gotta input your license key. It will come up on the first click/open of the main INVENTORY GUI and it will check if it's valid with this link https://api.superclient.org/license/check and it will return with "license":"valid" or "license":"invalid" including the timestamp of how long it lasts. So showcase that aswell. Make it check the license every time the client is opened. Add a cache aswell like every 30-90 minutes. Please don't add any extra spacing or comments.

šŸ“Ž 1 file 24,375 chars
šŸ“„
pasted-code-1782338254347.txt
txt 505 lines
ā–¶
package org.superclient.superClient.client.INVENTORY GUI;

import net.minecraft.client.INVENTORY GUI.GuiGraphics;
import net.minecraft.client.INVENTORY GUI.screens.Screen;
import net.minecraft.client.input.MouseButtonEvent;
import net.minecraft.client.renderer.RenderPipelines;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;

public class SuperClientScreen extends Screen {

    private int guiWidth = 450;
    private int guiHeight = 280;
    private int guiX, guiY;

    private float renderX, renderY, renderWidth, renderHeight;

    private static final int MIN_WIDTH = 350;
    private static final int MIN_HEIGHT = 220;

    private final int topBarHeight = 24;
    private final int navWidth = 110;
    private final int socialsHeight = 22;

    private boolean dragging = false;
    private int dragOffsetX, dragOffsetY;

    private boolean resizing = false;
    private int resizeStartMouseX, resizeStartMouseY;
    private int resizeStartWidth, resizeStartHeight;

    private int selectedTab = 0;

    private static final String[] NAV_ITEMS  = {"⚔ Movement", "āš” Combat", "\uD83D\uDEE1 Render", "☷ Settings"};
    private static final String[] NAV_LABELS  = {"Movement", "Combat", "Render", "Settings"};
    private final float[] hoverProgress = new float[NAV_ITEMS.length];
    private final float[] navTextShift = new float[NAV_ITEMS.length];

    private float resizeHandleHover = 0f;
    private float closeButtonHover = 0f;
    private float logoHover = 0f;
    private float guiOpenAnimation = 0f;
    private float socialsButtonHover = 0f;

    private float glowPhase = 0f;
    private float logoFloatPhase = 0f;

    private float scrollOffset = 0f;
    private float scrollOffsetTarget = 0f;
    private float scrollBarHover = 0f;
    private boolean scrollBarDragging = false;
    private int scrollBarDragStartY;
    private float scrollBarDragStartOffset;

    private static final int CATEGORY_HEADER_H = 20;
    private static final int SCROLLBAR_W = 4;

    private boolean settingsWindowOpen  = false;
    private int settingsX, settingsY;
    private int settingsWidth = 250;
    private int settingsHeight = 180;
    private boolean settingsDragging = false;
    private int settingsDragOffsetX, settingsDragOffsetY;
    private boolean settingsResizing = false;
    private int settingsResizeStartMouseX, settingsResizeStartMouseY;
    private int settingsResizeStartWidth, settingsResizeStartHeight;
    private float settingsAnimation = 0f;

    private final SocialsWindow socialsWindow = new SocialsWindow(this);

    private static final Identifier LOGO  = Identifier.fromNamespaceAndPath("super-client", "textures/INVENTORY GUI/logo.png");
    private static final int LOGO_SIZE = 16;

    private static final int COLOR_BACKGROUND = 0xD9050510;
    private static final int COLOR_TOPBAR = 0xFF0D0D2E;
    private static final int COLOR_TOPBAR_BORDER = 0xFF1a1aff;
    private static final int COLOR_CONTENT_BG = 0x99080818;
    private static final int COLOR_NAV_BG = 0x880A0A20;
    private static final int COLOR_TITLE = 0xFF4fc3f7;
    private static final int COLOR_CLOSE_NORMAL = 0xFFcc0000;
    private static final int COLOR_CLOSE_HOVER = 0xFFff1744;
    private static final int COLOR_NAV_TEXT = 0xFFCCCCCC;
    private static final int COLOR_NAV_HOVER = 0xFF4fc3f7;
    private static final int COLOR_BORDER_OUTER = 0xFF1a1aff;
    private static final int COLOR_BORDER_INNER = 0x661a1aff;
    private static final int COLOR_RESIZE_HANDLE = 0xFF4fc3f7;
    private static final int COLOR_SETTINGS_BG = 0xEE060615;
    private static final int COLOR_SETTINGS_TOP = 0xFF0D0D2E;
    private static final int COLOR_SCROLLBAR_BG = 0x44FFFFFF;
    private static final int COLOR_SCROLLBAR_FG = 0xFF1a1aff;
    private static final int COLOR_CAT_HEADER = 0xFF0D0D2E;
    private static final int COLOR_CAT_TEXT = 0xFF4fc3f7;
    private static final int COLOR_CAT_LINE = 0x441a1aff;

    public SuperClientScreen() {
        super(Component.literal("SuperClient"));
    }

    @Override
    protected void init() {
        guiWidth = Math.min(450, this.width - 20);
        guiHeight = Math.min(280, this.height - 20);
        guiX = (this.width - guiWidth)  / 2;
        guiY = (this.height - guiHeight) / 2;
        renderX = guiX;
        renderY = guiY;
        renderWidth = guiWidth;
        renderHeight = guiHeight;
        settingsX = guiX + guiWidth  / 2 - settingsWidth  / 2;
        settingsY = guiY + guiHeight / 2 - settingsHeight / 2;
        guiOpenAnimation = 0f;
        socialsWindow.init(this.width, this.height);
    }

    @Override
    public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
        glowPhase += 0.04f;
        logoFloatPhase += 0.025f;
        guiOpenAnimation += (1f - guiOpenAnimation) * 0.12f;

        renderX += (guiX - renderX) * 0.18f;
        renderY += (guiY - renderY) * 0.18f;
        renderWidth += (guiWidth - renderWidth) * 0.18f;
        renderHeight += (guiHeight - renderHeight) * 0.18f;

        settingsAnimation += ((settingsWindowOpen ? 1f : 0f) - settingsAnimation) * 0.15f;
        scrollOffset += (scrollOffsetTarget - scrollOffset) * 0.2f;

        int rx = (int) renderX, ry = (int) renderY;
        int rw = (int) renderWidth, rh = (int) renderHeight;

        float openScale = 0.95f + guiOpenAnimation * 0.05f;
        int openAlpha = (int)(guiOpenAnimation * 255);

        float cx = rx + rw / 2f;
        float cy = ry + rh / 2f;

        var pose = graphics.pose();
        pose.pushMatrix();
        pose.translate(cx, cy);
        pose.scale(openScale, openScale);
        pose.translate(-cx, -cy);

        float gi = (float)(Math.sin(glowPhase) * 0.5 + 0.5);
        int glowA = (int)(40 + gi * 80);
        int glowCol = (glowA << 24) | 0x001a1aff;

        fillRounded(graphics, rx - 2, ry - 2, rx + rw + 2, ry + rh + 2, 9, glowCol);
        fillRounded(graphics, rx - 1, ry - 1, rx + rw + 1, ry + rh + 1, 9, COLOR_BORDER_OUTER);
        fillRounded(graphics, rx, ry, rx + rw, ry + rh, 8, applyAlpha(COLOR_BACKGROUND, openAlpha));
        fillRounded(graphics, rx, ry, rx + rw, ry + topBarHeight, 8, applyAlpha(COLOR_TOPBAR, openAlpha));
        graphics.fill(rx, ry + topBarHeight - 4, rx + rw, ry + topBarHeight, applyAlpha(COLOR_TOPBAR, openAlpha));
        graphics.fill(rx, ry + topBarHeight, rx + rw, ry + topBarHeight + 1, applyAlpha(COLOR_TOPBAR_BORDER, openAlpha));

        boolean hoveringLogo = mouseX >= rx + 3 && mouseX <= rx + 3 + LOGO_SIZE + 2
                && mouseY >= ry + 3 && mouseY <= ry + 3 + LOGO_SIZE;
        logoHover += ((hoveringLogo ? 1f : 0f) - logoHover) * 0.15f;
        float floatOff = (float)(Math.sin(logoFloatPhase) * 1.2f);
        float logoScale = 1f + logoHover * 0.12f;
        float logoX  = rx + 5, logoY = ry + 4 + floatOff;
        float logoCX = logoX + LOGO_SIZE / 2f, logoCY = logoY + LOGO_SIZE / 2f;
        pose.pushMatrix();
        pose.translate(logoCX, logoCY);
        pose.scale(logoScale, logoScale);
        pose.translate(-logoCX, -logoCY);
        graphics.blit(RenderPipelines.GUI_TEXTURED, LOGO, (int)logoX, (int)logoY, 0, 0, LOGO_SIZE, LOGO_SIZE, LOGO_SIZE, LOGO_SIZE);
        pose.popMatrix();

        graphics.drawString(font, "SuperClient v1.0", rx + 6 + LOGO_SIZE + 4, ry + 8, applyAlpha(COLOR_TITLE, openAlpha), false);

        boolean hoveringX = isHoveringCloseBtn(mouseX, mouseY, rx, ry, rw);
        closeButtonHover += ((hoveringX ? 1f : 0f) - closeButtonHover) * 0.15f;
        int closeBg = blendColors(COLOR_CLOSE_NORMAL, COLOR_CLOSE_HOVER, closeButtonHover);
        int cX1 = rx + rw - 22;
        int cX2 = rx + rw - 3;
        int cY1 = ry + 3;
        int cY2 = ry + topBarHeight - 3;
        fillRounded(graphics, cX1, cY1, cX2, cY2, 4, applyAlpha(closeBg, openAlpha));
        int centerX = (cX1 + cX2) / 2;
        int centerY = (cY1 + cY2) / 2;
        graphics.drawString(font, "Ɨ", centerX - 2, centerY - 4, 0xFFFFFFFF, false);

        int navBottom = ry + rh - socialsHeight;
        fillRounded(graphics, rx, ry + topBarHeight, rx + navWidth, navBottom, 0, applyAlpha(COLOR_NAV_BG, openAlpha));
        fillRounded(graphics, rx + navWidth + 4, ry + topBarHeight + 4, rx + rw - 4, ry + rh - 4, 6, applyAlpha(COLOR_CONTENT_BG, openAlpha));
        graphics.fill(rx + navWidth, ry + topBarHeight, rx + navWidth + 1, ry + rh, applyAlpha(COLOR_BORDER_INNER, openAlpha));

        for (int i = 0; i < NAV_ITEMS.length; i++) {
            int itemY = ry + topBarHeight + 8 + i * 24;
            boolean hovering = isHoveringNav(mouseX, mouseY, i, rx, ry, rh);
            boolean selected = (i == selectedTab);

            if (hovering || selected) hoverProgress[i] = Math.min(1f, hoverProgress[i] + 0.1f);
            else hoverProgress[i] = Math.max(0f, hoverProgress[i] - 0.1f);

            float tgt = selected ? 3f : 0f;
            navTextShift[i] += (tgt - navTextShift[i]) * 0.15f;

            if (hoverProgress[i] > 0.01f) {
                int lw = (int)((navWidth - 8) * hoverProgress[i]);
                drawGradientLine(graphics, rx + 4, itemY + 14, lw, openAlpha);
            }
            if (selected) {
                fillRounded(graphics, rx + 2, itemY - 1, rx + navWidth - 2, itemY + 16, 4, applyAlpha(0x221a1aff, openAlpha));
            }

            int textColor = (hovering || selected)
                    ? applyAlpha(COLOR_NAV_HOVER, openAlpha)
                    : applyAlpha(COLOR_NAV_TEXT,  openAlpha);
            graphics.drawString(font, NAV_ITEMS[i], rx + 6 + (int)navTextShift[i], itemY + 4, textColor, false);
        }

        renderSocialsButton(graphics, mouseX, mouseY, rx, ry, rw, rh, openAlpha);
        renderCategoryArea(graphics, mouseX, mouseY, rx, ry, rw, rh, openAlpha);

        boolean hoveringResize = isHoveringResizeHandle(mouseX, mouseY, rx, ry, rw, rh);
        resizeHandleHover += ((hoveringResize || resizing ? 1f : 0f) - resizeHandleHover) * 0.15f;
        drawResizeHandle(graphics, rx + rw - 14, ry + rh - 14, resizeHandleHover, openAlpha);

        pose.popMatrix();

        if (socialsWindow.isOpen() || socialsWindow.isVisible()) socialsWindow.render(graphics, font, mouseX, mouseY);

        super.render(graphics, mouseX, mouseY, delta);
    }

    private void renderCategoryArea(GuiGraphics graphics, int mouseX, int mouseY, int rx, int ry, int rw, int rh, int openAlpha) {
        int cX1 = rx + navWidth + 4;
        int cY1 = ry + topBarHeight + 4;
        int cX2 = rx + rw - 4;
        int cY2 = ry + rh - 4;
        int cH = cY2 - cY1;

        int totalContent = NAV_ITEMS.length * CATEGORY_HEADER_H;
        float maxScroll = Math.max(0, totalContent - cH);
        scrollOffsetTarget = Math.max(0, Math.min(scrollOffsetTarget, maxScroll));
        scrollOffset = Math.max(0, Math.min(scrollOffset, maxScroll));

        int drawAreaX2 = totalContent > cH ? cX2 - SCROLLBAR_W - 3 : cX2;

        graphics.enableScissor(cX1, cY1, cX2, cY2);

        int drawY = cY1 + 2 - (int)scrollOffset;
        for (int i = 0; i < NAV_ITEMS.length; i++) {
            int hY1 = drawY + i * CATEGORY_HEADER_H;
            int hY2 = hY1 + CATEGORY_HEADER_H;
            if (hY2 < cY1 || hY1 > cY2) continue;

            fillRounded(graphics, cX1 + 2, hY1 + 1, drawAreaX2 - 2, hY2 - 1, 4, applyAlpha(COLOR_CAT_HEADER, openAlpha));

            float glowI = (float)(Math.sin(glowPhase + i * 0.8f) * 0.5 + 0.5);
            int lineAlp = (int)((60 + glowI * 40) * (openAlpha / 255f));
            int lineCol = (lineAlp << 24) | (COLOR_TOPBAR_BORDER & 0x00FFFFFF);
            graphics.fill(cX1 + 2, hY1 + 1, cX1 + 4, hY2 - 1, lineCol);

            graphics.drawString(font, NAV_LABELS[i], cX1 + 8, hY1 + (CATEGORY_HEADER_H - font.lineHeight) / 2, applyAlpha(COLOR_CAT_TEXT, openAlpha), false);

            graphics.fill(cX1 + 2, hY2 - 1, drawAreaX2 - 2, hY2, applyAlpha(COLOR_CAT_LINE, openAlpha));
        }

        graphics.disableScissor();

        if (totalContent > cH) {
            float ratio = (float)cH / totalContent;
            int barH = Math.max(16, (int)(cH * ratio));
            float fraction = maxScroll > 0 ? scrollOffset / maxScroll : 0;
            int barY1 = cY1 + (int)((cH - barH) * fraction);
            int barY2 = barY1 + barH;
            int barX1 = cX2 - SCROLLBAR_W - 1;
            int barX2 = cX2 - 1;

            boolean hovBar = mouseX >= barX1 - 2 && mouseX <= barX2 + 2 && mouseY >= cY1 && mouseY <= cY2;
            scrollBarHover += ((hovBar || scrollBarDragging ? 1f : 0f) - scrollBarHover) * 0.15f;

            graphics.fill(barX1, cY1, barX2, cY2, applyAlpha(COLOR_SCROLLBAR_BG, openAlpha));
            int sbA = (int)(80 + scrollBarHover * 175);
            int sbCol = (sbA << 24) | (COLOR_SCROLLBAR_FG & 0x00FFFFFF);
            fillRounded(graphics, barX1, barY1, barX2, barY2, 2, sbCol);
        }
    }

    private void renderSocialsButton(GuiGraphics graphics, int mouseX, int mouseY, int rx, int ry, int rw, int rh, int openAlpha) {
        int btnX1 = rx + 2;
        int btnY1 = ry + rh - socialsHeight + 2;
        int btnX2 = rx + navWidth - 2;
        int btnY2 = ry + rh - 2;

        boolean hov = mouseX >= btnX1 && mouseX <= btnX2 && mouseY >= btnY1 && mouseY <= btnY2;
        socialsButtonHover += ((hov ? 1f : 0f) - socialsButtonHover) * 0.15f;

        int bg = blendColors(applyAlpha(COLOR_NAV_BG, openAlpha), applyAlpha(0xFF1a1aff, openAlpha), socialsButtonHover * 0.35f);
        fillRounded(graphics, btnX1, btnY1, btnX2, btnY2, 4, bg);
        graphics.fill(rx, ry + rh - socialsHeight, rx + navWidth, ry + rh - socialsHeight + 1, applyAlpha(COLOR_BORDER_INNER, openAlpha));

        String label = "Socials";
        int lw = font.width(label);
        int lx = btnX1 + (btnX2 - btnX1 - lw) / 2;
        int ly = btnY1 + (btnY2 - btnY1 - font.lineHeight) / 2;
        int col = socialsWindow.isOpen() ? applyAlpha(COLOR_NAV_HOVER, openAlpha) : applyAlpha(COLOR_NAV_TEXT, openAlpha);
        graphics.drawString(font, label, lx, ly, col, false);
    }

    private void drawResizeHandle(GuiGraphics graphics, int x, int y, float hover, int alpha) {
        int bA  = (int)((80 + hover * 175) * (alpha / 255f));
        int color = (bA << 24) | (COLOR_RESIZE_HANDLE & 0x00FFFFFF);
        for (int i = 0; i < 3; i++) {
            int d = i * 4;
            graphics.fill(x + d,  y + 10, x + d + 2,  y + 12, color);
            graphics.fill(x + 10, y + d,  x + 12,     y + d + 2, color);
        }
        for (int i = 0; i < 3; i++) {
            graphics.fill(x + 10 - i * 4, y + 10, x + 12 - i * 4, y + 12, color);
        }
    }

    private void drawGradientLine(GuiGraphics graphics, int x, int y, int width, int globalAlpha) {
        for (int i = 0; i < width; i++) {
            float t = (float)i / width;
            int r = (int)(0xFF * (1 - t) + 0x4f * t);
            int g = (int)(0x17 * (1 - t) + 0xc3 * t);
            int b = (int)(0x44 * (1 - t) + 0xf7 * t);
            int col = (globalAlpha << 24) | (r << 16) | (g << 8) | b;
            graphics.fill(x + i, y, x + i + 1, y + 2, col);
        }
    }

    private void fillRounded(GuiGraphics g, int x1, int y1, int x2, int y2, int radius, int color) {
        if (x2 <= x1 || y2 <= y1) return;
        if (radius <= 0) { g.fill(x1, y1, x2, y2, color); return; }
        int r = Math.min(radius, Math.min((x2 - x1) / 2, (y2 - y1) / 2));
        g.fill(x1 + r, y1, x2 - r, y2, color);
        g.fill(x1, y1 + r, x1 + r, y2 - r, color);
        g.fill(x2 - r, y1 + r, x2, y2 - r, color);
        fillCircleCorner(g, x1 + r, y1 + r, r, 0, color);
        fillCircleCorner(g, x2 - r, y1 + r, r, 1, color);
        fillCircleCorner(g, x1 + r, y2 - r, r, 2, color);
        fillCircleCorner(g, x2 - r, y2 - r, r, 3, color);
    }

    private void fillCircleCorner(GuiGraphics g, int cx, int cy, int r, int quadrant, int color) {
        for (int y = 0; y < r; y++) {
            for (int x = 0; x < r; x++) {
                if (x * x + y * y <= r * r) {
                    int px = (quadrant == 0 || quadrant == 2) ? cx - x - 1 : cx + x;
                    int py = (quadrant == 0 || quadrant == 1) ? cy - y - 1 : cy + y;
                    g.fill(px, py, px + 1, py + 1, color);
                }
            }
        }
    }

    private int applyAlpha(int color, int alpha) {
        int origA = (color >> 24) & 0xFF;
        int newA = (origA * alpha) / 255;
        return (color & 0x00FFFFFF) | (newA << 24);
    }

    private int blendColors(int a, int b, float t) {
        int aA = (a >> 24) & 0xFF, aR = (a >> 16) & 0xFF, aG = (a >> 8) & 0xFF, aB = a & 0xFF;
        int bA = (b >> 24) & 0xFF, bR = (b >> 16) & 0xFF, bG = (b >> 8) & 0xFF, bB = b & 0xFF;
        return ((int)(aA + (bA - aA) * t) << 24)
                | ((int)(aR + (bR - aR) * t) << 16)
                | ((int)(aG + (bG - aG) * t) << 8)
                | (int)(aB + (bB - aB) * t);
    }

    @Override
    public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) {
        int rx = (int)renderX, ry = (int)renderY, rw = (int)renderWidth, rh = (int)renderHeight;
        int cX1 = rx + navWidth + 4, cY1 = ry + topBarHeight + 4;
        int cX2 = rx + rw - 4, cY2 = ry + rh - 4;
        if (mouseX >= cX1 && mouseX <= cX2 && mouseY >= cY1 && mouseY <= cY2) {
            float maxScroll = Math.max(0, NAV_ITEMS.length * CATEGORY_HEADER_H - (cY2 - cY1));
            scrollOffsetTarget = (float)Math.max(0, Math.min(scrollOffsetTarget - scrollY * CATEGORY_HEADER_H, maxScroll));
            return true;
        }
        return super.mouseScrolled(mouseX, mouseY, scrollX, scrollY);
    }

    @Override
    public boolean mouseClicked(MouseButtonEvent event, boolean handled) {
        int mouseX = (int)event.x();
        int mouseY = (int)event.y();
        int rx = (int)renderX, ry = (int)renderY, rw = (int)renderWidth, rh = (int)renderHeight;

        if (settingsAnimation > 0.01f) {
            int sx = settingsX, sy = settingsY, sw = settingsWidth, sh = settingsHeight, sTopH = 22;
            if (mouseX >= sx + sw - 20 && mouseX <= sx + sw - 4 && mouseY >= sy + 4 && mouseY <= sy + sTopH - 4) {
                settingsWindowOpen = false; return true;
            }
            if (mouseX >= sx + sw - 14 && mouseX <= sx + sw && mouseY >= sy + sh - 14 && mouseY <= sy + sh) {
                settingsResizing = true; settingsResizeStartMouseX = mouseX; settingsResizeStartMouseY = mouseY;
                settingsResizeStartWidth = settingsWidth; settingsResizeStartHeight = settingsHeight; return true;
            }
            if (mouseX >= sx && mouseX <= sx + sw && mouseY >= sy && mouseY <= sy + sTopH) {
                settingsDragging = true; settingsDragOffsetX = mouseX - sx; settingsDragOffsetY = mouseY - sy; return true;
            }
            if (mouseX >= sx && mouseX <= sx + sw && mouseY >= sy && mouseY <= sy + sh) return true;
        }

        int cX1 = rx + navWidth + 4, cY1 = ry + topBarHeight + 4;
        int cX2 = rx + rw - 4, cY2 = ry + rh - 4;
        int barX1 = cX2 - SCROLLBAR_W - 1;
        if (mouseX >= barX1 - 2 && mouseX <= cX2 && mouseY >= cY1 && mouseY <= cY2) {
            scrollBarDragging = true; scrollBarDragStartY = mouseY; scrollBarDragStartOffset = scrollOffsetTarget; return true;
        }

        if (isHoveringCloseBtn(mouseX, mouseY, rx, ry, rw)) { this.onClose(); return true; }

        if (isHoveringResizeHandle(mouseX, mouseY, rx, ry, rw, rh)) {
            resizing = true; resizeStartMouseX = mouseX; resizeStartMouseY = mouseY;
            resizeStartWidth = guiWidth; resizeStartHeight = guiHeight; return true;
        }

        if (mouseX >= rx && mouseX <= rx + rw - 20 && mouseY >= ry && mouseY <= ry + topBarHeight) {
            dragging = true; dragOffsetX = mouseX - guiX; dragOffsetY = mouseY - guiY; return true;
        }

        int btnX1 = rx + 2, btnY1 = ry + rh - socialsHeight + 2, btnX2 = rx + navWidth - 2, btnY2 = ry + rh - 2;
        if (mouseX >= btnX1 && mouseX <= btnX2 && mouseY >= btnY1 && mouseY <= btnY2) {
            if (socialsWindow.isOpen()) socialsWindow.close();
            else socialsWindow.open();
            return true;
        }

        if (socialsWindow.mouseClicked(event, this.width, this.height)) return true;

        for (int i = 0; i < NAV_ITEMS.length; i++) {
            if (isHoveringNav(mouseX, mouseY, i, rx, ry, rh)) { selectedTab = i; return true; }
        }

        return super.mouseClicked(event, handled);
    }

    @Override
    public boolean mouseDragged(MouseButtonEvent event, double deltaX, double deltaY) {
        int mouseX = (int)event.x();
        int mouseY = (int)event.y();

        if (socialsWindow.mouseDragged(event, this.width, this.height)) return true;

        if (scrollBarDragging) {
            int rx = (int)renderX, ry = (int)renderY, rw = (int)renderWidth, rh = (int)renderHeight;
            int cH = (ry + rh - 4) - (ry + topBarHeight + 4);
            int totalContent = NAV_ITEMS.length * CATEGORY_HEADER_H;
            float maxScroll = Math.max(0, totalContent - cH);
            float ratio = (float)cH / totalContent;
            int barH = Math.max(16, (int)(cH * ratio));
            float movable = cH - barH;
            if (movable > 0) {
                float d2 = mouseY - scrollBarDragStartY;
                scrollOffsetTarget = (float)Math.max(0, Math.min(scrollBarDragStartOffset + d2 * (maxScroll / movable), maxScroll));
            }
            return true;
        }
        if (settingsResizing) {
            int nW = Math.max(180, settingsResizeStartWidth + (mouseX - settingsResizeStartMouseX));
            int nH = Math.max(140, settingsResizeStartHeight + (mouseY - settingsResizeStartMouseY));
            settingsWidth = Math.min(nW, this.width  - settingsX);
            settingsHeight = Math.min(nH, this.height - settingsY);
            return true;
        }
        if (settingsDragging) {
            settingsX = Math.max(0, Math.min(mouseX - settingsDragOffsetX, this.width - settingsWidth));
            settingsY = Math.max(0, Math.min(mouseY - settingsDragOffsetY, this.height - settingsHeight));
            return true;
        }
        if (resizing) {
            int nW = Math.max(MIN_WIDTH, resizeStartWidth + (mouseX - resizeStartMouseX));
            int nH = Math.max(MIN_HEIGHT, resizeStartHeight + (mouseY - resizeStartMouseY));
            guiWidth = Math.min(nW, this.width - guiX);
            guiHeight = Math.min(nH, this.height - guiY);
            return true;
        }
        if (dragging) {
            guiX = Math.max(0, Math.min(mouseX - dragOffsetX, this.width  - guiWidth));
            guiY = Math.max(0, Math.min(mouseY - dragOffsetY, this.height - guiHeight));
            return true;
        }
        return super.mouseDragged(event, deltaX, deltaY);
    }

    @Override
    public boolean mouseReleased(MouseButtonEvent event) {
        dragging = resizing = settingsDragging = settingsResizing = scrollBarDragging = false;
        socialsWindow.mouseReleased(event);
        return super.mouseReleased(event);
    }

    private boolean isHoveringCloseBtn(int mx, int my, int rx, int ry, int rw) {
        return mx >= rx + rw - 22 && mx <= rx + rw - 3 && my >= ry + 3 && my <= ry + topBarHeight - 3;
    }

    private boolean isHoveringResizeHandle(int mx, int my, int rx, int ry, int rw, int rh) {
        return mx >= rx + rw - 14 && mx <= rx + rw && my >= ry + rh - 14 && my <= ry + rh;
    }

    private boolean isHoveringNav(int mx, int my, int index, int rx, int ry, int rh) {
        int itemY = ry + topBarHeight + 8 + index * 24;
        return mx >= rx && mx <= rx + navWidth && my >= itemY - 1 && my <= itemY + 17;
    }

    @Override
    public boolean isPauseScreen() { return false; }
}
Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code