99 */
1010package org .enginehub .worldeditcui .render ;
1111
12+ import com .mojang .blaze3d .opengl .GlStateManager ;
1213import com .mojang .blaze3d .pipeline .RenderPipeline ;
1314import com .mojang .blaze3d .systems .RenderSystem ;
1415import com .mojang .blaze3d .vertex .BufferBuilder ;
15- import com .mojang .blaze3d .vertex .BufferUploader ;
1616import com .mojang .blaze3d .vertex .Tesselator ;
1717import com .mojang .blaze3d .vertex .VertexFormat ;
18- import net .minecraft .client .renderer .MultiBufferSource ;
1918import org .jetbrains .annotations .Nullable ;
2019import org .joml .Vector3f ;
2120import org .lwjgl .opengl .GL11 ;
@@ -92,7 +91,7 @@ public boolean apply(final LineStyle line, final RenderStyle.RenderType type) {
9291 this .builder = Tesselator .getInstance ().begin (this .activeRenderType .mode , this .activeRenderType .format );
9392 }
9493 LineWidth .set (this .lastLineWidth = line .lineWidth );
95- RenderSystem . depthFunc (this .lastDepthFunc = line .renderType .depthFunc ());
94+ GlStateManager . _depthFunc (this .lastDepthFunc = line .renderType .depthFunc ());
9695 }
9796 return true ;
9897 }
@@ -228,10 +227,10 @@ public void flush() {
228227 this .canFlush = false ;
229228 this .preFlush .run ();
230229 try {
231- if (this .activeRenderType ! = null ) {
232- RenderSystem . setShader ( this . activeRenderType . renderPipeline );
230+ if (this .activeRenderType = = null ) {
231+ throw new IllegalStateException ( "Active type cannot be null" );
233232 }
234- BufferUploader . drawWithShader (this .builder .buildOrThrow ());
233+ this . activeRenderType . type . draw (this .builder .buildOrThrow ());
235234 } finally {
236235 this .postFlush .run ();
237236 this .builder = null ;
@@ -270,13 +269,13 @@ public static class RenderType {
270269 private final VertexFormat .Mode mode ;
271270 private final VertexFormat format ;
272271 private final boolean hasNormals ;
273- private final RenderPipeline renderPipeline ;
272+ private final net . minecraft . client . renderer . RenderType type ;
274273
275- public RenderType (final VertexFormat .Mode mode , final VertexFormat format , @ Nullable final RenderPipeline renderPipeline ) {
274+ public RenderType (final VertexFormat .Mode mode , final VertexFormat format , @ Nullable final net . minecraft . client . renderer . RenderType renderPipeline ) {
276275 this .mode = mode ;
277276 this .format = format ;
278277 this .hasNormals = format .getElementAttributeNames ().contains ("Normal" );
279- this .renderPipeline = renderPipeline ;
278+ this .type = renderPipeline ;
280279 }
281280
282281 VertexFormat .Mode mode () {
@@ -291,11 +290,6 @@ boolean hasNormals() {
291290 return this .hasNormals ;
292291 }
293292
294- @ Nullable
295- RenderPipeline shader () {
296- return this .renderPipeline ;
297- }
298-
299293 boolean mustFlushAfter (final RenderType previous ) {
300294 return previous .mode != this .mode || !Objects .equals (previous .format , this .format );
301295 }
0 commit comments