Гайд ColorSettings | Выбор цвета | Expensive 3.1

Начинающий
Статус
Оффлайн
Регистрация
14 Ноя 2024
Сообщения
23
Реакции[?]
0
Поинты[?]
0

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

Так вот выглядит это дело
1733058102032.png

Заходим в ModuleComponent и туда вписываем

if (setting instanceof ColorSetting color) {
components.add(new ColorComponent(color));
}

Дальше создаем класс ColorComponent в ui.dropdown.components.settings;

и туда вписываем этот код
код:
package im.Winced.ui.dropdown.components.settings;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.Winced.functions.settings.impl.ColorSetting;
import im.Winced.ui.dropdown.impl.Component;
import im.Winced.utils.render.ColorUtils;
import im.Winced.utils.render.DisplayUtils;
import im.Winced.utils.render.font.Fonts;
import org.lwjgl.opengl.GL11;

import java.awt.*;

public class ColorComponent extends Component {
    private final ColorSetting colorSetting;
    private boolean expanded;
    private boolean draggingHue;
    private boolean draggingSatVal;

    public ColorComponent(ColorSetting color) {
        super();
        this.colorSetting = color;
        this.setHeight(16);
    }

    [USER=1367676]@override[/USER]
    public void render(MatrixStack stack, float mouseX, float mouseY) {
        super.render(stack, mouseX, mouseY);

        Fonts.sf_regular1.drawText(stack, colorSetting.getName(), getX() + 5, getY() + 2,
                ColorUtils.rgb(255, 255, 255), 7.0f, 0.0f);

        float previewX = getX() + getWidth() - 20;
        float previewY = getY() + 3;
        DisplayUtils.drawRoundedRect(previewX, previewY, 15, 10, 2, colorSetting.get());

        if (expanded) {
            float pickerX = getX() + 5;
            float pickerY = getY() + 20;

            DisplayUtils.drawRoundedRect(pickerX - 2, pickerY - 2, 84, 84, 3,
                    ColorUtils.rgba(17, 17, 17, 255));
            int baseColor = ColorUtils.HSBtoRGB(colorSetting.getHue(), 1.0f, 1.0f);
            DisplayUtils.drawGradientRect(pickerX, pickerY, 65, 65,
                    ColorUtils.rgba(255, 255, 255, 255),
                    baseColor,
                    ColorUtils.rgba(255, 255, 255, 255),
                    baseColor);

            DisplayUtils.drawGradientRect(pickerX, pickerY, 65, 65,
                    ColorUtils.rgba(0, 0, 0, 0),
                    ColorUtils.rgba(0, 0, 0, 0),
                    ColorUtils.rgba(0, 0, 0, 255),
                    ColorUtils.rgba(0, 0, 0, 255));
            float hueX = pickerX + 70;
            DisplayUtils.drawRoundedRect(hueX - 1, pickerY - 1, 7, 67, 2,
                    ColorUtils.rgba(40, 40, 40, 255));
            float sliderHeight = 65f / 6f;
            for (int i = 0; i < 6; i++) {
                float yPos = pickerY + (i * sliderHeight);
                DisplayUtils.drawGradientRect(hueX, yPos, 5, sliderHeight,
                        ColorUtils.HSBtoRGB(i / 6f, 1.0f, 1.0f),
                        ColorUtils.HSBtoRGB(i / 6f, 1.0f, 1.0f),
                        ColorUtils.HSBtoRGB((i + 1) / 6f, 1.0f, 1.0f),
                        ColorUtils.HSBtoRGB((i + 1) / 6f, 1.0f, 1.0f));
            }

            float satX = pickerX + (colorSetting.getSaturation() * 65);
            float valY = pickerY + ((1 - colorSetting.getValue()) * 65);
            float hueY = pickerY + (colorSetting.getHue() * 65);

            DisplayUtils.drawCircle(satX, valY, 3, ColorUtils.rgb(255, 255, 255));
            DisplayUtils.drawCircle(satX, valY, 2, ColorUtils.rgb(0, 0, 0));

            DisplayUtils.drawRoundedRect(hueX - 2, hueY - 1, 9, 3, 1, ColorUtils.rgb(255, 255, 255));
            DisplayUtils.drawRoundedRect(hueX - 1, hueY, 7, 1, 1, ColorUtils.rgb(0, 0, 0));

            if (draggingSatVal) {
                updateColor(mouseX, mouseY);
            }
            if (draggingHue) {
                updateHue(mouseY - pickerY);
            }

            setHeight(95);
        } else {
            setHeight(16);
        }
    }





    [USER=1367676]@override[/USER]
    public void mouseClick(float mouseX, float mouseY, int button) {
        if (button == 0) {
            float pickerX = getX() + 5;
            float pickerY = getY() + 20;
            float hueX = pickerX + 70;

            if (mouseX >= getX() + getWidth() - 20 && mouseX <= getX() + getWidth() - 5 &&
                    mouseY >= getY() + 3 && mouseY <= getY() + 13) {
                expanded = !expanded;
                return;
            }

            if (expanded) {
                if (mouseX >= pickerX && mouseX <= pickerX + 65 &&
                        mouseY >= pickerY && mouseY <= pickerY + 65) {
                    draggingSatVal = true;
                    updateColor(mouseX, mouseY);
                }

                if (mouseX >= hueX && mouseX <= hueX + 5 &&
                        mouseY >= pickerY && mouseY <= pickerY + 65) {
                    draggingHue = true;
                    updateHue(mouseY - pickerY);
                }
            }
        }
    }


    [USER=1367676]@override[/USER]
    public void mouseRelease(float mouseX, float mouseY, int button) {
        draggingSatVal = false;
        draggingHue = false;
    }

    private void drawSaturationValueSelector(MatrixStack stack, float x, float y) {
        DisplayUtils.drawRoundedRect(x, y, 100, 100, 2,
                ColorUtils.HSBtoRGB(colorSetting.getHue(), 1.0f, 1.0f));

        DisplayUtils.drawGradientRect(x, y, x + 100, y + 100,
                ColorUtils.rgba(255, 255, 255, 0),
                ColorUtils.rgba(255, 255, 255, 255),
                ColorUtils.rgba(0, 0, 0, 0),
                ColorUtils.rgba(0, 0, 0, 255));

        float satX = x + colorSetting.getSaturation() * 100;
        float valY = y + (1 - colorSetting.getValue()) * 100;
        DisplayUtils.drawCircle(satX, valY, 3, -1);
    }

