modules list and remove broken stuff
This commit is contained in:
parent
2a89f212e5
commit
b58eedfb9c
16 changed files with 168 additions and 44 deletions
|
@ -16,7 +16,9 @@ public class ModuleManager
|
|||
new NoFall(),
|
||||
new HUDModule(),
|
||||
new Step(),
|
||||
new Fullbright()
|
||||
new Fullbright(),
|
||||
new Speed(),
|
||||
new ModulesList()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,12 @@ package me.kawaiizenbo.moonlight.module;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import me.kawaiizenbo.moonlight.module.settings.BooleanSetting;
|
||||
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
||||
import me.kawaiizenbo.moonlight.ui.ModulesListOverlay;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.MovementType;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public abstract class Module_
|
||||
{
|
||||
|
@ -15,6 +19,8 @@ public abstract class Module_
|
|||
public ArrayList<Setting> settings;
|
||||
public int keyBind;
|
||||
|
||||
public BooleanSetting showInModulesList = new BooleanSetting("Show in Modules List", true);
|
||||
|
||||
public Module_(String name, String description, Category category)
|
||||
{
|
||||
this.name = name;
|
||||
|
@ -23,8 +29,9 @@ public abstract class Module_
|
|||
settings = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void onEnable() {}
|
||||
public void onDisable() {}
|
||||
public void onEnable() { ModulesListOverlay.INSTANCE.update(); }
|
||||
public void onDisable() { ModulesListOverlay.INSTANCE.update(); }
|
||||
public void onMotion(MovementType type, Vec3d movement) {}
|
||||
public void tick() {}
|
||||
|
||||
public void toggle()
|
||||
|
|
|
@ -20,6 +20,7 @@ public class Fly extends Module_
|
|||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
super.onDisable();
|
||||
mc.player.getAbilities().flying = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,12 +14,14 @@ public class Fullbright extends Module_
|
|||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
super.onEnable();
|
||||
((ISimpleOption<Double>)(Object)mc.options.getGamma()).setValueUnrestricted(100.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
super.onDisable();
|
||||
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.Module_;
|
||||
import me.kawaiizenbo.moonlight.module.settings.BooleanSetting;
|
||||
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
||||
import me.kawaiizenbo.moonlight.ui.HUD;
|
||||
import me.kawaiizenbo.moonlight.util.ReflectionUtils;
|
||||
import me.kawaiizenbo.moonlight.ui.HUDOverlay;
|
||||
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||
|
||||
public class HUDModule extends Module_
|
||||
{
|
||||
//public DoubleSetting r = new DoubleSetting("Red", 0x55, 0, 255, 0, ReflectionUtils.tryGetMethod("updateHUD()V", getClass()));
|
||||
//public DoubleSetting g = new DoubleSetting("Green", 255, 0, 255, 0, ReflectionUtils.tryGetMethod("updateHUD()V", getClass()));
|
||||
//public DoubleSetting b = new DoubleSetting("Blue", 255, 0, 255, 0, ReflectionUtils.tryGetMethod("updateHUD()V", getClass()));
|
||||
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", "Enables or disables the Moonlight HUD.", Category.RENDER);
|
||||
super("HUD", "The Moonlight HUD. Toggle to update.", Category.RENDER);
|
||||
this.enabled = true;
|
||||
//settings.add(r);
|
||||
//settings.add(g);
|
||||
//settings.add(b);
|
||||
this.showInModulesList.value = false;
|
||||
|
||||
settings.add(clientTag);
|
||||
settings.add(r);
|
||||
settings.add(g);
|
||||
settings.add(b);
|
||||
//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_
|
||||
{
|
||||
DoubleSetting stepHeight = new DoubleSetting("Height", 1, 1, 10, 0, null);
|
||||
DoubleSetting stepHeight = new DoubleSetting("Height", 1, 1, 10, 0);
|
||||
|
||||
public Step()
|
||||
{
|
||||
|
@ -23,6 +23,7 @@ public class Step extends Module_
|
|||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
super.onDisable();
|
||||
mc.player.setStepHeight(0.5f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package me.kawaiizenbo.moonlight.module.settings;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import me.kawaiizenbo.moonlight.util.ReflectionUtils;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
@ -10,11 +7,10 @@ public class BooleanSetting extends Setting
|
|||
{
|
||||
public boolean value;
|
||||
|
||||
public BooleanSetting(String name, boolean value, Method onValueChanged)
|
||||
public BooleanSetting(String name, boolean value)
|
||||
{
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.onValueChanged = onValueChanged;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,7 +29,6 @@ public class BooleanSetting extends Setting
|
|||
if (hovered((int)mouseX, (int)mouseY) && button == 0)
|
||||
{
|
||||
this.value = !value;
|
||||
ReflectionUtils.tryCallMethod(onValueChanged, new Object[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package me.kawaiizenbo.moonlight.module.settings;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.Text;
|
||||
|
@ -14,12 +12,11 @@ public class ColorSetting extends Setting
|
|||
public int b;
|
||||
|
||||
|
||||
public ColorSetting(String name, int value, Method onValueChanged)
|
||||
public ColorSetting(String name, int value)
|
||||
{
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.height = 64;
|
||||
this.onValueChanged = onValueChanged;
|
||||
this.r = (value >> 16) & 0xFF;
|
||||
this.g = (value >> 8) & 0xFF;
|
||||
this.b = value & 0xFF;
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package me.kawaiizenbo.moonlight.module.settings;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import me.kawaiizenbo.moonlight.util.MathUtils;
|
||||
import me.kawaiizenbo.moonlight.util.ReflectionUtils;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
@ -15,11 +12,10 @@ public class DoubleSetting extends Setting
|
|||
|
||||
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.value = value;
|
||||
this.onValueChanged = onValueChanged;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.roundingPlace = roundingPlace;
|
||||
|
@ -66,7 +62,6 @@ public class DoubleSetting extends Setting
|
|||
public void mouseReleased(double mouseX, double mouseY, int button)
|
||||
{
|
||||
sliding = false;
|
||||
ReflectionUtils.tryCallMethod(onValueChanged, new Object[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue