diff --git a/build.gradle b/build.gradle index 46235628..ad410cae 100644 --- a/build.gradle +++ b/build.gradle @@ -64,9 +64,6 @@ dependencies { libImpl("io.netty:netty-handler-proxy:${project.netty_version}") { transitive = false } libImpl("io.netty:netty-codec-socks:${project.netty_version}") { transitive = false } - - compileOnlyApi("org.apiguardian:apiguardian-api:1.1.2") - configurations.libImpl.dependencies.each { implementation(it) } diff --git a/src/main/java/thunder/hack/ThunderHack.java b/src/main/java/thunder/hack/ThunderHack.java index 50d5022e..88202afe 100644 --- a/src/main/java/thunder/hack/ThunderHack.java +++ b/src/main/java/thunder/hack/ThunderHack.java @@ -5,11 +5,9 @@ import meteordevelopment.orbit.IEventBus; import net.fabricmc.api.ModInitializer; import net.fabricmc.loader.api.FabricLoader; -import net.fabricmc.loader.api.entrypoint.EntrypointContainer; import net.fabricmc.loader.api.metadata.ModMetadata; import net.minecraft.client.MinecraftClient; import net.minecraft.util.math.BlockPos; -import thunder.hack.api.IAddon; import thunder.hack.core.Core; import thunder.hack.core.impl.*; import thunder.hack.utility.ThunderUtility; @@ -21,28 +19,29 @@ import java.lang.invoke.MethodHandles; import java.net.URL; import java.nio.charset.StandardCharsets; -import java.util.Objects; public class ThunderHack implements ModInitializer { public static final ModMetadata MOD_META; + public static final String MOD_ID = "thunderhack"; public static final String VERSION = "1.6b305"; public static String GITH_HASH = "0"; public static String BUILD_DATE = "1 Jan 1970"; - public static final IEventBus EVENT_BUS = new EventBus(); - public static MinecraftClient mc; + public static final boolean baritone = FabricLoader.getInstance().isModLoaded("baritone") || FabricLoader.getInstance().isModLoaded("baritone-meteor"); + public static final IEventBus EVENT_BUS = new EventBus(); + public static String[] contributors = new String[32]; + public static Color copy_color = new Color(-1); + public static KeyListening currentKeyListener; public static boolean isOutdated = false; - public static float TICK_TIMER = 1f; public static BlockPos gps_position; - public static Color copy_color = new Color(-1); + public static float TICK_TIMER = 1f; + public static MinecraftClient mc; public static long initTime; - public static KeyListening currentKeyListener; - public static String[] contributors = new String[16]; - public static final boolean baritone = FabricLoader.getInstance().isModLoaded("baritone") || FabricLoader.getInstance().isModLoaded("baritone-meteor"); + /*----------------- Managers ---------------------*/ public static NotificationManager notificationManager = new NotificationManager(); @@ -55,6 +54,7 @@ public class ThunderHack implements ModInitializer { public static CombatManager combatManager = new CombatManager(); public static ConfigManager configManager = new ConfigManager(); public static ShaderManager shaderManager = new ShaderManager(); + public static AddonManager addonManager = new AddonManager(); public static AsyncManager asyncManager = new AsyncManager(); public static MacroManager macroManager = new MacroManager(); public static SoundManager soundManager = new SoundManager(); @@ -65,18 +65,18 @@ public class ThunderHack implements ModInitializer { /*--------------------------------------------------------*/ static { - MOD_META = FabricLoader.getInstance() - .getModContainer(MOD_ID) - .orElseThrow() - .getMetadata(); + MOD_META = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow().getMetadata(); } - @Override public void onInitialize() { mc = MinecraftClient.getInstance(); initTime = System.currentTimeMillis(); + BUILD_DATE = ThunderUtility.readManifestField("Build-Timestamp"); + GITH_HASH = ThunderUtility.readManifestField("Git-Commit"); + ThunderUtility.syncVersion(); + EVENT_BUS.registerLambdaFactory("thunder.hack", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup())); EVENT_BUS.subscribe(notificationManager); @@ -87,107 +87,25 @@ public void onInitialize() { EVENT_BUS.subscribe(telemetryManager); EVENT_BUS.subscribe(core); - FriendManager.loadFriends(); - - LogUtils.getLogger().info("Starting addon initialization."); - - for (EntrypointContainer entrypoint : FabricLoader.getInstance().getEntrypointContainers("thunderhack", IAddon.class)) { - IAddon addon = entrypoint.getEntrypoint(); - - try { - LogUtils.getLogger().info("Initializing addon: " + addon.getClass().getName()); - LogUtils.getLogger().debug("Addon class loader: " + addon.getClass().getClassLoader()); - addon.onInitialize(); - LogUtils.getLogger().info("Addon initialized successfully: " + addon.getClass().getName()); - - AddonManager.incrementAddonCount(); - LogUtils.getLogger().debug("Addon count incremented."); - - AddonManager.addAddon(addon); - LogUtils.getLogger().debug("Addon added to manager."); - EVENT_BUS.registerLambdaFactory(addon.getPackage(), (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup())); - - // Register Modules - addon.getModules().stream().filter(Objects::nonNull).forEach(module -> { - try { - LogUtils.getLogger().info("Registering module: " + module.getClass().getName()); - LogUtils.getLogger().debug("Module class loader: " + module.getClass().getClassLoader()); - moduleManager.registerModule(module); - LogUtils.getLogger().info("Module registered successfully: " + module.getClass().getName()); - } catch (Exception e) { - LogUtils.getLogger().error("Error registering module: " + module.getClass().getName(), e); - } - }); - - // Register Commands - addon.getCommands().stream().filter(Objects::nonNull).forEach(command -> { - try { - LogUtils.getLogger().info("Registering command: " + command.getClass().getName()); - LogUtils.getLogger().debug("Command class loader: " + command.getClass().getClassLoader()); - commandManager.registerCommand(command); - LogUtils.getLogger().info("Command registered successfully: " + command.getClass().getName()); - } catch (Exception e) { - LogUtils.getLogger().error("Error registering command: " + command.getClass().getName(), e); - } - }); - - // Register HUD Elements - addon.getHudElements().stream().filter(Objects::nonNull).forEach(hudElement -> { - try { - LogUtils.getLogger().info("Registering HUD element: " + hudElement.getClass().getName()); - LogUtils.getLogger().debug("HUD element class loader: " + hudElement.getClass().getClassLoader()); - moduleManager.registerHudElement(hudElement); - LogUtils.getLogger().info("HUD element registered successfully: " + hudElement.getClass().getName()); - } catch (Exception e) { - LogUtils.getLogger().error("Error registering HUD element: " + hudElement.getClass().getName(), e); - } - }); - - } catch (Exception e) { - LogUtils.getLogger().error("Error initializing addon: " + addon.getClass().getName(), e); - } - } - - LogUtils.getLogger().info("Addon initialization complete."); - + addonManager.initAddons(); configManager.load(configManager.getCurrentConfig()); moduleManager.onLoad("none"); - - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - if (ModuleManager.unHook.isEnabled()) - ModuleManager.unHook.disable(); - FriendManager.saveFriends(); - configManager.save(configManager.getCurrentConfig()); - wayPointManager.saveWayPoints(); - macroManager.saveMacro(); - proxyManager.saveProxies(); - for (IAddon addon : AddonManager.getAddons()) { - try { - addon.onShutdown(); - } catch (Exception e) { - LogUtils.getLogger().error("Error running addon onShutdown method: " + addon.getClass().getName(), e); - } - } - })); - + friendManager.loadFriends(); macroManager.onLoad(); wayPointManager.onLoad(); proxyManager.onLoad(); Render2DEngine.initShaders(); - BUILD_DATE = ThunderUtility.readManifestField("Build-Timestamp"); - GITH_HASH = ThunderUtility.readManifestField("Git-Commit"); - soundManager.registerSounds(); - // TODO Move to dedicated Thread - syncVersion(); - syncContributors(); - ThunderUtility.parseStarGazer(); - ThunderUtility.parseCommits(); - ModuleManager.rpc.startRpc(); + asyncManager.run(() -> { + ThunderUtility.syncContributors(); + ThunderUtility.parseStarGazer(); + ThunderUtility.parseCommits(); + telemetryManager.fetchData(); + }); - telemetryManager.fetchData(); + ModuleManager.rpc.startRpc(); LogUtils.getLogger().info(""" \n /$$$$$$$$ /$$ /$$ /$$ /$$ /$$ \s @@ -202,30 +120,17 @@ public void onInitialize() { LogUtils.getLogger().info("[ThunderHack] Init time: " + (System.currentTimeMillis() - initTime) + " ms."); initTime = System.currentTimeMillis(); - } - public static void syncVersion() { - try { - if (!new BufferedReader(new InputStreamReader(new URL("https://raw.githubusercontent.com/Pan4ur/THRecodeUtil/main/syncVersionBeta.txt").openStream())).readLine().equals(VERSION)) - isOutdated = true; - } catch (Exception ignored) { - } - } + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + if (ModuleManager.unHook.isEnabled()) ModuleManager.unHook.disable(); - public static void syncContributors() { - try { - URL list = new URL("https://raw.githubusercontent.com/Pan4ur/THRecodeUtil/main/thTeam.txt"); - BufferedReader in = new BufferedReader(new InputStreamReader(list.openStream(), StandardCharsets.UTF_8)); - String inputLine; - int i = 0; - while ((inputLine = in.readLine()) != null) { - contributors[i] = inputLine.trim(); - i++; - } - in.close(); - } catch (Exception e) { - e.printStackTrace(); - } + friendManager.saveFriends(); + configManager.save(configManager.getCurrentConfig()); + wayPointManager.saveWayPoints(); + macroManager.saveMacro(); + proxyManager.saveProxies(); + addonManager.shutDown(); + })); } public static boolean isFuturePresent() { @@ -233,11 +138,6 @@ public static boolean isFuturePresent() { } public enum KeyListening { - ThunderGui, - ClickGui, - Search, - Sliders, - Strings + ThunderGui, ClickGui, Search, Sliders, Strings } -} - +} \ No newline at end of file diff --git a/src/main/java/thunder/hack/cmd/impl/AddonsCommand.java b/src/main/java/thunder/hack/cmd/impl/AddonsCommand.java index e6cdf44e..77f56a69 100644 --- a/src/main/java/thunder/hack/cmd/impl/AddonsCommand.java +++ b/src/main/java/thunder/hack/cmd/impl/AddonsCommand.java @@ -2,6 +2,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.minecraft.command.CommandSource; +import thunder.hack.ThunderHack; import thunder.hack.api.IAddon; import thunder.hack.cmd.Command; import thunder.hack.core.impl.AddonManager; @@ -20,10 +21,10 @@ public AddonsCommand() { @Override public void executeBuild(LiteralArgumentBuilder builder) { builder.executes(context -> { - List sortedAddons = AddonManager.getAddons().stream() + List sortedAddons = ThunderHack.addonManager.getAddons().stream() .filter(Objects::nonNull) .sorted(Comparator.comparing(IAddon::getName)) - .collect(Collectors.toList()); + .toList(); if (sortedAddons.isEmpty()) { sendMessage("No addons installed."); diff --git a/src/main/java/thunder/hack/cmd/impl/GamemodeCommand.java b/src/main/java/thunder/hack/cmd/impl/GamemodeCommand.java new file mode 100644 index 00000000..b44f303e --- /dev/null +++ b/src/main/java/thunder/hack/cmd/impl/GamemodeCommand.java @@ -0,0 +1,36 @@ +package thunder.hack.cmd.impl; + +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import net.minecraft.command.CommandSource; +import net.minecraft.world.GameMode; +import thunder.hack.cmd.Command; + +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; + +public class GamemodeCommand extends Command { + public GamemodeCommand() { + super("gamemode", "gm"); + } + + @Override + public void executeBuild(LiteralArgumentBuilder builder) { + + builder.then(arg("mode", StringArgumentType.greedyString()).executes(context -> { + final String mode = context.getArgument("mode", String.class); + + switch (mode) { + case "survival", "0": + mc.interactionManager.setGameMode(GameMode.SURVIVAL); + case "creative", "1": + mc.interactionManager.setGameMode(GameMode.CREATIVE); + case "spectator", "2": + mc.interactionManager.setGameMode(GameMode.SPECTATOR); + case "adventure", "3": + mc.interactionManager.setGameMode(GameMode.ADVENTURE); + } + + return SINGLE_SUCCESS; + })); + } +} diff --git a/src/main/java/thunder/hack/core/Core.java b/src/main/java/thunder/hack/core/Core.java index 949e3a76..2ff476bc 100644 --- a/src/main/java/thunder/hack/core/Core.java +++ b/src/main/java/thunder/hack/core/Core.java @@ -83,7 +83,7 @@ public void onTick(PlayerUpdateEvent event) { }); if(autoSave.every(600000)) { - FriendManager.saveFriends(); + ThunderHack.friendManager.saveFriends(); ThunderHack.configManager.save(ThunderHack.configManager.getCurrentConfig()); ThunderHack.wayPointManager.saveWayPoints(); ThunderHack.macroManager.saveMacro(); @@ -142,7 +142,7 @@ public void onPacketReceive(PacketEvent.Receive e) { setBackTimer.reset(); if(autoSave.every(200000)) { - FriendManager.saveFriends(); + ThunderHack.friendManager.saveFriends(); ThunderHack.configManager.save(ThunderHack.configManager.getCurrentConfig()); ThunderHack.wayPointManager.saveWayPoints(); ThunderHack.macroManager.saveMacro(); diff --git a/src/main/java/thunder/hack/core/impl/AddonManager.java b/src/main/java/thunder/hack/core/impl/AddonManager.java index 75144735..c33269f0 100644 --- a/src/main/java/thunder/hack/core/impl/AddonManager.java +++ b/src/main/java/thunder/hack/core/impl/AddonManager.java @@ -1,28 +1,107 @@ package thunder.hack.core.impl; +import com.mojang.logging.LogUtils; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.entrypoint.EntrypointContainer; +import thunder.hack.ThunderHack; import thunder.hack.api.IAddon; import thunder.hack.core.IManager; +import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.List; +import java.util.Objects; public class AddonManager implements IManager { - private static int totalAddons = 0; - private static final List addons = new ArrayList<>(); + private int totalAddons = 0; + private final List addons = new ArrayList<>(); - public static void incrementAddonCount() { + public void incrementAddonCount() { totalAddons++; } - public static int getTotalAddons() { + public int getTotalAddons() { return totalAddons; } - public static void addAddon(IAddon addon) { + public void addAddon(IAddon addon) { addons.add(addon); } - public static List getAddons() { + public List getAddons() { return addons; } + + public void initAddons() { + LogUtils.getLogger().info("Starting addon initialization."); + + for (EntrypointContainer entrypoint : FabricLoader.getInstance().getEntrypointContainers("thunderhack", IAddon.class)) { + IAddon addon = entrypoint.getEntrypoint(); + + try { + LogUtils.getLogger().info("Initializing addon: " + addon.getClass().getName()); + LogUtils.getLogger().debug("Addon class loader: " + addon.getClass().getClassLoader()); + addon.onInitialize(); + LogUtils.getLogger().info("Addon initialized successfully: " + addon.getClass().getName()); + + incrementAddonCount(); + LogUtils.getLogger().debug("Addon count incremented."); + + addAddon(addon); + LogUtils.getLogger().debug("Addon added to manager."); + ThunderHack.EVENT_BUS.registerLambdaFactory(addon.getPackage(), (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup())); + + // Register Modules + addon.getModules().stream().filter(Objects::nonNull).forEach(module -> { + try { + LogUtils.getLogger().info("Registering module: " + module.getClass().getName()); + LogUtils.getLogger().debug("Module class loader: " + module.getClass().getClassLoader()); + ThunderHack.moduleManager.registerModule(module); + LogUtils.getLogger().info("Module registered successfully: " + module.getClass().getName()); + } catch (Exception e) { + LogUtils.getLogger().error("Error registering module: " + module.getClass().getName(), e); + } + }); + + // Register Commands + addon.getCommands().stream().filter(Objects::nonNull).forEach(command -> { + try { + LogUtils.getLogger().info("Registering command: " + command.getClass().getName()); + LogUtils.getLogger().debug("Command class loader: " + command.getClass().getClassLoader()); + ThunderHack.commandManager.registerCommand(command); + LogUtils.getLogger().info("Command registered successfully: " + command.getClass().getName()); + } catch (Exception e) { + LogUtils.getLogger().error("Error registering command: " + command.getClass().getName(), e); + } + }); + + // Register HUD Elements + addon.getHudElements().stream().filter(Objects::nonNull).forEach(hudElement -> { + try { + LogUtils.getLogger().info("Registering HUD element: " + hudElement.getClass().getName()); + LogUtils.getLogger().debug("HUD element class loader: " + hudElement.getClass().getClassLoader()); + ThunderHack.moduleManager.registerHudElement(hudElement); + LogUtils.getLogger().info("HUD element registered successfully: " + hudElement.getClass().getName()); + } catch (Exception e) { + LogUtils.getLogger().error("Error registering HUD element: " + hudElement.getClass().getName(), e); + } + }); + + } catch (Exception e) { + LogUtils.getLogger().error("Error initializing addon: " + addon.getClass().getName(), e); + } + } + + LogUtils.getLogger().info("Addon initialization complete."); + } + + public void shutDown() { + for (IAddon addon : getAddons()) { + try { + addon.onShutdown(); + } catch (Exception e) { + LogUtils.getLogger().error("Error running addon onShutdown method: " + addon.getClass().getName(), e); + } + } + } } \ No newline at end of file diff --git a/src/main/java/thunder/hack/core/impl/CommandManager.java b/src/main/java/thunder/hack/core/impl/CommandManager.java index c3b26c9f..0d8249ce 100644 --- a/src/main/java/thunder/hack/core/impl/CommandManager.java +++ b/src/main/java/thunder/hack/core/impl/CommandManager.java @@ -6,11 +6,9 @@ import net.minecraft.command.CommandSource; import net.minecraft.util.Formatting; import org.jetbrains.annotations.NotNull; -import thunder.hack.ThunderHack; import thunder.hack.cmd.Command; import thunder.hack.cmd.impl.*; import thunder.hack.core.IManager; -import thunder.hack.modules.Module; import java.util.ArrayList; import java.util.List; @@ -23,39 +21,40 @@ public class CommandManager implements IManager { private final List commands = new ArrayList<>(); public CommandManager() { - add(new HorseSpeedCommand()); add(new RpcCommand()); add(new KitCommand()); add(new GpsCommand()); add(new CfgCommand()); + add(new RctCommand()); add(new BindCommand()); add(new DrawCommand()); add(new HelpCommand()); add(new NukerCommand()); add(new EClipCommand()); - add(new RctCommand()); add(new HClipCommand()); add(new LoginCommand()); add(new MacroCommand()); add(new StaffCommand()); add(new VClipCommand()); + add(new AddonsCommand()); add(new GetNbtCommand()); add(new FriendCommand()); add(new ModuleCommand()); add(new PrefixCommand()); - add(new BlockESPCommand()); add(new TrackerCommand()); + add(new GamemodeCommand()); add(new DropAllCommand()); add(new TreasureCommand()); add(new WayPointCommand()); add(new TabParseCommand()); + add(new BlockESPCommand()); + add(new HorseSpeedCommand()); add(new OpenFolderCommand()); add(new ResetBindsCommand()); add(new InvCleanerCommand()); + add(new GotoWaypointCommand()); add(new ChestStealerCommand()); add(new GarbageCleanerCommand()); - add(new GotoWaypointCommand()); - add(new AddonsCommand()); } private void add(@NotNull Command command) { diff --git a/src/main/java/thunder/hack/core/impl/FriendManager.java b/src/main/java/thunder/hack/core/impl/FriendManager.java index 22060ed1..d63dac6e 100644 --- a/src/main/java/thunder/hack/core/impl/FriendManager.java +++ b/src/main/java/thunder/hack/core/impl/FriendManager.java @@ -46,7 +46,7 @@ public List getNearFriends() { } @SuppressWarnings("ResultOfMethodCallIgnored") - public static void saveFriends() { + public void saveFriends() { File file = new File(ConfigManager.CONFIG_FOLDER_NAME + "/misc/friends.txt"); try { file.createNewFile(); @@ -60,7 +60,7 @@ public static void saveFriends() { } } - public static void loadFriends() { + public void loadFriends() { try { File file = new File(ConfigManager.CONFIG_FOLDER_NAME + "/misc/friends.txt"); diff --git a/src/main/java/thunder/hack/core/impl/ModuleManager.java b/src/main/java/thunder/hack/core/impl/ModuleManager.java index 7439a8fa..e8501ea9 100644 --- a/src/main/java/thunder/hack/core/impl/ModuleManager.java +++ b/src/main/java/thunder/hack/core/impl/ModuleManager.java @@ -35,6 +35,7 @@ public class ModuleManager implements IManager { public static InventoryCleaner inventoryCleaner = new InventoryCleaner(); public static NoCommentExploit noCommentExploit = new NoCommentExploit(); public static NoWaterCollision noWaterCollision = new NoWaterCollision(); + public static BaritoneSettings baritoneSettings = new BaritoneSettings(); public static PortalInventory portalInventory = new PortalInventory(); public static TotemPopCounter totemPopCounter = new TotemPopCounter(); public static HotbarReplenish hotbarReplenish = new HotbarReplenish(); @@ -65,6 +66,7 @@ public class ModuleManager implements IManager { public static AntiServerAdd antiServerAdd = new AntiServerAdd(); public static AntiLegitMiss antiLegitMiss = new AntiLegitMiss(); public static AntiBallPlace antiBallPlace = new AntiBallPlace(); + public static TridentBoost tridentBoost = new TridentBoost(); public static Trajectories trajectories = new Trajectories(); public static TargetStrafe targetStrafe = new TargetStrafe(); public static RadarRewrite radarRewrite = new RadarRewrite(); @@ -81,6 +83,7 @@ public class ModuleManager implements IManager { public static TotemCounter totemCounter = new TotemCounter(); public static PerfectDelay perfectDelay = new PerfectDelay(); public static ChestCounter chestCounter = new ChestCounter(); + public static UnfocusedCPU unfocusedCPU = new UnfocusedCPU(); public static StashLogger stashLogger = new StashLogger(); public static FastLatency fastLatency = new FastLatency(); public static PearlChaser pearlChaser = new PearlChaser(); @@ -158,8 +161,6 @@ public class ModuleManager implements IManager { public static MemoryHud memoryHud = new MemoryHud(); public static Companion companion = new Companion(); public static AntiCrash antiCrash = new AntiCrash(); - public static UnfocusedCPU unfocusedCPU = new UnfocusedCPU(); - public static BaritoneSettings baritoneSettings = new BaritoneSettings(); public static AutoGear autoGear = new AutoGear(); public static ViewLock viewLock = new ViewLock(); public static Velocity velocity = new Velocity(); @@ -193,6 +194,7 @@ public class ModuleManager implements IManager { public static AutoWalk autoWalk = new AutoWalk(); public static AutoSign autoSign = new AutoSign(); public static BlockESP blockESP = new BlockESP(); + public static SafeWalk safeWalk = new SafeWalk(); public static Windows windows = new Windows(); public static Breaker breaker = new Breaker(); public static AutoEat autoEat = new AutoEat(); @@ -260,7 +262,6 @@ public class ModuleManager implements IManager { public static FOV fov = new FOV(); public static ESP esp = new ESP(); public static RPC rpc = new RPC(); - public static SafeWalk safeWalk = new SafeWalk(); public ModuleManager() { for (Field field : getClass().getDeclaredFields()) { diff --git a/src/main/java/thunder/hack/core/impl/ProxyManager.java b/src/main/java/thunder/hack/core/impl/ProxyManager.java index 3441e492..85a40b02 100644 --- a/src/main/java/thunder/hack/core/impl/ProxyManager.java +++ b/src/main/java/thunder/hack/core/impl/ProxyManager.java @@ -1,18 +1,27 @@ package thunder.hack.core.impl; import com.mojang.logging.LogUtils; -import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; +import io.netty.bootstrap.Bootstrap; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioSocketChannel; +import io.netty.handler.flow.FlowControlHandler; +import io.netty.handler.proxy.Socks5ProxyHandler; +import io.netty.handler.timeout.ReadTimeoutHandler; +import net.minecraft.network.handler.NetworkStateTransitions; import thunder.hack.core.IManager; import java.io.*; import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.URI; -import java.net.http.HttpRequest; import java.util.ArrayList; import java.util.List; import java.util.Objects; + public class ProxyManager implements IManager { private final List proxies = new ArrayList<>(); @@ -69,8 +78,7 @@ public void onLoad() { ThProxy proxy = new ProxyManager.ThProxy(name, ip, p, login, password); addProxy(proxy); - if (Objects.equals(active, "true")) - setActiveProxy(proxy); + if (Objects.equals(active, "true")) setActiveProxy(proxy); } } } @@ -93,9 +101,57 @@ public void saveProxies() { } } + public void checkPing(ThProxy proxy) { + long now = System.currentTimeMillis(); + proxy.setPing(-2); + new Thread(() -> { + try { + NioEventLoopGroup group = new NioEventLoopGroup(); + + Bootstrap bootstrap = new Bootstrap(); + bootstrap.group(group) + .channel(NioSocketChannel.class) + .handler(new ChannelInitializer() { + @Override + protected void initChannel(SocketChannel ch) { + ch.pipeline().addLast(new FlowControlHandler()) + .addLast("timeout_proxy_checker", new ReadTimeoutHandler(8)) + .addLast("inbound_proxy_checker", new NetworkStateTransitions.InboundConfigurer()) + .addLast("outbound_proxy_checker", new NetworkStateTransitions.OutboundConfigurer()) + .addLast(new Socks5ProxyHandler(new InetSocketAddress(proxy.getIp(), proxy.getPort()), proxy.getL(), proxy.getP())) + .addLast(new ProxyHandler()); + } + }); + + ChannelFuture future = bootstrap.connect("mcfunny.su", 25565).sync(); + future.await(); + if (future.isSuccess()) proxy.setPing((int) (System.currentTimeMillis() - now)); + else proxy.setPing(-1); + + group.shutdownGracefully(); + } catch (Exception e) { + proxy.setPing(-1); + } + }).start(); + } + + private static class ProxyHandler extends ChannelInboundHandlerAdapter { + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + super.channelRead(ctx, msg); + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + System.err.println("Exception caught: " + cause.getMessage()); + cause.printStackTrace(); + ctx.close(); + } + } + public static class ThProxy { private String name, ip, l, p; - private int port; + private int port, ping; public ThProxy(String name, String ip, int port, String l, String p) { this.ip = ip; @@ -137,12 +193,20 @@ public void setP(String p) { this.p = p; } + public void setPort(int port) { + this.port = port; + } + public int getPort() { return port; } - public void setPort(int port) { - this.port = port; + public void setPing(int ping) { + this.ping = ping; + } + + public int getPing() { + return ping; } } } diff --git a/src/main/java/thunder/hack/events/impl/UseTridentEvent.java b/src/main/java/thunder/hack/events/impl/UseTridentEvent.java new file mode 100644 index 00000000..07745347 --- /dev/null +++ b/src/main/java/thunder/hack/events/impl/UseTridentEvent.java @@ -0,0 +1,6 @@ +package thunder.hack.events.impl; + +import thunder.hack.events.Event; + +public class UseTridentEvent extends Event { +} diff --git a/src/main/java/thunder/hack/gui/clickui/Category.java b/src/main/java/thunder/hack/gui/clickui/Category.java index 152a94ef..d18d7051 100644 --- a/src/main/java/thunder/hack/gui/clickui/Category.java +++ b/src/main/java/thunder/hack/gui/clickui/Category.java @@ -5,10 +5,12 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.*; import net.minecraft.util.Identifier; +import thunder.hack.ThunderHack; import thunder.hack.core.impl.ModuleManager; import thunder.hack.gui.clickui.impl.SearchBar; import thunder.hack.gui.font.FontRenderers; import thunder.hack.modules.Module; +import thunder.hack.modules.client.BaritoneSettings; import thunder.hack.modules.client.ClickGui; import thunder.hack.modules.client.HudEditor; import thunder.hack.utility.render.Render2DEngine; @@ -29,11 +31,15 @@ public class Category extends AbstractCategory { public Category(Module.Category category, ArrayList features, float x, float y, float width, float height) { super(category.getName(), x, y, width, height); buttons = new ArrayList<>(); - ICON = new Identifier("thunderhack", "textures/gui/headers/" + - (Module.Category.isCustomCategory(category) ? "stock" : category.getName().toLowerCase()) + ".png"); + ICON = new Identifier("thunderhack", "textures/gui/headers/" + (Module.Category.isCustomCategory(category) ? "stock" : category.getName().toLowerCase()) + ".png"); + if (category.getName().equals("Client")) buttons.add(new SearchBar()); - features.forEach(feature -> buttons.add(new ModuleButton(feature))); + + features.forEach(feature -> { + if (!(feature instanceof BaritoneSettings) || ThunderHack.baritone) + buttons.add(new ModuleButton(feature)); + }); } @Override diff --git a/src/main/java/thunder/hack/gui/clickui/ModuleButton.java b/src/main/java/thunder/hack/gui/clickui/ModuleButton.java index 6d8e7a97..f52e2432 100644 --- a/src/main/java/thunder/hack/gui/clickui/ModuleButton.java +++ b/src/main/java/thunder/hack/gui/clickui/ModuleButton.java @@ -6,7 +6,6 @@ import net.minecraft.client.resource.language.I18n; import net.minecraft.client.util.InputUtil; import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; import net.minecraft.util.math.RotationAxis; import org.jetbrains.annotations.NotNull; import org.lwjgl.glfw.GLFW; @@ -30,7 +29,6 @@ import java.awt.*; import java.util.ArrayList; import java.util.List; -import java.util.Objects; import static thunder.hack.modules.Module.mc; import static thunder.hack.modules.client.ClientSettings.isRu; @@ -292,7 +290,8 @@ public void mouseClicked(int mouseX, int mouseY, int button) { } if (button == 0) { - module.toggle(); + if (module.isToggleable()) + module.toggle(); } else if (button == 1 && (module.getSettings().size() > 3)) { setOpen(!isOpen()); diff --git a/src/main/java/thunder/hack/gui/font/FontRenderers.java b/src/main/java/thunder/hack/gui/font/FontRenderers.java index 1914dd95..848616d8 100644 --- a/src/main/java/thunder/hack/gui/font/FontRenderers.java +++ b/src/main/java/thunder/hack/gui/font/FontRenderers.java @@ -26,10 +26,6 @@ public class FontRenderers { public static FontRenderer minecraft; public static FontRenderer profont; - public static FontRenderer getSettingsRenderer() { - return settings; - } - public static FontRenderer getModulesRenderer() { return modules; } diff --git a/src/main/java/thunder/hack/gui/mainmenu/MainMenuScreen.java b/src/main/java/thunder/hack/gui/mainmenu/MainMenuScreen.java index 2d0c07e4..f2d90ba7 100644 --- a/src/main/java/thunder/hack/gui/mainmenu/MainMenuScreen.java +++ b/src/main/java/thunder/hack/gui/mainmenu/MainMenuScreen.java @@ -129,7 +129,7 @@ public void render(@NotNull DrawContext context, int mouseX, int mouseY, float d offsetY += 10; } - int totalAddonsLoaded = AddonManager.getTotalAddons(); + int totalAddonsLoaded = ThunderHack.addonManager.getTotalAddons(); String addonsText = "Addons Loaded: " + totalAddonsLoaded; int screenWidth = mc.getWindow().getScaledWidth(); int textWidth = (int) FontRenderers.sf_bold.getStringWidth(addonsText); @@ -137,7 +137,7 @@ public void render(@NotNull DrawContext context, int mouseX, int mouseY, float d FontRenderers.sf_bold.drawString(context.getMatrices(), addonsText, textX, 5, Color.WHITE.getRGB()); int offset = 0; - for (IAddon addon : AddonManager.getAddons()) { + for (IAddon addon : ThunderHack.addonManager.getAddons()) { // for (String addon : Arrays.asList("Addon", "Addon2", "Addon3", "Addon4", "Addon5")) { textWidth = (int) FontRenderers.sf_bold.getStringWidth(addon.getName() + " |"); textX = screenWidth - textWidth - 5; diff --git a/src/main/java/thunder/hack/gui/windows/impl/ProxyWindow.java b/src/main/java/thunder/hack/gui/windows/impl/ProxyWindow.java index 7ed2fbde..f905a644 100644 --- a/src/main/java/thunder/hack/gui/windows/impl/ProxyWindow.java +++ b/src/main/java/thunder/hack/gui/windows/impl/ProxyWindow.java @@ -3,6 +3,7 @@ import com.google.common.collect.Lists; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.InputUtil; +import net.minecraft.util.Formatting; import net.minecraft.util.StringHelper; import org.lwjgl.glfw.GLFW; import thunder.hack.ThunderHack; @@ -34,6 +35,7 @@ public class ProxyWindow extends WindowBase { private ListeningType listeningType; private String search = "Search", addIp = "Ip", addPort = "Port", addPassword = "Password", addLogin = "Login", addName = "Name"; + private String[] pinging = new String[]{".", "..", "..."}; private enum ListeningType { Name, Ip, Port, Login, Password @@ -79,7 +81,7 @@ public void render(DrawContext context, int mouseX, int mouseY) { float posXWidth = getWidth() / 5f; float portX = ipX + posXWidth + 2; - float posYWidth = getWidth() / 6.5f; + float posYWidth = getWidth() / 12f; float posZX = portX + posYWidth + 2; float posZWidth = getWidth() / 6.5f; @@ -87,7 +89,6 @@ public void render(DrawContext context, int mouseX, int mouseY) { float serverX = posZX + posZWidth + 2; float serverWidth = getWidth() / 6f; - { boolean hover2 = Render2DEngine.isHovered(mouseX, mouseY, nameX, getY() + 19, nameWidth, 11); Render2DEngine.drawRectWithOutline(context.getMatrices(), nameX, getY() + 19, nameWidth, 11, hover2 ? hoveredColor : color, color2); @@ -154,7 +155,7 @@ public void render(DrawContext context, int mouseX, int mouseY) { boolean hover5 = Render2DEngine.isHovered(mouseX, mouseY, posZX, getY() + 36 + getScrollOffset() + proxyPlate.offset, posZWidth, 11); Render2DEngine.drawRectWithOutline(context.getMatrices(), posZX, getY() + 36 + getScrollOffset() + proxyPlate.offset, posZWidth, 11, hover5 ? hoveredColor : color, color2); - FontRenderers.sf_medium.drawString(context.getMatrices(), hover5 ? (proxyPlate.proxy.getL() + (listeningId == proxyPlate.id && listeningType == ListeningType.Login ? blink : "")) : "*******" + FontRenderers.sf_medium.drawString(context.getMatrices(), hover5 ? (proxyPlate.proxy.getL() + (listeningId == proxyPlate.id && listeningType == ListeningType.Login ? blink : "")) : "*******" , posZX + 2, getY() + 40 + getScrollOffset() + proxyPlate.offset, new Color(0xBDBDBD).getRGB()); boolean hover6 = Render2DEngine.isHovered(mouseX, mouseY, serverX, getY() + 36 + getScrollOffset() + proxyPlate.offset, serverWidth, 11); @@ -167,11 +168,15 @@ public void render(DrawContext context, int mouseX, int mouseY) { FontRenderers.icons.drawString(context.getMatrices(), "w", getX() + getWidth() - 15, proxyPlate.offset + getY() + 40 + getScrollOffset(), -1); FontRenderers.sf_medium_mini.drawString(context.getMatrices(), id + ".", getX() + 3, getY() + 41 + getScrollOffset() + proxyPlate.offset, textColor); - boolean selected = ThunderHack.proxyManager.getActiveProxy() == proxyPlate.proxy; boolean hover9 = Render2DEngine.isHovered(mouseX, mouseY, getX() + getWidth() - 28, getY() + 36 + getScrollOffset() + proxyPlate.offset, 11, 11); Render2DEngine.drawRectWithOutline(context.getMatrices(), getX() + getWidth() - 28, getY() + 36 + getScrollOffset() + proxyPlate.offset, 11, 11, hover9 ? hoveredColor : color, color2); - FontRenderers.icons.drawString(context.getMatrices(), selected? "i" : "k", getX() + getWidth() - 26, proxyPlate.offset + getY() + 41 + getScrollOffset(), selected ? -1 : Color.GRAY.getRGB()); + FontRenderers.icons.drawString(context.getMatrices(), selected ? "i" : "k", getX() + getWidth() - 26, proxyPlate.offset + getY() + 41 + getScrollOffset(), selected ? -1 : Color.GRAY.getRGB()); + + boolean hover10 = Render2DEngine.isHovered(mouseX, mouseY, getX() + getWidth() - 51.5f, getY() + 36 + getScrollOffset() + proxyPlate.offset, 21.5f, 11); + String ping = proxyPlate.proxy.getPing() <= 0 ? proxyPlate.proxy.getPing() == -1 ? Formatting.RED + "shit" : proxyPlate.proxy.getPing() == -2 ? pinging[(int) (System.currentTimeMillis() / 200 % 3)] : "check" : proxyPlate.proxy.getPing() + "ms"; + Render2DEngine.drawRectWithOutline(context.getMatrices(), getX() + getWidth() - 51.5f, getY() + 36 + getScrollOffset() + proxyPlate.offset, 21.5f, 11, hover10 ? hoveredColor : color, color2); + FontRenderers.sf_medium_mini.drawCenteredString(context.getMatrices(), ping, getX() + getWidth() - 41, proxyPlate.offset + getY() + 40 + getScrollOffset(), hover10 ? -1 : Color.GRAY.getRGB()); } setMaxElementsHeight(proxyPlates.size() * 20); Render2DEngine.popWindow(); @@ -195,7 +200,7 @@ public void mouseClicked(double mouseX, double mouseY, int button) { float posXWidth = getWidth() / 5f; float posYX = posXX + posXWidth + 2; - float posYWidth = getWidth() / 6.5f; + float posYWidth = getWidth() / 12f; float posZX = posYX + posYWidth + 2; float posZWidth = getWidth() / 6.5f; @@ -260,6 +265,7 @@ public void mouseClicked(double mouseX, double mouseY, int button) { boolean hoveringPassword = Render2DEngine.isHovered(mouseX, mouseY, serverX, getY() + 36 + getScrollOffset() + proxyPlate.offset, serverWidth, 11); boolean hoveringRemove = Render2DEngine.isHovered(mouseX, mouseY, getX() + getWidth() - 15, getY() + 36 + getScrollOffset() + proxyPlate.offset, 11, 11); boolean hoveringSelect = Render2DEngine.isHovered(mouseX, mouseY, getX() + getWidth() - 28, getY() + 36 + getScrollOffset() + proxyPlate.offset, 11, 11); + boolean hoveringCheck = Render2DEngine.isHovered(mouseX, mouseY, getX() + getWidth() - 51.5f, getY() + 36 + getScrollOffset() + proxyPlate.offset, 21.5f, 11); if (hoveringName) listeningType = ListeningType.Name; @@ -276,6 +282,9 @@ public void mouseClicked(double mouseX, double mouseY, int button) { if (hoveringPassword) listeningType = ListeningType.Password; + if (hoveringCheck) + ThunderHack.proxyManager.checkPing(proxyPlate.proxy()); + if (hoveringName || hoveringIp || hoveringPort || hoveringLogin || hoveringPassword) listeningId = proxyPlate.id; diff --git a/src/main/java/thunder/hack/injection/MixinHeldItemRenderer.java b/src/main/java/thunder/hack/injection/MixinHeldItemRenderer.java index 08bad08f..7f60c5de 100644 --- a/src/main/java/thunder/hack/injection/MixinHeldItemRenderer.java +++ b/src/main/java/thunder/hack/injection/MixinHeldItemRenderer.java @@ -1,5 +1,6 @@ package thunder.hack.injection; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.HeldItemRenderer; @@ -27,13 +28,19 @@ @Mixin(HeldItemRenderer.class) public abstract class MixinHeldItemRenderer { - @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V"), cancellable = true) + @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) private void onRenderItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { if(Module.fullNullCheck()) return; EventHeldItemRenderer event = new EventHeldItemRenderer(hand, item, equipProgress, matrices); ThunderHack.EVENT_BUS.post(event); } + @Inject(method = "renderFirstPersonItem", at = @At(value = "RETURN")) + private void onRenderItemPost(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { + if (ModuleManager.chams.isEnabled() && ModuleManager.chams.handItems.getValue()) + RenderSystem.setShaderColor(1f,1f,1f,1f); + } + @Inject(method = "renderFirstPersonItem", at = @At(value = "HEAD"), cancellable = true) private void onRenderItemHook(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { if (ThunderHack.moduleManager != null && ModuleManager.animations.shouldAnimate() && !(item.isEmpty()) && !(item.getItem() instanceof FilledMapItem)) { diff --git a/src/main/java/thunder/hack/injection/MixinTridentItem.java b/src/main/java/thunder/hack/injection/MixinTridentItem.java new file mode 100644 index 00000000..25301ac9 --- /dev/null +++ b/src/main/java/thunder/hack/injection/MixinTridentItem.java @@ -0,0 +1,42 @@ +package thunder.hack.injection; + +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.TridentItem; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import thunder.hack.ThunderHack; +import thunder.hack.core.impl.ModuleManager; +import thunder.hack.events.impl.UseTridentEvent; + +import static thunder.hack.ThunderHack.mc; + +@Mixin(TridentItem.class) +public class MixinTridentItem { + @Inject(method = "onStoppedUsing", at = @At(value = "HEAD"), cancellable = true) + public void onStoppedUsingHook(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfo ci) { + if (user == mc.player && EnchantmentHelper.getRiptide(stack) > 0) { + UseTridentEvent e = new UseTridentEvent(); + ThunderHack.EVENT_BUS.post(e); + if (e.isCancelled()) + ci.cancel(); + } + } + + @Inject(method = "use", at = @At(value = "HEAD"), cancellable = true) + public void useHook(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable> cir) { + ItemStack itemStack = user.getStackInHand(hand); + if (EnchantmentHelper.getRiptide(itemStack) > 0 && !user.isTouchingWaterOrRain() && ModuleManager.tridentBoost.isEnabled() && ModuleManager.tridentBoost.anyWeather.getValue()) { + user.setCurrentHand(hand); + cir.setReturnValue(TypedActionResult.consume(itemStack)); + } + } +} diff --git a/src/main/java/thunder/hack/modules/Module.java b/src/main/java/thunder/hack/modules/Module.java index eb554205..9dd2a514 100644 --- a/src/main/java/thunder/hack/modules/Module.java +++ b/src/main/java/thunder/hack/modules/Module.java @@ -46,13 +46,6 @@ public abstract class Module { "HudEditor" ); - private final List ignoredModules = Arrays.asList( - "ClickGui", - "ClientSettings", - "Rotations", - "BaritoneSettings" - ); - public static final MinecraftClient mc = MinecraftClient.getInstance(); public Module(@NotNull String name, @NotNull Category category) { @@ -86,6 +79,10 @@ public void onRender3D(MatrixStack event) { public void onUnload() { } + public boolean isToggleable() { + return true; + } + protected void sendPacket(Packet packet) { if (mc.getNetworkHandler() == null) return; @@ -134,11 +131,6 @@ public void enable() { if (isOn()) ThunderHack.EVENT_BUS.subscribe(this); if (fullNullCheck()) return; - if (ignoredModules.contains(getDisplayName())) { - enabled.setValue(false); - return; - } - LogUtils.getLogger().info("[ThunderHack] enabled " + this.getName()); ThunderHack.moduleManager.sortModules(); @@ -166,7 +158,6 @@ public void disable() { ThunderHack.moduleManager.sortModules(); if (fullNullCheck()) return; - if (ignoredModules.contains(getDisplayName())) enabled.setValue(false); onDisable(); diff --git a/src/main/java/thunder/hack/modules/client/BaritoneSettings.java b/src/main/java/thunder/hack/modules/client/BaritoneSettings.java index dd37539f..3aa8a786 100644 --- a/src/main/java/thunder/hack/modules/client/BaritoneSettings.java +++ b/src/main/java/thunder/hack/modules/client/BaritoneSettings.java @@ -31,4 +31,9 @@ public void onSettingChange(EventSetting e){ BaritoneAPI.getSettings().chatDebug.value = debug.getValue(); BaritoneAPI.getSettings().enterPortal.value = enterPortal.getValue(); } + + @Override + public boolean isToggleable() { + return false; + } } \ No newline at end of file diff --git a/src/main/java/thunder/hack/modules/client/ClientSettings.java b/src/main/java/thunder/hack/modules/client/ClientSettings.java index 13fc2129..3082860b 100644 --- a/src/main/java/thunder/hack/modules/client/ClientSettings.java +++ b/src/main/java/thunder/hack/modules/client/ClientSettings.java @@ -35,4 +35,9 @@ public ClientSettings() { public static boolean isRu() { return language.is(Language.RU); } + + @Override + public boolean isToggleable() { + return false; + } } diff --git a/src/main/java/thunder/hack/modules/client/HudEditor.java b/src/main/java/thunder/hack/modules/client/HudEditor.java index 5fcf02d4..e6d186dc 100644 --- a/src/main/java/thunder/hack/modules/client/HudEditor.java +++ b/src/main/java/thunder/hack/modules/client/HudEditor.java @@ -21,7 +21,7 @@ public final class HudEditor extends Module { public static final Setting textColor = new Setting<>("TextColor", new ColorSetting(new Color(0xFFFFFFFF, true).getRGB())); public static final Setting textColor2 = new Setting<>("TextColor2", new ColorSetting(new Color(0xFFFFFFFF, true).getRGB())); public static final Setting blurColor = new Setting<>("BlurColor", new ColorSetting(new Color(0xFF000E25, true).getRGB())); - public static final Setting hudRound = new Setting<>("HudRound", 6f, 1f, 10f); + public static final Setting hudRound = new Setting<>("HudRound", 4f, 1f, 7f); public static final Setting alpha = new Setting<>("Alpha", 0.9f, 0f, 1f); public static final Setting blend = new Setting<>("Blend", 10f, 1f, 15f); public static final Setting outline = new Setting<>("Outline", 0.5f, 0f, 2.5f); diff --git a/src/main/java/thunder/hack/modules/client/Rotations.java b/src/main/java/thunder/hack/modules/client/Rotations.java index be7334ff..bb78a00b 100644 --- a/src/main/java/thunder/hack/modules/client/Rotations.java +++ b/src/main/java/thunder/hack/modules/client/Rotations.java @@ -78,4 +78,9 @@ private Vec3d fix(float yaw, Vec3d movementInput, float speed) { float g = MathHelper.cos(yaw * MathHelper.RADIANS_PER_DEGREE); return new Vec3d(vec3d.x * (double) g - vec3d.z * (double) f, vec3d.y, vec3d.z * (double) g + vec3d.x * (double) f); } + + @Override + public boolean isToggleable() { + return false; + } } diff --git a/src/main/java/thunder/hack/modules/combat/Aura.java b/src/main/java/thunder/hack/modules/combat/Aura.java index 2888d496..0d1ab5a4 100644 --- a/src/main/java/thunder/hack/modules/combat/Aura.java +++ b/src/main/java/thunder/hack/modules/combat/Aura.java @@ -272,14 +272,14 @@ private void enableSprint() { } public void resolvePlayers() { - if (resolver.getValue() != Resolver.Off) + if (resolver.not(Resolver.Off)) for (PlayerEntity player : mc.world.getPlayers()) if (player instanceof OtherClientPlayerEntity) ((IOtherClientPlayerEntity) player).resolve(resolver.getValue()); } public void restorePlayers() { - if (resolver.getValue() != Resolver.Off) + if (resolver.not(Resolver.Off)) for (PlayerEntity player : mc.world.getPlayers()) if (player instanceof OtherClientPlayerEntity) ((IOtherClientPlayerEntity) player).releaseResolver(); diff --git a/src/main/java/thunder/hack/modules/combat/AutoCrystal.java b/src/main/java/thunder/hack/modules/combat/AutoCrystal.java index 841818f9..50f41d9d 100644 --- a/src/main/java/thunder/hack/modules/combat/AutoCrystal.java +++ b/src/main/java/thunder/hack/modules/combat/AutoCrystal.java @@ -129,9 +129,9 @@ public class AutoCrystal extends Module { private final Setting swingMode = new Setting<>("Swing", Swing.Place, v -> page.getValue() == Pages.Render); private final Setting render = new Setting<>("Render", true, v -> page.getValue() == Pages.Render); private final Setting renderExtrapolation = new Setting<>("RenderExtrapolation", new BooleanSettingGroup(false), v -> page.getValue() == Pages.Render); - private final Setting extrapolationColor = new Setting<>("ExtrapolationColor", new ColorSetting(Color.white), v -> page.getValue() == Pages.Render); + private final Setting extrapolationColor = new Setting<>("ExtrapolationColor", new ColorSetting(Color.white), v -> page.getValue() == Pages.Render).addToGroup(renderExtrapolation); private final Setting renderInteractVector = new Setting<>("RenderInteractVector", new BooleanSettingGroup(true), v -> page.getValue() == Pages.Render); - private final Setting interactColor = new Setting<>("InteractColor", new ColorSetting(Color.red), v -> page.getValue() == Pages.Render); + private final Setting interactColor = new Setting<>("InteractColor", new ColorSetting(Color.red), v -> page.getValue() == Pages.Render).addToGroup(renderInteractVector); private final Setting renderMode = new Setting<>("RenderMode", Render.Fade, v -> page.getValue() == Pages.Render); private final Setting rselfDamage = new Setting<>("SelfDamage", true, v -> page.getValue() == Pages.Render); private final Setting drawDamage = new Setting<>("RenderDamage", true, v -> page.getValue() == Pages.Render); diff --git a/src/main/java/thunder/hack/modules/combat/LegitHelper.java b/src/main/java/thunder/hack/modules/combat/LegitHelper.java index c7bafd39..7975a377 100644 --- a/src/main/java/thunder/hack/modules/combat/LegitHelper.java +++ b/src/main/java/thunder/hack/modules/combat/LegitHelper.java @@ -83,19 +83,23 @@ public void onUpdate() { ThunderHack.asyncManager.run(() -> { mc.player.getInventory().selectedSlot = anchorSlot; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(anchorSlot)); - AsyncManager.sleep(anchorDelay.getValue()); - ((IMinecraftClient) mc).idoItemUse(); - AsyncManager.sleep(anchorDelay.getValue()); + }); + + ThunderHack.asyncManager.run(() -> mc.executeSync(() -> ((IMinecraftClient) mc).idoItemUse()), anchorDelay.getValue()); + + ThunderHack.asyncManager.run(() -> { mc.player.getInventory().selectedSlot = glowSlot; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(glowSlot)); - AsyncManager.sleep(anchorDelay.getValue()); - ((IMinecraftClient) mc).idoItemUse(); - AsyncManager.sleep(anchorDelay.getValue()); + }, anchorDelay.getValue() * 2); + + ThunderHack.asyncManager.run(() -> mc.executeSync(() -> ((IMinecraftClient) mc).idoItemUse()), anchorDelay.getValue() * 3L); + + ThunderHack.asyncManager.run(() -> { mc.player.getInventory().selectedSlot = prevSlot; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(prevSlot)); - AsyncManager.sleep(anchorDelay.getValue()); - ((IMinecraftClient) mc).idoItemUse(); - }); + }, anchorDelay.getValue() * 4); + + ThunderHack.asyncManager.run(() -> mc.executeSync(() -> ((IMinecraftClient) mc).idoItemUse()), anchorDelay.getValue() * 5L); return; } @@ -116,14 +120,16 @@ public void onUpdate() { int prevSlot = mc.player.getInventory().selectedSlot; + if (!obbyAtCrosshair) { + mc.player.getInventory().selectedSlot = obbySlot; + mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(obbySlot)); + ((IMinecraftClient) mc).idoItemUse(); + } + ThunderHack.asyncManager.run(() -> { - if (!obbyAtCrosshair) { - mc.player.getInventory().selectedSlot = obbySlot; - mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(obbySlot)); + if (!obbyAtCrosshair) AsyncManager.sleep(crystalDelay.getValue()); - ((IMinecraftClient) mc).idoItemUse(); - AsyncManager.sleep(crystalDelay.getValue()); - } + mc.player.getInventory().selectedSlot = crystalSlot; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(crystalSlot)); AsyncManager.sleep(crystalDelay.getValue()); @@ -150,6 +156,7 @@ public void onUpdate() { return; int prevSlot = mc.player.getInventory().selectedSlot; + ThunderHack.asyncManager.run(() -> { AsyncManager.sleep(breakerDelay.getValue()); mc.player.getInventory().selectedSlot = axeSlot; diff --git a/src/main/java/thunder/hack/modules/combat/Surround.java b/src/main/java/thunder/hack/modules/combat/Surround.java index b8b64ee8..e11d7ae4 100644 --- a/src/main/java/thunder/hack/modules/combat/Surround.java +++ b/src/main/java/thunder/hack/modules/combat/Surround.java @@ -1,10 +1,12 @@ package thunder.hack.modules.combat; +import com.google.common.collect.Lists; import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventPriority; import net.minecraft.entity.EntityType; import net.minecraft.entity.MovementType; import net.minecraft.entity.decoration.EndCrystalEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.network.packet.s2c.play.*; import net.minecraft.sound.SoundCategory; @@ -13,18 +15,17 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import thunder.hack.ThunderHack; -import thunder.hack.events.impl.EventEntitySpawn; import thunder.hack.events.impl.EventTick; import thunder.hack.events.impl.PacketEvent; import thunder.hack.modules.base.PlaceModule; import thunder.hack.setting.Setting; import thunder.hack.setting.impl.SettingGroup; import thunder.hack.utility.player.InteractionUtility; -import thunder.hack.utility.world.HoleUtility; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; -import java.util.Objects; +import java.util.Set; import static thunder.hack.modules.client.ClientSettings.isRu; @@ -92,8 +93,7 @@ private void onTick(EventTick event) { return; } - if (!getBlockResult().found()) - disable(isRu() ? "Нет блоков!" : "No blocks!"); + if (!getBlockResult().found()) disable(isRu() ? "Нет блоков!" : "No blocks!"); int placed = 0; @@ -102,8 +102,7 @@ private void onTick(EventTick event) { if (!getBlockResult().found()) disable(isRu() ? "Нет блоков!" : "No blocks!"); BlockPos targetBlock = getSequentialPos(); - if (targetBlock == null) - break; + if (targetBlock == null) break; if (placeBlock(targetBlock, true)) { placed++; @@ -131,124 +130,67 @@ private void onPacketReceive(PacketEvent.@NotNull Receive event) { if (event.getPacket() instanceof BlockUpdateS2CPacket pac && mc.player.squaredDistanceTo(pac.getPos().toCenterPos()) < range.getPow2Value() && pac.getState().isReplaceable()) handlePacket(); - if (event.getPacket() instanceof ExplosionS2CPacket p - && mc.player.squaredDistanceTo(p.getX(), p.getY(), p.getZ()) < range.getPow2Value()) + if (event.getPacket() instanceof ExplosionS2CPacket p && mc.player.squaredDistanceTo(p.getX(), p.getY(), p.getZ()) < range.getPow2Value()) handlePacket(); - if (event.getPacket() instanceof PlaySoundS2CPacket p - && p.getCategory().equals(SoundCategory.BLOCKS) - && p.getSound().value().equals(SoundEvents.ENTITY_GENERIC_EXPLODE) - && mc.player.squaredDistanceTo(p.getX(), p.getY(), p.getZ()) < range.getPow2Value()) + if (event.getPacket() instanceof PlaySoundS2CPacket p && p.getCategory().equals(SoundCategory.BLOCKS) && p.getSound().value().equals(SoundEvents.ENTITY_GENERIC_EXPLODE) && mc.player.squaredDistanceTo(p.getX(), p.getY(), p.getZ()) < range.getPow2Value()) handlePacket(); - if (event.getPacket() instanceof PlayerPositionLookS2CPacket) - if (onTp.getValue() == OnTpAction.Disable) { - disable(isRu() ? "Выключен из-за руббербенда!" : "Disabled due to a rubberband!"); - } + if (event.getPacket() instanceof PlayerPositionLookS2CPacket) if (onTp.getValue() == OnTpAction.Disable) { + disable(isRu() ? "Выключен из-за руббербенда!" : "Disabled due to a rubberband!"); + } } private void handlePacket() { BlockPos bp = getSequentialPos(); if (bp != null) { - if (placeBlock(bp, InteractMode.Packet)) - inactivityTimer.reset(); + if (placeBlock(bp, InteractMode.Packet)) inactivityTimer.reset(); } } private @Nullable BlockPos getSequentialPos() { for (BlockPos bp : getBlocks()) { - if (new Box(bp).intersects(mc.player.getBoundingBox())) - continue; + if (new Box(bp).intersects(mc.player.getBoundingBox())) continue; if (InteractionUtility.canPlaceBlock(bp, interact.getValue(), true) && mc.world.getBlockState(bp).isReplaceable()) return bp; } return null; } - private @NotNull List getBlocks() { - final BlockPos playerPos = getPlayerPos(); - final List offsets = new ArrayList<>(); - - if (center.getValue() == CenterMode.Disabled && mc.player != null) { - int z; - int x; - final double decimalX = Math.abs(mc.player.getX()) - Math.floor(Math.abs(mc.player.getX())); - final double decimalZ = Math.abs(mc.player.getZ()) - Math.floor(Math.abs(mc.player.getZ())); - final int lengthXPos = HoleUtility.calcLength(decimalX, false); - final int lengthXNeg = HoleUtility.calcLength(decimalX, true); - final int lengthZPos = HoleUtility.calcLength(decimalZ, false); - final int lengthZNeg = HoleUtility.calcLength(decimalZ, true); - final ArrayList tempOffsets = new ArrayList<>(); - offsets.addAll(getOverlapPos()); - - for (x = 1; x < lengthXPos + 1; ++x) { - tempOffsets.add(HoleUtility.addToPlayer(playerPos, x, 0.0, 1 + lengthZPos)); - tempOffsets.add(HoleUtility.addToPlayer(playerPos, x, 0.0, -(1 + lengthZNeg))); - } - for (x = 0; x <= lengthXNeg; ++x) { - tempOffsets.add(HoleUtility.addToPlayer(playerPos, -x, 0.0, 1 + lengthZPos)); - tempOffsets.add(HoleUtility.addToPlayer(playerPos, -x, 0.0, -(1 + lengthZNeg))); - } - for (z = 1; z < lengthZPos + 1; ++z) { - tempOffsets.add(HoleUtility.addToPlayer(playerPos, 1 + lengthXPos, 0.0, z)); - tempOffsets.add(HoleUtility.addToPlayer(playerPos, -(1 + lengthXNeg), 0.0, z)); - } - for (z = 0; z <= lengthZNeg; ++z) { - tempOffsets.add(HoleUtility.addToPlayer(playerPos, 1 + lengthXPos, 0.0, -z)); - tempOffsets.add(HoleUtility.addToPlayer(playerPos, -(1 + lengthXNeg), 0.0, -z)); - } - - for (BlockPos pos : tempOffsets) { - if (getDown(pos)) - offsets.add(pos.add(0, -1, 0)); - offsets.add(pos); - } - } else { - offsets.add(playerPos.add(0, -1, 0)); - - for (Vec3i surround : HoleUtility.VECTOR_PATTERN) { - if (getDown(playerPos.add(surround))) - offsets.add(playerPos.add(surround.getX(), -1, surround.getZ())); - - offsets.add(playerPos.add(surround)); - } - } - - return offsets; - } - - private boolean getDown(BlockPos pos) { - for (Direction dir : Direction.values()) - if (!mc.world.getBlockState(pos.add(dir.getVector())).isReplaceable()) - return false; - return mc.world.getBlockState(pos).isReplaceable() - && interact.getValue() != InteractionUtility.Interact.AirPlace; - } - - private @NotNull List getOverlapPos() { - List positions = new ArrayList<>(); - - if (mc.player != null) { - double decimalX = mc.player.getX() - Math.floor(mc.player.getX()); - double decimalZ = mc.player.getZ() - Math.floor(mc.player.getZ()); - int offX = HoleUtility.calcOffset(decimalX); - int offZ = HoleUtility.calcOffset(decimalZ); - positions.add(getPlayerPos()); - for (int x = 0; x <= Math.abs(offX); ++x) { - for (int z = 0; z <= Math.abs(offZ); ++z) { - int properX = x * offX; - int properZ = z * offZ; - positions.add(Objects.requireNonNull(getPlayerPos()).add(properX, -1, properZ)); + public List getBlocks() { + List finalPoses = new ArrayList<>(); + List playerPos = new ArrayList<>(); + Box box = mc.player.getBoundingBox(); + double y = mc.player.getY() - Math.floor(mc.player.getY()) > 0.8 ? Math.floor(mc.player.getY()) + 1.0 : Math.floor(mc.player.getY()); + playerPos.add(BlockPos.ofFloored(box.maxX, y, box.maxZ)); + playerPos.add(BlockPos.ofFloored(box.minX, y, box.minZ)); + playerPos.add(BlockPos.ofFloored(box.maxX, y, box.minZ)); + playerPos.add(BlockPos.ofFloored(box.minX, y, box.maxZ)); + + for (BlockPos pos : playerPos) { + for (Direction direction : Direction.values()) { + if (direction == Direction.UP || direction == Direction.DOWN) continue; + BlockPos offset = pos.offset(direction); + if (!playerPos.contains(offset)) { + finalPoses.add(offset); + finalPoses.add(offset.down()); } } + finalPoses.add(pos.down()); } - return positions; - } - - private @NotNull BlockPos getPlayerPos() { - return BlockPos.ofFloored(mc.player.getX(), mc.player.getY() - Math.floor(mc.player.getY()) > 0.8 ? Math.floor(mc.player.getY()) + 1.0 : Math.floor(mc.player.getY()), mc.player.getZ()); + for (BlockPos pos : Lists.newArrayList(finalPoses)) + for (PlayerEntity player : ThunderHack.asyncManager.getAsyncPlayers()) + if (player.getBoundingBox().intersects(new Box(pos))) { + finalPoses.removeIf(b -> b.equals(pos)); + for (Direction direction : Direction.values()) { + if (direction == Direction.UP || direction == Direction.DOWN) continue; + if (player.getBoundingBox().intersects(new Box(pos.offset(direction)))) continue; + finalPoses.add(pos.offset(direction)); + } + } + return finalPoses; } private enum CenterMode { diff --git a/src/main/java/thunder/hack/modules/movement/PacketFly.java b/src/main/java/thunder/hack/modules/movement/PacketFly.java index 07637389..0fab3838 100644 --- a/src/main/java/thunder/hack/modules/movement/PacketFly.java +++ b/src/main/java/thunder/hack/modules/movement/PacketFly.java @@ -36,7 +36,7 @@ public PacketFly() { private final Setting anticKickOffset = new Setting<>("anticKickOffset", 0.04f, 0.008f, 1f).addToGroup(antiKick); private final Setting speed = new Setting<>("Speed", 1.0f, 0.0f, 10.0f); private final Setting upSpeed = new Setting<>("UpSpeed", 0.062f, 0.001f, 0.1f); - private final Setting timer = new Setting<>("Timer", 1f, 0.01f, 5f); + private final Setting timer = new Setting<>("Timer", 1f, 0.1f, 5f); private final Setting increaseTicks = new Setting<>("IncreaseTicks", 1, 1, 20); private final Setting factor = new Setting<>("Factor", 1f, 1f, 10f); private final Setting offset = new Setting<>("Offset", 1337f, 1f, 1337f, v-> type.is(Type.Up) || type.is(Type.Down)); diff --git a/src/main/java/thunder/hack/modules/movement/TridentBoost.java b/src/main/java/thunder/hack/modules/movement/TridentBoost.java new file mode 100644 index 00000000..36d5b5d6 --- /dev/null +++ b/src/main/java/thunder/hack/modules/movement/TridentBoost.java @@ -0,0 +1,59 @@ +package thunder.hack.modules.movement; + +import meteordevelopment.orbit.EventHandler; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.MovementType; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvents; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; +import thunder.hack.events.impl.UseTridentEvent; +import thunder.hack.modules.Module; +import thunder.hack.setting.Setting; + +public class TridentBoost extends Module { + public TridentBoost() { + super("TridentBoost", Category.MOVEMENT); + } + + private final Setting mode = new Setting<>("Mode", Mode.Motion); + private final Setting factor = new Setting<>("Factor", 1f, 0.1f, 20f); + public final Setting cooldown = new Setting<>("Cooldown", 10, 0, 20); + public final Setting anyWeather = new Setting<>("AnyWeather", true); + + private enum Mode { + Motion, Factor + } + + @EventHandler + public void onUseTrident(UseTridentEvent e) { + if (mc.player.getItemUseTime() >= cooldown.getValue()) { + int j = EnchantmentHelper.getRiptide(mc.player.getActiveItem()); + if (anyWeather.getValue() || mc.player.isTouchingWaterOrRain()) { + if (j > 0) { + float f = mc.player.getYaw(); + float g = mc.player.getPitch(); + float speedX = -MathHelper.sin(f * 0.017453292F) * MathHelper.cos(g * 0.017453292F); + float speedY = -MathHelper.sin(g * 0.017453292F); + float speedZ = MathHelper.cos(f * 0.017453292F) * MathHelper.cos(g * 0.017453292F); + float plannedSpeed = MathHelper.sqrt(speedX * speedX + speedY * speedY + speedZ * speedZ); + + float n = mode.is(Mode.Factor) ? factor.getValue() * 3.0F * ((1.0F + (float) j) / 4.0F) : factor.getValue(); + + speedX *= n / plannedSpeed; + speedY *= n / plannedSpeed; + speedZ *= n / plannedSpeed; + + mc.player.addVelocity(speedX, speedY, speedZ); + mc.player.useRiptide(20); + + if (mc.player.isOnGround()) + mc.player.move(MovementType.SELF, new Vec3d(0.0, 1.1999999284744263, 0.0)); + + mc.world.playSoundFromEntity(null, mc.player, SoundEvents.ITEM_TRIDENT_RIPTIDE_3, SoundCategory.PLAYERS, 1.0F, 1.0F); + } + } + } + e.cancel(); + } +} diff --git a/src/main/java/thunder/hack/modules/player/PerfectDelay.java b/src/main/java/thunder/hack/modules/player/PerfectDelay.java index 8a89e053..201a6fa5 100644 --- a/src/main/java/thunder/hack/modules/player/PerfectDelay.java +++ b/src/main/java/thunder/hack/modules/player/PerfectDelay.java @@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.TridentItem; import net.minecraft.registry.entry.RegistryEntry; +import thunder.hack.core.impl.ModuleManager; import thunder.hack.injection.accesors.IClientPlayerEntity; import thunder.hack.modules.Module; import thunder.hack.setting.Setting; @@ -38,7 +39,7 @@ private float getEnchantLevel(ItemStack stack) { @Override public void onUpdate() { if (mc.player.getActiveItem().getItem() instanceof TridentItem && trident.getValue()) { - if (mc.player.getItemUseTime() > 9) + if (mc.player.getItemUseTime() > (ModuleManager.tridentBoost.isEnabled() ? ModuleManager.tridentBoost.cooldown.getValue() : 9)) mc.interactionManager.stopUsingItem(mc.player); } diff --git a/src/main/java/thunder/hack/modules/render/BreadCrumbs.java b/src/main/java/thunder/hack/modules/render/BreadCrumbs.java index f5fa8fee..a6711072 100644 --- a/src/main/java/thunder/hack/modules/render/BreadCrumbs.java +++ b/src/main/java/thunder/hack/modules/render/BreadCrumbs.java @@ -3,7 +3,6 @@ import com.mojang.blaze3d.systems.RenderSystem; import meteordevelopment.orbit.EventHandler; import net.minecraft.client.render.*; -import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.Vec3d; import thunder.hack.events.impl.EventPostSync; @@ -23,6 +22,7 @@ public BreadCrumbs() { super("BreadCrumbs", Category.RENDER); } + private final Setting throughWalls = new Setting<>("ThroughWalls", true); private final Setting limit = new Setting<>("ListLimit", 1000, 10, 99999); private final List positions = new CopyOnWriteArrayList<>(); private final Setting lmode = new Setting<>("ColorMode", Mode.Sync); @@ -33,20 +33,16 @@ private enum Mode { } public void onRender3D(MatrixStack stack) { - drawLine(2f, false); - drawLine(5, false); - drawLine(10, false); - drawLine(1, true); - } - - public void drawLine(float width, boolean white) { Render3DEngine.setupRender(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); - RenderSystem.disableDepthTest(); + + if (throughWalls.getValue()) + RenderSystem.disableDepthTest(); + RenderSystem.disableCull(); + RenderSystem.lineWidth(1f); RenderSystem.setShader(GameRenderer::getRenderTypeLinesProgram); - RenderSystem.lineWidth(width); buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES); for (int i = 0; i < positions.size(); i++) { @@ -58,8 +54,6 @@ public void drawLine(float width, boolean white) { Vec3d vec2 = positions.get(i); if (vec1 != null && vec2 != null) { Color c = lmode.getValue() == Mode.Sync ? HudEditor.getColor(i) : color.getValue().getColorObject(); - if (white) c = Color.WHITE; - if (i < 10) c = Render2DEngine.injectAlpha(c, (int) (c.getAlpha() * (i / 10f))); MatrixStack matrices = Render3DEngine.matrixFrom(vec1.getX(), vec1.getY(), vec1.getZ()); Render3DEngine.vertexLine(matrices, buffer, 0f, 0f, 0f, (float) (vec2.getX() - vec1.getX()), (float) (vec2.getY() - vec1.getY()), (float) (vec2.getZ() - vec1.getZ()), c); @@ -68,7 +62,8 @@ public void drawLine(float width, boolean white) { tessellator.draw(); RenderSystem.enableCull(); - RenderSystem.enableDepthTest(); + if (throughWalls.getValue()) + RenderSystem.enableDepthTest(); Render3DEngine.endRender(); } diff --git a/src/main/java/thunder/hack/modules/render/Chams.java b/src/main/java/thunder/hack/modules/render/Chams.java index 41d00b26..9ce06a5c 100644 --- a/src/main/java/thunder/hack/modules/render/Chams.java +++ b/src/main/java/thunder/hack/modules/render/Chams.java @@ -39,7 +39,7 @@ public Chams() { super("Chams", Category.RENDER); } - private final Setting handItems = new Setting<>("HandItems", false); + public final Setting handItems = new Setting<>("HandItems", false); private final Setting handItemsColor = new Setting<>("HandItemsColor", new ColorSetting(new Color(0x9317DE5D, true)), v -> handItems.getValue()); public final Setting crystals = new Setting<>("Crystals", false); diff --git a/src/main/java/thunder/hack/modules/render/NameTags.java b/src/main/java/thunder/hack/modules/render/NameTags.java index 2384cb1b..f33a5818 100644 --- a/src/main/java/thunder/hack/modules/render/NameTags.java +++ b/src/main/java/thunder/hack/modules/render/NameTags.java @@ -44,7 +44,6 @@ import thunder.hack.core.impl.ModuleManager; import thunder.hack.gui.font.FontRenderers; import thunder.hack.gui.hud.impl.PotionHud; -import thunder.hack.gui.hud.impl.WaterMark; import thunder.hack.modules.Module; import thunder.hack.modules.client.HudEditor; import thunder.hack.modules.misc.NameProtect; @@ -61,9 +60,9 @@ import java.util.*; public class NameTags extends Module { - private final Setting self = new Setting<>("Self",false); + private final Setting self = new Setting<>("Self", false); private final Setting scale = new Setting<>("Scale", 1f, 0.1f, 10f); - private final Setting resize= new Setting<>("Resize",false); + private final Setting resize = new Setting<>("Resize", false); private final Setting height = new Setting<>("Height", 2f, 0.1f, 10f); private final Setting gamemode = new Setting<>("Gamemode", false); private final Setting spawners = new Setting<>("SpawnerNameTag", false); @@ -72,7 +71,7 @@ public class NameTags extends Module { private final Setting hp = new Setting<>("HP", true); private final Setting distance = new Setting<>("Distance", true); private final Setting pops = new Setting<>("TotemPops", true); - private final Setting outline = new Setting<>("Outline", OutlineColor.None); + private final Setting outline = new Setting<>("OutlineType", OutlineColor.New); private final Setting friendOutline = new Setting<>("FriendOutline", OutlineColor.None); private final Setting outlineColor = new Setting<>("OutlineColor", new ColorSetting(0x80000000)); private final Setting friendOutlineColor = new Setting<>("FriendOutlineColor", new ColorSetting(0x80000000)); @@ -103,7 +102,7 @@ public enum Health { } private enum OutlineColor { - Sync, Custom, None + Sync, Custom, None, New } public NameTags() { @@ -118,7 +117,7 @@ public NameTags() { } public void onRender2D(DrawContext context) { - if(mc.options.hudHidden) return; + if (mc.options.hudHidden) return; for (PlayerEntity ent : mc.world.getPlayers()) { if (ent == mc.player && (mc.options.getPerspective().isFirstPerson() || !self.getValue())) continue; if (getEntityPing(ent) <= 0 && ignoreBots.getValue()) continue; @@ -147,8 +146,7 @@ public void onRender2D(DrawContext context) { if (FriendManager.friends.stream().anyMatch(i -> i.contains(ent.getDisplayName().getString())) && NameProtect.hideFriends.getValue() && ModuleManager.nameProtect.isEnabled()) { final_string += NameProtect.getCustomName() + " "; - } - else { + } else { final_string += ent.getDisplayName().getString() + " "; } @@ -257,7 +255,12 @@ public void onRender2D(DrawContext context) { Color color = ThunderHack.friendManager.isFriend(ent) ? fillColorF.getValue().getColorObject() : fillColorA.getValue().getColorObject(); - Render2DEngine.drawRect(context.getMatrices(), tagX - 2, (float) (posY - 13f), textWidth + 4, 11, color); + OutlineColor cl = ThunderHack.friendManager.isFriend(ent) ? friendOutline.getValue() : outline.getValue(); + + if (cl == OutlineColor.New) + Render2DEngine.drawRectWithOutline(context.getMatrices(), tagX - 2, (float) (posY - 13f), textWidth + 4, 11, color, outlineColor.getValue().getColorObject()); + else + Render2DEngine.drawRect(context.getMatrices(), tagX - 2, (float) (posY - 13f), textWidth + 4, 11, color); if (ThunderHack.telemetryManager.getOnlinePlayers().contains(ent.getGameProfile().getName())) { Render2DEngine.drawRect(context.getMatrices(), tagX - 14, (float) (posY - 13f), 12, 11, color.brighter().brighter()); @@ -271,10 +274,8 @@ public void onRender2D(DrawContext context) { RenderSystem.disableBlend(); } - OutlineColor cl = ThunderHack.friendManager.isFriend(ent) ? friendOutline.getValue() : outline.getValue(); - switch (cl) { - case None -> { + case None, New -> { } case Sync -> { @@ -285,16 +286,17 @@ public void onRender2D(DrawContext context) { } case Custom -> { Render2DEngine.drawRect(context.getMatrices(), tagX - 3, (float) (posY - 14f), textWidth + 6, 1, - ThunderHack.friendManager.isFriend(ent) ? friendOutlineColor.getValue().getColorObject() : outlineColor.getValue().getColorObject()); + ThunderHack.friendManager.isFriend(ent) ? friendOutlineColor.getValue().getColorObject() : outlineColor.getValue().getColorObject()); Render2DEngine.drawRect(context.getMatrices(), tagX - 3, (float) (posY - 3f), textWidth + 6, 1, - ThunderHack.friendManager.isFriend(ent) ? friendOutlineColor.getValue().getColorObject() : outlineColor.getValue().getColorObject()); + ThunderHack.friendManager.isFriend(ent) ? friendOutlineColor.getValue().getColorObject() : outlineColor.getValue().getColorObject()); Render2DEngine.drawRect(context.getMatrices(), tagX - 3, (float) (posY - 14f), 1, 11, - ThunderHack.friendManager.isFriend(ent) ? friendOutlineColor.getValue().getColorObject() : outlineColor.getValue().getColorObject()); + ThunderHack.friendManager.isFriend(ent) ? friendOutlineColor.getValue().getColorObject() : outlineColor.getValue().getColorObject()); Render2DEngine.drawRect(context.getMatrices(), tagX + textWidth + 2, (float) (posY - 14f), 1, 11, - ThunderHack.friendManager.isFriend(ent) ? friendOutlineColor.getValue().getColorObject() : outlineColor.getValue().getColorObject()); + ThunderHack.friendManager.isFriend(ent) ? friendOutlineColor.getValue().getColorObject() : outlineColor.getValue().getColorObject()); } } + if (font.getValue() == Font.Fancy) { FontRenderers.sf_bold.drawString(context.getMatrices(), final_string, tagX, (float) posY - 10, -1); } else { diff --git a/src/main/java/thunder/hack/utility/ThunderUtility.java b/src/main/java/thunder/hack/utility/ThunderUtility.java index a95a10b8..d582a0fc 100644 --- a/src/main/java/thunder/hack/utility/ThunderUtility.java +++ b/src/main/java/thunder/hack/utility/ThunderUtility.java @@ -20,7 +20,6 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; -import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; @@ -55,6 +54,14 @@ public static Identifier getCustomImg(String name) throws IOException { return mc.getTextureManager().registerDynamicTexture("th-" + name + "-" + (int) MathUtility.random(0, 1000), new NativeImageBackedTexture(NativeImage.read(new FileInputStream(IMAGES_FOLDER + "/" + name + ".png")))); } + public static void syncVersion() { + try { + if (!new BufferedReader(new InputStreamReader(new URL("https://raw.githubusercontent.com/Pan4ur/THRecodeUtil/main/syncVersionBeta.txt").openStream())).readLine().equals(ThunderHack.VERSION)) + ThunderHack.isOutdated = true; + } catch (Exception ignored) { + } + } + public static void parseStarGazer() { List starGazers = new ArrayList<>(); @@ -83,6 +90,21 @@ public static void parseStarGazer() { } } + public static void syncContributors() { + try { + URL list = new URL("https://raw.githubusercontent.com/Pan4ur/THRecodeUtil/main/thTeam.txt"); + BufferedReader in = new BufferedReader(new InputStreamReader(list.openStream(), StandardCharsets.UTF_8)); + String inputLine; + int i = 0; + while ((inputLine = in.readLine()) != null) { + ThunderHack.contributors[i] = inputLine.trim(); + i++; + } + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } public static String readManifestField(String fieldName) { try { @@ -93,7 +115,7 @@ public static String readManifestField(String fieldName) { InputStream is = url.openStream(); if (is != null) { String s = new Manifest(is).getMainAttributes().getValue(fieldName); - if(s != null) + if (s != null) return s; } } catch (Exception ignored) { diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/ShaderEffectManager.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/ShaderEffectManager.java index e14b56a6..43e354bf 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/ShaderEffectManager.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/ShaderEffectManager.java @@ -17,17 +17,12 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed; -import thunder.hack.utility.render.shaders.satin.impl.ReloadableShaderEffectManager; import net.minecraft.client.render.VertexFormat; -import net.minecraft.client.render.VertexFormats; import net.minecraft.util.Identifier; -import org.apiguardian.api.API; +import thunder.hack.utility.render.shaders.satin.impl.ReloadableShaderEffectManager; import java.util.function.Consumer; -import static org.apiguardian.api.API.Status.EXPERIMENTAL; -import static org.apiguardian.api.API.Status.STABLE; - /** * @see ManagedShaderEffect */ diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/SamplerUniformV2.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/SamplerUniformV2.java index 45f3dbf1..966a02e6 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/SamplerUniformV2.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/SamplerUniformV2.java @@ -17,12 +17,9 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed.uniform; -import org.apiguardian.api.API; import java.util.function.IntSupplier; -import static org.apiguardian.api.API.Status.EXPERIMENTAL; - public interface SamplerUniformV2 extends SamplerUniform { void set(IntSupplier textureSupplier); } diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform1f.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform1f.java index 7019a5ae..8ec7521f 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform1f.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform1f.java @@ -17,10 +17,6 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed.uniform; -import org.apiguardian.api.API; - -import static org.apiguardian.api.API.Status.MAINTAINED; - public interface Uniform1f { void set(float value); } diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform1i.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform1i.java index b34e3669..f84bbeb4 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform1i.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform1i.java @@ -17,10 +17,6 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed.uniform; -import org.apiguardian.api.API; - -import static org.apiguardian.api.API.Status.MAINTAINED; - public interface Uniform1i { void set(int value); } diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform2f.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform2f.java index fda3ccde..17bff8b5 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform2f.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform2f.java @@ -17,11 +17,8 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed.uniform; -import org.apiguardian.api.API; import org.joml.Vector2f; -import static org.apiguardian.api.API.Status.MAINTAINED; - public interface Uniform2f { void set(float value0, float value1); diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform2i.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform2i.java index d2db1869..f74afc5b 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform2i.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform2i.java @@ -17,10 +17,6 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed.uniform; -import org.apiguardian.api.API; - -import static org.apiguardian.api.API.Status.MAINTAINED; - public interface Uniform2i { void set(int value0, int value1); } diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform3i.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform3i.java index 6cdc1c4e..6512ebe5 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform3i.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform3i.java @@ -17,10 +17,6 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed.uniform; -import org.apiguardian.api.API; - -import static org.apiguardian.api.API.Status.MAINTAINED; - public interface Uniform3i { void set(int value0, int value1, int value2); } diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform4f.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform4f.java index 88be1243..268d4814 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform4f.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform4f.java @@ -17,11 +17,8 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed.uniform; -import org.apiguardian.api.API; import org.joml.Vector4f; -import static org.apiguardian.api.API.Status.MAINTAINED; - public interface Uniform4f { void set(float value0, float value1, float value2, float value3); diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform4i.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform4i.java index 7f881fb9..937be41f 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform4i.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/Uniform4i.java @@ -17,10 +17,6 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed.uniform; -import org.apiguardian.api.API; - -import static org.apiguardian.api.API.Status.MAINTAINED; - public interface Uniform4i { void set(int value0, int value1, int value2, int value3); } diff --git a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/UniformMat4.java b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/UniformMat4.java index ff14a9b6..9a221e4e 100644 --- a/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/UniformMat4.java +++ b/src/main/java/thunder/hack/utility/render/shaders/satin/api/managed/uniform/UniformMat4.java @@ -17,11 +17,8 @@ */ package thunder.hack.utility.render.shaders.satin.api.managed.uniform; -import org.apiguardian.api.API; import org.joml.Matrix4f; -import static org.apiguardian.api.API.Status.MAINTAINED; - public interface UniformMat4 { void set(Matrix4f value); diff --git a/src/main/resources/thunderhack.mixins.json b/src/main/resources/thunderhack.mixins.json index f7f11e18..872dded6 100644 --- a/src/main/resources/thunderhack.mixins.json +++ b/src/main/resources/thunderhack.mixins.json @@ -86,6 +86,7 @@ "MixinSodiumBlockOcclusionCache", "MixinSplashOverlay", "MixinSweetBerryBushBlock", + "MixinTridentItem", "MixinWorld", "MixinWorldChunk", "accesors.IAreaEffectCloudEntity",