Cyclops Core

Cyclops Core

121M Downloads

NPE fix for 1.20.1

DeityLamb opened this issue · 6 comments

commented

Issue type:

  • 🐛 Bug

Short description:

can you please fix this npe for 1.20.1 too?
93dafb4

https://github.com/CyclopsMC/CyclopsCore/blob/master-1.20-lts/src/main/java/org/cyclops/cyclopscore/network/PacketHandler.java#L104

Steps to reproduce the problem:

You’ve already fixed it, so I assume you know 🐈‍

Expected behaviour:

works


Versions:

Latest release on curseforge for 1.20.1
https://www.curseforge.com/minecraft/mc-mods/cyclops-core/files/6602273

  • This mod:
  • Minecraft: 1.20.1
  • Mod loader version:

Log file:

commented

Thanks for reporting!

commented

Could you share the crashlog?
Because there are different places this could be going wrong.
So we need to make sure the right thing is fixed.

commented

@rubensworks

This error only shows up on the DisconnectScreen and nowhere else (it doesn’t appear in stdout/stderr).
It also only occurs under certain conditions, most likely just a race condition.

I ran the client through the debugger, caught the NPE, and got the stack trace, so the issue really is in this spot. I’d share screenshots, but I’m too lazy to reproduce it all again :)
I was hitting the error roughly 1 out of 40 logins, but for some players on my server it was happening constantly, and they could only log in after ~30–40 attempts.

I temporarily built the library with an NPE fix in that spot, and after that it hasn’t occurred for anyone (~7 people who had the issue confirmed this)

commented

@DeityLamb This fix requires changes when backporting. So to ensure the right things is fixed, I do need the stacktrace.
Because the are small, but significant, nuances in that part of the code across MC versions.

However, if you already have a fix that works in production for you, could you share the changes you applied? I can then analyze them, and include them here if appropriate.

commented

https://github.com/CyclopsMC/CyclopsCore/blob/master-1.20-lts/src/main/java/org/cyclops/cyclopscore/network/PacketHandler.java#L104

@OnlyIn(value=Dist.CLIENT)
public void handlePacketClient(NetworkEvent.Context context, PacketBase packet) {
    packet.actionClient(
        Minecraft.getInstance().player != null 
          ? Minecraft.getInstance().player.level()
          : null,

      Minecraft.getInstance().player
    );
}

I didn’t do this for the server because I didn’t need to, but maybe it has the same problem there

GitHub
Minecraft library mod for EvilCraft, Integrated Dynamics and others. - CyclopsMC/CyclopsCore
commented

Knowing that the issue only occurs client-side for you definitely helps.
Thanks for the input!