Вопрос Не открывается клик гуи

Начинающий
Статус
Оффлайн
Регистрация
25 Июл 2023
Сообщения
25
Реакции[?]
0
Поинты[?]
0
Здравствуйте, сделал функции и клик гуи, но клик гуи не открывается.


Код clickgui:
package fun.fantastic.client.ui.panel;

import com.mojang.blaze3d.matrix.MatrixStack;
import fun.fantastic.client.Client;
import fun.fantastic.client.module.CategoryType;
import fun.fantastic.client.ui.panel.element.Element;
import fun.fantastic.client.ui.panel.element.impl.ElementModule;
import fun.fantastic.client.utils.animation.Animation;
import fun.fantastic.client.utils.render.ClientUtil;
import fun.fantastic.client.utils.render.RenderUtils;
import fun.fantastic.client.utils.render.Shader;
import fun.fantastic.client.module.Module;
import fun.fantastic.client.utils.render.ShaderUtil;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

public class Panel extends Element {
    private String title = "Fantastic Client";
    public CategoryType selectedCategory = CategoryType.Combat;
    float yAnimation = 100;

    public Shader shader = new Shader("circledTexture");

    public float scroll = 0;

    public List<ElementModule> modules = new ArrayList<>();

    public Panel(double width, double height){
        this.width = (float) width;
        this.height = height;
        for(Module m : Client.getInstance().manager.getModules()){
            modules.add(new ElementModule(m));
        }
    }

    public void scroll(double delta){
        if (delta > 0) {
            this.scroll -= 12f;
        }
        else if (delta < 0) {
            this.scroll += 12f;
        }
    }

    @Override
    public void draw(int mouseX, int mouseY) {

        double posX = (double) mc.getMainWindow().getScaledWidth() / 2 - this.width / 2;
        double posY = (double) mc.getMainWindow().getScaledHeight() / 2 - this.height / 2;

        if (this.x != posX && this.y != posY){
            this.x = (float) posX;
            this.y = (float) posY;
        }
        this.width = 370;

        ShaderUtil.drawRound((float) this.x, (float) this.y, (float) this.width, (float) this.height, 6, new Color(10, 10, 10, 250).getRGB());
        ShaderUtil.drawRound((float) this.x, (float) this.y, (float) this.width / 3.6f - 3, (float) this.height, 6, new Color(20, 20, 20, 250).getRGB());
        AbstractGui.fill(new MatrixStack(), (int) ((int) this.x + this.width / 3.6f) - 3, (int) this.y, (int) ((int) this.x + this.width / 3.6f), (int) ((int) this.y + this.height) + 1, new Color(20, 20, 20, 250).getRGB());
        Client.rubik_17.drawString("Fantastic Client", (float) (x + 10), (float) (y)  + 10, new Color(ClientUtil.getClientColor().getRGB()).getRGB(), false);

        shader.load();
        shader.setUniformf("radius", 0.5F);
        shader.setUniformf("glow", 0.03F);
        shader.unload();

        int offset = 40;

        for (CategoryType category : CategoryType.values()) {
            Client.rubik_17.drawString(category.getDisplayName(), (float) (x + 28), (float) (y + 10 + 30 + offset), new Color(255, 255, 255).getRGB(), false);
            RenderUtils.drawImage(stack, new ResourceLocation("fantastic/category/" + category.getIndex() + ".png"), x + 10, (float) (y + 10 + 30 + offset), 12, 12);
            if (selectedCategory == category) {
                yAnimation = Animation.fast(yAnimation, (float) (y + 10 + 30 + offset - 2.5f), 15f);
                ShaderUtil.drawRound(x + 5, yAnimation + 1, 1, 14, 2f, new Color(ClientUtil.getClientColor().getRGB()).getRGB());
            }
            offset += 18;
        }
        List<ElementModule> sorted = modules.stream().filter(component -> component.module.category == selectedCategory).toList();
        GL11.glPushMatrix();

        GL11.glEnable(GL11.GL_SCISSOR_TEST);
        float scissorX = ((float) this.x);
        float scissorY = ((float) this.y);

        float scissorWidth = (scissorX + (float) this.width);
        float scissorHeight = (scissorY + (float) this.height);


        float factor = (float) mc.getMainWindow().getGuiScaleFactor();
        GL11.glScissor((int) (scissorX * (float) factor), (int) (((float) mc.getMainWindow().getScaledHeight() - scissorHeight) * (float) factor), (int) ((scissorWidth - scissorX) * (float) factor), (int) ((scissorHeight - scissorY) * (float) factor));
        float offsetGui = 0;
        for (ElementModule component : sorted.stream().filter(component -> sorted.indexOf(component) % 2 == 0).toList()) {
            if (component.module.category == selectedCategory) {
                component.x = x + 100 + 10;
                component.y = Animation.lerp(component.y, y + 30 + offsetGui + scroll, 15f);
                component.width = 245 / 2f;
                component.height = 20;
                if (component.binding) {
                    offsetGui += component.height + 5;
                }

                for (Element component1 : component.component) {
                    offsetGui += component1.height;
                }

                component.draw(mouseX, mouseY);
                offsetGui += 26;
            }
        }
        offsetGui = 0;
        for (ElementModule component : sorted.stream().filter(component -> sorted.indexOf(component) % 2 != 0).toList()) {
            if (component.module.category == selectedCategory) {
                component.x = x + 100 + 10 + 245 / 2f + 10;
                component.y = Animation.lerp(component.y, y + 30 + offsetGui + scroll, 15f);
                component.width = 245 / 2f;
                component.height = 20;
                if (component.binding) {
                    offsetGui += component.height + 5;
                }

                for (Element component1 : component.component) {
                    offsetGui += component1.height;
                }

                component.draw(mouseX, mouseY);
                offsetGui += 26;
            }
        }
        GL11.glDisable(GL11.GL_SCISSOR_TEST);

        GL11.glPopMatrix();


    }

