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

@ -1 +1 @@
Moonlight Meadows Utility Mod
# Moonlight Meadows Utility Mod for Minecraft 1.19.3

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
{
}

View file

@ -1,6 +1,8 @@
package me.kawaiizenbo.moonlight.ui;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.module.ModuleManager;
import me.kawaiizenbo.moonlight.module.modules.HUDModule;
import me.kawaiizenbo.moonlight.util.ColorUtils;
import me.kawaiizenbo.moonlight.util.MathUtils;
@ -14,6 +16,7 @@ public class HUD
public static HUD INSTANCE = new HUD();
private MinecraftClient mc = MinecraftClient.getInstance();
TextRenderer textRenderer = mc.textRenderer;
HUDModule hm = (HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD");
public void renderHUD(MatrixStack matrix, int scaledWidth, int scaledHeight)
{
@ -21,13 +24,18 @@ public class HUD
if (mc.options.debugEnabled) return;
// draw stats
textRenderer.drawWithShadow(matrix, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215);
textRenderer.drawWithShadow(matrix, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 12, 0x55FFFF);
textRenderer.drawWithShadow(matrix, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 22, 0x55FFFF);
if (hm.enableLogo.value)
textRenderer.drawWithShadow(matrix, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215);
if (hm.enableFPS.value)
textRenderer.drawWithShadow(matrix, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 12, 0x55FFFF);
if (hm.enablePing.value)
textRenderer.drawWithShadow(matrix, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 22, 0x55FFFF);
textRenderer.drawWithShadow(matrix, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, 0x55FFFF);
// Coords
textRenderer.drawWithShadow(matrix, "X: " + ColorUtils.gray + MathUtils.round(mc.player.getX(), 1) +
if (hm.enableSpeed.value)
textRenderer.drawWithShadow(matrix, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, 0x55FFFF);
if (hm.enableCoordinates.value)
textRenderer.drawWithShadow(matrix, "X: " + ColorUtils.gray + MathUtils.round(mc.player.getX(), 1) +
ColorUtils.reset + " Y: " + ColorUtils.gray + MathUtils.round(mc.player.getY(), 1) +
ColorUtils.reset + " Z: " + ColorUtils.gray + MathUtils.round(mc.player.getZ(), 1), 2, scaledHeight - 10, 0x55FFFF);
}

View file

@ -3,7 +3,6 @@ package me.kawaiizenbo.moonlight.util;
import java.math.BigDecimal;
import java.math.RoundingMode;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;