diff --git a/src/main/java/dev/heliosclient/command/commands/Reset.java b/src/main/java/dev/heliosclient/command/commands/Reset.java index e714178..131e09d 100644 --- a/src/main/java/dev/heliosclient/command/commands/Reset.java +++ b/src/main/java/dev/heliosclient/command/commands/Reset.java @@ -3,6 +3,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import dev.heliosclient.HeliosClient; import dev.heliosclient.command.Command; +import dev.heliosclient.managers.ModuleManager; import dev.heliosclient.util.ChatUtils; import net.minecraft.command.CommandSource; @@ -14,6 +15,7 @@ public Reset() { @Override public void build(LiteralArgumentBuilder builder) { builder.executes(context -> { + ModuleManager.init(); HeliosClient.CONFIG.writeDefaultModuleConfig(); ChatUtils.sendHeliosMsg("Reset config."); diff --git a/src/main/java/dev/heliosclient/managers/ColorManager.java b/src/main/java/dev/heliosclient/managers/ColorManager.java index cba232d..fc510ec 100644 --- a/src/main/java/dev/heliosclient/managers/ColorManager.java +++ b/src/main/java/dev/heliosclient/managers/ColorManager.java @@ -78,8 +78,6 @@ private ColorManager() { .setEndGradient(this::getPrimaryGradientEnd) .register(); - - registerStaticGradient("Sunrise", new Color(255, 94, 77), new Color(255, 165, 0)); registerStaticGradient("Ocean", new Color(0, 105, 148), new Color(0, 168, 255)); registerStaticGradient("Forest", new Color(34, 139, 34), new Color(107, 142, 35)); @@ -163,14 +161,13 @@ public int clickGuiPaneText() { return clickGuiPaneText; } } - + @SuppressWarnings("all") @SubscribeEvent public void onTick(TickEvent.CLIENT e) { if (HeliosClient.CLICKGUI == null) return; ColorManager.SYNC_ACCENT = HeliosClient.CLICKGUI.syncAccentColor.value; - Tooltip.tooltip.mode = HeliosClient.CLICKGUI.TooltipMode.value; Tooltip.tooltip.fixedPos = HeliosClient.CLICKGUI.TooltipPos.value; @@ -178,13 +175,10 @@ public void onTick(TickEvent.CLIENT e) { //Hud color is synced in HUDModule.java if (SYNC_ACCENT) { updateClickGuiSecondary(HeliosClient.CLICKGUI.AccentColor.getColor(), HeliosClient.CLICKGUI.AccentColor.isRainbow()); - updatePrimaryGradients(HeliosClient.CLICKGUI.AccentColor.getColor(), HeliosClient.CLICKGUI.AccentColor.getColor()); return; } - - - + //hey blackbox, fix this bloated code please GUI gui = (ModuleManager.get(GUI.class)); @@ -196,7 +190,6 @@ public void onTick(TickEvent.CLIENT e) { updatePrimaryGradients(gui.gradientType.get().getStartGradient(), gui.gradientType.get().getEndGradient()); } - updateClickGuiSecondary(HeliosClient.CLICKGUI.AccentColor.getColor(), HeliosClient.CLICKGUI.AccentColor.isRainbow()); this.defaultTextColor = HeliosClient.CLICKGUI.TextColor.getColor().getRGB(); diff --git a/src/main/java/dev/heliosclient/managers/ModuleManager.java b/src/main/java/dev/heliosclient/managers/ModuleManager.java index f00fbd3..38e008d 100644 --- a/src/main/java/dev/heliosclient/managers/ModuleManager.java +++ b/src/main/java/dev/heliosclient/managers/ModuleManager.java @@ -54,6 +54,7 @@ public static void init() { new AutoNametag(), new BetterPortals(), new LiquidInteract(), + new ServerScraper(), new Painter(), new SignTweaks(), new Collisions(), diff --git a/src/main/java/dev/heliosclient/module/modules/chat/ChatHighlight.java b/src/main/java/dev/heliosclient/module/modules/chat/ChatHighlight.java index 3482910..15ad276 100644 --- a/src/main/java/dev/heliosclient/module/modules/chat/ChatHighlight.java +++ b/src/main/java/dev/heliosclient/module/modules/chat/ChatHighlight.java @@ -81,10 +81,6 @@ public ChatHighlight() { addSettingGroup(sgGeneral); addQuickSettings(sgGeneral.getSettings()); - - //Test - // this.highlightList.add("ElBe_Gaming"); - // this.highlightList.add("tanishisherewith"); } public void checkForHighlights() { @@ -112,7 +108,7 @@ public void checkForHighlights() { //Priority low for chat tweaks to append first. - @SubscribeEvent + @SubscribeEvent(priority = SubscribeEvent.Priority.LOW) public void onChatMessageEvent(ChatMessageEvent event) { event.setCanceled(true); @@ -165,8 +161,7 @@ public void onChatMessageEvent(ChatMessageEvent event) { // The message has been edited; we should change the text. messageEdited = true; } - } catch (PatternSyntaxException ignored) { - } + } catch (PatternSyntaxException ignored) {} } } @@ -175,7 +170,6 @@ public void onChatMessageEvent(ChatMessageEvent event) { } } - private String applyCaseCheck(String input) { if (checkCase.getOption() != CaseCheck.NONE) { return ((CaseCheck) checkCase.getOption()).getString(input); diff --git a/src/main/java/dev/heliosclient/module/modules/world/ServerScraper.java b/src/main/java/dev/heliosclient/module/modules/world/ServerScraper.java new file mode 100644 index 0000000..baa9e4e --- /dev/null +++ b/src/main/java/dev/heliosclient/module/modules/world/ServerScraper.java @@ -0,0 +1,108 @@ +package dev.heliosclient.module.modules.world; + +import dev.heliosclient.event.SubscribeEvent; +import dev.heliosclient.event.events.player.PacketEvent; +import dev.heliosclient.event.events.player.PlayerJoinEvent; +import dev.heliosclient.module.Categories; +import dev.heliosclient.module.Module_; +import net.minecraft.client.network.ServerInfo; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.network.packet.s2c.common.ResourcePackSendS2CPacket; +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; +import net.minecraft.util.math.Vec3d; + +public class ServerScraper extends Module_ { + public ServerScraper() { + super("ServerScraper", "Gathers information about the server and world on join.", Categories.WORLD); + } + + @SubscribeEvent + public void onPacketSend(PacketEvent.SEND event) { + if (event.getPacket() instanceof ResourcePackSendS2CPacket rsPack) { + MutableText text = Text.literal("ResourcePack URL:") + .formatted(Formatting.BOLD, Formatting.BLUE) + .append(Text.literal(" " + rsPack.url()) + .formatted(Formatting.ITALIC, Formatting.GOLD) + ); + + mc.inGameHud.getChatHud().addMessage(text); + } + } + @SubscribeEvent + public void onPlayerJoin(PlayerJoinEvent event) { + // Get the current world + ClientWorld world = mc.world; + + if (world != null) { + // Gather world information + long worldAge = world.getTime(); + long dayTime = world.getTimeOfDay(); + boolean isDay = dayTime >= 0 && dayTime < 12000; // Daytime is between 0 and 12000 ticks + + // Gather player and entity information + int playerCount = world.getPlayers().size(); + + // Gather world border information + double worldBorderSize = world.getWorldBorder().getSize(); + Vec3d worldBorderCenter = new Vec3d(world.getWorldBorder().getCenterX(),0, world.getWorldBorder().getCenterZ()); + + // Gather biome information + String biomeName = world.getBiome(mc.player.getBlockPos()).value().toString(); + MutableText separator = Text.of("=======================================================").copy().formatted(Formatting.DARK_GREEN); + mc.inGameHud.getChatHud().addMessage(separator); + + // Constructing the information message + MutableText worldInfoMessage = Text.literal("World Info:") + .formatted(Formatting.BOLD, Formatting.GREEN) + .append(Text.literal("\nWorld Age: ").formatted(Formatting.WHITE).append(Text.literal(worldAge + " ticks").formatted(Formatting.YELLOW))) + .append(Text.literal("\nDay Time: ").formatted(Formatting.WHITE).append(Text.literal(dayTime + " ticks").formatted(Formatting.YELLOW))) + .append(Text.literal("\nDay Count: ").formatted(Formatting.WHITE).append(Text.literal(String.valueOf(Math.floor(mc.world.getTime() / 24000))).formatted(Formatting.YELLOW))) + .append(Text.literal("\nIs Day: ").formatted(Formatting.WHITE).append(Text.literal(isDay ? "Yes" : "No").formatted(isDay ? Formatting.GREEN : Formatting.RED))) + .append(Text.literal("\nPlayer Count: ").formatted(Formatting.WHITE).append(Text.literal(playerCount + "").formatted(Formatting.YELLOW))) + .append(Text.literal("\nWorld Border Size: ").formatted(Formatting.WHITE).append(Text.literal(worldBorderSize + " blocks").formatted(Formatting.YELLOW))) + .append(Text.literal("\nWorld Border Center: ").formatted(Formatting.WHITE).append(Text.literal(worldBorderCenter.toString()).formatted(Formatting.YELLOW))) + .append(Text.literal("\nDifficulty: ").formatted(Formatting.WHITE).append(Text.literal(mc.world.getDifficulty().name()).formatted(Formatting.YELLOW))) + .append(Text.literal("\nPermissionLevel: ").formatted(Formatting.WHITE).append(Text.literal(String.valueOf(mc.player.getPermissionLevel())).formatted(Formatting.YELLOW))) + .append(Text.literal("\nCurrent Biome: ").formatted(Formatting.WHITE).append(Text.literal(biomeName).formatted(Formatting.YELLOW))) + .append(Text.literal("\nWorld Spawn Pos: ").formatted(Formatting.WHITE).append(Text.literal(mc.world.getSpawnPos().toString()).formatted(Formatting.YELLOW))); + + // Display the message in chat + mc.inGameHud.getChatHud().addMessage(worldInfoMessage); + mc.inGameHud.getChatHud().addMessage(Text.of("------------------------------------------------------")); + + + ServerInfo info = mc.getCurrentServerEntry(); + if(info != null) { + String serverName = info.name; + String serverVersion = info.version.getString(); + String serverProtocolVersion = String.valueOf(info.protocolVersion); + String motd = info.label.getString(); + String serverAddress = info.address; + String online = String.valueOf(info.online); + boolean hasSecureChat = info.isSecureChatEnforced(); + boolean texturePackRequired = info.getResourcePackPolicy() == ServerInfo.ResourcePackPolicy.ENABLED; + + // Constructing the server information message + MutableText serverInfoMessage = Text.literal("Server Info:") + .formatted(Formatting.BOLD, Formatting.BLUE) + .append(Text.literal("\nName: ").formatted(Formatting.WHITE).append(Text.literal(serverName).formatted(Formatting.YELLOW))) + .append(Text.literal("\nServer Address: ").formatted(Formatting.WHITE).append(Text.literal(serverAddress).formatted(Formatting.YELLOW))) + .append(Text.literal("\nVersion: ").formatted(Formatting.WHITE).append(Text.literal(serverVersion).formatted(Formatting.YELLOW))) + .append(Text.literal("\nProtocol Version: ").formatted(Formatting.WHITE).append(Text.literal(serverProtocolVersion).formatted(Formatting.YELLOW))) + .append(Text.literal("\nMOTD: ").formatted(Formatting.WHITE).append(Text.literal(motd).formatted(Formatting.YELLOW))) + .append(Text.literal("\nOnline: ").formatted(Formatting.WHITE).append(Text.literal(online).formatted(Formatting.YELLOW))) + .append(Text.literal("\nTexture Pack Required: ").formatted(Formatting.WHITE).append(Text.literal(texturePackRequired ? "Yes" : "No").formatted(texturePackRequired ? Formatting.GREEN : Formatting.RED))) + .append(Text.literal("\nTexture Pack Policy: ").formatted(Formatting.WHITE).append(Text.literal(info.getResourcePackPolicy().name()).formatted(Formatting.YELLOW))) + .append(Text.literal("\nIs Chat Secure: ").formatted(Formatting.WHITE).append(Text.literal(hasSecureChat ? "Yes" : "No").formatted(hasSecureChat ? Formatting.GREEN : Formatting.RED))) + .append(Text.literal("\nServer Type: ").formatted(Formatting.WHITE).append(Text.literal(info.getServerType().name()).formatted(Formatting.YELLOW))); + + // Display the server info message in chat + mc.inGameHud.getChatHud().addMessage(serverInfoMessage); + } + + mc.inGameHud.getChatHud().addMessage(separator); + } + } +} diff --git a/src/main/java/dev/heliosclient/system/config/ConfigManager.java b/src/main/java/dev/heliosclient/system/config/ConfigManager.java index b92d676..1afa4df 100644 --- a/src/main/java/dev/heliosclient/system/config/ConfigManager.java +++ b/src/main/java/dev/heliosclient/system/config/ConfigManager.java @@ -113,6 +113,7 @@ public boolean checkIfEmpty(String fileName) { public boolean save() { return currentConfig != null && currentConfig.save(); } + public void loadCurrent() { if (currentConfig != null) { currentConfig.load(); diff --git a/src/main/resources/heliosclient.accesswidener b/src/main/resources/heliosclient.accesswidener index f744562..6af85f1 100644 --- a/src/main/resources/heliosclient.accesswidener +++ b/src/main/resources/heliosclient.accesswidener @@ -30,4 +30,6 @@ accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPa accessible method net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractTypeHandler getType ()Lnet/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractType; accessible method net/minecraft/client/render/Camera setPos (DDD)V -accessible method net/minecraft/client/render/Camera setRotation (FF)V \ No newline at end of file +accessible method net/minecraft/client/render/Camera setRotation (FF)V + +accessible method net/minecraft/client/network/ClientPlayerEntity getPermissionLevel ()I \ No newline at end of file