    private void drawHueSlider(MatrixStack stack, float x, float y) {
        for (int i = 0; i < 100; i++) {
            float hue = i / 100f;
            int color = ColorUtils.HSBtoRGB(hue, 1.0f, 1.0f);
            DisplayUtils.drawRect(x, y + i, 15, 1, color);
        }

        float hueY = y + colorSetting.getHue() * 100;
        DisplayUtils.drawRect(x - 2, hueY, 19, 2, -1);
    }


    private void updateColor(float mouseX, float mouseY) {
        float pickerX = getX() + 5;
        float pickerY = getY() + 20;

        float saturation = (mouseX - pickerX) / 65f;
        float value = 1f - ((mouseY - pickerY) / 65f);

        saturation = Math.max(0f, Math.min(1f, saturation));
        value = Math.max(0f, Math.min(1f, value));

        colorSetting.setSaturation(saturation);
        colorSetting.setValue(value);
        colorSetting.updateColor();
    }


    private void updateHue(float y) {
        float hue = y / 65f;
        hue = Math.max(0f, Math.min(1f, hue));
        colorSetting.setHue(hue);
        colorSetting.updateColor();
    }
}
Дальше идем в DisplayUtils и вставляем в любое место следующие методы

код:
    public static void drawGradientRect(float x, float y, float width, float height, int topLeft, int topRight, int bottomLeft, int bottomRight) {
        GlStateManager.enableBlend();
        GlStateManager.disableTexture();
        GlStateManager.blendFuncSeparate(770, 771, 1, 0);
        GlStateManager.shadeModel(7425);

        buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);

        float[] colorTopLeft = ColorUtils.rgba(topLeft);
        float[] colorTopRight = ColorUtils.rgba(topRight);
        float[] colorBottomLeft = ColorUtils.rgba(bottomLeft);
        float[] colorBottomRight = ColorUtils.rgba(bottomRight);

        buffer.pos(x, y + height, 0)
                .color(colorBottomLeft[0], colorBottomLeft[1], colorBottomLeft[2], colorBottomLeft[3])
                .endVertex();

        buffer.pos(x + width, y + height, 0)
                .color(colorBottomRight[0], colorBottomRight[1], colorBottomRight[2], colorBottomRight[3])
                .endVertex();

        buffer.pos(x + width, y, 0)
                .color(colorTopRight[0], colorTopRight[1], colorTopRight[2], colorTopRight[3])
                .endVertex();

        buffer.pos(x, y, 0)
                .color(colorTopLeft[0], colorTopLeft[1], colorTopLeft[2], colorTopLeft[3])
                .endVertex();

        tessellator.draw();

        GlStateManager.shadeModel(7424);
        GlStateManager.enableTexture();
        GlStateManager.disableBlend();
    }


    public static void drawBlur(float radius) {
        GlStateManager.enableBlend();
        GlStateManager.color4f(1, 1, 1, 1);

        ShaderUtil.blur.attach();
        ShaderUtil.blur.setUniform("texture", 0);
        ShaderUtil.blur.setUniform("texelSize", 1.0f / mc.getMainWindow().getWidth(), 1.0f / mc.getMainWindow().getHeight());
        ShaderUtil.blur.setUniform("radius", radius);

        GlStateManager.bindTexture(mc.getFramebuffer().framebufferTexture);
        ShaderUtil.drawQuads();
        ShaderUtil.blur.detach();

        GlStateManager.bindTexture(0);
    }

    public static void drawGlow(float x, float y, float width, float height, float radius, int color) {
        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();

        ShaderUtil.glow.attach();
        ShaderUtil.glow.setUniform("size", width, height);
        ShaderUtil.glow.setUniform("radius", radius);
        ShaderUtil.glow.setUniform("color", ColorUtils.rgba(color));

        drawQuads(x, y, width, height, 7);

        ShaderUtil.glow.detach();
        GlStateManager.disableBlend();
        GlStateManager.popMatrix();
    }

    public static void drawOutlinedRoundedRect(float x, float y, float width, float height, float radius, float lineWidth, int color, int outlineColor) {
        drawRoundedRect(x, y, width, height, radius, color);
        drawRoundedRect(x - lineWidth, y - lineWidth, width + lineWidth * 2, height + lineWidth * 2, radius + lineWidth, outlineColor);
    }

    public static void drawAnimatedRect(float x, float y, float width, float height, float progress, int startColor, int endColor) {
        float animProgress = MathHelper.clamp(progress, 0, 1);
        int currentColor = ColorUtils.interpolate(startColor, endColor, animProgress);
        drawRect(x, y, x + width * animProgress, y + height, currentColor);
    }

    public static void drawCircleOutline(float x, float y, float radius, float lineWidth, int segments, int color) {
        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();
        GlStateManager.disableTexture();
        GlStateManager.blendFuncSeparate(770, 771, 1, 0);

        buffer.begin(GL11.GL_LINE_LOOP, POSITION_COLOR);

        float theta = (float) (2 * Math.PI / segments);
        float tangetial_factor = (float) Math.tan(theta);
        float radial_factor = (float) Math.cos(theta);

        float x1 = radius;
        float y1 = 0;

        float[] rgba = ColorUtils.rgba(color);

        GL11.glLineWidth(lineWidth);

        for(int i = 0; i < segments; i++) {
            buffer.pos(x1 + x, y1 + y, 0).color(rgba[0], rgba[1], rgba[2], rgba[3]).endVertex();

            float tx = -y1;
            float ty = x1;

            x1 += tx * tangetial_factor;
            y1 += ty * tangetial_factor;

            x1 *= radial_factor;
            y1 *= radial_factor;
        }

        tessellator.draw();

        GlStateManager.enableTexture();
        GlStateManager.disableBlend();
        GlStateManager.popMatrix();
    }
Дальше идем в ShaderUtil и вставляем данные методы

код:
    // color component

    public static ShaderUtil blur = new ShaderUtil("blur");
    public static ShaderUtil glow = new ShaderUtil("glow");
    public static ShaderUtil gradient = new ShaderUtil("gradient");

    public void setUniformMatrix4f(String name, float[] matrix) {
        int location = getUniform(name);
        glUniformMatrix4fv(location, false, matrix);
    }

    public void setUniformSampler(String name, int textureUnit) {
        int location = getUniform(name);
        glUniform1i(location, textureUnit);
    }

    public boolean hasUniform(String name) {
        return glGetUniformLocation(programID, name) != -1;
    }

    public void bindTexture(String uniformName, int textureId, int textureUnit) {
        glActiveTexture(GL_TEXTURE0 + textureUnit);
        glBindTexture(GL_TEXTURE_2D, textureId);
        setUniform(uniformName, textureUnit);
    }

    public static void setupRenderState() {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glDisable(GL_TEXTURE_2D);
        glDisable(GL_ALPHA_TEST);
    }

    public static void cleanup() {
        glEnable(GL_TEXTURE_2D);
        glEnable(GL_ALPHA_TEST);
        glDisable(GL_BLEND);
    }

    public int getProgramID() {
        return programID;
    }
Идем в ColorUtils и вставляем это

код:
    // color component

    public static int HSBtoRGB(float hue, float saturation, float brightness) {
        return Color.HSBtoRGB(hue, saturation, brightness);
    }

    public static float[] RGBtoHSB(int rgb) {
        int r = (rgb >> 16) & 0xFF;
        int g = (rgb >> 8) & 0xFF;
        int b = rgb & 0xFF;
        return Color.RGBtoHSB(r, g, b, null);
    }

    public static int rainbow(float speed, float saturation, float brightness) {
        float hue = (System.currentTimeMillis() % (int)(speed * 1000)) / (speed * 1000f);
        return HSBtoRGB(hue, saturation, brightness);
    }

    public static int fade(int color, int speed, float offset) {
        float[] hsb = RGBtoHSB(color);
        float hue = hsb[0];
        float brightness = ((float) Math.sin((System.currentTimeMillis() + offset) / speed) + 1f) / 2f;
        return HSBtoRGB(hue, hsb[1], brightness * hsb[2]);
    }
Дальше переходим или создаем ColorSettings в functions.settings.impl;
и туда делаем этот код

код:
package im.Winced.functions.settings.impl;


import im.Winced.functions.settings.Setting;

import java.util.function.Supplier;

public class ColorSetting extends Setting<Integer> {
    private float hue, saturation, value;
    private float alpha = 1.0f;

    public ColorSetting(String name, Integer defaultVal) {
        super(name, defaultVal);
        updateHSB();
    }

    private void updateHSB() {
        float[] hsb = java.awt.Color.RGBtoHSB(
                (get() >> 16) & 0xFF,
                (get() >> 8) & 0xFF,
                get() & 0xFF,
                null
        );
        this.hue = hsb[0];
        this.saturation = hsb[1];
        this.value = hsb[2];
    }

    public void updateColor() {
        int rgb = java.awt.Color.HSBtoRGB(hue, saturation, value);
        set(rgb);
    }

    public float getHue() {
        return hue;
    }

    public void setHue(float hue) {
        this.hue = hue;
    }

    public float getSaturation() {
        return saturation;
    }

    public void setSaturation(float saturation) {
        this.saturation = saturation;
    }

    public float getValue() {
        return value;
    }

    public void setValue(float value) {
        this.value = value;
    }

    public float getAlpha() {
        return alpha;
    }

    public void setAlpha(float alpha) {
        this.alpha = alpha;
    }

    [USER=1367676]@override[/USER]
    public ColorSetting setVisible(Supplier<Boolean> bool) {
        return (ColorSetting) super.setVisible(bool);
    }
}
Все готово, теперь чтобы протестить это можем использовать данный код


Тест:
package im.Winced.functions.impl.pve;

import im.Winced.functions.api.Category;
import im.Winced.functions.api.Function;
import im.Winced.functions.api.FunctionRegister;
import im.Winced.functions.settings.impl.ColorSetting;

@FunctionRegister(name = "Test", type = Category.Combat)
public class Test extends Function {
    private final ColorSetting colorSetting = new ColorSetting("Color", 0x000000);

    public Test() {
        this.addSettings(colorSetting);
    }
}

! Для пастеров: Чтобы поменять многие ошибки нажимаем cntr shift r, в верхнем поле пишем im.Winced, в нижнем ваше название клиента (im.expensive)
 
Начинающий
Статус
Оффлайн
Регистрация
14 Апр 2023
Сообщения
536
Реакции[?]
5
Поинты[?]
2K
Так вот выглядит это дело

Заходим в ModuleComponent и туда вписываем

if (setting instanceof ColorSetting color) {
components.add(new ColorComponent(color));
}

Дальше создаем класс ColorComponent в ui.dropdown.components.settings;

и туда вписываем этот код
код:
package im.Winced.ui.dropdown.components.settings;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.Winced.functions.settings.impl.ColorSetting;
import im.Winced.ui.dropdown.impl.Component;
import im.Winced.utils.render.ColorUtils;
import im.Winced.utils.render.DisplayUtils;
import im.Winced.utils.render.font.Fonts;
import org.lwjgl.opengl.GL11;

import java.awt.*;

public class ColorComponent extends Component {
    private final ColorSetting colorSetting;
    private boolean expanded;
    private boolean draggingHue;
    private boolean draggingSatVal;

    public ColorComponent(ColorSetting color) {
        super();
        this.colorSetting = color;
        this.setHeight(16);
    }

    [USER=1367676]@override[/USER]
    public void render(MatrixStack stack, float mouseX, float mouseY) {
        super.render(stack, mouseX, mouseY);

        Fonts.sf_regular1.drawText(stack, colorSetting.getName(), getX() + 5, getY() + 2,
                ColorUtils.rgb(255, 255, 255), 7.0f, 0.0f);

        float previewX = getX() + getWidth() - 20;
        float previewY = getY() + 3;
        DisplayUtils.drawRoundedRect(previewX, previewY, 15, 10, 2, colorSetting.get());

        if (expanded) {
            float pickerX = getX() + 5;
            float pickerY = getY() + 20;

            DisplayUtils.drawRoundedRect(pickerX - 2, pickerY - 2, 84, 84, 3,
                    ColorUtils.rgba(17, 17, 17, 255));
            int baseColor = ColorUtils.HSBtoRGB(colorSetting.getHue(), 1.0f, 1.0f);
            DisplayUtils.drawGradientRect(pickerX, pickerY, 65, 65,
                    ColorUtils.rgba(255, 255, 255, 255),
                    baseColor,
                    ColorUtils.rgba(255, 255, 255, 255),
                    baseColor);

            DisplayUtils.drawGradientRect(pickerX, pickerY, 65, 65,
                    ColorUtils.rgba(0, 0, 0, 0),
                    ColorUtils.rgba(0, 0, 0, 0),
                    ColorUtils.rgba(0, 0, 0, 255),
                    ColorUtils.rgba(0, 0, 0, 255));
            float hueX = pickerX + 70;
            DisplayUtils.drawRoundedRect(hueX - 1, pickerY - 1, 7, 67, 2,
                    ColorUtils.rgba(40, 40, 40, 255));
            float sliderHeight = 65f / 6f;
            for (int i = 0; i < 6; i++) {
                float yPos = pickerY + (i * sliderHeight);
                DisplayUtils.drawGradientRect(hueX, yPos, 5, sliderHeight,
                        ColorUtils.HSBtoRGB(i / 6f, 1.0f, 1.0f),
                        ColorUtils.HSBtoRGB(i / 6f, 1.0f, 1.0f),
                        ColorUtils.HSBtoRGB((i + 1) / 6f, 1.0f, 1.0f),
                        ColorUtils.HSBtoRGB((i + 1) / 6f, 1.0f, 1.0f));
            }

            float satX = pickerX + (colorSetting.getSaturation() * 65);
            float valY = pickerY + ((1 - colorSetting.getValue()) * 65);
            float hueY = pickerY + (colorSetting.getHue() * 65);

            DisplayUtils.drawCircle(satX, valY, 3, ColorUtils.rgb(255, 255, 255));
            DisplayUtils.drawCircle(satX, valY, 2, ColorUtils.rgb(0, 0, 0));

            DisplayUtils.drawRoundedRect(hueX - 2, hueY - 1, 9, 3, 1, ColorUtils.rgb(255, 255, 255));
            DisplayUtils.drawRoundedRect(hueX - 1, hueY, 7, 1, 1, ColorUtils.rgb(0, 0, 0));

            if (draggingSatVal) {
                updateColor(mouseX, mouseY);
            }
            if (draggingHue) {
                updateHue(mouseY - pickerY);
            }

            setHeight(95);
        } else {
            setHeight(16);
        }
    }





    [USER=1367676]@override[/USER]
    public void mouseClick(float mouseX, float mouseY, int button) {
        if (button == 0) {
            float pickerX = getX() + 5;
            float pickerY = getY() + 20;
            float hueX = pickerX + 70;

            if (mouseX >= getX() + getWidth() - 20 && mouseX <= getX() + getWidth() - 5 &&
                    mouseY >= getY() + 3 && mouseY <= getY() + 13) {
                expanded = !expanded;
                return;
            }

            if (expanded) {
                if (mouseX >= pickerX && mouseX <= pickerX + 65 &&
                        mouseY >= pickerY && mouseY <= pickerY + 65) {
                    draggingSatVal = true;
                    updateColor(mouseX, mouseY);
                }

                if (mouseX >= hueX && mouseX <= hueX + 5 &&
                        mouseY >= pickerY && mouseY <= pickerY + 65) {
                    draggingHue = true;
                    updateHue(mouseY - pickerY);
                }
            }
        }
    }


    [USER=1367676]@override[/USER]
    public void mouseRelease(float mouseX, float mouseY, int button) {
        draggingSatVal = false;
        draggingHue = false;
    }

    private void drawSaturationValueSelector(MatrixStack stack, float x, float y) {
        DisplayUtils.drawRoundedRect(x, y, 100, 100, 2,
                ColorUtils.HSBtoRGB(colorSetting.getHue(), 1.0f, 1.0f));

        DisplayUtils.drawGradientRect(x, y, x + 100, y + 100,
                ColorUtils.rgba(255, 255, 255, 0),
                ColorUtils.rgba(255, 255, 255, 255),
                ColorUtils.rgba(0, 0, 0, 0),
                ColorUtils.rgba(0, 0, 0, 255));

        float satX = x + colorSetting.getSaturation() * 100;
        float valY = y + (1 - colorSetting.getValue()) * 100;
        DisplayUtils.drawCircle(satX, valY, 3, -1);
    }

    private void drawHueSlider(MatrixStack stack, float x, float y) {
        for (int i = 0; i < 100; i++) {
            float hue = i / 100f;
            int color = ColorUtils.HSBtoRGB(hue, 1.0f, 1.0f);
            DisplayUtils.drawRect(x, y + i, 15, 1, color);
        }

        float hueY = y + colorSetting.getHue() * 100;
        DisplayUtils.drawRect(x - 2, hueY, 19, 2, -1);
    }


    private void updateColor(float mouseX, float mouseY) {
        float pickerX = getX() + 5;
        float pickerY = getY() + 20;

        float saturation = (mouseX - pickerX) / 65f;
        float value = 1f - ((mouseY - pickerY) / 65f);

        saturation = Math.max(0f, Math.min(1f, saturation));
        value = Math.max(0f, Math.min(1f, value));

        colorSetting.setSaturation(saturation);
        colorSetting.setValue(value);
        colorSetting.updateColor();
    }


    private void updateHue(float y) {
        float hue = y / 65f;
        hue = Math.max(0f, Math.min(1f, hue));
        colorSetting.setHue(hue);
        colorSetting.updateColor();
    }
}
Дальше идем в DisplayUtils и вставляем в любое место следующие методы

код:
    public static void drawGradientRect(float x, float y, float width, float height, int topLeft, int topRight, int bottomLeft, int bottomRight) {
        GlStateManager.enableBlend();
        GlStateManager.disableTexture();
        GlStateManager.blendFuncSeparate(770, 771, 1, 0);
        GlStateManager.shadeModel(7425);

        buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);

        float[] colorTopLeft = ColorUtils.rgba(topLeft);
        float[] colorTopRight = ColorUtils.rgba(topRight);
        float[] colorBottomLeft = ColorUtils.rgba(bottomLeft);
        float[] colorBottomRight = ColorUtils.rgba(bottomRight);

        buffer.pos(x, y + height, 0)
                .color(colorBottomLeft[0], colorBottomLeft[1], colorBottomLeft[2], colorBottomLeft[3])
                .endVertex();

        buffer.pos(x + width, y + height, 0)
                .color(colorBottomRight[0], colorBottomRight[1], colorBottomRight[2], colorBottomRight[3])
                .endVertex();

        buffer.pos(x + width, y, 0)
                .color(colorTopRight[0], colorTopRight[1], colorTopRight[2], colorTopRight[3])
                .endVertex();

        buffer.pos(x, y, 0)
                .color(colorTopLeft[0], colorTopLeft[1], colorTopLeft[2], colorTopLeft[3])
                .endVertex();

        tessellator.draw();

        GlStateManager.shadeModel(7424);
        GlStateManager.enableTexture();
        GlStateManager.disableBlend();
    }


    public static void drawBlur(float radius) {
        GlStateManager.enableBlend();
        GlStateManager.color4f(1, 1, 1, 1);

        ShaderUtil.blur.attach();
        ShaderUtil.blur.setUniform("texture", 0);
        ShaderUtil.blur.setUniform("texelSize", 1.0f / mc.getMainWindow().getWidth(), 1.0f / mc.getMainWindow().getHeight());
        ShaderUtil.blur.setUniform("radius", radius);

        GlStateManager.bindTexture(mc.getFramebuffer().framebufferTexture);
        ShaderUtil.drawQuads();
        ShaderUtil.blur.detach();

        GlStateManager.bindTexture(0);
    }

    public static void drawGlow(float x, float y, float width, float height, float radius, int color) {
        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();

        ShaderUtil.glow.attach();
        ShaderUtil.glow.setUniform("size", width, height);
        ShaderUtil.glow.setUniform("radius", radius);
        ShaderUtil.glow.setUniform("color", ColorUtils.rgba(color));

        drawQuads(x, y, width, height, 7);

        ShaderUtil.glow.detach();
        GlStateManager.disableBlend();
        GlStateManager.popMatrix();
    }

    public static void drawOutlinedRoundedRect(float x, float y, float width, float height, float radius, float lineWidth, int color, int outlineColor) {
        drawRoundedRect(x, y, width, height, radius, color);
        drawRoundedRect(x - lineWidth, y - lineWidth, width + lineWidth * 2, height + lineWidth * 2, radius + lineWidth, outlineColor);
    }

    public static void drawAnimatedRect(float x, float y, float width, float height, float progress, int startColor, int endColor) {
        float animProgress = MathHelper.clamp(progress, 0, 1);
        int currentColor = ColorUtils.interpolate(startColor, endColor, animProgress);
        drawRect(x, y, x + width * animProgress, y + height, currentColor);
    }

    public static void drawCircleOutline(float x, float y, float radius, float lineWidth, int segments, int color) {
        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();
        GlStateManager.disableTexture();
        GlStateManager.blendFuncSeparate(770, 771, 1, 0);

        buffer.begin(GL11.GL_LINE_LOOP, POSITION_COLOR);

        float theta = (float) (2 * Math.PI / segments);
        float tangetial_factor = (float) Math.tan(theta);
        float radial_factor = (float) Math.cos(theta);

        float x1 = radius;
        float y1 = 0;

        float[] rgba = ColorUtils.rgba(color);

        GL11.glLineWidth(lineWidth);

        for(int i = 0; i < segments; i++) {
            buffer.pos(x1 + x, y1 + y, 0).color(rgba[0], rgba[1], rgba[2], rgba[3]).endVertex();

            float tx = -y1;
            float ty = x1;

            x1 += tx * tangetial_factor;
            y1 += ty * tangetial_factor;

            x1 *= radial_factor;
            y1 *= radial_factor;
        }

        tessellator.draw();

        GlStateManager.enableTexture();
        GlStateManager.disableBlend();
        GlStateManager.popMatrix();
    }
Дальше идем в ShaderUtil и вставляем данные методы

код:
    // color component

    public static ShaderUtil blur = new ShaderUtil("blur");
    public static ShaderUtil glow = new ShaderUtil("glow");
    public static ShaderUtil gradient = new ShaderUtil("gradient");

    public void setUniformMatrix4f(String name, float[] matrix) {
        int location = getUniform(name);
        glUniformMatrix4fv(location, false, matrix);
    }

    public void setUniformSampler(String name, int textureUnit) {
        int location = getUniform(name);
        glUniform1i(location, textureUnit);
    }

    public boolean hasUniform(String name) {
        return glGetUniformLocation(programID, name) != -1;
    }

    public void bindTexture(String uniformName, int textureId, int textureUnit) {
        glActiveTexture(GL_TEXTURE0 + textureUnit);
        glBindTexture(GL_TEXTURE_2D, textureId);
        setUniform(uniformName, textureUnit);
    }

    public static void setupRenderState() {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glDisable(GL_TEXTURE_2D);
        glDisable(GL_ALPHA_TEST);
    }

    public static void cleanup() {
        glEnable(GL_TEXTURE_2D);
        glEnable(GL_ALPHA_TEST);
        glDisable(GL_BLEND);
    }

    public int getProgramID() {
        return programID;
    }
Идем в ColorUtils и вставляем это

код:
    // color component

    public static int HSBtoRGB(float hue, float saturation, float brightness) {
        return Color.HSBtoRGB(hue, saturation, brightness);
    }

    public static float[] RGBtoHSB(int rgb) {
        int r = (rgb >> 16) & 0xFF;
        int g = (rgb >> 8) & 0xFF;
        int b = rgb & 0xFF;
        return Color.RGBtoHSB(r, g, b, null);
    }

    public static int rainbow(float speed, float saturation, float brightness) {
        float hue = (System.currentTimeMillis() % (int)(speed * 1000)) / (speed * 1000f);
        return HSBtoRGB(hue, saturation, brightness);
    }

    public static int fade(int color, int speed, float offset) {
        float[] hsb = RGBtoHSB(color);
        float hue = hsb[0];
        float brightness = ((float) Math.sin((System.currentTimeMillis() + offset) / speed) + 1f) / 2f;
        return HSBtoRGB(hue, hsb[1], brightness * hsb[2]);
    }
Дальше переходим или создаем ColorSettings в functions.settings.impl;
и туда делаем этот код

код:
package im.Winced.functions.settings.impl;


import im.Winced.functions.settings.Setting;

import java.util.function.Supplier;

public class ColorSetting extends Setting<Integer> {
    private float hue, saturation, value;
    private float alpha = 1.0f;

    public ColorSetting(String name, Integer defaultVal) {
        super(name, defaultVal);
        updateHSB();
    }

    private void updateHSB() {
        float[] hsb = java.awt.Color.RGBtoHSB(
                (get() >> 16) & 0xFF,
                (get() >> 8) & 0xFF,
                get() & 0xFF,
                null
        );
        this.hue = hsb[0];
        this.saturation = hsb[1];
        this.value = hsb[2];
    }

    public void updateColor() {
        int rgb = java.awt.Color.HSBtoRGB(hue, saturation, value);
        set(rgb);
    }

    public float getHue() {
        return hue;
    }

    public void setHue(float hue) {
        this.hue = hue;
    }

    public float getSaturation() {
        return saturation;
    }

    public void setSaturation(float saturation) {
        this.saturation = saturation;
    }

    public float getValue() {
        return value;
    }

    public void setValue(float value) {
        this.value = value;
    }

    public float getAlpha() {
        return alpha;
    }

    public void setAlpha(float alpha) {
        this.alpha = alpha;
    }

    [USER=1367676]@override[/USER]
    public ColorSetting setVisible(Supplier<Boolean> bool) {
        return (ColorSetting) super.setVisible(bool);
    }
}
Все готово, теперь чтобы протестить это можем использовать данный код


Тест:
package im.Winced.functions.impl.pve;

import im.Winced.functions.api.Category;
import im.Winced.functions.api.Function;
import im.Winced.functions.api.FunctionRegister;
import im.Winced.functions.settings.impl.ColorSetting;

@FunctionRegister(name = "Test", type = Category.Combat)
public class Test extends Function {
    private final ColorSetting colorSetting = new ColorSetting("Color", 0x000000);

    public Test() {
        this.addSettings(colorSetting);
    }
}

! Для пастеров: Чтобы поменять многие ошибки нажимаем cntr shift r, в верхнем поле пишем im.Winced, в нижнем ваше название клиента (im.expensive)
не знаю почему, мне понравилось
 
Начинающий
Статус
Оффлайн
Регистрация
14 Дек 2022
Сообщения
54
Реакции[?]
1
Поинты[?]
1K
Так вот выглядит это дело

Заходим в ModuleComponent и туда вписываем

if (setting instanceof ColorSetting color) {
components.add(new ColorComponent(color));
}

Дальше создаем класс ColorComponent в ui.dropdown.components.settings;

и туда вписываем этот код
код:
package im.Winced.ui.dropdown.components.settings;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.Winced.functions.settings.impl.ColorSetting;
import im.Winced.ui.dropdown.impl.Component;
import im.Winced.utils.render.ColorUtils;
import im.Winced.utils.render.DisplayUtils;
import im.Winced.utils.render.font.Fonts;
import org.lwjgl.opengl.GL11;

import java.awt.*;

public class ColorComponent extends Component {
    private final ColorSetting colorSetting;
    private boolean expanded;
    private boolean draggingHue;
    private boolean draggingSatVal;

    public ColorComponent(ColorSetting color) {
        super();
        this.colorSetting = color;
        this.setHeight(16);
    }

    [USER=1367676]@override[/USER]
    public void render(MatrixStack stack, float mouseX, float mouseY) {
        super.render(stack, mouseX, mouseY);

        Fonts.sf_regular1.drawText(stack, colorSetting.getName(), getX() + 5, getY() + 2,
                ColorUtils.rgb(255, 255, 255), 7.0f, 0.0f);

        float previewX = getX() + getWidth() - 20;
        float previewY = getY() + 3;
        DisplayUtils.drawRoundedRect(previewX, previewY, 15, 10, 2, colorSetting.get());

        if (expanded) {
            float pickerX = getX() + 5;
            float pickerY = getY() + 20;

            DisplayUtils.drawRoundedRect(pickerX - 2, pickerY - 2, 84, 84, 3,
                    ColorUtils.rgba(17, 17, 17, 255));
            int baseColor = ColorUtils.HSBtoRGB(colorSetting.getHue(), 1.0f, 1.0f);
            DisplayUtils.drawGradientRect(pickerX, pickerY, 65, 65,
                    ColorUtils.rgba(255, 255, 255, 255),
                    baseColor,
                    ColorUtils.rgba(255, 255, 255, 255),
                    baseColor);

            DisplayUtils.drawGradientRect(pickerX, pickerY, 65, 65,
                    ColorUtils.rgba(0, 0, 0, 0),
                    ColorUtils.rgba(0, 0, 0, 0),
                    ColorUtils.rgba(0, 0, 0, 255),
                    ColorUtils.rgba(0, 0, 0, 255));
            float hueX = pickerX + 70;
            DisplayUtils.drawRoundedRect(hueX - 1, pickerY - 1, 7, 67, 2,
                    ColorUtils.rgba(40, 40, 40, 255));
            float sliderHeight = 65f / 6f;
            for (int i = 0; i < 6; i++) {
                float yPos = pickerY + (i * sliderHeight);
                DisplayUtils.drawGradientRect(hueX, yPos, 5, sliderHeight,
                        ColorUtils.HSBtoRGB(i / 6f, 1.0f, 1.0f),
                        ColorUtils.HSBtoRGB(i / 6f, 1.0f, 1.0f),
                        ColorUtils.HSBtoRGB((i + 1) / 6f, 1.0f, 1.0f),
                        ColorUtils.HSBtoRGB((i + 1) / 6f, 1.0f, 1.0f));
            }

            float satX = pickerX + (colorSetting.getSaturation() * 65);
            float valY = pickerY + ((1 - colorSetting.getValue()) * 65);
            float hueY = pickerY + (colorSetting.getHue() * 65);

            DisplayUtils.drawCircle(satX, valY, 3, ColorUtils.rgb(255, 255, 255));
            DisplayUtils.drawCircle(satX, valY, 2, ColorUtils.rgb(0, 0, 0));

            DisplayUtils.drawRoundedRect(hueX - 2, hueY - 1, 9, 3, 1, ColorUtils.rgb(255, 255, 255));
            DisplayUtils.drawRoundedRect(hueX - 1, hueY, 7, 1, 1, ColorUtils.rgb(0, 0, 0));

            if (draggingSatVal) {
                updateColor(mouseX, mouseY);
            }
            if (draggingHue) {
                updateHue(mouseY - pickerY);
            }

            setHeight(95);
        } else {
            setHeight(16);
        }
    }





    [USER=1367676]@override[/USER]
    public void mouseClick(float mouseX, float mouseY, int button) {
        if (button == 0) {
            float pickerX = getX() + 5;
            float pickerY = getY() + 20;
            float hueX = pickerX + 70;

            if (mouseX >= getX() + getWidth() - 20 && mouseX <= getX() + getWidth() - 5 &&
                    mouseY >= getY() + 3 && mouseY <= getY() + 13) {
                expanded = !expanded;
                return;
            }

            if (expanded) {
                if (mouseX >= pickerX && mouseX <= pickerX + 65 &&
                        mouseY >= pickerY && mouseY <= pickerY + 65) {
                    draggingSatVal = true;
                    updateColor(mouseX, mouseY);
                }

                if (mouseX >= hueX && mouseX <= hueX + 5 &&
                        mouseY >= pickerY && mouseY <= pickerY + 65) {
                    draggingHue = true;
                    updateHue(mouseY - pickerY);
                }
            }
        }
    }


    [USER=1367676]@override[/USER]
    public void mouseRelease(float mouseX, float mouseY, int button) {
        draggingSatVal = false;
        draggingHue = false;
    }

    private void drawSaturationValueSelector(MatrixStack stack, float x, float y) {
        DisplayUtils.drawRoundedRect(x, y, 100, 100, 2,
                ColorUtils.HSBtoRGB(colorSetting.getHue(), 1.0f, 1.0f));

        DisplayUtils.drawGradientRect(x, y, x + 100, y + 100,
                ColorUtils.rgba(255, 255, 255, 0),
                ColorUtils.rgba(255, 255, 255, 255),
                ColorUtils.rgba(0, 0, 0, 0),
                ColorUtils.rgba(0, 0, 0, 255));

        float satX = x + colorSetting.getSaturation() * 100;
        float valY = y + (1 - colorSetting.getValue()) * 100;
        DisplayUtils.drawCircle(satX, valY, 3, -1);
    }

    private void drawHueSlider(MatrixStack stack, float x, float y) {
        for (int i = 0; i < 100; i++) {
            float hue = i / 100f;
            int color = ColorUtils.HSBtoRGB(hue, 1.0f, 1.0f);
            DisplayUtils.drawRect(x, y + i, 15, 1, color);
        }

        float hueY = y + colorSetting.getHue() * 100;
        DisplayUtils.drawRect(x - 2, hueY, 19, 2, -1);
    }


    private void updateColor(float mouseX, float mouseY) {
        float pickerX = getX() + 5;
        float pickerY = getY() + 20;

        float saturation = (mouseX - pickerX) / 65f;
        float value = 1f - ((mouseY - pickerY) / 65f);

        saturation = Math.max(0f, Math.min(1f, saturation));
        value = Math.max(0f, Math.min(1f, value));

        colorSetting.setSaturation(saturation);
        colorSetting.setValue(value);
        colorSetting.updateColor();
    }


    private void updateHue(float y) {
        float hue = y / 65f;
        hue = Math.max(0f, Math.min(1f, hue));
        colorSetting.setHue(hue);
        colorSetting.updateColor();
    }
}
Дальше идем в DisplayUtils и вставляем в любое место следующие методы

код:
    public static void drawGradientRect(float x, float y, float width, float height, int topLeft, int topRight, int bottomLeft, int bottomRight) {
        GlStateManager.enableBlend();
        GlStateManager.disableTexture();
        GlStateManager.blendFuncSeparate(770, 771, 1, 0);
        GlStateManager.shadeModel(7425);

        buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);

        float[] colorTopLeft = ColorUtils.rgba(topLeft);
        float[] colorTopRight = ColorUtils.rgba(topRight);
        float[] colorBottomLeft = ColorUtils.rgba(bottomLeft);
        float[] colorBottomRight = ColorUtils.rgba(bottomRight);

        buffer.pos(x, y + height, 0)
                .color(colorBottomLeft[0], colorBottomLeft[1], colorBottomLeft[2], colorBottomLeft[3])
                .endVertex();

        buffer.pos(x + width, y + height, 0)
                .color(colorBottomRight[0], colorBottomRight[1], colorBottomRight[2], colorBottomRight[3])
                .endVertex();

        buffer.pos(x + width, y, 0)
                .color(colorTopRight[0], colorTopRight[1], colorTopRight[2], colorTopRight[3])
                .endVertex();

        buffer.pos(x, y, 0)
                .color(colorTopLeft[0], colorTopLeft[1], colorTopLeft[2], colorTopLeft[3])
                .endVertex();

        tessellator.draw();

        GlStateManager.shadeModel(7424);
        GlStateManager.enableTexture();
        GlStateManager.disableBlend();
    }


    public static void drawBlur(float radius) {
        GlStateManager.enableBlend();
        GlStateManager.color4f(1, 1, 1, 1);

        ShaderUtil.blur.attach();
        ShaderUtil.blur.setUniform("texture", 0);
        ShaderUtil.blur.setUniform("texelSize", 1.0f / mc.getMainWindow().getWidth(), 1.0f / mc.getMainWindow().getHeight());
        ShaderUtil.blur.setUniform("radius", radius);

        GlStateManager.bindTexture(mc.getFramebuffer().framebufferTexture);
        ShaderUtil.drawQuads();
        ShaderUtil.blur.detach();

        GlStateManager.bindTexture(0);
    }

    public static void drawGlow(float x, float y, float width, float height, float radius, int color) {
        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();

        ShaderUtil.glow.attach();
        ShaderUtil.glow.setUniform("size", width, height);
        ShaderUtil.glow.setUniform("radius", radius);
        ShaderUtil.glow.setUniform("color", ColorUtils.rgba(color));

        drawQuads(x, y, width, height, 7);

        ShaderUtil.glow.detach();
        GlStateManager.disableBlend();
        GlStateManager.popMatrix();
    }

    public static void drawOutlinedRoundedRect(float x, float y, float width, float height, float radius, float lineWidth, int color, int outlineColor) {
        drawRoundedRect(x, y, width, height, radius, color);
        drawRoundedRect(x - lineWidth, y - lineWidth, width + lineWidth * 2, height + lineWidth * 2, radius + lineWidth, outlineColor);
    }

    public static void drawAnimatedRect(float x, float y, float width, float height, float progress, int startColor, int endColor) {
        float animProgress = MathHelper.clamp(progress, 0, 1);
        int currentColor = ColorUtils.interpolate(startColor, endColor, animProgress);
        drawRect(x, y, x + width * animProgress, y + height, currentColor);
    }

    public static void drawCircleOutline(float x, float y, float radius, float lineWidth, int segments, int color) {
        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();
        GlStateManager.disableTexture();
        GlStateManager.blendFuncSeparate(770, 771, 1, 0);

        buffer.begin(GL11.GL_LINE_LOOP, POSITION_COLOR);

        float theta = (float) (2 * Math.PI / segments);
        float tangetial_factor = (float) Math.tan(theta);
        float radial_factor = (float) Math.cos(theta);

        float x1 = radius;
        float y1 = 0;

        float[] rgba = ColorUtils.rgba(color);

        GL11.glLineWidth(lineWidth);

        for(int i = 0; i < segments; i++) {
            buffer.pos(x1 + x, y1 + y, 0).color(rgba[0], rgba[1], rgba[2], rgba[3]).endVertex();

            float tx = -y1;
            float ty = x1;

            x1 += tx * tangetial_factor;
            y1 += ty * tangetial_factor;

            x1 *= radial_factor;
            y1 *= radial_factor;
        }

        tessellator.draw();

        GlStateManager.enableTexture();
        GlStateManager.disableBlend();
        GlStateManager.popMatrix();
    }
