Minecraftforge: [?bug?] `Minecraft.getCurrentServerData().forgeData == null` if ping to server fails

Created on 20 Aug 2019  路  4Comments  路  Source: MinecraftForge/MinecraftForge


Minecraft Version: 1.13.2 (1.14.x not tested)

Forge Version: 1.13.2-25.0.219

Logs: ---

Steps to Reproduce:

  1. Main-Menu -> Multiplayer
  2. Click Refresh until pinging was failed
  3. Connect to un-pinged server (modded or vanilla)

Description of issue:

At first, I'm not sure if it is a bug. But in my point of view it麓s an unexpected behaviour.

After connecting to the un-pinged server on physically client Minecraft.getCurrentServerData().forgeData == null is set. I use Minecraft.getCurrentServerData().forgeData.type to find out if the client has connected to a vanilla server. But it is not possible if the server was not pinged previously.

Also the client sides clientAcceptedVersions(String serverVersion) from NetworkRegistry::newSimpleChannel(..., Predicate<String> clientAcceptedVersions, ...) is not performed in this case. If the server was pinged then the call looks like clientAcceptedVersions("ALLOWVANILLA.*").

I understand for compatibility it should be possible that the client can try to connect to an unknown/un-pinged server (i.e. firewall blocks something). But I think it should popup a warning to the user that she/he connects to a server without any compatibility-checks.

Current Workaround

My current work-around is to send a SimpleChannel message to the server. If the client receive a reply to it then the server is modded, otherwise not.

Triage

Most helpful comment

1.13.x is no longer developed, does this issue still remain in 1.14.4 forge?

All 4 comments

1.13.x is no longer developed, does this issue still remain in 1.14.4 forge?

This isn't a bug, if the ping fails/was never done, we do not have the data to set.
However, the handshake still happens if it's a modded server so the network tests will still happen.
And you can use NetworkHooks.getConnectionType to find the connection type based on the handshake.

@Orange1861 luuuul, I love you 馃槅 鉂わ笍

@LexManos Thanks for the hint. Works fine for all my test cases 馃槂

Was this page helpful?
0 / 5 - 0 ratings