commit
854ce7201c
37 changed files with 965 additions and 100 deletions
|
@ -9,7 +9,7 @@ org.gradle.parallel=true
|
||||||
loader_version=0.16.3
|
loader_version=0.16.3
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.2.1
|
mod_version = 0.3.0
|
||||||
maven_group = me.kawaiizenbo
|
maven_group = me.kawaiizenbo
|
||||||
archives_base_name = moonlight
|
archives_base_name = moonlight
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,13 @@ import me.kawaiizenbo.moonlight.module.ModuleManager;
|
||||||
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.BooleanSetting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
||||||
|
import me.kawaiizenbo.moonlight.module.settings.IndexSetting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting;
|
import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.StringSetting;
|
import me.kawaiizenbo.moonlight.module.settings.StringSetting;
|
||||||
import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen;
|
import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
|
||||||
public class Config
|
public class Config
|
||||||
|
@ -57,19 +60,60 @@ public class Config
|
||||||
{
|
{
|
||||||
ms.put(s.name, ((DoubleSetting)s).value);
|
ms.put(s.name, ((DoubleSetting)s).value);
|
||||||
}
|
}
|
||||||
if (s instanceof StringSetting)
|
else if (s instanceof StringSetting)
|
||||||
{
|
{
|
||||||
ms.put(s.name, ((StringSetting)s).value);
|
ms.put(s.name, ((StringSetting)s).value);
|
||||||
}
|
}
|
||||||
else if (s instanceof KeycodeSetting)
|
else if (s instanceof KeycodeSetting)
|
||||||
{
|
{
|
||||||
ms.put(s.name, ((KeycodeSetting)s).value);
|
ms.put(s.name, ((KeycodeSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof IndexSetting)
|
||||||
|
{
|
||||||
|
ms.put(s.name, ((IndexSetting)s).index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mo.put("settings", ms);
|
mo.put("settings", ms);
|
||||||
mi.put(m.name, mo);
|
mi.put(m.name, mo);
|
||||||
}
|
}
|
||||||
config.put("modules", mi);
|
config.put("modules", mi);
|
||||||
|
|
||||||
|
HUDModuleManager.INSTANCE = new HUDModuleManager();
|
||||||
|
Map<String, Object> hi = new HashMap<>();
|
||||||
|
for (HUDModule h : HUDModuleManager.INSTANCE.modules)
|
||||||
|
{
|
||||||
|
Map<String, Object> ho = new HashMap<>();
|
||||||
|
ho.put("enabled", h.enabled);
|
||||||
|
Map<String, Object> hs = new HashMap<>();
|
||||||
|
for (Setting s : h.settings)
|
||||||
|
{
|
||||||
|
if (s instanceof BooleanSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((BooleanSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof DoubleSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((DoubleSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof StringSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((StringSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof KeycodeSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((KeycodeSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof IndexSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((IndexSetting)s).index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ho.put("settings", hs);
|
||||||
|
ho.put("x", h.x);
|
||||||
|
ho.put("y", h.y);
|
||||||
|
hi.put(h.name, ho);
|
||||||
|
}
|
||||||
|
config.put("hud", hi);
|
||||||
int xOffset = 4;
|
int xOffset = 4;
|
||||||
int yOffset = 4;
|
int yOffset = 4;
|
||||||
Map<String, Object> pi = new HashMap<>();
|
Map<String, Object> pi = new HashMap<>();
|
||||||
|
@ -91,6 +135,7 @@ public class Config
|
||||||
ClickGUIScreen.INSTANCE = new ClickGUIScreen();
|
ClickGUIScreen.INSTANCE = new ClickGUIScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void load() throws IOException
|
public void load() throws IOException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -12,11 +12,14 @@ import me.kawaiizenbo.moonlight.module.ModuleManager;
|
||||||
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.BooleanSetting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
||||||
|
import me.kawaiizenbo.moonlight.module.settings.IndexSetting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting;
|
import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.StringSetting;
|
import me.kawaiizenbo.moonlight.module.settings.StringSetting;
|
||||||
import me.kawaiizenbo.moonlight.ui.clickgui.CategoryPane;
|
import me.kawaiizenbo.moonlight.ui.clickgui.CategoryPane;
|
||||||
import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen;
|
import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager;
|
||||||
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
|
|
||||||
public class Moonlight implements ModInitializer
|
public class Moonlight implements ModInitializer
|
||||||
|
@ -24,10 +27,8 @@ public class Moonlight implements ModInitializer
|
||||||
public static final Moonlight INSTANCE = new Moonlight();
|
public static final Moonlight INSTANCE = new Moonlight();
|
||||||
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.2.1";
|
public static final String versionTag = ColorUtils.magenta + "v0.3.0";
|
||||||
public static Config CONFIG = new Config();
|
public static Config CONFIG = new Config();
|
||||||
public static int uiColorA = 0xFF55FFFF;
|
|
||||||
public static int uiColor = 0x55FFFF;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize()
|
public void onInitialize()
|
||||||
|
@ -36,6 +37,7 @@ public class Moonlight implements ModInitializer
|
||||||
loadConfig();
|
loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void loadConfig()
|
public void loadConfig()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -62,6 +64,39 @@ public class Moonlight implements ModInitializer
|
||||||
else if (s instanceof KeycodeSetting)
|
else if (s instanceof KeycodeSetting)
|
||||||
{
|
{
|
||||||
((KeycodeSetting)s).value = ((Double)((Map<String, Object>)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("modules")).get(m.name)).get("settings")).get(s.name)).intValue();
|
((KeycodeSetting)s).value = ((Double)((Map<String, Object>)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("modules")).get(m.name)).get("settings")).get(s.name)).intValue();
|
||||||
|
}
|
||||||
|
else if (s instanceof IndexSetting)
|
||||||
|
{
|
||||||
|
((IndexSetting)s).index = ((Double)((Map<String, Object>)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("modules")).get(m.name)).get("settings")).get(s.name)).intValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (HUDModule m : HUDModuleManager.INSTANCE.modules)
|
||||||
|
{
|
||||||
|
m.enabled = (boolean)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("hud")).get(m.name)).get("enabled");
|
||||||
|
m.x = ((Double)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("hud")).get(m.name)).get("x")).intValue();
|
||||||
|
m.y = ((Double)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("hud")).get(m.name)).get("y")).intValue();
|
||||||
|
for (Setting s : m.settings)
|
||||||
|
{
|
||||||
|
if (s instanceof BooleanSetting)
|
||||||
|
{
|
||||||
|
((BooleanSetting)s).value = (boolean)((Map<String, Object>)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name);
|
||||||
|
}
|
||||||
|
else if (s instanceof DoubleSetting)
|
||||||
|
{
|
||||||
|
((DoubleSetting)s).value = (Double)((Map<String, Object>)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name);
|
||||||
|
}
|
||||||
|
else if (s instanceof StringSetting)
|
||||||
|
{
|
||||||
|
((StringSetting)s).value = (String)((Map<String, Object>)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name);
|
||||||
|
}
|
||||||
|
else if (s instanceof KeycodeSetting)
|
||||||
|
{
|
||||||
|
((KeycodeSetting)s).value = ((Double)((Map<String, Object>)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name)).intValue();
|
||||||
|
}
|
||||||
|
else if (s instanceof IndexSetting)
|
||||||
|
{
|
||||||
|
((IndexSetting)s).index = ((Double)((Map<String, Object>)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name)).intValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,19 +129,60 @@ public class Moonlight implements ModInitializer
|
||||||
{
|
{
|
||||||
ms.put(s.name, ((DoubleSetting)s).value);
|
ms.put(s.name, ((DoubleSetting)s).value);
|
||||||
}
|
}
|
||||||
if (s instanceof StringSetting)
|
else if (s instanceof StringSetting)
|
||||||
{
|
{
|
||||||
ms.put(s.name, ((StringSetting)s).value);
|
ms.put(s.name, ((StringSetting)s).value);
|
||||||
}
|
}
|
||||||
else if (s instanceof KeycodeSetting)
|
else if (s instanceof KeycodeSetting)
|
||||||
{
|
{
|
||||||
ms.put(s.name, ((KeycodeSetting)s).value);
|
ms.put(s.name, ((KeycodeSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof IndexSetting)
|
||||||
|
{
|
||||||
|
ms.put(s.name, ((IndexSetting)s).index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mo.put("settings", ms);
|
mo.put("settings", ms);
|
||||||
mi.put(m.name, mo);
|
mi.put(m.name, mo);
|
||||||
}
|
}
|
||||||
CONFIG.config.put("modules", mi);
|
CONFIG.config.put("modules", mi);
|
||||||
|
|
||||||
|
Map<String, Object> hi = new HashMap<>();
|
||||||
|
for (HUDModule h : HUDModuleManager.INSTANCE.modules)
|
||||||
|
{
|
||||||
|
Map<String, Object> ho = new HashMap<>();
|
||||||
|
ho.put("enabled", h.enabled);
|
||||||
|
Map<String, Object> hs = new HashMap<>();
|
||||||
|
for (Setting s : h.settings)
|
||||||
|
{
|
||||||
|
if (s instanceof BooleanSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((BooleanSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof DoubleSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((DoubleSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof StringSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((StringSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof KeycodeSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((KeycodeSetting)s).value);
|
||||||
|
}
|
||||||
|
else if (s instanceof IndexSetting)
|
||||||
|
{
|
||||||
|
hs.put(s.name, ((IndexSetting)s).index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ho.put("settings", hs);
|
||||||
|
ho.put("x", h.x);
|
||||||
|
ho.put("y", h.y);
|
||||||
|
hi.put(h.name, ho);
|
||||||
|
}
|
||||||
|
CONFIG.config.put("hud", hi);
|
||||||
|
|
||||||
Map<String, Object> pi = new HashMap<>();
|
Map<String, Object> pi = new HashMap<>();
|
||||||
for (CategoryPane c : ClickGUIScreen.INSTANCE.categoryPanes)
|
for (CategoryPane c : ClickGUIScreen.INSTANCE.categoryPanes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class ClientPlayerEntityMixin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
@Inject(method = "tick", at = @At(value = "HEAD"), cancellable = true)
|
@Inject(method = "tick", at = @At(value = "HEAD"), cancellable = true)
|
||||||
public void onTick(CallbackInfo ci)
|
public void onTick(CallbackInfo ci)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,8 +6,10 @@ 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.HUDOverlay;
|
import me.kawaiizenbo.moonlight.module.modules.HUDEnabler;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.LegacyHUD;
|
||||||
import me.kawaiizenbo.moonlight.ui.ModulesListOverlay;
|
import me.kawaiizenbo.moonlight.ui.ModulesListOverlay;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDRenderer;
|
||||||
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;
|
||||||
import net.minecraft.client.render.RenderTickCounter;
|
import net.minecraft.client.render.RenderTickCounter;
|
||||||
|
@ -18,7 +20,12 @@ public class InGameHudMixin {
|
||||||
@Inject(at = @At("TAIL"), method = "render")
|
@Inject(at = @At("TAIL"), method = "render")
|
||||||
public void onRender (DrawContext drawContext, RenderTickCounter tickCounter, CallbackInfo info)
|
public void onRender (DrawContext drawContext, RenderTickCounter tickCounter, CallbackInfo info)
|
||||||
{
|
{
|
||||||
if (ModuleManager.INSTANCE.getModuleByName("HUD").enabled) HUDOverlay.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight());
|
HUDEnabler hudModule = (HUDEnabler)ModuleManager.INSTANCE.getModuleByName("HUD");
|
||||||
|
if (hudModule.enabled)
|
||||||
|
{
|
||||||
|
if (hudModule.mode.index == 1) LegacyHUD.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight());
|
||||||
|
else HUDRenderer.INSTANCE.render(drawContext);
|
||||||
|
}
|
||||||
if (ModuleManager.INSTANCE.getModuleByName("ModulesList").enabled) ModulesListOverlay.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight());
|
if (ModuleManager.INSTANCE.getModuleByName("ModulesList").enabled) ModulesListOverlay.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ public abstract class Module
|
||||||
public Category category;
|
public Category category;
|
||||||
public boolean enabled;
|
public boolean enabled;
|
||||||
public ArrayList<Setting> settings;
|
public ArrayList<Setting> settings;
|
||||||
|
public boolean showEditButton;
|
||||||
|
|
||||||
public BooleanSetting showInModulesList = new BooleanSetting("Show in Modules List", true);
|
public BooleanSetting showInModulesList = new BooleanSetting("Show in Modules List", true);
|
||||||
public KeycodeSetting keybind = new KeycodeSetting("Keybind", 0);
|
public KeycodeSetting keybind = new KeycodeSetting("Keybind", 0);
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class ModuleManager
|
||||||
registerModules(
|
registerModules(
|
||||||
new Fly(),
|
new Fly(),
|
||||||
new NoFall(),
|
new NoFall(),
|
||||||
new HUDModule(),
|
new HUDEnabler(),
|
||||||
new Step(),
|
new Step(),
|
||||||
new Fullbright(),
|
new Fullbright(),
|
||||||
new Speed(),
|
new Speed(),
|
||||||
|
@ -23,7 +23,9 @@ public class ModuleManager
|
||||||
new Rotation(),
|
new Rotation(),
|
||||||
new AutoJump(),
|
new AutoJump(),
|
||||||
new Reach(),
|
new Reach(),
|
||||||
new AntiPowderSnow()
|
new AntiPowderSnow(),
|
||||||
|
new AutoTotem(),
|
||||||
|
new AutoWalk()
|
||||||
/*new Timer()*/
|
/*new Timer()*/
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
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;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.screen.slot.SlotActionType;
|
||||||
|
|
||||||
|
public class AutoTotem extends Module
|
||||||
|
{
|
||||||
|
public BooleanSetting overrideItems = new BooleanSetting("Override other items", false);
|
||||||
|
|
||||||
|
public AutoTotem()
|
||||||
|
{
|
||||||
|
super("Auto Totem", "Automatically puts totems in offhand.", Category.COMBAT);
|
||||||
|
settings.add(overrideItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
|
{
|
||||||
|
if (mc.player.getInventory().offHand.get(0).getItem() != Items.TOTEM_OF_UNDYING)
|
||||||
|
{
|
||||||
|
if((!mc.player.getInventory().offHand.isEmpty()) && !overrideItems.value) return;
|
||||||
|
for (int i = 0; i <= 35; i++)
|
||||||
|
{
|
||||||
|
if (mc.player.getInventory().getStack(i).getItem() == Items.TOTEM_OF_UNDYING)
|
||||||
|
{
|
||||||
|
mc.interactionManager.clickSlot(0, i, 8, SlotActionType.SWAP, mc.player);
|
||||||
|
mc.interactionManager.clickSlot(0, 45, 8, SlotActionType.SWAP, mc.player);
|
||||||
|
mc.interactionManager.clickSlot(0, i, 8, SlotActionType.SWAP, mc.player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package me.kawaiizenbo.moonlight.module.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.module.Category;
|
||||||
|
import me.kawaiizenbo.moonlight.module.Module;
|
||||||
|
|
||||||
|
public class AutoWalk extends Module
|
||||||
|
{
|
||||||
|
|
||||||
|
public AutoWalk()
|
||||||
|
{
|
||||||
|
super("Auto Walk", "Automatically moves forward.", Category.MOVEMENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
|
{
|
||||||
|
mc.options.forwardKey.setPressed(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable()
|
||||||
|
{
|
||||||
|
super.onDisable();
|
||||||
|
mc.options.forwardKey.setPressed(false);
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,6 +11,7 @@ public class Fullbright extends Module
|
||||||
super("Fullbright", "Allows you to see in the dark.", Category.RENDER);
|
super("Fullbright", "Allows you to see in the dark.", Category.RENDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package me.kawaiizenbo.moonlight.module.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.module.Category;
|
||||||
|
import me.kawaiizenbo.moonlight.module.Module;
|
||||||
|
import me.kawaiizenbo.moonlight.module.settings.IndexSetting;
|
||||||
|
|
||||||
|
public class HUDEnabler extends Module
|
||||||
|
{
|
||||||
|
public IndexSetting mode = new IndexSetting("Mode", 0, "Modular", "Legacy");
|
||||||
|
|
||||||
|
public HUDEnabler()
|
||||||
|
{
|
||||||
|
super("HUD", "The Moonlight HUD.", Category.RENDER);
|
||||||
|
this.enabled = true;
|
||||||
|
this.showInModulesList.value = false;
|
||||||
|
this.showEditButton = true;
|
||||||
|
settings.add(mode);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,51 +0,0 @@
|
||||||
package me.kawaiizenbo.moonlight.module.modules;
|
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.Moonlight;
|
|
||||||
import me.kawaiizenbo.moonlight.module.Category;
|
|
||||||
import me.kawaiizenbo.moonlight.module.Module;
|
|
||||||
import me.kawaiizenbo.moonlight.module.settings.BooleanSetting;
|
|
||||||
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
|
||||||
import me.kawaiizenbo.moonlight.ui.HUDOverlay;
|
|
||||||
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
|
||||||
|
|
||||||
public class HUDModule extends Module
|
|
||||||
{
|
|
||||||
public BooleanSetting clientTag = new BooleanSetting("Client Tag", true);
|
|
||||||
public DoubleSetting r = new DoubleSetting("Red", 0x55, 0, 255, 0);
|
|
||||||
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 HUDModule()
|
|
||||||
{
|
|
||||||
super("HUD", "The Moonlight HUD. Toggle to update.", Category.RENDER);
|
|
||||||
this.enabled = true;
|
|
||||||
this.showInModulesList.value = false;
|
|
||||||
|
|
||||||
settings.add(clientTag);
|
|
||||||
settings.add(r);
|
|
||||||
settings.add(g);
|
|
||||||
settings.add(b);
|
|
||||||
//settings.add(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
super.onEnable();
|
|
||||||
HUDOverlay.INSTANCE.showClientTag = clientTag.value;
|
|
||||||
Moonlight.uiColorA =
|
|
||||||
ColorUtils.rgbaToInt(
|
|
||||||
(int)r.value,
|
|
||||||
(int)g.value,
|
|
||||||
(int)b.value,
|
|
||||||
255
|
|
||||||
);
|
|
||||||
Moonlight.uiColor =
|
|
||||||
ColorUtils.rgbToInt(
|
|
||||||
(int)r.value,
|
|
||||||
(int)g.value,
|
|
||||||
(int)b.value
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package me.kawaiizenbo.moonlight.module.settings;
|
||||||
|
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
public class IndexSetting extends Setting
|
||||||
|
{
|
||||||
|
public int index;
|
||||||
|
public String[] elements;
|
||||||
|
|
||||||
|
public IndexSetting(String name, int index, String... elements)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.index = index;
|
||||||
|
this.elements = elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
|
||||||
|
{
|
||||||
|
super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
|
||||||
|
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF);
|
||||||
|
drawContext.fill(x+96, y+5, x+190, y+19, 0xFFFFFFFF);
|
||||||
|
drawContext.fill(x+97, y+6, x+189, y+18, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
|
||||||
|
drawContext.drawTextWithShadow(textRenderer, elements[index], x+98, y+8, 0xFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(double mouseX, double mouseY, int button)
|
||||||
|
{
|
||||||
|
if (hovered((int)mouseX, (int)mouseY) && button == 0)
|
||||||
|
{
|
||||||
|
if (index >= elements.length-1) index = 0;
|
||||||
|
else index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
package me.kawaiizenbo.moonlight.ui;
|
package me.kawaiizenbo.moonlight.ui;
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.Moonlight;
|
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.ColorUtils;
|
||||||
import me.kawaiizenbo.moonlight.util.MathUtils;
|
import me.kawaiizenbo.moonlight.util.MathUtils;
|
||||||
|
|
||||||
|
@ -10,16 +8,11 @@ import net.minecraft.client.MinecraftClient;
|
||||||
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 HUDOverlay
|
public class LegacyHUD
|
||||||
{
|
{
|
||||||
public static HUDOverlay INSTANCE = new HUDOverlay();
|
// This is deprecated and will be removed in a later version
|
||||||
|
public static LegacyHUD INSTANCE = new LegacyHUD();
|
||||||
private MinecraftClient mc = MinecraftClient.getInstance();
|
private MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
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")).g.value,
|
|
||||||
(int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).b.value,
|
|
||||||
255 );
|
|
||||||
|
|
||||||
public void render(DrawContext drawContext, int scaledWidth, int scaledHeight)
|
public void render(DrawContext drawContext, int scaledWidth, int scaledHeight)
|
||||||
{
|
{
|
||||||
|
@ -27,24 +20,21 @@ public class HUDOverlay
|
||||||
if (mc.getDebugHud().shouldShowDebugHud()) return;
|
if (mc.getDebugHud().shouldShowDebugHud()) return;
|
||||||
|
|
||||||
// draw stats
|
// draw stats
|
||||||
drawContext.drawTextWithShadow(mc.textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 2, Moonlight.uiColorA);
|
drawContext.drawTextWithShadow(mc.textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 2, 0xFF55FFFF);
|
||||||
drawContext.drawTextWithShadow(mc.textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 12, Moonlight.uiColorA);
|
drawContext.drawTextWithShadow(mc.textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 12, 0xFF55FFFF);
|
||||||
drawContext.drawTextWithShadow(mc.textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, Moonlight.uiColorA);
|
drawContext.drawTextWithShadow(mc.textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, 0xFF55FFFF);
|
||||||
|
|
||||||
// draw coordinates
|
// draw coordinates
|
||||||
drawContext.drawTextWithShadow(mc.textRenderer,
|
drawContext.drawTextWithShadow(mc.textRenderer,
|
||||||
"X: " + ColorUtils.gray + String.format("%.1f", mc.player.getX()) + ColorUtils.reset +
|
"X: " + ColorUtils.gray + String.format("%.1f", mc.player.getX()) + ColorUtils.reset +
|
||||||
" Y: " + ColorUtils.gray + String.format("%.1f", mc.player.getY()) + ColorUtils.reset +
|
" Y: " + ColorUtils.gray + String.format("%.1f", mc.player.getY()) + ColorUtils.reset +
|
||||||
" Z: " + ColorUtils.gray + String.format("%.1f", mc.player.getZ()), 2, scaledHeight - 10, Moonlight.uiColorA
|
" Z: " + ColorUtils.gray + String.format("%.1f", mc.player.getZ()), 2, scaledHeight - 10, 0xFF55FFFF
|
||||||
);
|
);
|
||||||
|
|
||||||
// draw client tag (if enabled)
|
// draw client tag
|
||||||
if (showClientTag)
|
|
||||||
{
|
|
||||||
drawContext.drawTextWithShadow(mc.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag,
|
drawContext.drawTextWithShadow(mc.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag,
|
||||||
scaledWidth - mc.textRenderer.getWidth(Moonlight.clientTag + " " + Moonlight.versionTag) - 2, scaledHeight - 10, 16777215);
|
scaledWidth - mc.textRenderer.getWidth(Moonlight.clientTag + " " + Moonlight.versionTag) - 2, scaledHeight - 10, 16777215);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private double moveSpeed()
|
private double moveSpeed()
|
||||||
{
|
{
|
|
@ -2,7 +2,6 @@ package me.kawaiizenbo.moonlight.ui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.Moonlight;
|
|
||||||
import me.kawaiizenbo.moonlight.module.ModuleManager;
|
import me.kawaiizenbo.moonlight.module.ModuleManager;
|
||||||
import me.kawaiizenbo.moonlight.module.Module;
|
import me.kawaiizenbo.moonlight.module.Module;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
@ -11,6 +10,8 @@ import net.minecraft.client.gui.DrawContext;
|
||||||
|
|
||||||
public class ModulesListOverlay
|
public class ModulesListOverlay
|
||||||
{
|
{
|
||||||
|
// this will be replaced with a new hud version at some point
|
||||||
|
|
||||||
public static ModulesListOverlay INSTANCE = new ModulesListOverlay();
|
public static ModulesListOverlay INSTANCE = new ModulesListOverlay();
|
||||||
private MinecraftClient mc = MinecraftClient.getInstance();
|
private MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
private ArrayList<Module> enabledModules = ModuleManager.INSTANCE.getEnabledModules();
|
private ArrayList<Module> enabledModules = ModuleManager.INSTANCE.getEnabledModules();
|
||||||
|
@ -26,7 +27,7 @@ public class ModulesListOverlay
|
||||||
if (!m.showInModulesList.value) continue;
|
if (!m.showInModulesList.value) continue;
|
||||||
int nameWidth = mc.textRenderer.getWidth(m.name);
|
int nameWidth = mc.textRenderer.getWidth(m.name);
|
||||||
drawContext.fill(scaledWidth - nameWidth - 8, yOffset, scaledWidth, yOffset+12, 0x77222222);
|
drawContext.fill(scaledWidth - nameWidth - 8, yOffset, scaledWidth, yOffset+12, 0x77222222);
|
||||||
drawContext.fill(scaledWidth - 2, yOffset, scaledWidth, yOffset+12, Moonlight.uiColorA);
|
drawContext.fill(scaledWidth - 2, yOffset, scaledWidth, yOffset+12, 0xFF55FFFF);
|
||||||
drawContext.drawText(mc.textRenderer, m.name, scaledWidth - nameWidth - 4, yOffset + 2, 0xFFFFFFFF, false);
|
drawContext.drawText(mc.textRenderer, m.name, scaledWidth - nameWidth - 4, yOffset + 2, 0xFFFFFFFF, false);
|
||||||
yOffset += 12;
|
yOffset += 12;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,30 @@
|
||||||
package me.kawaiizenbo.moonlight.ui;
|
package me.kawaiizenbo.moonlight.ui;
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
public class TextButton
|
public class SetScreenButton
|
||||||
{
|
{
|
||||||
String text;
|
String text;
|
||||||
|
Screen screen;
|
||||||
int x, y, color, width;
|
int x, y, color, width;
|
||||||
|
|
||||||
public TextButton(String text, int x, int y, int color)
|
public SetScreenButton(String text, int x, int y, int color, Screen screen)
|
||||||
{
|
{
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
this.screen = screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(DrawContext drawContext, TextRenderer textRenderer, int mouseX, int mouseY)
|
public void render(DrawContext drawContext, TextRenderer textRenderer, int mouseX, int mouseY, int x, int y)
|
||||||
{
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
width = textRenderer.getWidth(text);
|
width = textRenderer.getWidth(text);
|
||||||
drawContext.fill(x-1, y-1, x + width + 1, y + 10, hovered(mouseX, mouseY) ? 0x55FFFFFF : 0);
|
drawContext.fill(x-1, y-1, x + width + 1, y + 10, hovered(mouseX, mouseY) ? 0x55FFFFFF : 0);
|
||||||
drawContext.drawText(textRenderer, Text.literal(text), x, y, color, true);
|
drawContext.drawText(textRenderer, Text.literal(text), x, y, color, true);
|
||||||
|
@ -35,8 +39,7 @@ public class TextButton
|
||||||
{
|
{
|
||||||
if (hovered(mouseX, mouseY))
|
if (hovered(mouseX, mouseY))
|
||||||
{
|
{
|
||||||
// i have no clue how to pass a method so this is kind of stupid
|
MinecraftClient.getInstance().setScreen(screen);
|
||||||
MinecraftClient.getInstance().setScreen(ClickGUIScreen.INSTANCE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ public class ClickGUIScreen extends Screen
|
||||||
public static ClickGUIScreen INSTANCE = new ClickGUIScreen();
|
public static ClickGUIScreen INSTANCE = new ClickGUIScreen();
|
||||||
public ArrayList<CategoryPane> categoryPanes;
|
public ArrayList<CategoryPane> categoryPanes;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public ClickGUIScreen()
|
public ClickGUIScreen()
|
||||||
{
|
{
|
||||||
super(Text.literal("ClickGUI"));
|
super(Text.literal("ClickGUI"));
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package me.kawaiizenbo.moonlight.ui.clickgui;
|
package me.kawaiizenbo.moonlight.ui.clickgui;
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.Moonlight;
|
|
||||||
import me.kawaiizenbo.moonlight.module.Module;
|
import me.kawaiizenbo.moonlight.module.Module;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
@ -23,7 +22,7 @@ public class ModuleButton
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
|
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
|
||||||
drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? Moonlight.uiColor : 0xFFFFFF, false);
|
drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? 0x55FFFF : 0xFFFFFF, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hovered(int mouseX, int mouseY)
|
public boolean hovered(int mouseX, int mouseY)
|
||||||
|
|
|
@ -2,7 +2,8 @@ package me.kawaiizenbo.moonlight.ui.clickgui;
|
||||||
|
|
||||||
import me.kawaiizenbo.moonlight.module.Module;
|
import me.kawaiizenbo.moonlight.module.Module;
|
||||||
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
||||||
import me.kawaiizenbo.moonlight.ui.TextButton;
|
import me.kawaiizenbo.moonlight.ui.SetScreenButton;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.editor.HUDEditorScreen;
|
||||||
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.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
@ -11,7 +12,8 @@ import net.minecraft.text.Text;
|
||||||
public class SettingsScreen extends Screen
|
public class SettingsScreen extends Screen
|
||||||
{
|
{
|
||||||
private Module module;
|
private Module module;
|
||||||
private TextButton backButton;
|
private SetScreenButton backButton;
|
||||||
|
private SetScreenButton editButton;
|
||||||
|
|
||||||
boolean dragging = false;
|
boolean dragging = false;
|
||||||
int startX, startY, x = (ClickGUIScreen.INSTANCE.width/2)-112, y = (ClickGUIScreen.INSTANCE.height/2)-96, windowWidth = 224, windowHeight = 192;
|
int startX, startY, x = (ClickGUIScreen.INSTANCE.width/2)-112, y = (ClickGUIScreen.INSTANCE.height/2)-96, windowWidth = 224, windowHeight = 192;
|
||||||
|
@ -19,6 +21,8 @@ public class SettingsScreen extends Screen
|
||||||
public SettingsScreen(Module module)
|
public SettingsScreen(Module module)
|
||||||
{
|
{
|
||||||
super(Text.literal("Settings"));
|
super(Text.literal("Settings"));
|
||||||
|
backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, 0xFFFFFF, ClickGUIScreen.INSTANCE);
|
||||||
|
editButton = new SetScreenButton(ColorUtils.underline + "Edit", x+windowWidth-22, y+4, 0xFFFFFF, HUDEditorScreen.INSTANCE);
|
||||||
this.module = module;
|
this.module = module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +42,8 @@ public class SettingsScreen extends Screen
|
||||||
drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, 0xFF222222);
|
drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, 0xFF222222);
|
||||||
drawContext.drawCenteredTextWithShadow(textRenderer, module.name, x+(windowWidth/2), y+4, 0xFFFFFF);
|
drawContext.drawCenteredTextWithShadow(textRenderer, module.name, x+(windowWidth/2), y+4, 0xFFFFFF);
|
||||||
drawContext.drawText(textRenderer, module.description, x+8, y+24, 0xFFFFFF, true);
|
drawContext.drawText(textRenderer, module.description, x+8, y+24, 0xFFFFFF, true);
|
||||||
backButton = new TextButton(ColorUtils.underline + "< Back", x+4, y+4, 0xFFFFFF);
|
backButton.render(drawContext, textRenderer, mouseX, mouseY, x+4, y+4);
|
||||||
backButton.render(drawContext, textRenderer, mouseX, mouseY);
|
if (module.showEditButton) editButton.render(drawContext, textRenderer, mouseX, mouseY, x+windowWidth-22, y+4);
|
||||||
int yOffset = y+40;
|
int yOffset = y+40;
|
||||||
for (Setting setting : module.settings)
|
for (Setting setting : module.settings)
|
||||||
{
|
{
|
||||||
|
@ -69,6 +73,7 @@ public class SettingsScreen extends Screen
|
||||||
dragging = true;
|
dragging = true;
|
||||||
}
|
}
|
||||||
backButton.mouseClicked((int)mouseX, (int)mouseY);
|
backButton.mouseClicked((int)mouseX, (int)mouseY);
|
||||||
|
editButton.mouseClicked((int)mouseX, (int)mouseY);
|
||||||
for (Setting setting : module.settings)
|
for (Setting setting : module.settings)
|
||||||
{
|
{
|
||||||
setting.mouseClicked(mouseX, mouseY, button);
|
setting.mouseClicked(mouseX, mouseY, button);
|
||||||
|
|
67
src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDModule.java
Normal file
67
src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDModule.java
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
|
||||||
|
public abstract class HUDModule
|
||||||
|
{
|
||||||
|
public int x, y, height, width;
|
||||||
|
public String name;
|
||||||
|
int startX, startY;
|
||||||
|
boolean dragging = false;
|
||||||
|
public boolean enabled = false;
|
||||||
|
public ArrayList<Setting> settings;
|
||||||
|
|
||||||
|
protected static MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
|
|
||||||
|
public HUDModule(String name, int x, int y)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
settings = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
|
||||||
|
{
|
||||||
|
if (editMode)
|
||||||
|
{
|
||||||
|
if (dragging)
|
||||||
|
{
|
||||||
|
x = mouseX - startX;
|
||||||
|
y = mouseY - startY;
|
||||||
|
}
|
||||||
|
drawContext.fill(x-1, y-1, x+width+1, y+height+1, enabled ? 0xFF55FFFF : 0xFF555555);
|
||||||
|
drawContext.fill(x, y, x+width, y+height, 0xFF222222);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hovered(int mouseX, int mouseY)
|
||||||
|
{
|
||||||
|
return mouseX >= x && mouseX <= x+width && mouseY >= y && mouseY <= y+height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseClicked(int mouseX, int mouseY, int button)
|
||||||
|
{
|
||||||
|
if (hovered(mouseX, mouseY) && button == 0)
|
||||||
|
{
|
||||||
|
startX = (int)mouseX-x;
|
||||||
|
startY = (int)mouseY-y;
|
||||||
|
dragging = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(int mouseX, int mouseY, int button)
|
||||||
|
{
|
||||||
|
dragging = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggle()
|
||||||
|
{
|
||||||
|
enabled = !enabled;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.modules.*;
|
||||||
|
|
||||||
|
public class HUDModuleManager
|
||||||
|
{
|
||||||
|
public static HUDModuleManager INSTANCE = new HUDModuleManager();
|
||||||
|
public ArrayList<HUDModule> modules = new ArrayList<>();
|
||||||
|
|
||||||
|
public HUDModuleManager()
|
||||||
|
{
|
||||||
|
registerModules(
|
||||||
|
new ClientTag(2, 2),
|
||||||
|
new FPS(2, 12),
|
||||||
|
new Ping(2, 22),
|
||||||
|
new MovementSpeed(2, 32),
|
||||||
|
new Coordinates(2, 42),
|
||||||
|
new ArmorDisplay(2, 52),
|
||||||
|
new TotemCounter(20, 52)
|
||||||
|
//new TestModuleHUD(20, 50)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerModules(HUDModule... modules)
|
||||||
|
{
|
||||||
|
for (HUDModule module : modules) {
|
||||||
|
this.modules.add(module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HUDModule getModuleByName(String moduleName)
|
||||||
|
{
|
||||||
|
for(HUDModule module : modules)
|
||||||
|
{
|
||||||
|
if ((module.name.trim().equalsIgnoreCase(moduleName)))
|
||||||
|
{
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<HUDModule> getEnabledModules()
|
||||||
|
{
|
||||||
|
ArrayList<HUDModule> enabledModules = new ArrayList<>();
|
||||||
|
for (HUDModule module : modules)
|
||||||
|
{
|
||||||
|
if (!module.enabled)
|
||||||
|
continue;
|
||||||
|
enabledModules.add(module);
|
||||||
|
}
|
||||||
|
return enabledModules;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
|
||||||
|
public class HUDRenderer
|
||||||
|
{
|
||||||
|
public static HUDRenderer INSTANCE = new HUDRenderer();
|
||||||
|
private MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
|
|
||||||
|
public void render(DrawContext drawContext)
|
||||||
|
{
|
||||||
|
// do not draw if F3 enabled
|
||||||
|
if (mc.getDebugHud().shouldShowDebugHud()) return;
|
||||||
|
|
||||||
|
for (HUDModule h : HUDModuleManager.INSTANCE.getEnabledModules())
|
||||||
|
{
|
||||||
|
// mouse coords are not needed when not in edit mode
|
||||||
|
h.render(drawContext, 0, 0, mc.textRenderer, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.editor;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
public class HUDEditorScreen extends Screen
|
||||||
|
{
|
||||||
|
public static HUDEditorScreen INSTANCE = new HUDEditorScreen();
|
||||||
|
HUDModuleList moduleList;
|
||||||
|
|
||||||
|
public HUDEditorScreen()
|
||||||
|
{
|
||||||
|
super(Text.literal("HUD Editor"));
|
||||||
|
moduleList = new HUDModuleList(256, 2, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta)
|
||||||
|
{
|
||||||
|
this.renderBackground(drawContext, mouseX, mouseY, delta);
|
||||||
|
for (HUDModule h : HUDModuleManager.INSTANCE.modules)
|
||||||
|
{
|
||||||
|
h.render(drawContext, mouseX, mouseY, textRenderer, true, h.enabled);
|
||||||
|
}
|
||||||
|
moduleList.render(drawContext, mouseX, mouseY, delta, textRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClicked(double mouseX, double mouseY, int button)
|
||||||
|
{
|
||||||
|
for (HUDModule h : HUDModuleManager.INSTANCE.modules)
|
||||||
|
{
|
||||||
|
h.mouseClicked((int)mouseX, (int)mouseY, button);
|
||||||
|
}
|
||||||
|
moduleList.mouseClicked((int)mouseX, (int)mouseY, button);
|
||||||
|
return super.mouseClicked(mouseX, mouseY, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseReleased(double mouseX, double mouseY, int button)
|
||||||
|
{
|
||||||
|
for (HUDModule h : HUDModuleManager.INSTANCE.modules)
|
||||||
|
{
|
||||||
|
h.mouseReleased((int)mouseX, (int)mouseY, button);
|
||||||
|
}
|
||||||
|
moduleList.mouseReleased((int)mouseX, (int)mouseY, button);
|
||||||
|
return super.mouseReleased(mouseX, mouseY, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldPause()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.editor;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class HUDModuleButton
|
||||||
|
{
|
||||||
|
public HUDModule module;
|
||||||
|
public int x, y, width, height = 0;
|
||||||
|
|
||||||
|
public HUDModuleButton(HUDModule module)
|
||||||
|
{
|
||||||
|
this.module = module;
|
||||||
|
this.width = 124;
|
||||||
|
this.height = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, int x, int y, TextRenderer textRenderer)
|
||||||
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
|
||||||
|
drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? 0x55FFFF : 0xFFFFFF, false);
|
||||||
|
if (!module.settings.isEmpty()) drawContext.drawGuiTexture(Identifier.of("moonlight", "settings"), x+width-12, y, 12, 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hovered(int mouseX, int mouseY)
|
||||||
|
{
|
||||||
|
return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean mouseClicked(int mouseX, int mouseY, int button)
|
||||||
|
{
|
||||||
|
if (hovered(mouseX, mouseY))
|
||||||
|
{
|
||||||
|
if (button == 0)
|
||||||
|
{
|
||||||
|
module.toggle();
|
||||||
|
}
|
||||||
|
else if (button == 1)
|
||||||
|
{
|
||||||
|
if (!module.settings.isEmpty()) MinecraftClient.getInstance().setScreen(new HUDModuleSettingsScreen(module));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.editor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class HUDModuleList
|
||||||
|
{
|
||||||
|
public int x, y, height, width = 128;
|
||||||
|
int startX, startY;
|
||||||
|
boolean dragging = false;
|
||||||
|
public boolean collapsed = false;
|
||||||
|
ArrayList<HUDModuleButton> buttons;
|
||||||
|
|
||||||
|
public HUDModuleList(int initialX, int initialY, boolean collapsed)
|
||||||
|
{
|
||||||
|
this.x = initialX;
|
||||||
|
this.y = initialY;
|
||||||
|
this.collapsed = collapsed;
|
||||||
|
buttons = new ArrayList<HUDModuleButton>();
|
||||||
|
for (HUDModule m : HUDModuleManager.INSTANCE.modules)
|
||||||
|
{
|
||||||
|
buttons.add(new HUDModuleButton(m));
|
||||||
|
}
|
||||||
|
if (buttons.size() == 0) collapsed = true;
|
||||||
|
height = (buttons.size()*12) + 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta, TextRenderer textRenderer)
|
||||||
|
{
|
||||||
|
if (dragging)
|
||||||
|
{
|
||||||
|
x = mouseX - startX;
|
||||||
|
y = mouseY - startY;
|
||||||
|
}
|
||||||
|
drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, 0xFF55FFFF);
|
||||||
|
drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
|
||||||
|
drawContext.drawGuiTexture(Identifier.of("moonlight", "hud"), x+2, y+2, 12, 12);
|
||||||
|
drawContext.drawText(textRenderer, "HUD Modules", x+16, y+4, 0xFFFFFFFF, false);
|
||||||
|
if (!collapsed)
|
||||||
|
{
|
||||||
|
int buttonYOffset = y+16;
|
||||||
|
for (HUDModuleButton m : buttons)
|
||||||
|
{
|
||||||
|
m.render(drawContext, mouseX, mouseY, x+2, buttonYOffset, textRenderer);
|
||||||
|
buttonYOffset += 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hovered(int mouseX, int mouseY)
|
||||||
|
{
|
||||||
|
return mouseX >= x+2 && mouseX <= x+(width-2) && mouseY >= y+2 && mouseY <= y+14;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseClicked(int mouseX, int mouseY, int button)
|
||||||
|
{
|
||||||
|
for (HUDModuleButton moduleButton : buttons)
|
||||||
|
{
|
||||||
|
if (moduleButton.mouseClicked(mouseX, mouseY, button)) return;
|
||||||
|
}
|
||||||
|
if (hovered(mouseX, mouseY) && button == 1) collapsed = !collapsed;
|
||||||
|
else if (hovered(mouseX, mouseY) && button == 0)
|
||||||
|
{
|
||||||
|
startX = (int)mouseX-x;
|
||||||
|
startY = (int)mouseY-y;
|
||||||
|
dragging = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(int mouseX, int mouseY, int button)
|
||||||
|
{
|
||||||
|
dragging = false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.editor;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.SetScreenButton;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
public class HUDModuleSettingsScreen extends Screen
|
||||||
|
{
|
||||||
|
// adapted for hud modules
|
||||||
|
private HUDModule module;
|
||||||
|
private SetScreenButton backButton;
|
||||||
|
|
||||||
|
boolean dragging = false;
|
||||||
|
int startX, startY, x = (HUDEditorScreen.INSTANCE.width/2)-112, y = (HUDEditorScreen.INSTANCE.height/2)-96, windowWidth = 224, windowHeight = 192;
|
||||||
|
|
||||||
|
public HUDModuleSettingsScreen(HUDModule module)
|
||||||
|
{
|
||||||
|
super(Text.literal("Settings"));
|
||||||
|
backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, 0xFFFFFF, HUDEditorScreen.INSTANCE);
|
||||||
|
this.module = module;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta)
|
||||||
|
{
|
||||||
|
this.renderBackground(drawContext, mouseX, mouseY, delta);
|
||||||
|
|
||||||
|
// move window if dragging
|
||||||
|
if (dragging)
|
||||||
|
{
|
||||||
|
x = mouseX - startX;
|
||||||
|
y = mouseY - startY;
|
||||||
|
}
|
||||||
|
drawContext.fill(x, y, x+windowWidth, y+windowHeight, 0xFF222222);
|
||||||
|
drawContext.fill(x, y, x+windowWidth, y+16, 0xFF55FFFF);
|
||||||
|
drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, 0xFF222222);
|
||||||
|
drawContext.drawCenteredTextWithShadow(textRenderer, module.name, x+(windowWidth/2), y+4, 0xFFFFFF);
|
||||||
|
backButton.render(drawContext, textRenderer, mouseX, mouseY, x+4, y+4);
|
||||||
|
int yOffset = y+24;
|
||||||
|
for (Setting setting : module.settings)
|
||||||
|
{
|
||||||
|
setting.render(drawContext, x+16, yOffset, mouseX, mouseY, textRenderer);
|
||||||
|
yOffset += 25;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean barHovered(int mouseX, int mouseY)
|
||||||
|
{
|
||||||
|
return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldPause()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClicked(double mouseX, double mouseY, int button)
|
||||||
|
{
|
||||||
|
if (barHovered((int)mouseX, (int)mouseY))
|
||||||
|
{
|
||||||
|
startX = (int)mouseX-x;
|
||||||
|
startY = (int)mouseY-y;
|
||||||
|
dragging = true;
|
||||||
|
}
|
||||||
|
backButton.mouseClicked((int)mouseX, (int)mouseY);
|
||||||
|
for (Setting setting : module.settings)
|
||||||
|
{
|
||||||
|
setting.mouseClicked(mouseX, mouseY, button);
|
||||||
|
}
|
||||||
|
return super.mouseClicked(mouseX, mouseY, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseReleased(double mouseX, double mouseY, int button)
|
||||||
|
{
|
||||||
|
dragging = false;
|
||||||
|
for (Setting setting : module.settings)
|
||||||
|
{
|
||||||
|
setting.mouseReleased(mouseX, mouseY, button);
|
||||||
|
}
|
||||||
|
return super.mouseReleased(mouseX, mouseY, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyPressed(int keyCode, int scanCode, int modifiers)
|
||||||
|
{
|
||||||
|
for (Setting setting : module.settings)
|
||||||
|
{
|
||||||
|
setting.keyPressed(keyCode, scanCode, modifiers);
|
||||||
|
}
|
||||||
|
return super.keyPressed(keyCode, scanCode, modifiers);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
|
import me.kawaiizenbo.moonlight.util.MathUtils;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
public class ArmorDisplay extends HUDModule
|
||||||
|
{
|
||||||
|
|
||||||
|
public ArmorDisplay(int x, int y)
|
||||||
|
{
|
||||||
|
super("Armor Display", x, y);
|
||||||
|
this.width = 16;
|
||||||
|
this.height = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
|
||||||
|
{
|
||||||
|
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
|
||||||
|
int yOffset = 0;
|
||||||
|
for (int i = 39; i >= 36; i--)
|
||||||
|
{
|
||||||
|
ItemStack piece = mc.player.getInventory().getStack(i);
|
||||||
|
drawContext.drawItem(piece, x, y+yOffset);
|
||||||
|
drawContext.drawItemInSlot(textRenderer, piece, x, y+yOffset);
|
||||||
|
yOffset += 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.Moonlight;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
|
||||||
|
public class ClientTag extends HUDModule
|
||||||
|
{
|
||||||
|
public ClientTag(int x, int y)
|
||||||
|
{
|
||||||
|
super("Client Tag", x, y);
|
||||||
|
this.width = 128;
|
||||||
|
this.height = 8;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
|
||||||
|
{
|
||||||
|
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
|
||||||
|
drawContext.drawTextWithShadow(mc.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, x, y, 16777215);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
|
||||||
|
public class Coordinates extends HUDModule
|
||||||
|
{
|
||||||
|
public Coordinates(int x, int y)
|
||||||
|
{
|
||||||
|
super("Coordinates", x, y);
|
||||||
|
this.width = 128;
|
||||||
|
this.height = 8;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
|
||||||
|
{
|
||||||
|
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
|
||||||
|
drawContext.drawTextWithShadow(mc.textRenderer,
|
||||||
|
"X: " + ColorUtils.gray + String.format("%.1f", mc.player.getX()) + ColorUtils.reset +
|
||||||
|
" Y: " + ColorUtils.gray + String.format("%.1f", mc.player.getY()) + ColorUtils.reset +
|
||||||
|
" Z: " + ColorUtils.gray + String.format("%.1f", mc.player.getZ()), x, y, 0xFF55FFFF
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
|
||||||
|
public class FPS extends HUDModule
|
||||||
|
{
|
||||||
|
public FPS(int x, int y)
|
||||||
|
{
|
||||||
|
super("FPS", x, y);
|
||||||
|
this.width = 48;
|
||||||
|
this.height = 8;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
|
||||||
|
{
|
||||||
|
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
|
||||||
|
drawContext.drawTextWithShadow(mc.textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], x, y, 0xFF55FFFF);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
|
import me.kawaiizenbo.moonlight.util.MathUtils;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
public class MovementSpeed extends HUDModule
|
||||||
|
{
|
||||||
|
public MovementSpeed(int x, int y)
|
||||||
|
{
|
||||||
|
super("Movement Speed", x, y);
|
||||||
|
this.width = 72;
|
||||||
|
this.height = 8;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
|
||||||
|
{
|
||||||
|
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
|
||||||
|
drawContext.drawTextWithShadow(mc.textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), x, y, 0xFF55FFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double moveSpeed()
|
||||||
|
{
|
||||||
|
Vec3d move = new Vec3d(mc.player.getX() - mc.player.prevX, 0, mc.player.getZ() - mc.player.prevZ).multiply(20);
|
||||||
|
return Math.abs(MathUtils.length2D(move)) ;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
|
||||||
|
public class Ping extends HUDModule
|
||||||
|
{
|
||||||
|
public Ping(int x, int y)
|
||||||
|
{
|
||||||
|
super("Ping", x, y);
|
||||||
|
this.width = 48;
|
||||||
|
this.height = 8;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
|
||||||
|
{
|
||||||
|
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
|
||||||
|
drawContext.drawTextWithShadow(mc.textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), x, y, 0xFF55FFFF);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
||||||
|
import me.kawaiizenbo.moonlight.module.settings.StringSetting;
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
|
||||||
|
public class TestModuleHUD extends HUDModule
|
||||||
|
{
|
||||||
|
public StringSetting text = new StringSetting("Text", "hii :3");
|
||||||
|
public DoubleSetting number = new DoubleSetting("test", 1, 0, 10, 0);
|
||||||
|
|
||||||
|
public TestModuleHUD(int x, int y)
|
||||||
|
{
|
||||||
|
super("Test HUD Module", x, y);
|
||||||
|
this.width = 96;
|
||||||
|
this.height = 8;
|
||||||
|
settings.add(text);
|
||||||
|
settings.add(number);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
|
||||||
|
{
|
||||||
|
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
|
||||||
|
drawContext.drawText(textRenderer, text.value, x, y, 0xFFFFFF, false);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package me.kawaiizenbo.moonlight.ui.hud.modules;
|
||||||
|
|
||||||
|
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||||
|
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||||
|
import me.kawaiizenbo.moonlight.util.MathUtils;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
public class TotemCounter extends HUDModule
|
||||||
|
{
|
||||||
|
|
||||||
|
public TotemCounter(int x, int y)
|
||||||
|
{
|
||||||
|
super("Totem Counter", x, y);
|
||||||
|
this.width = 24;
|
||||||
|
this.height = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
|
||||||
|
{
|
||||||
|
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
|
||||||
|
int count = 0;
|
||||||
|
for (int i = 0; i < 36; i++)
|
||||||
|
{
|
||||||
|
ItemStack stack = mc.player.getInventory().getStack(i);
|
||||||
|
if (stack.getItem() == Items.TOTEM_OF_UNDYING) count += stack.getCount();
|
||||||
|
}
|
||||||
|
drawContext.drawItem(Items.TOTEM_OF_UNDYING.getDefaultStack(), x, y);
|
||||||
|
drawContext.drawTextWithShadow(textRenderer, count+"", x+16, y+8, 16777215);
|
||||||
|
}
|
||||||
|
}
|
BIN
src/main/resources/assets/moonlight/textures/gui/sprites/hud.png
Normal file
BIN
src/main/resources/assets/moonlight/textures/gui/sprites/hud.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 354 B |
Binary file not shown.
After Width: | Height: | Size: 366 B |
|
@ -1,11 +1,12 @@
|
||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "moonlight",
|
"id": "moonlight",
|
||||||
"version": "v0.2.1",
|
"version": "v0.3.0",
|
||||||
"name": "Moonlight Meadows",
|
"name": "Moonlight Meadows",
|
||||||
"description": "Utility mod with a focus on stability.",
|
"description": "Utility mod with a focus on stability.",
|
||||||
"authors": [
|
"authors": [
|
||||||
"KawaiiZenbo",
|
"KawaiiZenbo",
|
||||||
|
"madeline1805",
|
||||||
"BadGamesInc (re-used Hypnotic Code)"
|
"BadGamesInc (re-used Hypnotic Code)"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue