Skip to content

Commit 7dbb926

Browse files
committed
Forceload RenderType/RenderStateShard on the main thread during startup
Fixes launch deadlock with Registrate/Quark
1 parent 4397f27 commit 7dbb926

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.embeddedt.modernfix.forge.mixin.core;
2+
3+
import net.minecraft.client.renderer.RenderType;
4+
import net.minecraft.server.Bootstrap;
5+
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
6+
import org.spongepowered.asm.mixin.Mixin;
7+
import org.spongepowered.asm.mixin.injection.At;
8+
import org.spongepowered.asm.mixin.injection.Inject;
9+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
10+
11+
@Mixin(Bootstrap.class)
12+
@ClientOnlyMixin
13+
public class BootstrapClientMixin {
14+
/**
15+
* Hack to workaround RenderStateShard deadlock (by loading it early on a single thread). We use validate
16+
* here to ensure Forge registries are initialized.
17+
*/
18+
@Inject(method = "validate", at = @At("HEAD"))
19+
private static void loadClientClasses(CallbackInfo ci) {
20+
RenderType.solid();
21+
}
22+
}

0 commit comments

Comments
 (0)