diff --git a/src/openonyx/features/Module.java b/src/openonyx/features/Module.java new file mode 100644 index 0000000..0afb151 --- /dev/null +++ b/src/openonyx/features/Module.java @@ -0,0 +1,180 @@ +package openonyx.features; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import openonyx.core.MinecraftAccess; +import openonyx.core.OnyxClient; +import openonyx.history.Setting; +import openonyx.history.UndoManager; +import openonyx.history.internal.EnumSetting; +import openonyx.history.internal.KeybindSetting; +import openonyx.utilities.RotationRequester; +import org.apache.logging.log4j.Logger; + +public class Module implements MinecraftAccess, RotationRequester { + private final EnumSetting bindMode; + private final String description; + private final KeybindSetting bind = new KeybindSetting("Bind"); + private final List settings; + private boolean enabled; + private final String name; + private final ModuleCategory moduleCategory; + + public boolean i() { + return true; + } + + public ModuleCategory getModuleCategory() { + return this.moduleCategory; + } + + public boolean D() { + return true; + } + + private void L(Object object, Class class_) { + Module module1 = this; + + Class class_x; + for (Class class_xx = class_x = object.getClass(); class_xx != null && class_x != class_xx; class_xx = class_x = class_x.getSuperclass()) { + Field[] fields; + int i = (fields = class_x.getDeclaredFields()).length; + + int j; + for (int k = j = 0; k < i; k = ++j) { + Field field = fields[j]; + if (Setting.class.isAssignableFrom(field.getType()) && !Modifier.isStatic(field.getModifiers()) && !Modifier.isTransient(field.getModifiers())) { + try { + field.setAccessible(true); + Object object1; + if ((object1 = field.get(object)) != null) { + module1.settings.add((Setting)object1); + } + } catch (IllegalAccessException illegalAccessException) { + Logger logger = OnyxClient.LOGGER; + Object[] objects = new Object[2]; + boolean bl = true; + objects[0] = field.getName(); + objects[1] = illegalAccessException; + logger.error("Failed to read setting field '{}'", objects); + } + } + } + } + } + + public EnumSetting getBindMode() { + return this.bindMode; + } + + public boolean isEnabled() { + return this.enabled; + } + + @Override + public boolean isToggled() { + return this.enabled; + } + + public void setEnabled(boolean bl) { + if (this.enabled != bl) { + this.toggle(); + } + } + + public Module(String string, String string1, ModuleCategory moduleCategory) { + this.bindMode = new EnumSetting<>("Bind Mode", ModuleState.TOGGLE); + this.settings = new ArrayList<>(); + this.enabled = false; + this.name = string; + this.description = string1; + this.moduleCategory = moduleCategoryx; + } + + public void toggle() { + UndoManager.L(null, this::toggle, this::toggle); + if (this.enabled) { + this.enabled = false; + this.refreshSettings(); + this.onDisable(); + OnyxClient.EVENT_BUS.unsubscribe(this); + } else { + this.enabled = true; + OnyxClient.EVENT_BUS.subscribe(this); + this.onEnable(); + this.refreshSettings(); + } + } + + public String getDescription() { + return this.description; + } + + public List getVisibleSettings() { + return this.settings.stream().filter(Setting::isVisible).toList(); + } + + public String getName() { + return this.name; + } + + public String getSuffix() { + return null; + } + + public void refreshSettings() { + Module module1 = this; + + for (Iterator iterator1 = iterator = module1.settings.iterator(); iterator1.hasNext(); iterator1 = iterator) { + ((Setting)iterator.next()).setActive(module1.enabled); + } + } + + public KeybindSetting getBind() { + return this.bind; + } + + public List getSettings() { + return this.settings; + } + + protected void onDisable() { + } + + public void attachSettings() { + Module module1 = this; + module1.bind.attach(module1, null); + module1.bindMode.attach(module1, null); + if (module1.i()) { + module1.bind.withBindMode(module1.bindMode); + } + + module1.settings.clear(); + module1.L(module1, Module.class); + module1.settings.sort(Comparator.comparingInt(Setting::getIndex)); + HashSet hashSet = new HashSet(); + + Iterator iterator; + for (Iterator iterator1 = iterator = module1.settings.iterator(); iterator1.hasNext(); iterator1 = iterator) { + Setting setting = (Setting)iterator.next(); + if (!hashSet.add(setting.getName())) { + Logger logger = OnyxClient.LOGGER; + Object[] objects = new Object[2]; + boolean bl = true; + objects[0] = setting.getName(); + objects[1] = module1.name; + logger.warn("Duplicate setting name '{}' in module '{}'", objects); + } + + setting.attach(module1, null); + } + } + + protected void onEnable() { + } +} diff --git a/src/openonyx/features/ModuleCategory.java b/src/openonyx/features/ModuleCategory.java new file mode 100644 index 0000000..3adb652 --- /dev/null +++ b/src/openonyx/features/ModuleCategory.java @@ -0,0 +1,37 @@ +package openonyx.features; + +import openonyx.history.DisplayNamed; + +public enum ModuleCategory implements DisplayNamed { + HUD("HUD"), + COMBAT("Combat"), + PLAYER("Player"), + RENDER("Render"), + MOVEMENT("Movement"); + + private final String e; + + @Override + public String getDisplayName() { + return this.e; + } + + public String d() { + return this.e; + } + + private static ModuleCategory[] L() { + ModuleCategory[] moduleCategorys = new ModuleCategory[5]; + boolean bl = true; + moduleCategorys[0] = COMBAT; + moduleCategorys[1] = MOVEMENT; + moduleCategorys[2] = PLAYER; + moduleCategorys[3] = RENDER; + moduleCategorys[4] = HUD; + return moduleCategorys; + } + + ModuleCategory(String string1) { + this.e = string1; + } +} diff --git a/src/openonyx/features/ModuleManager.java b/src/openonyx/features/ModuleManager.java new file mode 100644 index 0000000..2694b3e --- /dev/null +++ b/src/openonyx/features/ModuleManager.java @@ -0,0 +1,286 @@ +package openonyx.features; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import meteordevelopment.orbit.EventHandler; +import openonyx.configuration.internal.RunTickEvent; +import openonyx.core.MinecraftAccess; +import openonyx.features.combat.AntiBot; +import openonyx.features.combat.BedBreaker; +import openonyx.features.combat.BedDefender; +import openonyx.features.combat.JumpReset; +import openonyx.features.combat.KillAura; +import openonyx.features.combat.Velocity; +import openonyx.features.hud.ArrayListModule; +import openonyx.features.hud.CustomGui; +import openonyx.features.hud.DiscordRPC; +import openonyx.features.hud.Keybinds; +import openonyx.features.hud.Notifications; +import openonyx.features.hud.PotionHUD; +import openonyx.features.hud.TargetHUD; +import openonyx.features.hud.Watermark; +import openonyx.features.movement.AutoSprint; +import openonyx.features.movement.NoSlow; +import openonyx.features.movement.SafeWalk; +import openonyx.features.player.ChestStealer; +import openonyx.features.player.Deposit; +import openonyx.features.player.FastPlace; +import openonyx.features.player.InventoryManager; +import openonyx.features.player.NameChanger; +import openonyx.features.player.Scaffold; +import openonyx.features.render.Ambience; +import openonyx.features.render.Animations; +import openonyx.features.render.Arrows; +import openonyx.features.render.BedESP; +import openonyx.features.render.BlockOverlay; +import openonyx.features.render.Boxes; +import openonyx.features.render.Camera; +import openonyx.features.render.CapeChanger; +import openonyx.features.render.Chams; +import openonyx.features.render.ChinaHat; +import openonyx.features.render.ClickGUI; +import openonyx.features.render.ContainerESP; +import openonyx.features.render.Crosshair; +import openonyx.features.render.ESP; +import openonyx.features.render.FogBlur; +import openonyx.features.render.FogRemove; +import openonyx.features.render.Freelook; +import openonyx.features.render.Fullbright; +import openonyx.features.render.GlowESP; +import openonyx.features.render.Hand; +import openonyx.features.render.Hurtcam; +import openonyx.features.render.ItemPhysics; +import openonyx.features.render.JumpCircles; +import openonyx.features.render.NoRender; +import openonyx.features.render.ParticleLimiter; +import openonyx.features.render.Particles; +import openonyx.features.render.SeeInvisibles; +import openonyx.features.render.SkeletonESP; +import openonyx.features.render.SkinChanger; +import openonyx.features.render.Skybox; +import openonyx.features.render.TNTTimer; +import openonyx.features.render.TargetESP; +import openonyx.features.render.Trails; +import openonyx.features.render.Trajectories; +import openonyx.features.render.Wings; +import openonyx.features.render.Zoom; + +public class ModuleManager implements MinecraftAccess { + public Wings wings; + public BedDefender bedDefender; + public BlockOverlay blockOverlay; + public ParticleLimiter particleLimiter; + public FogBlur fogBlur; + public InventoryManager inventoryManager; + public BedESP bedESP; + public FastPlace fastPlace; + public SeeInvisibles seeInvisibles; + public Arrows arrows; + public ItemPhysics itemPhysics; + public ChinaHat chinaHat; + public JumpReset jumpReset; + public Camera camera; + public Freelook freelook; + public AutoSprint autoSprint; + public TargetESP z; + public ESP esp; + public Crosshair crosshair; + public Hurtcam hurtcam; + public CustomGui customGui; + public TNTTimer tntTimer; + public Watermark watermark; + public DiscordRPC x; + public KillAura killAura; + public Fullbright y; + public Scaffold scaffold; + public TargetHUD targetHUD; + public Skybox skybox; + public Zoom zoom; + public JumpCircles jumpCircles; + public SkeletonESP skeletonESP; + public SafeWalk safeWalk; + public Velocity velocity; + public Animations animations; + public ChestStealer chestStealer; + public AntiBot antiBot; + public GlowESP glowESP; + public ContainerESP containerESP; + public Trails trails; + public NoSlow noSlow; + public NameChanger nameChanger; + public ArrayListModule arrayListModule; + public Ambience ambience; + public CapeChanger capeChanger; + public Keybinds keybinds; + public FogRemove fogRemove; + public ClickGUI clickGUI; + public SkinChanger skinChanger; + public Trajectories trajectories; + public Boxes boxes; + public Deposit deposit; + public NoRender noRender; + public Particles particles; + public Notifications notifications; + public PotionHUD potionHUD; + public Hand hand; + private final ArrayList modules; + public Chams chams; + public BedBreaker bedBreaker; + private final Set modules2; + + public ModuleManager() { + ModuleManager moduleManager1 = this; + moduleManager1./* $VF: Unable to resugar constructor */(); + moduleManager1.clickGUI = new ClickGUI(); + moduleManager1.customGui = new CustomGui(); + moduleManager1.animations = new Animations(); + moduleManager1.esp = new ESP(); + moduleManager1.glowESP = new GlowESP(); + moduleManager1.z = new TargetESP(); + moduleManager1.particles = new Particles(); + moduleManager1.y = new Fullbright(); + moduleManager1.crosshair = new Crosshair(); + moduleManager1.containerESP = new ContainerESP(); + moduleManager1.tntTimer = new TNTTimer(); + moduleManager1.noRender = new NoRender(); + moduleManager1.particleLimiter = new ParticleLimiter(); + moduleManager1.fogRemove = new FogRemove(); + moduleManager1.itemPhysics = new ItemPhysics(); + moduleManager1.camera = new Camera(); + moduleManager1.zoom = new Zoom(); + moduleManager1.ambience = new Ambience(); + moduleManager1.skybox = new Skybox(); + moduleManager1.fogBlur = new FogBlur(); + moduleManager1.chams = new Chams(); + moduleManager1.boxes = new Boxes(); + moduleManager1.blockOverlay = new BlockOverlay(); + moduleManager1.wings = new Wings(); + moduleManager1.chinaHat = new ChinaHat(); + moduleManager1.trails = new Trails(); + moduleManager1.jumpCircles = new JumpCircles(); + moduleManager1.hand = new Hand(); + moduleManager1.autoSprint = new AutoSprint(); + moduleManager1.safeWalk = new SafeWalk(); + moduleManager1.noSlow = new NoSlow(); + moduleManager1.killAura = new KillAura(); + moduleManager1.antiBot = new AntiBot(); + moduleManager1.bedBreaker = new BedBreaker(); + moduleManager1.bedDefender = new BedDefender(); + moduleManager1.velocity = new Velocity(); + moduleManager1.jumpReset = new JumpReset(); + moduleManager1.scaffold = Scaffold.INSTANCE; + moduleManager1.nameChanger = new NameChanger(); + moduleManager1.skinChanger = new SkinChanger(); + moduleManager1.capeChanger = new CapeChanger(); + moduleManager1.fastPlace = new FastPlace(); + moduleManager1.deposit = Deposit.INSTANCE; + moduleManager1.inventoryManager = new InventoryManager(); + moduleManager1.chestStealer = new ChestStealer(); + moduleManager1.targetHUD = new TargetHUD(); + moduleManager1.keybinds = new Keybinds(); + moduleManager1.arrayListModule = new ArrayListModule(); + moduleManager1.watermark = new Watermark(); + moduleManager1.notifications = new Notifications(); + moduleManager1.potionHUD = new PotionHUD(); + moduleManager1.arrows = new Arrows(); + moduleManager1.bedESP = new BedESP(); + moduleManager1.skeletonESP = new SkeletonESP(); + moduleManager1.trajectories = new Trajectories(); + moduleManager1.seeInvisibles = new SeeInvisibles(); + moduleManager1.freelook = new Freelook(); + moduleManager1.hurtcam = new Hurtcam(); + moduleManager1.x = new DiscordRPC(); + moduleManager1.modules = new ArrayList<>(); + moduleManager1.modules2 = new HashSet<>(); + Field[] fields; + int i = (fields = moduleManager1.getClass().getDeclaredFields()).length; + + int j; + for (int k = j = 0; k < i; k = ++j) { + Field field = fields[j]; + if (Module.class.isAssignableFrom(field.getType())) { + try { + Module module = (Module)field.get(moduleManager1); + module.attachSettings(); + moduleManager1.modules.add(module); + } catch (IllegalAccessException illegalAccessException) { + illegalAccessException.printStackTrace(); + } + } + } + + moduleManager1.modules.sort(Comparator.comparing(Module::getName, String.CASE_INSENSITIVE_ORDER).thenComparing(Module::getName)); + } + + public ArrayList getModules(ModuleCategory moduleCategory) { + ModuleManager moduleManager1 = this; + ArrayList arrayList = new ArrayList(); + Iterator iterator = moduleManager1.modules.iterator(); + + while (iterator.hasNext()) { + Module module; + if ((module = (Module)iterator.next()).getModuleCategory() == moduleCategory) { + arrayList.add(module); + } + } + + return arrayList; + } + + @EventHandler + public void onRunTick(RunTickEvent runTickEvent) { + ModuleManager moduleManager1 = this; + boolean bl2 = mc.currentScreen != null; + Iterator iterator = moduleManager1.modules.iterator(); + + label67: + while (true) { + Iterator iterator1 = iterator; + + while (iterator1.hasNext()) { + Module module; + boolean bl = (module = (Module)iterator.next()).getBindMode().is(ModuleState.HOLD) && module.i(); + boolean bl1 = !bl2 && module.getBind().isBound() && module.getBind().isPressed(); + if (bl) { + if (bl1) { + iterator1 = iterator; + moduleManager1.modules2.add(module); + module.setEnabled(true); + } else { + if (!moduleManager1.modules2.remove(module)) { + continue label67; + } + + iterator1 = iterator; + module.setEnabled(false); + } + } else { + if (bl2) { + continue label67; + } + + if (module.getBind().isBound()) { + if (bl1 && moduleManager1.modules2.add(module)) { + module.toggle(); + } else if (!bl1) { + moduleManager1.modules2.remove(module); + } + continue label67; + } + + iterator1 = iterator; + } + } + + return; + } + } + + public ArrayList getModules() { + return this.modules; + } +} diff --git a/src/openonyx/features/ModuleState.java b/src/openonyx/features/ModuleState.java new file mode 100644 index 0000000..51f60bf --- /dev/null +++ b/src/openonyx/features/ModuleState.java @@ -0,0 +1,14 @@ +package openonyx.features; + +public enum ModuleState { + HOLD, + TOGGLE; + + private static ModuleState[] L() { + ModuleState[] moduleStates = new ModuleState[2]; + boolean bl = true; + moduleStates[0] = TOGGLE; + moduleStates[1] = HOLD; + return moduleStates; + } +}