add config system and window dragging

This commit is contained in:
kawaiizenbo 2023-06-29 18:30:32 -07:00
parent 6e584de0e6
commit a18cb2a137
22 changed files with 354 additions and 104 deletions

View file

@ -6,8 +6,8 @@ public enum Category
MOVEMENT("Movement", 0xFFFF55FF),
RENDER("Render", 0xFF5555FF),
WORLD("World", 0xFF55FF55),
PLAYER("Player", 0xFFFFFFFF),
CHAT("Chat", 0xFFFFFF55);
PLAYER("Player", 0xFF00AAAA),
CHAT("Chat", 0xFFFFAA00);
public String name;
public int color;

View file

@ -17,8 +17,7 @@ public abstract class Module_
public Category category;
public boolean enabled;
public ArrayList<Setting> settings;
public int keyBind;
public BooleanSetting showInModulesList = new BooleanSetting("Show in Modules List", true);
public Module_(String name, String description, Category category)

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
@ -14,9 +15,9 @@ public class BooleanSetting extends Setting
}
@Override
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY)
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
{
super.render(drawContext, x, y, mouseX, mouseY);
super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF);
drawContext.fill(x+175, y+7, x+185, y+17, 0xFFFFFFFF);
drawContext.fill(x+176, y+8, x+184, y+16, 0xFF222222);

View file

@ -1,6 +1,7 @@
package me.kawaiizenbo.moonlight.module.settings;
import me.kawaiizenbo.moonlight.util.ColorUtils;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
@ -23,9 +24,9 @@ public class ColorSetting extends Setting
}
@Override
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY)
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
{
super.render(drawContext, x, y, mouseX, mouseY);
super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
int redDisplayStartColor = ColorUtils.rgbaToInt(0, g, b, 255);
int redDisplayEndColor = ColorUtils.rgbaToInt(255, g, b, 255);

View file

@ -1,6 +1,7 @@
package me.kawaiizenbo.moonlight.module.settings;
import me.kawaiizenbo.moonlight.util.MathUtils;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
@ -22,9 +23,9 @@ public class DoubleSetting extends Setting
}
@Override
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY)
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
{
super.render(drawContext, x, y, mouseX, mouseY);
super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
double diff = Math.min(100, Math.max(0, (mouseX - x)/1.9));

View file

@ -1,20 +1,16 @@
package me.kawaiizenbo.moonlight.module.settings;
import java.lang.reflect.Method;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
public class Setting
{
public String name;
public Method onValueChanged;
protected TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
public int height = 24;
public Object value;
int x = 0, y = 0;
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY)
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
{
this.x = x;
this.y = y;