Fix null pointer when joining some multiverse servers

This commit is contained in:
James Seibel
2023-11-25 11:39:53 -06:00
parent 83c01cabfb
commit dd60c7620f
3 changed files with 14 additions and 11 deletions
@@ -27,9 +27,9 @@ public class MixinClientPacketListener
void onHandleLoginEnd(CallbackInfo ci) { ClientApi.INSTANCE.onClientOnlyConnected(); }
@Inject(method = "handleRespawn", at = @At("HEAD"))
void onHandleRespawnStart(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(level)); }
void onHandleRespawnStart(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(this.level)); }
@Inject(method = "handleRespawn", at = @At("RETURN"))
void onHandleRespawnEnd(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(level)); }
void onHandleRespawnEnd(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level)); }
#if PRE_MC_1_19_4
@Inject(method = "cleanup", at = @At("HEAD"))
@@ -38,10 +38,9 @@ public class MixinClientPacketListener
#endif
void onCleanupStart(CallbackInfo ci)
{
// TODO Is this even needed here?
if (level != null)
if (this.level != null)
{
ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(level));
ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(this.level));
}
ClientApi.INSTANCE.onClientOnlyDisconnected();
}