Дальше идем в ShaderUtil и вставляем данные методы

код:
    // color component

    public static ShaderUtil blur = new ShaderUtil("blur");
    public static ShaderUtil glow = new ShaderUtil("glow");
    public static ShaderUtil gradient = new ShaderUtil("gradient");

    public void setUniformMatrix4f(String name, float[] matrix) {
        int location = getUniform(name);
        glUniformMatrix4fv(location, false, matrix);
    }

    public void setUniformSampler(String name, int textureUnit) {
        int location = getUniform(name);
        glUniform1i(location, textureUnit);
    }

    public boolean hasUniform(String name) {
        return glGetUniformLocation(programID, name) != -1;
    }

    public void bindTexture(String uniformName, int textureId, int textureUnit) {
        glActiveTexture(GL_TEXTURE0 + textureUnit);
        glBindTexture(GL_TEXTURE_2D, textureId);
        setUniform(uniformName, textureUnit);
    }

    public static void setupRenderState() {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glDisable(GL_TEXTURE_2D);
        glDisable(GL_ALPHA_TEST);
    }

    public static void cleanup() {
        glEnable(GL_TEXTURE_2D);
        glEnable(GL_ALPHA_TEST);
        glDisable(GL_BLEND);
    }

    public int getProgramID() {
        return programID;
    }
Идем в ColorUtils и вставляем это

код:
    // color component

    public static int HSBtoRGB(float hue, float saturation, float brightness) {
        return Color.HSBtoRGB(hue, saturation, brightness);
    }

    public static float[] RGBtoHSB(int rgb) {
        int r = (rgb >> 16) & 0xFF;
        int g = (rgb >> 8) & 0xFF;
        int b = rgb & 0xFF;
        return Color.RGBtoHSB(r, g, b, null);
    }

    public static int rainbow(float speed, float saturation, float brightness) {
        float hue = (System.currentTimeMillis() % (int)(speed * 1000)) / (speed * 1000f);
        return HSBtoRGB(hue, saturation, brightness);
    }

    public static int fade(int color, int speed, float offset) {
        float[] hsb = RGBtoHSB(color);
        float hue = hsb[0];
        float brightness = ((float) Math.sin((System.currentTimeMillis() + offset) / speed) + 1f) / 2f;
        return HSBtoRGB(hue, hsb[1], brightness * hsb[2]);
    }
Дальше переходим или создаем ColorSettings в functions.settings.impl;
и туда делаем этот код

код:
package im.Winced.functions.settings.impl;


import im.Winced.functions.settings.Setting;

import java.util.function.Supplier;

public class ColorSetting extends Setting<Integer> {
    private float hue, saturation, value;
    private float alpha = 1.0f;

    public ColorSetting(String name, Integer defaultVal) {
        super(name, defaultVal);
        updateHSB();
    }

    private void updateHSB() {
        float[] hsb = java.awt.Color.RGBtoHSB(
                (get() >> 16) & 0xFF,
                (get() >> 8) & 0xFF,
                get() & 0xFF,
                null
        );
        this.hue = hsb[0];
        this.saturation = hsb[1];
        this.value = hsb[2];
    }

    public void updateColor() {
        int rgb = java.awt.Color.HSBtoRGB(hue, saturation, value);
        set(rgb);
    }

    public float getHue() {
        return hue;
    }

    public void setHue(float hue) {
        this.hue = hue;
    }

    public float getSaturation() {
        return saturation;
    }

    public void setSaturation(float saturation) {
        this.saturation = saturation;
    }

    public float getValue() {
        return value;
    }

    public void setValue(float value) {
        this.value = value;
    }

    public float getAlpha() {
        return alpha;
    }

    public void setAlpha(float alpha) {
        this.alpha = alpha;
    }

    [USER=1367676]@override[/USER]
    public ColorSetting setVisible(Supplier<Boolean> bool) {
        return (ColorSetting) super.setVisible(bool);
    }
}
Все готово, теперь чтобы протестить это можем использовать данный код


Тест:
package im.Winced.functions.impl.pve;

import im.Winced.functions.api.Category;
import im.Winced.functions.api.Function;
import im.Winced.functions.api.FunctionRegister;
import im.Winced.functions.settings.impl.ColorSetting;

@FunctionRegister(name = "Test", type = Category.Combat)
public class Test extends Function {
    private final ColorSetting colorSetting = new ColorSetting("Color", 0x000000);

    public Test() {
        this.addSettings(colorSetting);
    }
}

! Для пастеров: Чтобы поменять многие ошибки нажимаем cntr shift r, в верхнем поле пишем im.Winced, в нижнем ваше название клиента (im.expensive)
+rep за сторание но мне не нравиться
 
Сверху Снизу