modules list and remove broken stuff
This commit is contained in:
parent
2a89f212e5
commit
b58eedfb9c
16 changed files with 168 additions and 44 deletions
|
@ -1,8 +1,6 @@
|
||||||
package me.kawaiizenbo.moonlight;
|
package me.kawaiizenbo.moonlight;
|
||||||
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -12,7 +10,6 @@ import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
public class Moonlight implements ModInitializer
|
public class Moonlight implements ModInitializer
|
||||||
{
|
{
|
||||||
public static final Moonlight INSTANCE = new Moonlight();
|
public static final Moonlight INSTANCE = new Moonlight();
|
||||||
public static final DrawContext drawCfontext = new DrawContext(MinecraftClient.getInstance(), null);
|
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight");
|
public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight");
|
||||||
public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows";
|
public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows";
|
||||||
public static final String versionTag = ColorUtils.magenta + "v0.dev";
|
public static final String versionTag = ColorUtils.magenta + "v0.dev";
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package me.kawaiizenbo.moonlight.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.module.ModuleManager;
|
||||||
|
import me.kawaiizenbo.moonlight.module.Module_;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.entity.MovementType;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
@Mixin(ClientPlayerEntity.class)
|
||||||
|
public class ClientPlayerEntityMixin
|
||||||
|
{
|
||||||
|
@Inject(method = "move", at = @At(value = "HEAD"), cancellable = true)
|
||||||
|
public void onMotion(MovementType type, Vec3d movement, CallbackInfo ci)
|
||||||
|
{
|
||||||
|
for (Module_ m : ModuleManager.INSTANCE.getEnabledModules())
|
||||||
|
{
|
||||||
|
m.onMotion(type, movement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.module.ModuleManager;
|
import me.kawaiizenbo.moonlight.module.ModuleManager;
|
||||||
import me.kawaiizenbo.moonlight.ui.HUD;
|
import me.kawaiizenbo.moonlight.ui.HUDOverlay;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.ModulesListOverlay;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.hud.InGameHud;
|
import net.minecraft.client.gui.hud.InGameHud;
|
||||||
|
|
||||||
|
@ -20,7 +21,8 @@ public class InGameHudMixin {
|
||||||
@Inject(at = @At("TAIL"), method = "render")
|
@Inject(at = @At("TAIL"), method = "render")
|
||||||
public void onRender (DrawContext drawContext, float tickDelta, CallbackInfo info)
|
public void onRender (DrawContext drawContext, float tickDelta, CallbackInfo info)
|
||||||
{
|
{
|
||||||
if (ModuleManager.INSTANCE.getModuleByName("HUD").enabled) HUD.INSTANCE.renderHUD(drawContext, scaledWidth, scaledHeight);
|
if (ModuleManager.INSTANCE.getModuleByName("HUD").enabled) HUDOverlay.INSTANCE.render(drawContext, scaledWidth, scaledHeight);
|
||||||
|
if (ModuleManager.INSTANCE.getModuleByName("ModulesList").enabled) ModulesListOverlay.INSTANCE.render(drawContext, scaledWidth, scaledHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,9 @@ public class ModuleManager
|
||||||
new NoFall(),
|
new NoFall(),
|
||||||
new HUDModule(),
|
new HUDModule(),
|
||||||
new Step(),
|
new Step(),
|
||||||
new Fullbright()
|
new Fullbright(),
|
||||||
|
new Speed(),
|
||||||
|
new ModulesList()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,12 @@ package me.kawaiizenbo.moonlight.module;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.module.settings.BooleanSetting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.ModulesListOverlay;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.entity.MovementType;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public abstract class Module_
|
public abstract class Module_
|
||||||
{
|
{
|
||||||
|
@ -15,6 +19,8 @@ public abstract class Module_
|
||||||
public ArrayList<Setting> settings;
|
public ArrayList<Setting> settings;
|
||||||
public int keyBind;
|
public int keyBind;
|
||||||
|
|
||||||
|
public BooleanSetting showInModulesList = new BooleanSetting("Show in Modules List", true);
|
||||||
|
|
||||||
public Module_(String name, String description, Category category)
|
public Module_(String name, String description, Category category)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -23,8 +29,9 @@ public abstract class Module_
|
||||||
settings = new ArrayList<>();
|
settings = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEnable() {}
|
public void onEnable() { ModulesListOverlay.INSTANCE.update(); }
|
||||||
public void onDisable() {}
|
public void onDisable() { ModulesListOverlay.INSTANCE.update(); }
|
||||||
|
public void onMotion(MovementType type, Vec3d movement) {}
|
||||||
public void tick() {}
|
public void tick() {}
|
||||||
|
|
||||||
public void toggle()
|
public void toggle()
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class Fly extends Module_
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
|
super.onDisable();
|
||||||
mc.player.getAbilities().flying = false;
|
mc.player.getAbilities().flying = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,14 @@ public class Fullbright extends Module_
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
|
super.onEnable();
|
||||||
((ISimpleOption<Double>)(Object)mc.options.getGamma()).setValueUnrestricted(100.0);
|
((ISimpleOption<Double>)(Object)mc.options.getGamma()).setValueUnrestricted(100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
|
super.onDisable();
|
||||||
mc.options.getGamma().setValue(1.0);
|
mc.options.getGamma().setValue(1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,28 +2,43 @@ package me.kawaiizenbo.moonlight.module.modules;
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.module.Category;
|
import me.kawaiizenbo.moonlight.module.Category;
|
||||||
import me.kawaiizenbo.moonlight.module.Module_;
|
import me.kawaiizenbo.moonlight.module.Module_;
|
||||||
|
import me.kawaiizenbo.moonlight.module.settings.BooleanSetting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
||||||
import me.kawaiizenbo.moonlight.ui.HUD;
|
import me.kawaiizenbo.moonlight.ui.HUDOverlay;
|
||||||
import me.kawaiizenbo.moonlight.util.ReflectionUtils;
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
|
|
||||||
public class HUDModule extends Module_
|
public class HUDModule extends Module_
|
||||||
{
|
{
|
||||||
//public DoubleSetting r = new DoubleSetting("Red", 0x55, 0, 255, 0, ReflectionUtils.tryGetMethod("updateHUD()V", getClass()));
|
public BooleanSetting clientTag = new BooleanSetting("Client Tag", true);
|
||||||
//public DoubleSetting g = new DoubleSetting("Green", 255, 0, 255, 0, ReflectionUtils.tryGetMethod("updateHUD()V", getClass()));
|
public DoubleSetting r = new DoubleSetting("Red", 0x55, 0, 255, 0);
|
||||||
//public DoubleSetting b = new DoubleSetting("Blue", 255, 0, 255, 0, ReflectionUtils.tryGetMethod("updateHUD()V", getClass()));
|
public DoubleSetting g = new DoubleSetting("Green", 255, 0, 255, 0);
|
||||||
|
public DoubleSetting b = new DoubleSetting("Blue", 255, 0, 255, 0);
|
||||||
//public ColorSetting color = new ColorSetting("Color", 0x55FFFF, ReflectionUtils.tryGetMethod("updateHUD", getClass()));
|
//public ColorSetting color = new ColorSetting("Color", 0x55FFFF, ReflectionUtils.tryGetMethod("updateHUD", getClass()));
|
||||||
|
|
||||||
public HUDModule()
|
public HUDModule()
|
||||||
{
|
{
|
||||||
super("HUD", "Enables or disables the Moonlight HUD.", Category.RENDER);
|
super("HUD", "The Moonlight HUD. Toggle to update.", Category.RENDER);
|
||||||
this.enabled = true;
|
this.enabled = true;
|
||||||
//settings.add(r);
|
this.showInModulesList.value = false;
|
||||||
//settings.add(g);
|
|
||||||
//settings.add(b);
|
settings.add(clientTag);
|
||||||
|
settings.add(r);
|
||||||
|
settings.add(g);
|
||||||
|
settings.add(b);
|
||||||
//settings.add(color);
|
//settings.add(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateHUD()
|
@Override
|
||||||
|
public void onEnable()
|
||||||
{
|
{
|
||||||
HUD.INSTANCE = new HUD();
|
super.onEnable();
|
||||||
|
HUDOverlay.INSTANCE.showClientTag = clientTag.value;
|
||||||
|
HUDOverlay.INSTANCE.hudColor =
|
||||||
|
ColorUtils.rgbaToInt(
|
||||||
|
(int)r.value,
|
||||||
|
(int)g.value,
|
||||||
|
(int)b.value,
|
||||||
|
255
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package me.kawaiizenbo.moonlight.module.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.module.Category;
|
||||||
|
import me.kawaiizenbo.moonlight.module.Module_;
|
||||||
|
|
||||||
|
public class ModulesList extends Module_
|
||||||
|
{
|
||||||
|
public ModulesList()
|
||||||
|
{
|
||||||
|
super("ModulesList", "Shows enabled modules on side of screen", Category.RENDER);
|
||||||
|
this.enabled = true;
|
||||||
|
this.showInModulesList.value = false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
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;
|
||||||
|
import net.minecraft.entity.MovementType;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
public class Speed extends Module_
|
||||||
|
{
|
||||||
|
DoubleSetting speed = new DoubleSetting("Speed", 2, 0.1, 10, 1);
|
||||||
|
public Speed()
|
||||||
|
{
|
||||||
|
super("Speed", "Allows you to move faster.", Category.MOVEMENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMotion(MovementType type, Vec3d movement)
|
||||||
|
{
|
||||||
|
mc.player.addVelocity(movement);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
||||||
|
|
||||||
public class Step extends Module_
|
public class Step extends Module_
|
||||||
{
|
{
|
||||||
DoubleSetting stepHeight = new DoubleSetting("Height", 1, 1, 10, 0, null);
|
DoubleSetting stepHeight = new DoubleSetting("Height", 1, 1, 10, 0);
|
||||||
|
|
||||||
public Step()
|
public Step()
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@ public class Step extends Module_
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
|
super.onDisable();
|
||||||
mc.player.setStepHeight(0.5f);
|
mc.player.setStepHeight(0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package me.kawaiizenbo.moonlight.module.settings;
|
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.client.gui.DrawContext;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
@ -10,11 +7,10 @@ public class BooleanSetting extends Setting
|
||||||
{
|
{
|
||||||
public boolean value;
|
public boolean value;
|
||||||
|
|
||||||
public BooleanSetting(String name, boolean value, Method onValueChanged)
|
public BooleanSetting(String name, boolean value)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.onValueChanged = onValueChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,7 +29,6 @@ public class BooleanSetting extends Setting
|
||||||
if (hovered((int)mouseX, (int)mouseY) && button == 0)
|
if (hovered((int)mouseX, (int)mouseY) && button == 0)
|
||||||
{
|
{
|
||||||
this.value = !value;
|
this.value = !value;
|
||||||
ReflectionUtils.tryCallMethod(onValueChanged, new Object[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package me.kawaiizenbo.moonlight.module.settings;
|
package me.kawaiizenbo.moonlight.module.settings;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
@ -14,12 +12,11 @@ public class ColorSetting extends Setting
|
||||||
public int b;
|
public int b;
|
||||||
|
|
||||||
|
|
||||||
public ColorSetting(String name, int value, Method onValueChanged)
|
public ColorSetting(String name, int value)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.height = 64;
|
this.height = 64;
|
||||||
this.onValueChanged = onValueChanged;
|
|
||||||
this.r = (value >> 16) & 0xFF;
|
this.r = (value >> 16) & 0xFF;
|
||||||
this.g = (value >> 8) & 0xFF;
|
this.g = (value >> 8) & 0xFF;
|
||||||
this.b = value & 0xFF;
|
this.b = value & 0xFF;
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package me.kawaiizenbo.moonlight.module.settings;
|
package me.kawaiizenbo.moonlight.module.settings;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.util.MathUtils;
|
import me.kawaiizenbo.moonlight.util.MathUtils;
|
||||||
import me.kawaiizenbo.moonlight.util.ReflectionUtils;
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
@ -15,11 +12,10 @@ public class DoubleSetting extends Setting
|
||||||
|
|
||||||
boolean sliding = false;
|
boolean sliding = false;
|
||||||
|
|
||||||
public DoubleSetting(String name, double value, double min, double max, int roundingPlace, Method onValueChanged)
|
public DoubleSetting(String name, double value, double min, double max, int roundingPlace)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.onValueChanged = onValueChanged;
|
|
||||||
this.min = min;
|
this.min = min;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
this.roundingPlace = roundingPlace;
|
this.roundingPlace = roundingPlace;
|
||||||
|
@ -66,7 +62,6 @@ public class DoubleSetting extends Setting
|
||||||
public void mouseReleased(double mouseX, double mouseY, int button)
|
public void mouseReleased(double mouseX, double mouseY, int button)
|
||||||
{
|
{
|
||||||
sliding = false;
|
sliding = false;
|
||||||
ReflectionUtils.tryCallMethod(onValueChanged, new Object[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,32 +11,39 @@ import net.minecraft.client.font.TextRenderer;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public class HUD
|
public class HUDOverlay
|
||||||
{
|
{
|
||||||
public static HUD INSTANCE = new HUD();
|
public static HUDOverlay INSTANCE = new HUDOverlay();
|
||||||
private MinecraftClient mc = MinecraftClient.getInstance();
|
private MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
TextRenderer textRenderer = mc.textRenderer;
|
TextRenderer textRenderer = mc.textRenderer;
|
||||||
public int hudColor = 0xFF00FFFF; /*ColorUtils.rgbaToInt(
|
public boolean showClientTag = ((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).clientTag.value;
|
||||||
|
public int hudColor = ColorUtils.rgbaToInt(
|
||||||
(int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).r.value,
|
(int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).r.value,
|
||||||
(int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).g.value,
|
(int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).g.value,
|
||||||
(int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).b.value,
|
(int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).b.value,
|
||||||
255 );*/
|
255 );
|
||||||
|
|
||||||
public void renderHUD(DrawContext drawContext, int scaledWidth, int scaledHeight)
|
public void render(DrawContext drawContext, int scaledWidth, int scaledHeight)
|
||||||
{
|
{
|
||||||
// do not draw if F3 enabled
|
// do not draw if F3 enabled
|
||||||
if (mc.options.debugEnabled) return;
|
if (mc.options.debugEnabled) return;
|
||||||
|
|
||||||
// draw stats
|
// draw stats
|
||||||
drawContext.drawTextWithShadow(textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215);
|
drawContext.drawTextWithShadow(textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 2, hudColor);
|
||||||
drawContext.drawTextWithShadow(textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 12, hudColor);
|
drawContext.drawTextWithShadow(textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 12, hudColor);
|
||||||
drawContext.drawTextWithShadow(textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 22, hudColor);
|
|
||||||
drawContext.drawTextWithShadow(textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, hudColor);
|
drawContext.drawTextWithShadow(textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, hudColor);
|
||||||
|
|
||||||
// draw coordinates
|
// draw coordinates
|
||||||
drawContext.drawTextWithShadow(textRenderer, "X: " + ColorUtils.gray + MathUtils.round(mc.player.getX(), 1) +
|
drawContext.drawTextWithShadow(textRenderer, "X: " + ColorUtils.gray + MathUtils.round(mc.player.getX(), 1) +
|
||||||
ColorUtils.reset + " Y: " + ColorUtils.gray + MathUtils.round(mc.player.getY(), 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, hudColor);
|
ColorUtils.reset + " Z: " + ColorUtils.gray + MathUtils.round(mc.player.getZ(), 1), 2, scaledHeight - 10, hudColor);
|
||||||
|
|
||||||
|
// draw client tag (if enabled)
|
||||||
|
if (showClientTag)
|
||||||
|
{
|
||||||
|
drawContext.drawTextWithShadow(textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag,
|
||||||
|
scaledWidth - textRenderer.getWidth(Moonlight.clientTag + " " + Moonlight.versionTag) - 2, scaledHeight - 10, 16777215);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double moveSpeed()
|
private double moveSpeed()
|
|
@ -0,0 +1,41 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.module.ModuleManager;
|
||||||
|
import me.kawaiizenbo.moonlight.module.Module_;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
|
||||||
|
public class ModulesListOverlay
|
||||||
|
{
|
||||||
|
public static ModulesListOverlay INSTANCE = new ModulesListOverlay();
|
||||||
|
private MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
|
TextRenderer textRenderer = mc.textRenderer;
|
||||||
|
private ArrayList<Module_> enabledModules = ModuleManager.INSTANCE.getEnabledModules();
|
||||||
|
|
||||||
|
public void render(DrawContext drawContext, int scaledWidth, int scaledHeight)
|
||||||
|
{
|
||||||
|
// do not draw if F3 enabled
|
||||||
|
if (mc.options.debugEnabled) return;
|
||||||
|
|
||||||
|
int yOffset = 0;
|
||||||
|
for (Module_ m : enabledModules)
|
||||||
|
{
|
||||||
|
if (!m.showInModulesList.value) continue;
|
||||||
|
int nameWidth = textRenderer.getWidth(m.name);
|
||||||
|
drawContext.fill(scaledWidth - nameWidth - 8, yOffset, scaledWidth, yOffset+12, 0x55222222);
|
||||||
|
drawContext.fill(scaledWidth - 2, yOffset, scaledWidth, yOffset+12, HUDOverlay.INSTANCE.hudColor);
|
||||||
|
drawContext.drawText(textRenderer, m.name, scaledWidth - nameWidth - 4, yOffset + 2, 0xFFFFFFFF, false);
|
||||||
|
yOffset += 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update()
|
||||||
|
{
|
||||||
|
enabledModules = ModuleManager.INSTANCE.getEnabledModules();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue