Skip to content

Commit

Permalink
[config b1.7.3] fix 'close world' event fired when connecting to server
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceWalkerRS committed Jul 6, 2024
1 parent c6e158c commit efe27dd
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.ornithemc.osl.config.impl.mixin.client;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -15,14 +16,16 @@
@Mixin(Minecraft.class)
public class MinecraftMixin {

@Shadow private World world;

@Inject(
method = "setWorld(Lnet/minecraft/world/World;Ljava/lang/String;Lnet/minecraft/entity/living/player/PlayerEntity;)V",
at = @At(
value = "HEAD"
)
)
private void osl$config$closeWorld(World world, String message, PlayerEntity player, CallbackInfo ci) {
if (world == null && osl$config$startGameDepth == 0) {
if (this.world != null && world == null && osl$config$startGameDepth == 0) {
ConfigInitializer.CLOSE_WORLD.invoker().accept((Minecraft)(Object)this);
}
}
Expand Down

0 comments on commit efe27dd

Please sign in to comment.