Skip to content

Commit

Permalink
Fix ClientConfigurationNetworkAddon.handleReady() being called too la…
Browse files Browse the repository at this point in the history
…te. (#3331)

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.
  • Loading branch information
modmuss50 authored Sep 23, 2023
1 parent b1913a6 commit 74a33ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ allprojects {
}
}

loom.runs.configureEach {
vmArg("-enableassertions")
}

allprojects.each { p ->
if (project.name == "deprecated") {
return
Expand Down Expand Up @@ -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"
)
}
}
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void initAddon(CallbackInfo ci) {
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();
}
Expand Down

0 comments on commit 74a33ae

Please sign in to comment.