Skip to content

HypixelUtils sends and receives packets incorrectly #595

@BridgeSenseDev

Description

@BridgeSenseDev

Original reporter & ticket id

No response

Category

API

Bug description

Ever since these changes to HypixelApiInternalsImpl.java in c20a4f2 to switch from OneConfig's PacketEvent to use OmniCoreClientNetworking instead, HypixelUtils is unable to send and receive packets from the mod API.

The new implementation uses OmniClientNetworking.send(), which enforces a strict check requiring packet IDs to be pre-registered in OmniCore's internal registry. Since the Hypixel Mod API sends packets (like hypixel:register) that aren't explicitly registered in the OmniCore payload map, this causes a java.lang.IllegalStateException: No packet registered with ID 'hypixel:register' whenever it tries to initialize by sending the hypixel:register packet.

Additionally, incoming packets, like hypixel:hello are being dropped because OmniCore's receiver logic strictly filters channels based on its registry, whereas the old PacketEvent implementation manually inspected the channel string of every S3FPacketCustomPayload.

Steps to reproduce

On any OneConfig version after c20a4f2, trying to use HypixelUtils api like getLocation() or getPlayerInfo() etc from OneConfig will lead to this error:

[16:39:33] [main/INFO] (OneConfig/HypixelAPI) Registering Hypixel API packet handlers
[16:39:33] [main/INFO] (OneConfig/HypixelUtils) Registering ClientboundPlayerInfoPacket packet handler
[16:39:33] [main/ERROR] (OneConfig/BrigaiderTranslator) Failed to execute command!
 java.lang.reflect.InvocationTargetException: null
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_472]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_472]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_472]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_472]
	at org.polyfrost.oneconfig.api.commands.v1.factories.annotated.AnnotationCommandFactory.lambda$setup$1(AnnotationCommandFactory.java:191) ~[AnnotationCommandFactory.class:?]
	at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:263) ~[CommandDispatcher.class:?]
	at dev.deftu.omnicore.internal.client.commands.ClientCommandInternals.execute(ClientCommandInternals.kt:91) ~[ClientCommandInternals.class:?]
	at dev.deftu.omnicore.internal.client.commands.ClientCommandInternals.register$lambda$0(ClientCommandInternals.kt:75) ~[ClientCommandInternals.class:?]
	at dev.deftu.omnicore.internal.commands.LegacyCommandBridge.processCommand(LegacyCommandBridge.kt:35) [LegacyCommandBridge.class:?]
	at net.minecraftforge.client.ClientCommandHandler.executeCommand(ClientCommandHandler.java:72) [ClientCommandHandler.class:?]
	at net.minecraft.client.gui.GuiScreen.sendChatMessage(GuiScreen.java:333) [GuiScreen.class:?]
	at net.minecraft.client.gui.GuiScreen.sendChatMessage(GuiScreen.java:325) [GuiScreen.class:?]
	at net.minecraft.client.gui.GuiChat.keyTyped(GuiChat.java:88) [GuiChat.class:?]
	at net.minecraft.client.gui.GuiScreen.handleKeyboardInput(GuiScreen.java:476) [GuiScreen.class:?]
	at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:434) [GuiScreen.class:?]
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1526) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:975) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:433) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:106) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_472]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_472]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_472]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_472]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) [dev-launch-injector-0.2.1+build.8.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_472]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_472]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_472]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_472]
	at org.polyfrost.oneconfig.loader.relaunch.RelaunchImpl.relaunch(RelaunchImpl.java:150) [relaunch.jar:unspecified]
	at org.polyfrost.oneconfig.loader.relaunch.RelaunchImpl.maybeRelaunch(RelaunchImpl.java:212) [relaunch.jar:unspecified]
	at org.polyfrost.oneconfig.loader.stage1.Stage1Loader.postLoad(Stage1Loader.java:140) [stage1.jar:1.1.0-alpha.53]
	at org.polyfrost.oneconfig.loader.stage1.DelayedStage0Tweaker.injectIntoClassLoader(DelayedStage0Tweaker.java:64) [stage1.jar:1.1.0-alpha.53]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:115) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) [dev-launch-injector-0.2.1+build.8.jar:?]
Caused by: java.lang.ClassCastException: org.polyfrost.oneconfig.api.hypixel.v1.internal.ServerboundHypixelPayload cannot be cast to org.polyfrost.oneconfig.api.hypixel.v1.internal.ClientboundHypixelPayload
	at dev.deftu.omnicore.api.network.codec.StreamCodec$Companion$ofMember$1.encode(StreamCodec.kt:40) ~[StreamCodec$Companion$ofMember$1.class:?]
	at dev.deftu.omnicore.api.client.network.OmniClientNetworking.send(OmniClientNetworking.kt:64) ~[OmniClientNetworking.class:?]
	at org.polyfrost.oneconfig.api.hypixel.v1.internal.HypixelApiInternalsImpl.lambda$registerHypixelApi$2(HypixelApiInternalsImpl.java:100) ~[HypixelApiInternalsImpl.class:?]
	at net.hypixel.modapi.HypixelModAPI.sendPacket(HypixelModAPI.java:191) ~[HypixelModAPI.class:?]
	at org.polyfrost.oneconfig.api.hypixel.v1.HypixelUtils$PlayerInfo.update(HypixelUtils.java:154) ~[HypixelUtils$PlayerInfo.class:?]
	at org.polyfrost.oneconfig.api.hypixel.v1.HypixelUtils$InfoBase.<init>(HypixelUtils.java:100) ~[HypixelUtils$InfoBase.class:?]
	at org.polyfrost.oneconfig.api.hypixel.v1.HypixelUtils$PlayerInfo.<init>(HypixelUtils.java:151) ~[HypixelUtils$PlayerInfo.class:?]
Caused by: java.lang.ClassCastException: org.polyfrost.oneconfig.api.hypixel.v1.internal.ServerboundHypixelPayload cannot be cast to org.polyfrost.oneconfig.api.hypixel.v1.internal.ClientboundHypixelPayload

	at org.polyfrost.oneconfig.api.hypixel.v1.HypixelUtils.getPlayerInfo(HypixelUtils.java:83) ~[HypixelUtils.class:?]
	at org.polyfrost.example.client.command.StatsCommand.handleBridge(StatsCommand.kt:33) ~[StatsCommand.class:?]
	... 37 more

By manually rebuilding OneConfig using this version, HypixelUtils works as intended.

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions