Move closing of client world to a proper place

This commit is contained in:
s809
2023-10-28 19:43:22 +05:00
parent 71e3e10280
commit 1bb2ef29f5
3 changed files with 14 additions and 16 deletions
@@ -1,5 +1,6 @@
package com.seibel.distanthorizons.forge.mixins.client;
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
import com.seibel.distanthorizons.core.api.internal.ClientApi;
import net.minecraft.client.multiplayer.ClientPacketListener;
import org.spongepowered.asm.mixin.Mixin;
@@ -12,13 +13,17 @@ public class MixinClientPacketListener
{
// TODO update fabric version as well
@Inject(method = "handleLogin", at = @At("HEAD"))
void onHandleLoginStart(CallbackInfo ci)
{
// not the best way to notify Core that we are no longer in the previous world, but it will have to do for now
ClientApi.INSTANCE.onClientOnlyDisconnected();
}
@Inject(method = "handleLogin", at = @At("RETURN"))
void onHandleLoginEnd(CallbackInfo ci) { ClientApi.INSTANCE.onClientOnlyConnected(); }
#if PRE_MC_1_19_4
@Inject(method = "cleanup", at = @At("HEAD"))
#else
@Inject(method = "close", at = @At("HEAD"))
#endif
void onCleanupStart(CallbackInfo ci)
{
ClientApi.INSTANCE.onClientOnlyDisconnected();
}
}