Fix ClientConfigurationNetworkAddon.handleReady() being called too late. ()

This fixes a crash when assertions are enabled.
Also fixes ClientConfigurationConnectionEvents.READY being called at the incorrect time.
Assertions have also been enabled for all Fabric API run configs.
This commit is contained in:
modmuss 2023-09-23 10:08:54 +01:00 committed by GitHub
parent b1913a6ae6
commit 74a33ae79d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions
build.gradle
fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/mixin/networking/client

View file

@ -195,6 +195,10 @@ allprojects {
}
}
loom.runs.configureEach {
vmArg("-enableassertions")
}
allprojects.each { p ->
if (project.name == "deprecated") {
return
@ -501,7 +505,8 @@ tasks.register('runProductionAutoTestClient', JavaExec) {
jvmArgs(
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
"-Dfabric.autoTest"
"-Dfabric.autoTest",
"-enableassertions"
)
}
}
@ -532,7 +537,8 @@ tasks.register('runProductionAutoTestServer', JavaExec) {
jvmArgs(
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
"-Dfabric.autoTest"
"-Dfabric.autoTest",
"-enableassertions"
)
args("nogui")

View file

@ -51,7 +51,7 @@ public abstract class ClientConfigurationNetworkHandlerMixin extends ClientCommo
this.addon.lateInit();
}
@Inject(method = "onReady", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;setPacketListener(Lnet/minecraft/network/listener/PacketListener;)V"))
@Inject(method = "onReady", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;setPacketListener(Lnet/minecraft/network/listener/PacketListener;)V", shift = At.Shift.BEFORE))
public void onReady(ReadyS2CPacket packet, CallbackInfo ci) {
this.addon.handleReady();
}