From 74330c9e995597fd0b7f9ae089f1fb3173672fa4 Mon Sep 17 00:00:00 2001 From: Player Date: Mon, 10 May 2021 14:36:18 +0200 Subject: [PATCH] Fix network api throwing on client/server query disconnects --- build.gradle | 2 +- fabric-networking-api-v1/build.gradle | 2 +- .../fabric/mixin/networking/ClientConnectionMixin.java | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 63ebf1a36..67a6b8a23 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ plugins { def ENV = System.getenv() class Globals { - static def baseVersion = "0.34.2" + static def baseVersion = "0.34.3" static def mcVersion = "21w18a" static def yarnVersion = "+build.3" static def loaderVersion = "0.10.5+build.213" diff --git a/fabric-networking-api-v1/build.gradle b/fabric-networking-api-v1/build.gradle index 1c5a42e45..c7364f921 100644 --- a/fabric-networking-api-v1/build.gradle +++ b/fabric-networking-api-v1/build.gradle @@ -1,5 +1,5 @@ archivesBaseName = "fabric-networking-api-v1" -version = getSubprojectVersion(project, "1.0.8") +version = getSubprojectVersion(project, "1.0.9") moduleDependencies(project, [ 'fabric-api-base' diff --git a/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/mixin/networking/ClientConnectionMixin.java b/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/mixin/networking/ClientConnectionMixin.java index ee72347f8..02928dda8 100644 --- a/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/mixin/networking/ClientConnectionMixin.java +++ b/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/mixin/networking/ClientConnectionMixin.java @@ -85,7 +85,9 @@ abstract class ClientConnectionMixin implements ChannelInfoHolder { @Inject(method = "channelInactive", at = @At("HEAD")) private void handleDisconnect(ChannelHandlerContext channelHandlerContext, CallbackInfo ci) throws Exception { - ((NetworkHandlerExtensions) packetListener).getAddon().handleDisconnect(); + if (packetListener instanceof NetworkHandlerExtensions) { // not the case for client/server query + ((NetworkHandlerExtensions) packetListener).getAddon().handleDisconnect(); + } } @Override