broken shit

This commit is contained in:
kawaiizenbo 2023-06-11 10:59:20 -07:00
parent 0edfc893ab
commit 5ccad6b10a
16 changed files with 149 additions and 24 deletions

View file

@ -2,6 +2,7 @@ package me.kawaiizenbo.moonlight.module.modules;
import me.kawaiizenbo.moonlight.module.Category;
import me.kawaiizenbo.moonlight.module.Module_;
import me.kawaiizenbo.moonlight.util.ISimpleOption;
public class Fullbright extends Module_
{
@ -13,8 +14,7 @@ public class Fullbright extends Module_
@Override
public void onEnable()
{
// i dont know why but this makes it darker than 1.0
mc.options.getGamma().setValue(100.0);
((ISimpleOption<Double>)(Object)mc.options.getGamma()).setValueUnrestricted(100.0);
}
@Override

View file

@ -2,15 +2,28 @@ package me.kawaiizenbo.moonlight.module.modules;
import me.kawaiizenbo.moonlight.module.Category;
import me.kawaiizenbo.moonlight.module.Module_;
import me.kawaiizenbo.moonlight.module.settings.ColorSetting;
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
import me.kawaiizenbo.moonlight.ui.HUD;
import me.kawaiizenbo.moonlight.util.ReflectionUtils;
public class HUDModule extends Module_
public class HUDModule extends Module_
{
public ColorSetting color = new ColorSetting("Color", 0x55FFFF);
public DoubleSetting r = new DoubleSetting("Red", 0x55, 0, 255, 0, ReflectionUtils.tryGetMethod("updateHUD", getClass()));
public DoubleSetting g = new DoubleSetting("Green", 255, 0, 255, 0, ReflectionUtils.tryGetMethod("updateHUD", getClass()));
public DoubleSetting b = new DoubleSetting("Blue", 255, 0, 255, 0, ReflectionUtils.tryGetMethod("updateHUD", getClass()));
//public ColorSetting color = new ColorSetting("Color", 0x55FFFF, ReflectionUtils.tryGetMethod("updateHUD", getClass()));
public HUDModule()
{
super("HUD", "Enables or disables the Moonlight HUD.", Category.RENDER);
this.enabled = true;
settings.add(color);
settings.add(r);
settings.add(g);
settings.add(b);
//settings.add(color);
}
public static void updateHUD()
{
HUD.INSTANCE = new HUD();
}
}

View file

@ -6,7 +6,7 @@ import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
public class Step extends Module_
{
DoubleSetting stepHeight = new DoubleSetting("Height", 1, 1, 10, 0);
DoubleSetting stepHeight = new DoubleSetting("Height", 1, 1, 10, 0, null);
public Step()
{

View file

@ -1,5 +1,8 @@
package me.kawaiizenbo.moonlight.module.settings;
import java.lang.reflect.Method;
import me.kawaiizenbo.moonlight.util.ReflectionUtils;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
@ -7,10 +10,11 @@ public class BooleanSetting extends Setting
{
public boolean value;
public BooleanSetting(String name, boolean value)
public BooleanSetting(String name, boolean value, Method onValueChanged)
{
this.name = name;
this.value = value;
this.onValueChanged = onValueChanged;
}
@Override
@ -29,6 +33,7 @@ public class BooleanSetting extends Setting
if (hovered((int)mouseX, (int)mouseY) && button == 0)
{
this.value = !value;
ReflectionUtils.tryCallMethod(onValueChanged, new Object[0]);
}
}
}

View file

@ -1,5 +1,8 @@
package me.kawaiizenbo.moonlight.module.settings;
import java.lang.reflect.Method;
import me.kawaiizenbo.moonlight.util.ColorUtils;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
@ -11,11 +14,12 @@ public class ColorSetting extends Setting
public int b;
public ColorSetting(String name, int value)
public ColorSetting(String name, int value, Method onValueChanged)
{
this.name = name;
this.value = value;
this.height = 64;
this.onValueChanged = onValueChanged;
this.r = (value >> 16) & 0xFF;
this.g = (value >> 8) & 0xFF;
this.b = value & 0xFF;
@ -26,12 +30,12 @@ public class ColorSetting extends Setting
{
super.render(drawContext, x, y, mouseX, mouseY);
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
int redDisplayStartColor = ((255&0x0ff)<<24)|((0&0x0ff)<<16)|((g&0x0ff)<<8)|(b&0x0ff);
int redDisplayEndColor = ((255&0x0ff)<<24)|((255&0x0ff)<<16)|((g&0x0ff)<<8)|(b&0x0ff);
int greenDisplayStartColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((0&0x0ff)<<8)|(b&0x0ff);
int greenDisplayEndColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((255&0x0ff)<<8)|(b&0x0ff);
int blueDisplayStartColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((g&0x0ff)<<8)|(0&0x0ff);
int blueDisplayEndColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((g&0x0ff)<<8)|(255&0x0ff);
int redDisplayStartColor = ColorUtils.rgbaToInt(0, g, b, 255);
int redDisplayEndColor = ColorUtils.rgbaToInt(255, g, b, 255);
int greenDisplayStartColor = ColorUtils.rgbaToInt(r, 0, b, 255);
int greenDisplayEndColor = ColorUtils.rgbaToInt(r, 255, b, 255);
int blueDisplayStartColor = ColorUtils.rgbaToInt(r, g, 0, 255);
int blueDisplayEndColor = ColorUtils.rgbaToInt(r, g, 255, 255);
drawContext.fillGradient(x+80, y+2, x+92, y+62, redDisplayEndColor, redDisplayStartColor, 0);
drawContext.fillGradient(x+95, y+2, x+107, y+62, greenDisplayEndColor, greenDisplayStartColor, 0);
drawContext.fillGradient(x+110, y+2, x+122, y+62, blueDisplayEndColor, blueDisplayStartColor, 0);

View file

@ -1,6 +1,9 @@
package me.kawaiizenbo.moonlight.module.settings;
import java.lang.reflect.Method;
import me.kawaiizenbo.moonlight.util.MathUtils;
import me.kawaiizenbo.moonlight.util.ReflectionUtils;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
@ -12,10 +15,11 @@ public class DoubleSetting extends Setting
boolean sliding = false;
public DoubleSetting(String name, double value, double min, double max, int roundingPlace)
public DoubleSetting(String name, double value, double min, double max, int roundingPlace, Method onValueChanged)
{
this.name = name;
this.value = value;
this.onValueChanged = onValueChanged;
this.min = min;
this.max = max;
this.roundingPlace = roundingPlace;
@ -62,6 +66,7 @@ public class DoubleSetting extends Setting
public void mouseReleased(double mouseX, double mouseY, int button)
{
sliding = false;
ReflectionUtils.tryCallMethod(onValueChanged, new Object[0]);
}
}

View file

@ -1,5 +1,7 @@
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;
@ -7,6 +9,7 @@ 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;