44import com .google .common .util .concurrent .ListenableFuture ;
55import com .llamalad7 .mixinextras .injector .wrapoperation .Operation ;
66import com .llamalad7 .mixinextras .injector .wrapoperation .WrapOperation ;
7+ import mods .Hileb .optirefine .library .cursedmixinextensions .annotations .AccessibleOperation ;
8+ import org .objectweb .asm .Opcodes ;
79import net .minecraft .client .Minecraft ;
810import net .minecraftforge .client .resource .SelectiveReloadStateHandler ;
911import net .minecraftforge .client .resource .VanillaResourceType ;
@@ -18,7 +20,9 @@ public abstract class MixinShaders {
1820 @ WrapOperation (method = "loadShaderPack" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/Minecraft;func_175603_A()Lcom/google/common/util/concurrent/ListenableFuture;" ))
1921 private static ListenableFuture <Object > optiRefine$selectiveRefresh (Minecraft mc , Operation <ListenableFuture <Object >> original ) {
2022 // SelectiveReloadStateHandler state is read at reload time, so run the reload
21- // synchronously inside begin/end (async submission would lose the predicate).
23+ // OptiFine updates BLOCK/ITEM before scheduling the resource reload. The Cleanroom
24+ // reload path immediately rebuilds RenderChunk VBOs, so preserve that ordering here.
25+ DefaultVertexFormats_updateVertexFormats ();
2226 SelectiveReloadStateHandler .INSTANCE .beginReload (type -> type == VanillaResourceType .TEXTURES || type == VanillaResourceType .MODELS );
2327 try {
2428 mc .refreshResources ();
@@ -27,4 +31,8 @@ public abstract class MixinShaders {
2731 }
2832 return Futures .immediateFuture (null );
2933 }
34+
35+ @ SuppressWarnings ("MissingUnique" )
36+ @ AccessibleOperation (opcode = Opcodes .INVOKESTATIC , desc = "net.minecraft.client.renderer.vertex.DefaultVertexFormats updateVertexFormats ()V" )
37+ private static native void DefaultVertexFormats_updateVertexFormats ();
3038}
0 commit comments