HypixelDev / ModAPI

Hypixel Mod API for interfacing with the Hypixel Server via the Minecraft Plugin Message system.
MIT License
83 stars 10 forks source link

Unable to receive Event Packets (Player Location). #32

Closed HacktheTime closed 5 months ago

HacktheTime commented 5 months ago

I don't understand why I am not able to get a callback on any packets I did not directly request like PlayerLocation.

I am aware that they need to be subscribed and know that I might need to register them before the Client joins the Server. However, I registered it and tested that is indeed registered even before I joined the Server. Even rejoining the Server does not seem to fix the issue. I just don't get that packet on Main (Production) Server. If I, for example, request a Party Info Packet I DO get a Reponse . While I am not certain since it is quite some time back that I joined Alpha with the Mod as far as I remember it worked there for some reason.

Minecraft Fabric 1.20.6 Mod API Version: 0.5.0

I set a breakpoint in the Handling in the Mod API itself. Unfortunately only in the method header since I am unable to import the source for whatever reason. Reason below. Could be a problem with the Gradle configuration though. It is currently problematic and only works when starting in the IDE. public void handle(net.hypixel.modapi.packet.ClientboundHypixelPacket packet) in order to see which packets are received.

I get a Hello Packet as well as replies for packets I sent. However, no PlayerLocation packets when swapping lobbies. I remember joining Alpha and as far as I remember it worked there. I have had this problem for a while now. At least since 0.4.0 if not longer. I assumed it was a incorrect implementation on my side but at this point, I don't think it is me. I require Mod API in dependencies and it is up to date using latest.release.

All Code was checked whether it gets called via breakpoints,

public void register() {
        HypixelModAPI.getInstance().subscribeToEventPacket(ClientboundLocationPacket.class);
        HypixelModAPI.getInstance().registerHandler(ClientboundHelloPacket.class,this::onHelloEvent);
        HypixelModAPI.getInstance().registerHandler(ClientboundLocationPacket.class,this::onLocationEvent);
        HypixelModAPI.getInstance().registerHandler(ClientboundPingPacket.class,this::onPingPacket);
        HypixelModAPI.getInstance().registerHandler(ClientboundPlayerInfoPacket.class,this::onPlayerInfoPacket);
        HypixelModAPI.getInstance().registerHandler(ClientboundPartyInfoPacket.class,this::onPartyInfoPacket);
        HypixelModAPI.getInstance().registerHandler(ClientboundLocationPacket.class,this::onLocationEvent);
    }

If it is needed the Project can be found here

Source Download Error:

Execution failed for task ':common:ijDownloadSourcesf72cc370-269'.
> Could not resolve all files for configuration ':common:downloadSources_2c5ee321-b5cf-4fbf-8955-079a640af27d'.
   > Could not find mod-api-0.5.0-sources.jar (net.hypixel:mod-api:0.5.0).
     Searched in the following locations:
         https://repo.hypixel.net/repository/Hypixel/net/hypixel/mod-api/0.5.0/mod-api-0.5.0-sources.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
ConnorLinfoot commented 5 months ago

It looks like another case of the payload being sent before the login packet, and the client does not yet have a handler for sending a packet. I wouldn't say I like that the client just can't send custom payloads before the login packet, but since both 1.8 and even the latest versions with the fabric API have this issue, we will look at making a change on the server side to send the packet after the first login is sent to the client.

This issue wasn't previously noticed, as the login sequence for the staff team differs compared to players. So the hello packet is sent later for me during testing.

ConnorLinfoot commented 5 months ago

This issue should be resolved now on the production network

HacktheTime commented 5 months ago

This issue should be resolved now on the production network

It is. It worked since yesterday.

HacktheTime commented 5 months ago

This issue should be resolved now on the production network

For internal Event usage it would be good to know when the Lobby is fully loaded for example Tablist is fully loaded etc. I could imagine that a mod API packet for that at the end of the initialization phase would be good. Possibly the LocationEventPacket?

→ possibly move the packet to the end of the loading phase?

ConnorLinfoot commented 5 months ago

This issue should be resolved now on the production network

For internal Event usage it would be good to know when the Lobby is fully loaded for example Tablist is fully loaded etc. I could imagine that a mod API packet for that at the end of the initialization phase would be good. Possibly the LocationEventPacket?

→ possibly move the packet to the end of the loading phase?

The proxy doesn't know any context as to when a lobby is considered loaded, nor does the lobby in many cases, because there is no concept of being fully loaded.