This commit is contained in:
kawaiizenbo 2023-03-05 19:52:14 -07:00
parent 5981e5ce50
commit 3de1c7130a
13 changed files with 107 additions and 43 deletions

View file

@ -15,7 +15,8 @@ public class ModuleManager
new Fly(),
new NoFall(),
new HUDModule(),
new Step()
new Step(),
new Fullbright()
);
}

View file

@ -0,0 +1,25 @@
package me.kawaiizenbo.moonlight.module.modules;
import me.kawaiizenbo.moonlight.module.Category;
import me.kawaiizenbo.moonlight.module.Module_;
public class Fullbright extends Module_
{
public Fullbright()
{
super("Fullbright", "Allows you to see in the dark.", Category.RENDER);
}
@Override
public void onEnable()
{
// i dont know why but this makes it darker than 1.0
mc.options.getGamma().setValue(100.0);
}
@Override
public void onDisable()
{
mc.options.getGamma().setValue(1.0);
}
}

View file

@ -2,12 +2,24 @@ package me.kawaiizenbo.moonlight.module.modules;
import me.kawaiizenbo.moonlight.module.Category;
import me.kawaiizenbo.moonlight.module.Module_;
import me.kawaiizenbo.moonlight.module.settings.BooleanSetting;
public class HUDModule extends Module_
{
public BooleanSetting enableLogo = new BooleanSetting("Logo", true);
public BooleanSetting enableFPS = new BooleanSetting("FPS", true);
public BooleanSetting enablePing = new BooleanSetting("Ping", true);
public BooleanSetting enableSpeed = new BooleanSetting("Speed", true);
public BooleanSetting enableCoordinates = new BooleanSetting("Coordinates", true);
public HUDModule()
{
super("HUD", "Enables or disables the Moonlight HUD.", Category.RENDER);
this.enabled = true;
settings.add(enableLogo);
settings.add(enableFPS);
settings.add(enablePing);
settings.add(enableSpeed);
settings.add(enableCoordinates);
}
}

View file

@ -11,6 +11,7 @@ public class Step extends Module_
public Step()
{
super("Step", "Allows you to step up full blocks.", Category.MOVEMENT);
settings.add(stepHeight);
}
@Override

View file

@ -1,18 +0,0 @@
package me.kawaiizenbo.moonlight.module.modules;
import me.kawaiizenbo.moonlight.module.Category;
import me.kawaiizenbo.moonlight.module.Module_;
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
public class TestDisplay extends Module_
{
DoubleSetting test1 = new DoubleSetting("test1", 1, 0, 20, 0);
DoubleSetting test2 = new DoubleSetting("test2", 0, 0, 1, 1);
public TestDisplay()
{
super("TestDisplay", "Test of settings window", Category.RENDER);
this.settings.add(test1);
this.settings.add(test2);
}
}

View file

@ -0,0 +1,35 @@
package me.kawaiizenbo.moonlight.module.settings;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
public class BooleanSetting extends Setting
{
public boolean value;
public BooleanSetting(String name, boolean value)
{
this.name = name;
this.value = value;
}
@Override
public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY)
{
super.render(matrices, x, y, mouseX, mouseY);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF);
DrawableHelper.fill(matrices, x+175, y+7, x+185, y+17, 0xFFFFFFFF);
DrawableHelper.fill(matrices, x+176, y+8, x+184, y+16, 0xFF222222);
DrawableHelper.fill(matrices, x+177, y+9, x+183, y+15, value ? 0xFF55FFFF : 0xFF222222);
}
@Override
public void mouseClicked(double mouseX, double mouseY, int button)
{
if (hovered((int)mouseX, (int)mouseY) && button == 0)
{
this.value = !value;
}
}
}

View file

@ -0,0 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;
public class ColorSetting extends Setting
{
}

View file

@ -1,8 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;
import java.math.BigDecimal;
import java.math.RoundingMode;
import me.kawaiizenbo.moonlight.util.MathUtils;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
@ -28,6 +26,7 @@ public class DoubleSetting extends Setting
public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY)
{
super.render(matrices, x, y, mouseX, mouseY);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
double diff = Math.min(100, Math.max(0, (mouseX - x)/1.9));
if (sliding)
@ -38,12 +37,12 @@ public class DoubleSetting extends Setting
}
else
{
double newValue = round(((diff / 100) * (max - min) + min), roundingPlace);
double newValue = MathUtils.round(((diff / 100) * (max - min) + min), roundingPlace);
value = newValue;
}
}
String valueString = ""+round(value, roundingPlace);
String valueString = ""+MathUtils.round(value, roundingPlace);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(valueString), (x+190)-textRenderer.getWidth(valueString), y+2, 0xFFFFFF);
DrawableHelper.fill(matrices, x+2, y+16, x+190, y+18, 0xFF666666);
int scaledValue = (int)((value/max)*190);
@ -51,15 +50,6 @@ public class DoubleSetting extends Setting
DrawableHelper.fill(matrices, x+2+(scaledValue-1), y+14, x+2+(scaledValue+1), y+20, 0xFFFFFFFF);
}
private static double round(double value, int places)
{
if (places < 0) throw new IllegalArgumentException();
BigDecimal bd = new BigDecimal(Double.toString(value));
bd = bd.setScale(places, RoundingMode.HALF_UP);
return bd.doubleValue();
}
@Override
public void mouseClicked(double mouseX, double mouseY, int button)
{

View file

@ -4,7 +4,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
public class Setting
{
@ -17,7 +16,7 @@ public class Setting
this.x = x;
this.y = y;
DrawableHelper.fill(matrices, x, y, x+192, y+24, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
}
public void mouseClicked(double mouseX, double mouseY, int button) { }

View file

@ -0,0 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;
public class StringSetting extends Setting
{
}