FabricMC / fabric

Essential hooks for modding with Fabric.
Apache License 2.0
2.2k stars 388 forks source link

1.21 Crash when render some one in `WorldRenderEvents.BLOCK_OUTLINE` event #3882

Open SAGESSE-CN opened 1 week ago

SAGESSE-CN commented 1 week ago

https://github.com/FabricMC/fabric/blob/716be681fb0a5277cd600d92dc63bf26aa79cc6a/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/mixin/client/rendering/WorldRendererMixin.java#L129

the argument vertexConsumer is started on the drawBlockOutline of the RenderLayer.getLines().

and then if some one(yep is me) use getBuffer and RenderLayer.getTripwire() in WorldRenderEvents.BLOCK_OUTLINE event, the vertexConsumer will immediately end.

although fabric calls getBuffer with RenderLayer.getLines() again, but it not the same object (1.21 changed).

so the vertexConsumer still is end state, the game will throw java.lang.IllegalStateException: Not building! and crash.

logs demo.zip