Skip to content

Commit 5cadabd

Browse files
committed
Fix Font render crash (#117)
Signed-off-by: Hendrix-Shen <[email protected]>
1 parent 6a1c277 commit 5cadabd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/com/plusls/MasaGadget/impl/gui/ScalableWidgetLabel.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
//#endif
1616

1717
//#if MC < 12000 && MC > 11404
18-
import com.mojang.blaze3d.vertex.Tesselator;
1918
import net.minecraft.client.renderer.MultiBufferSource;
19+
import top.hendrixshen.magiclib.util.minecraft.render.RenderUtil;
2020
//#endif
2121

2222
@Getter
@@ -69,6 +69,9 @@ public void render(
6969
}
7070

7171
renderContext.scale(scale, scale, scale);
72+
//#if MC > 11404
73+
MultiBufferSource.BufferSource immediate = RenderUtil.getBufferSource();
74+
//#endif
7275
FontCompat.of(Minecraft.getInstance().font)
7376
.drawInBatch(
7477
text,
@@ -85,13 +88,16 @@ public void render(
8588
//#if MC > 11904
8689
//$$ renderContext.getGuiComponent().bufferSource(),
8790
//#else
88-
MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()),
91+
immediate,
8992
//#endif
9093
//#endif
9194
FontCompat.DisplayMode.NORMAL,
9295
0,
9396
0xf000f0
9497
);
98+
//#if MC > 11404
99+
immediate.endBatch();
100+
//#endif
95101
}
96102

97103
renderContext.popMatrix();

0 commit comments

Comments
 (0)