diff --git a/build.gradle.kts b/build.gradle.kts index 4ed15fe..4a02ade 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,6 +40,8 @@ dependencies { modImplementation("dev.ithundxr.createnumismatics:CreateNumismatics-fabric-1.20.1:1.0.6+fabric-mc1.20.1") modCompileOnly("maven.modrinth:copycats:fabric.1.20.1-1.3.2") + + modCompileOnly("maven.modrinth:appleskin:2.5.1+mc1.20") } tasks.processResources { diff --git a/src/main/java/dev/ithundxr/railwaystweaks/mixin/compat/appleskin/SyncHandlerMixin.java b/src/main/java/dev/ithundxr/railwaystweaks/mixin/compat/appleskin/SyncHandlerMixin.java new file mode 100644 index 0000000..5833d25 --- /dev/null +++ b/src/main/java/dev/ithundxr/railwaystweaks/mixin/compat/appleskin/SyncHandlerMixin.java @@ -0,0 +1,19 @@ +package dev.ithundxr.railwaystweaks.mixin.compat.appleskin; + +import net.minecraft.server.level.ServerPlayer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import squeek.appleskin.network.SyncHandler; + +@Pseudo +@Mixin(SyncHandler.class) +public class SyncHandlerMixin { + @Inject(method = "onPlayerUpdate", at = @At("HEAD"), cancellable = true) + private static void railwaysTweaks$fixAppleSkinCrash(ServerPlayer player, CallbackInfo ci) { + if (player.connection == null) + ci.cancel(); + } +} diff --git a/src/main/resources/railwaystweaks.mixins.json b/src/main/resources/railwaystweaks.mixins.json index e86fd69..e651de0 100644 --- a/src/main/resources/railwaystweaks.mixins.json +++ b/src/main/resources/railwaystweaks.mixins.json @@ -4,9 +4,10 @@ "package": "dev.ithundxr.railwaystweaks.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "ServerPlayerMixin", "LivingEntityMixin", - "ServerStatusPacketListenerImplMixin" + "ServerPlayerMixin", + "ServerStatusPacketListenerImplMixin", + "compat.appleskin.SyncHandlerMixin" ], "client": [ "client.HttpTextureMixin",