mirror of
https://github.com/Miasmusa/Shadow.git
synced 2024-11-14 19:04:54 -05:00
Merge branch 'master' of https://github.com/Moles-LLC/Shadow
This commit is contained in:
commit
6ff38e60ac
16 changed files with 217 additions and 177 deletions
|
@ -5,6 +5,13 @@
|
|||
package net.shadow.client.feature.command.impl;
|
||||
|
||||
import net.shadow.client.feature.command.Command;
|
||||
import net.shadow.client.feature.module.AddonModule;
|
||||
import net.shadow.client.feature.module.Module;
|
||||
import net.shadow.client.feature.module.ModuleRegistry;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
|
||||
public class Test extends Command {
|
||||
public Test() {
|
||||
|
@ -13,6 +20,16 @@ public class Test extends Command {
|
|||
|
||||
@Override
|
||||
public void onExecute(String[] args) {
|
||||
success("jooj");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Module module : ModuleRegistry.getModules()) {
|
||||
if (module instanceof AddonModule) continue;
|
||||
String cname = module.getClass().getSimpleName();
|
||||
sb.append(String.format("registerModule(%s.class);", cname)).append("\n");
|
||||
}
|
||||
try {
|
||||
Files.writeString(new File("bruh.txt").toPath(), sb.toString(), StandardOpenOption.CREATE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.shadow.client.feature.config.BooleanSetting;
|
|||
import net.shadow.client.feature.config.DoubleSetting;
|
||||
import net.shadow.client.feature.config.ModuleConfig;
|
||||
import net.shadow.client.feature.gui.notifications.Notification;
|
||||
import net.shadow.client.helper.event.Events;
|
||||
import net.shadow.client.helper.util.Utils;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
@ -119,9 +120,11 @@ public abstract class Module {
|
|||
Notification.create(1000, "Module toggle", Notification.Type.INFO, (this.enabled ? "§aEn" : "§cDis") + "abled §r" + this.getName());
|
||||
}
|
||||
if (this.enabled) {
|
||||
Events.registerEventHandlerClass(this);
|
||||
this.enable();
|
||||
} else {
|
||||
this.disable();
|
||||
Events.unregisterEventHandlerClass(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ import net.shadow.client.feature.module.impl.misc.AdBlock;
|
|||
import net.shadow.client.feature.module.impl.misc.AdSpammer;
|
||||
import net.shadow.client.feature.module.impl.misc.AllowFormatCodes;
|
||||
import net.shadow.client.feature.module.impl.misc.AntiCrash;
|
||||
import net.shadow.client.feature.module.impl.misc.AntiOffhandCrash;
|
||||
import net.shadow.client.feature.module.impl.misc.AntiPacketKick;
|
||||
import net.shadow.client.feature.module.impl.misc.ClientSettings;
|
||||
import net.shadow.client.feature.module.impl.misc.DiscordRPC;
|
||||
|
@ -132,6 +133,7 @@ import net.shadow.client.feature.module.impl.world.SurvivalNuker;
|
|||
import net.shadow.client.feature.module.impl.world.XRAY;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
@ -179,14 +181,27 @@ public class ModuleRegistry {
|
|||
try {
|
||||
initInner();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerModule(Module module) {
|
||||
ShadowMain.log(Level.INFO, "Initialized " + module.getName());
|
||||
vanillaModules.add(module);
|
||||
private static void registerModule(Class<? extends Module> moduleClass) {
|
||||
Module instance = null;
|
||||
for (Constructor<?> declaredConstructor : moduleClass.getDeclaredConstructors()) {
|
||||
if (declaredConstructor.getParameterCount() != 0) {
|
||||
throw new IllegalArgumentException(moduleClass.getName() + " has invalid constructor: expected " + moduleClass.getName() + "(), got " + declaredConstructor);
|
||||
}
|
||||
try {
|
||||
instance = (Module) declaredConstructor.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Failed to make instance of " + moduleClass.getName(), e);
|
||||
}
|
||||
}
|
||||
if (instance == null) {
|
||||
throw new IllegalArgumentException("Failed to make instance of " + moduleClass.getName());
|
||||
}
|
||||
ShadowMain.log(Level.INFO, "Initialized " + instance.getName() + " via " + moduleClass.getName());
|
||||
vanillaModules.add(instance);
|
||||
}
|
||||
|
||||
private static void initInner() {
|
||||
|
@ -194,132 +209,130 @@ public class ModuleRegistry {
|
|||
initialized.set(true);
|
||||
vanillaModules.clear();
|
||||
|
||||
registerModule(new Flight());
|
||||
registerModule(new Sprint());
|
||||
registerModule(new Fullbright());
|
||||
registerModule(new Hud());
|
||||
registerModule(new TargetHud());
|
||||
//modules.add(new AntiOffhandCrash()); this should be under anticrash
|
||||
registerModule(new AntiPacketKick());
|
||||
registerModule(new AntiRDI());
|
||||
registerModule(new BoatPhase());
|
||||
registerModule(new BoatCrash());
|
||||
registerModule(new Boom());
|
||||
registerModule(new CaveMapper()); // its fun
|
||||
registerModule(new InstaBow());
|
||||
registerModule(new ChunkCrash());
|
||||
registerModule(new OffhandCrash());
|
||||
registerModule(new OOBCrash());
|
||||
registerModule(new Phase());
|
||||
registerModule(new VanillaSpoof());
|
||||
registerModule(new XRAY());
|
||||
registerModule(new Decimator());
|
||||
registerModule(new ClickGUI());
|
||||
registerModule(new TpRange());
|
||||
registerModule(new AnyPlacer());
|
||||
registerModule(new FireballDeflector()); // its a fucking utility client saturn
|
||||
registerModule(new ShulkerDeflector());
|
||||
registerModule(new CarpetBomb());
|
||||
//modules.add(new SkinChangeExploit()); litteral fucking joke module, to be re-written as personhider or whatever i named it (skinfuscator is a good name lol)
|
||||
registerModule(new AutoTrap());
|
||||
registerModule(new AutoTNT());
|
||||
//modules.add(new LetThereBeLight()); awful why?
|
||||
registerModule(new FakeHacker());
|
||||
registerModule(new NoFall());
|
||||
registerModule(new ESP());
|
||||
registerModule(new Tracers());
|
||||
registerModule(new Hyperspeed());
|
||||
registerModule(new AntiAnvil());
|
||||
registerModule(new Swing());
|
||||
registerModule(new AimAssist());
|
||||
registerModule(new Criticals());
|
||||
registerModule(new Killaura()); //TODO: add settings and shit
|
||||
registerModule(new Velocity());
|
||||
registerModule(new AntiAntiXray());
|
||||
registerModule(new PingSpoof());
|
||||
registerModule(new AutoAttack());
|
||||
registerModule(new MouseEars()); //i really wanna remove this one | dont
|
||||
registerModule(new Spinner());
|
||||
registerModule(new AllowFormatCodes());
|
||||
registerModule(new InfChatLength());
|
||||
registerModule(new NoTitles());
|
||||
registerModule(new PortalGUI());
|
||||
registerModule(new Timer());
|
||||
registerModule(new XCarry());
|
||||
registerModule(new AirJump()); //TODO: unshit
|
||||
registerModule(new AutoElytra());
|
||||
registerModule(new Blink());
|
||||
registerModule(new Boost());
|
||||
registerModule(new EdgeJump()); // UTILITY CLIENT
|
||||
registerModule(new EdgeSneak());
|
||||
registerModule(new EntityFly());
|
||||
registerModule(new IgnoreWorldBorder()); //i'll allow it | as you should
|
||||
registerModule(new InventoryWalk());
|
||||
registerModule(new Jesus());
|
||||
registerModule(new LongJump());
|
||||
registerModule(new MoonGravity());
|
||||
registerModule(new NoJumpCool());
|
||||
registerModule(new NoLevitation());
|
||||
registerModule(new NoPush());
|
||||
registerModule(new Step());
|
||||
registerModule(new Freecam());
|
||||
registerModule(new FreeLook());
|
||||
registerModule(new ItemByteSize()); // TO BE RE-WRITTEN AS TOOLTIPS | keep it in for now tho
|
||||
registerModule(new Zoom());
|
||||
registerModule(new AutoTool()); // WHY????? this is so useless | how?
|
||||
registerModule(new BlockTagViewer());
|
||||
registerModule(new Annihilator());
|
||||
registerModule(new FastUse());
|
||||
registerModule(new Flattener());
|
||||
registerModule(new GodBridge()); //TODO: add this as a mode to scaffold
|
||||
registerModule(new InstantBreak()); //TODO: unshit
|
||||
registerModule(new MassUse());
|
||||
registerModule(new NoBreakDelay());
|
||||
registerModule(new SurvivalNuker());
|
||||
registerModule(new Nuker());
|
||||
registerModule(new Scaffold());
|
||||
registerModule(new Test());
|
||||
registerModule(new BlocksMCFlight());
|
||||
registerModule(new NameTags());
|
||||
registerModule(new Trail());
|
||||
registerModule(new AdBlock());
|
||||
registerModule(new AutoLavacast());
|
||||
registerModule(new Backtrack());
|
||||
registerModule(new TabGui());
|
||||
registerModule(new Theme());
|
||||
registerModule(new AntiCrash());
|
||||
registerModule(new ClientSettings());
|
||||
registerModule(new NoLiquidFog());
|
||||
registerModule(new Spotlight());
|
||||
registerModule(new ShowTntPrime());
|
||||
registerModule(new ToolsScreen());
|
||||
registerModule(new BookInflaterCrash());
|
||||
registerModule(new BlockHighlighting());
|
||||
registerModule(new AutoIgnite());
|
||||
registerModule(new DiscordRPC());
|
||||
registerModule(new AirPlace());
|
||||
registerModule(new AdSpammer());
|
||||
registerModule(new AnimationCrash());
|
||||
registerModule(new AutoFireball());
|
||||
registerModule(new AutoFish());
|
||||
registerModule(new AutoRun());
|
||||
registerModule(new LecternCrash());
|
||||
registerModule(new MinehutCrash());
|
||||
registerModule(new ArmorStandCrash());
|
||||
registerModule(new LoominaCrash());
|
||||
registerModule(new Reach());
|
||||
registerModule(new Fling());
|
||||
registerModule(new AutoSign());
|
||||
registerModule(new SuperCrossbow());
|
||||
registerModule(new ReverseKnockback());
|
||||
registerModule(new Speed());
|
||||
registerModule(new BoatFling());
|
||||
registerModule(new FilterBypass());
|
||||
registerModule(new InteractCrash());
|
||||
registerModule(new FlightCrash());
|
||||
registerModule(new ClickTP());
|
||||
registerModule(new ChestHighlighter());
|
||||
registerModule(new MoreChatHistory());
|
||||
registerModule(Flight.class);
|
||||
registerModule(Sprint.class);
|
||||
registerModule(Fullbright.class);
|
||||
registerModule(Hud.class);
|
||||
registerModule(TargetHud.class);
|
||||
registerModule(AntiOffhandCrash.class);
|
||||
registerModule(AntiPacketKick.class);
|
||||
registerModule(AntiRDI.class);
|
||||
registerModule(BoatPhase.class);
|
||||
registerModule(BoatCrash.class);
|
||||
registerModule(Boom.class);
|
||||
registerModule(CaveMapper.class);
|
||||
registerModule(InstaBow.class);
|
||||
registerModule(ChunkCrash.class);
|
||||
registerModule(OffhandCrash.class);
|
||||
registerModule(OOBCrash.class);
|
||||
registerModule(Phase.class);
|
||||
registerModule(VanillaSpoof.class);
|
||||
registerModule(XRAY.class);
|
||||
registerModule(Decimator.class);
|
||||
registerModule(ClickGUI.class);
|
||||
registerModule(TpRange.class);
|
||||
registerModule(AnyPlacer.class);
|
||||
registerModule(FireballDeflector.class);
|
||||
registerModule(ShulkerDeflector.class);
|
||||
registerModule(CarpetBomb.class);
|
||||
registerModule(AutoTrap.class);
|
||||
registerModule(AutoTNT.class);
|
||||
registerModule(FakeHacker.class);
|
||||
registerModule(NoFall.class);
|
||||
registerModule(ESP.class);
|
||||
registerModule(Tracers.class);
|
||||
registerModule(Hyperspeed.class);
|
||||
registerModule(AntiAnvil.class);
|
||||
registerModule(Swing.class);
|
||||
registerModule(AimAssist.class);
|
||||
registerModule(Criticals.class);
|
||||
registerModule(Killaura.class);
|
||||
registerModule(Velocity.class);
|
||||
registerModule(AntiAntiXray.class);
|
||||
registerModule(PingSpoof.class);
|
||||
registerModule(AutoAttack.class);
|
||||
registerModule(MouseEars.class);
|
||||
registerModule(Spinner.class);
|
||||
registerModule(AllowFormatCodes.class);
|
||||
registerModule(InfChatLength.class);
|
||||
registerModule(NoTitles.class);
|
||||
registerModule(PortalGUI.class);
|
||||
registerModule(Timer.class);
|
||||
registerModule(XCarry.class);
|
||||
registerModule(AirJump.class);
|
||||
registerModule(AutoElytra.class);
|
||||
registerModule(Blink.class);
|
||||
registerModule(Boost.class);
|
||||
registerModule(EdgeJump.class);
|
||||
registerModule(EdgeSneak.class);
|
||||
registerModule(EntityFly.class);
|
||||
registerModule(IgnoreWorldBorder.class);
|
||||
registerModule(InventoryWalk.class);
|
||||
registerModule(Jesus.class);
|
||||
registerModule(LongJump.class);
|
||||
registerModule(MoonGravity.class);
|
||||
registerModule(NoJumpCool.class);
|
||||
registerModule(NoLevitation.class);
|
||||
registerModule(NoPush.class);
|
||||
registerModule(Step.class);
|
||||
registerModule(Freecam.class);
|
||||
registerModule(FreeLook.class);
|
||||
registerModule(ItemByteSize.class);
|
||||
registerModule(Zoom.class);
|
||||
registerModule(AutoTool.class);
|
||||
registerModule(BlockTagViewer.class);
|
||||
registerModule(Annihilator.class);
|
||||
registerModule(FastUse.class);
|
||||
registerModule(Flattener.class);
|
||||
registerModule(GodBridge.class);
|
||||
registerModule(InstantBreak.class);
|
||||
registerModule(MassUse.class);
|
||||
registerModule(NoBreakDelay.class);
|
||||
registerModule(SurvivalNuker.class);
|
||||
registerModule(Nuker.class);
|
||||
registerModule(Scaffold.class);
|
||||
registerModule(Test.class);
|
||||
registerModule(BlocksMCFlight.class);
|
||||
registerModule(NameTags.class);
|
||||
registerModule(Trail.class);
|
||||
registerModule(AdBlock.class);
|
||||
registerModule(AutoLavacast.class);
|
||||
registerModule(Backtrack.class);
|
||||
registerModule(TabGui.class);
|
||||
registerModule(Theme.class);
|
||||
registerModule(AntiCrash.class);
|
||||
registerModule(ClientSettings.class);
|
||||
registerModule(NoLiquidFog.class);
|
||||
registerModule(Spotlight.class);
|
||||
registerModule(ShowTntPrime.class);
|
||||
registerModule(ToolsScreen.class);
|
||||
registerModule(BookInflaterCrash.class);
|
||||
registerModule(BlockHighlighting.class);
|
||||
registerModule(AutoIgnite.class);
|
||||
registerModule(DiscordRPC.class);
|
||||
registerModule(AirPlace.class);
|
||||
registerModule(AdSpammer.class);
|
||||
registerModule(AnimationCrash.class);
|
||||
registerModule(AutoFireball.class);
|
||||
registerModule(AutoFish.class);
|
||||
registerModule(AutoRun.class);
|
||||
registerModule(LecternCrash.class);
|
||||
registerModule(MinehutCrash.class);
|
||||
registerModule(ArmorStandCrash.class);
|
||||
registerModule(LoominaCrash.class);
|
||||
registerModule(Reach.class);
|
||||
registerModule(Fling.class);
|
||||
registerModule(AutoSign.class);
|
||||
registerModule(SuperCrossbow.class);
|
||||
registerModule(ReverseKnockback.class);
|
||||
registerModule(Speed.class);
|
||||
registerModule(BoatFling.class);
|
||||
registerModule(FilterBypass.class);
|
||||
registerModule(InteractCrash.class);
|
||||
registerModule(FlightCrash.class);
|
||||
registerModule(ClickTP.class);
|
||||
registerModule(ChestHighlighter.class);
|
||||
registerModule(MoreChatHistory.class);
|
||||
|
||||
rebuildSharedModuleList();
|
||||
}
|
||||
|
@ -328,13 +341,21 @@ public class ModuleRegistry {
|
|||
if (!initialized.get()) {
|
||||
init();
|
||||
}
|
||||
awaitLockOpen();
|
||||
return sharedModuleList;
|
||||
}
|
||||
|
||||
private static void awaitLockOpen() {
|
||||
while (reloadInProgress.get()) {
|
||||
Thread.onSpinWait();
|
||||
if (reloadInProgress.get()) {
|
||||
ShadowMain.log(Level.INFO, "Locking for some time for reload to complete");
|
||||
long lockStart = System.currentTimeMillis();
|
||||
long lockStartns = System.nanoTime();
|
||||
while (reloadInProgress.get()) {
|
||||
Thread.onSpinWait();
|
||||
}
|
||||
ShadowMain.log(Level.INFO, "Lock opened within " + (System.currentTimeMillis() - lockStart) + " ms (" + (System.nanoTime() - lockStartns) + " ns)");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.shadow.client.feature.module.Module;
|
|||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.helper.event.EventListener;
|
||||
import net.shadow.client.helper.event.EventType;
|
||||
import net.shadow.client.helper.event.Events;
|
||||
import net.shadow.client.helper.event.events.PacketEvent;
|
||||
import net.shadow.client.helper.util.Utils;
|
||||
|
||||
|
@ -29,7 +28,7 @@ public class Fling extends Module {
|
|||
|
||||
public Fling() {
|
||||
super("Fling", "Fling players in the air", ModuleType.COMBAT);
|
||||
Events.registerEventHandlerClass(this);
|
||||
// Events.registerEventHandlerClass(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.shadow.client.feature.module.Module;
|
|||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.helper.event.EventListener;
|
||||
import net.shadow.client.helper.event.EventType;
|
||||
import net.shadow.client.helper.event.Events;
|
||||
import net.shadow.client.helper.event.events.PacketEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -25,7 +24,7 @@ public class ReverseKnockback extends Module {
|
|||
|
||||
public ReverseKnockback() {
|
||||
super("ReverseKnockback", "Reverse the knockback you deal", ModuleType.MISC);
|
||||
Events.registerEventHandlerClass(this);
|
||||
// Events.registerEventHandlerClass(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.shadow.client.feature.module.Module;
|
|||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.helper.event.EventListener;
|
||||
import net.shadow.client.helper.event.EventType;
|
||||
import net.shadow.client.helper.event.Events;
|
||||
import net.shadow.client.helper.event.events.PacketEvent;
|
||||
import net.shadow.client.helper.util.Utils;
|
||||
|
||||
|
@ -29,7 +28,7 @@ public class FlightCrash extends Module {
|
|||
|
||||
public FlightCrash() {
|
||||
super("FlightCrash", "Generates a ton of chunks", ModuleType.CRASH);
|
||||
Events.registerEventHandlerClass(this);
|
||||
// Events.registerEventHandlerClass(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,6 @@ import net.shadow.client.feature.module.Module;
|
|||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.helper.event.EventListener;
|
||||
import net.shadow.client.helper.event.EventType;
|
||||
import net.shadow.client.helper.event.Events;
|
||||
import net.shadow.client.helper.event.events.PacketEvent;
|
||||
|
||||
public class InteractCrash extends Module {
|
||||
|
@ -29,7 +28,7 @@ public class InteractCrash extends Module {
|
|||
|
||||
public InteractCrash() {
|
||||
super("InteractCrash", "Crash using interaction packets", ModuleType.CRASH);
|
||||
Events.registerEventHandlerClass(this);
|
||||
// Events.registerEventHandlerClass(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,6 @@ import net.shadow.client.feature.module.Module;
|
|||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.helper.event.EventListener;
|
||||
import net.shadow.client.helper.event.EventType;
|
||||
import net.shadow.client.helper.event.Events;
|
||||
import net.shadow.client.helper.event.events.PacketEvent;
|
||||
|
||||
public class FilterBypass extends Module {
|
||||
|
@ -19,7 +18,7 @@ public class FilterBypass extends Module {
|
|||
|
||||
public FilterBypass() {
|
||||
super("FilterBypass", "Bypass chat filters", ModuleType.EXPLOIT);
|
||||
Events.registerEventHandlerClass(this);
|
||||
// Events.registerEventHandlerClass(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,18 +39,17 @@ public class FilterBypass extends Module {
|
|||
return null;
|
||||
}
|
||||
|
||||
@EventListener(type = EventType.PACKET_RECEIVE)
|
||||
void onRecievePacket(PacketEvent event) {
|
||||
if (!this.isEnabled()) return;
|
||||
@EventListener(type = EventType.PACKET_SEND)
|
||||
void onSendPacket(PacketEvent event) {
|
||||
// if (!this.isEnabled()) return;
|
||||
if (!blockPackets) return;
|
||||
if (event.getPacket() instanceof ChatMessageC2SPacket packet) {
|
||||
event.setCancelled(true);
|
||||
String message = packet.getChatMessage();
|
||||
if (message.startsWith("/") || message.startsWith(">")) {
|
||||
if (message.startsWith("/")) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
StringBuilder rvmsg = new StringBuilder(message).reverse();
|
||||
String msgout = rvmsg.toString();
|
||||
String msgformatted = "\u202E " + rvmsg;
|
||||
blockPackets = false;
|
||||
client.player.networkHandler.sendPacket(new ChatMessageC2SPacket(msgformatted));
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.shadow.client.feature.module.Module;
|
|||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.helper.event.EventListener;
|
||||
import net.shadow.client.helper.event.EventType;
|
||||
import net.shadow.client.helper.event.Events;
|
||||
import net.shadow.client.helper.event.events.BlockRenderingEvent;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
import net.shadow.client.helper.util.Utils;
|
||||
|
@ -26,7 +25,7 @@ public class Test extends Module {
|
|||
|
||||
public Test() {
|
||||
super("Test", "Testing stuff with the client, can be ignored", ModuleType.MISC);
|
||||
Events.registerEventHandlerClass(this);
|
||||
// Events.registerEventHandlerClass(this);
|
||||
}
|
||||
|
||||
@EventListener(type = EventType.BLOCK_RENDER)
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.shadow.client.feature.module.Module;
|
|||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.helper.event.EventListener;
|
||||
import net.shadow.client.helper.event.EventType;
|
||||
import net.shadow.client.helper.event.Events;
|
||||
import net.shadow.client.helper.event.events.MouseEvent;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
import net.shadow.client.helper.util.Utils;
|
||||
|
@ -31,7 +30,7 @@ public class ClickTP extends Module {
|
|||
|
||||
public ClickTP() {
|
||||
super("ClickTP", "Teleport somewhere you clicked to", ModuleType.MOVEMENT);
|
||||
Events.registerEventHandlerClass(this);
|
||||
// Events.registerEventHandlerClass(this);
|
||||
}
|
||||
|
||||
private static int lengthTo(BlockPos p) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.shadow.client.feature.module.Module;
|
|||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.helper.event.EventListener;
|
||||
import net.shadow.client.helper.event.EventType;
|
||||
import net.shadow.client.helper.event.Events;
|
||||
import net.shadow.client.helper.event.events.BlockEntityRenderEvent;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
|
||||
|
@ -26,7 +25,7 @@ public class ChestHighlighter extends Module {
|
|||
|
||||
public ChestHighlighter() {
|
||||
super("ChestHighlighter", "No description", ModuleType.RENDER);
|
||||
Events.registerEventHandlerClass(this);
|
||||
// Events.registerEventHandlerClass(this);
|
||||
}
|
||||
|
||||
void addIfNotExisting(BlockPos p) {
|
||||
|
|
|
@ -52,12 +52,6 @@ public class NameTags extends Module {
|
|||
}
|
||||
}
|
||||
|
||||
GameMode getGamemode(AbstractClientPlayerEntity p) {
|
||||
PlayerListEntry ple = client.getNetworkHandler().getPlayerListEntry(p.getUuid());
|
||||
if (ple == null) return null;
|
||||
return ple.getGameMode();
|
||||
}
|
||||
|
||||
void drawInternal(Vec3d screenPos, String text, AbstractClientPlayerEntity entity) {
|
||||
FontAdapter nameDrawer = FontRenderers.getRenderer();
|
||||
FontAdapter infoDrawer = FontRenderers.getCustomSize(12);
|
||||
|
@ -111,7 +105,7 @@ public class NameTags extends Module {
|
|||
@Override
|
||||
public void onWorldRender(MatrixStack matrices) {
|
||||
// sort the entire thing based on the most distant to the least distant because thats how rendering works
|
||||
for (AbstractClientPlayerEntity player : client.world.getPlayers().stream().sorted(Comparator.comparingDouble(value -> -value.getPos().distanceTo(client.gameRenderer.getCamera().getPos()))).toList()) {
|
||||
for (AbstractClientPlayerEntity player : client.world.getPlayers().stream().sorted(Comparator.comparingDouble(value -> -value.getPos().distanceTo(client.gameRenderer.getCamera().getPos()))).filter(abstractClientPlayerEntity -> !abstractClientPlayerEntity.equals(client.player)).toList()) {
|
||||
// String t = player.getEntityName();
|
||||
render(matrices, player, player.getName());
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.apache.logging.log4j.Level;
|
|||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
@ -21,8 +22,12 @@ public class Events {
|
|||
static final List<ListenerEntry> entries = new CopyOnWriteArrayList<>();
|
||||
|
||||
public static ListenerEntry registerEventHandler(int uniqueId, EventType event, Consumer<? extends Event> handler) {
|
||||
return registerEventHandler(uniqueId, event, handler, Events.class);
|
||||
}
|
||||
|
||||
public static ListenerEntry registerEventHandler(int uniqueId, EventType event, Consumer<? extends Event> handler, Class<?> owner) {
|
||||
if (entries.stream().noneMatch(listenerEntry -> listenerEntry.id == uniqueId)) {
|
||||
ListenerEntry le = new ListenerEntry(uniqueId, event, handler);
|
||||
ListenerEntry le = new ListenerEntry(uniqueId, event, handler, owner);
|
||||
entries.add(le);
|
||||
return le;
|
||||
} else {
|
||||
|
@ -39,6 +44,15 @@ public class Events {
|
|||
return registerEventHandler((int) Math.floor(Math.random() * 0xFFFFFF), event, handler);
|
||||
}
|
||||
|
||||
public static void unregisterEventHandlerClass(Object instance) {
|
||||
for (ListenerEntry entry : new ArrayList<>(entries)) {
|
||||
if (entry.owner.equals(instance.getClass())) {
|
||||
ShadowMain.log(Level.INFO, "Unregistering " + entry.type + ":" + entry.id);
|
||||
entries.remove(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerEventHandlerClass(Object instance) {
|
||||
for (Method declaredMethod : instance.getClass().getDeclaredMethods()) {
|
||||
for (Annotation declaredAnnotation : declaredMethod.getDeclaredAnnotations()) {
|
||||
|
@ -56,11 +70,9 @@ public class Events {
|
|||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}, instance.getClass());
|
||||
ShadowMain.log(Level.INFO, "Registered event handler " + declaredMethod + " with id " + l.id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,14 +80,17 @@ public class Events {
|
|||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static boolean fireEvent(EventType event, Event argument) {
|
||||
for (ListenerEntry entry : entries) {
|
||||
if (entry.type == event) {
|
||||
((Consumer) entry.eventListener()).accept(argument);
|
||||
}
|
||||
List<ListenerEntry> le = entries.stream().filter(listenerEntry -> listenerEntry.type == event).toList();
|
||||
if (le.size() == 0) {
|
||||
// ShadowMain.log(Level.INFO, "no one cares about "+event+" so we're gonna skip it");
|
||||
return false;
|
||||
}
|
||||
for (ListenerEntry entry : le) {
|
||||
((Consumer) entry.eventListener()).accept(argument);
|
||||
}
|
||||
return argument.isCancelled();
|
||||
}
|
||||
|
||||
record ListenerEntry(int id, EventType type, Consumer<? extends Event> eventListener) {
|
||||
record ListenerEntry(int id, EventType type, Consumer<? extends Event> eventListener, Class<?> owner) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class GameRendererMixin {
|
|||
}
|
||||
}
|
||||
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;raycast(DFZ)Lnet/minecraft/util/hit/HitResult;"), method = "updateTargetedEntity", require=0)
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;raycast(DFZ)Lnet/minecraft/util/hit/HitResult;"), method = "updateTargetedEntity", require = 0)
|
||||
HitResult replaceFreelookHitResult(Entity instance, double maxDistance, float tickDelta, boolean includeFluids) {
|
||||
if (ModuleRegistry.getByClass(FreeLook.class).isEnabled()) {
|
||||
Vec3d vec3d = instance.getCameraPosVec(tickDelta);
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
Port all the items
|
||||
Fix automated crash reports
|
||||
Sus
|
||||
Fixed compat issues
|
||||
Fixed race condition crash on startup
|
||||
|
|
|
@ -1 +1 @@
|
|||
19
|
||||
20
|
Loading…
Reference in a new issue