Skip to content

Commit

Permalink
Fix exit on main thread deadlock (#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
IzzelAliz committed Mar 10, 2024
1 parent 7554962 commit 0f2ca4b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.izzel.arclight.common.mixin.core.server;

import net.minecraft.server.MinecraftServer;
import org.spigotmc.AsyncCatcher;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(targets = "net/minecraft/server/Main$1")
public class Main_ServerShutdownThreadMixin {

@Redirect(method = "run", at = @At(value = "INVOKE", remap = true, target = "Lnet/minecraft/server/MinecraftServer;halt(Z)V"))
private void arclight$shutdown(MinecraftServer instance, boolean b) {
AsyncCatcher.enabled = false;
instance.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"network.rcon.RConConsoleSourceMixin",
"server.BootstrapMixin",
"server.CustomServerBossInfoMixin",
"server.Main_ServerShutdownThreadMixin",
"server.MinecraftServerMixin",
"server.PlayerAdvancementsMixin",
"server.ServerFunctionManagerMixin",
Expand Down
1 change: 1 addition & 0 deletions arclight-forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ task runProdServer(type: JavaExec) {
classpath = files(tasks.jar)
systemProperties 'terminal.ansi': 'true'
systemProperties 'mixin.debug.export': 'true'
systemProperties 'mixin.dumpTargetOnFailure': 'true'
systemProperties 'arclight.alwaysExtract': 'true'
systemProperties 'arclight.remapper.dump': './.mixin.out/plugin_classes'
workingDir System.env.ARCLIGHT_PROD_DIR ?: file('run_prod')
Expand Down

0 comments on commit 0f2ca4b

Please sign in to comment.