    @Override
    public void mouseClicked(int mouseX, int mouseY, int button) {

        int offset = 40;
        for (CategoryType category : CategoryType.values()) {
            if (mouseX > x && mouseX < x + 125 && mouseY > y + 10 + 30 + offset - 2.5f && mouseY < y + 10 + 30 + offset + 12.5f) {
                scroll = 0;
                selectedCategory = category;
            }
            offset += 18;
        }

        for (ElementModule component : modules) {
            if (component.module.category == selectedCategory) {
                component.mouseClicked(mouseX, mouseY, button);
            }
        }
        super.mouseClicked(mouseX, mouseY, button);
    }

    @Override
    public void mouseReleased(int x, int y, int button) {
        for (ElementModule component : modules) {
            if (component.module.category == selectedCategory) {
                component.mouseReleased(x, y, button);
            }
        }
        super.mouseReleased(x, y, button);
    }

    @Override
    public void keypressed(int key) {
        for (ElementModule component : modules) {
            if (component.module.category == selectedCategory) {
                component.keypressed(key);
            }
        }
        super.keypressed(key);
    }
}
Java:
package fun.fantastic.client.ui.panel;

import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.text.StringTextComponent;

public class UIScreen extends Screen {

    private Panel panel;
    public UIScreen() {
        super(new StringTextComponent(""));
        this.panel = new Panel(370, 250);
    }

    @Override
    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
        panel.draw(mouseX, mouseY);
        super.render(matrixStack, mouseX, mouseY, partialTicks);
    }

    @Override
    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
        panel.keypressed(keyCode);
        return super.keyPressed(keyCode, scanCode, modifiers);
    }

    @Override
    public boolean mouseReleased(double mouseX, double mouseY, int button) {
        panel.mouseReleased((int) mouseX, (int) mouseY, button);
        return super.mouseReleased(mouseX, mouseY, button);
    }

    @Override
    public boolean mouseClicked(double mouseX, double mouseY, int button) {
        panel.mouseClicked((int) mouseX, (int) mouseY, button);
        return super.mouseClicked(mouseX, mouseY, button);
    }

    @Override
    public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
        panel.scroll(delta);
        return super.mouseScrolled(mouseX, mouseY, delta);
    }
}
Java:
package fun.fantastic.client.module.impl.hud;

import fun.fantastic.client.event.EventTarget;
import fun.fantastic.client.module.CategoryType;
import fun.fantastic.client.module.ModuleAnnotation;
import fun.fantastic.client.module.Module;
import fun.fantastic.client.ui.panel.UIScreen;
import org.lwjgl.glfw.GLFW;

@ModuleAnnotation(name = "ClickGui",desc = "Открывает кликгуи", type = CategoryType.Hud)
public class ClickGUI extends Module {

    public ClickGUI() {
        this.bind = GLFW.GLFW_KEY_RIGHT_SHIFT;
    }

    @Override
    public void onEnable() {
        mc.displayGuiScreen(new UIScreen());
        toggle();
        this.setState(false);
        super.onEnable();
    }
}
Почему-то не изменяется, в общем 2 код - код скрина, а 3 - код самой функции
 
Сверху Снизу