Class BufferBuilder

All Implemented Interfaces:
BufferVertexConsumer, VertexConsumer

@Environment(CLIENT) public class BufferBuilder extends FixedColorVertexConsumer implements BufferVertexConsumer
Builds a buffer of primitives and optionally sorts them by the distance from the camera.

This builder can sort quad primitives. It sorts them by the distance between the camera position and the center of the quad. Sorting is required when drawing translucent objects because they have to be drawn in back-to-front order. See Transparency Sorting - OpenGL Wiki.

For LINES and LINE_STRIP draw modes, this builder duplicates every vertex in a line to produce a quad with zero area. See GameRenderer.getRenderTypeLinesProgram().

Mappings:
Namespace Name
named net/minecraft/client/render/BufferBuilder
intermediary net/minecraft/class_287
official ezv
  • Field Details Link icon

    • ROUND_SIZE_CHANGE Link icon

      private static final int ROUND_SIZE_CHANGE
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named ROUND_SIZE_CHANGE Lnet/minecraft/client/render/BufferBuilder;ROUND_SIZE_CHANGE:I
      intermediary field_46839 Lnet/minecraft/class_287;field_46839:I
      official f Lezv;f:I
    • LOGGER Link icon

      private static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      named LOGGER Lnet/minecraft/client/render/BufferBuilder;LOGGER:Lorg/slf4j/Logger;
      intermediary field_1557 Lnet/minecraft/class_287;field_1557:Lorg/slf4j/Logger;
      official g Lezv;g:Lorg/slf4j/Logger;
    • buffer Link icon

      private ByteBuffer buffer
      Mappings:
      Namespace Name Mixin selector
      named buffer Lnet/minecraft/client/render/BufferBuilder;buffer:Ljava/nio/ByteBuffer;
      intermediary field_1555 Lnet/minecraft/class_287;field_1555:Ljava/nio/ByteBuffer;
      official h Lezv;h:Ljava/nio/ByteBuffer;
    • closed Link icon

      private boolean closed
      Mappings:
      Namespace Name Mixin selector
      named closed Lnet/minecraft/client/render/BufferBuilder;closed:Z
      intermediary field_46840 Lnet/minecraft/class_287;field_46840:Z
      official i Lezv;i:Z
    • builtBufferCount Link icon

      private int builtBufferCount
      Mappings:
      Namespace Name Mixin selector
      named builtBufferCount Lnet/minecraft/client/render/BufferBuilder;builtBufferCount:I
      intermediary field_39061 Lnet/minecraft/class_287;field_39061:I
      official j Lezv;j:I
    • batchOffset Link icon

      private int batchOffset
      Mappings:
      Namespace Name Mixin selector
      named batchOffset Lnet/minecraft/client/render/BufferBuilder;batchOffset:I
      intermediary field_39062 Lnet/minecraft/class_287;field_39062:I
      official k Lezv;k:I
    • elementOffset Link icon

      private int elementOffset
      Mappings:
      Namespace Name Mixin selector
      named elementOffset Lnet/minecraft/client/render/BufferBuilder;elementOffset:I
      intermediary field_20884 Lnet/minecraft/class_287;field_20884:I
      official l Lezv;l:I
    • vertexCount Link icon

      private int vertexCount
      Mappings:
      Namespace Name Mixin selector
      named vertexCount Lnet/minecraft/client/render/BufferBuilder;vertexCount:I
      intermediary field_1554 Lnet/minecraft/class_287;field_1554:I
      official m Lezv;m:I
    • currentElement Link icon

      @Nullable private @Nullable VertexFormatElement currentElement
      Mappings:
      Namespace Name Mixin selector
      named currentElement Lnet/minecraft/client/render/BufferBuilder;currentElement:Lnet/minecraft/client/render/VertexFormatElement;
      intermediary field_1558 Lnet/minecraft/class_287;field_1558:Lnet/minecraft/class_296;
      official n Lezv;n:Lfag;
    • currentElementId Link icon

      private int currentElementId
      Mappings:
      Namespace Name Mixin selector
      named currentElementId Lnet/minecraft/client/render/BufferBuilder;currentElementId:I
      intermediary field_1553 Lnet/minecraft/class_287;field_1553:I
      official o Lezv;o:I
    • format Link icon

      private VertexFormat format
      Mappings:
      Namespace Name Mixin selector
      named format Lnet/minecraft/client/render/BufferBuilder;format:Lnet/minecraft/client/render/VertexFormat;
      intermediary field_1565 Lnet/minecraft/class_287;field_1565:Lnet/minecraft/class_293;
      official p Lezv;p:Lfaf;
    • drawMode Link icon

      private VertexFormat.DrawMode drawMode
      Mappings:
      Namespace Name Mixin selector
      named drawMode Lnet/minecraft/client/render/BufferBuilder;drawMode:Lnet/minecraft/client/render/VertexFormat$DrawMode;
      intermediary field_1567 Lnet/minecraft/class_287;field_1567:Lnet/minecraft/class_293$class_5596;
      official q Lezv;q:Lfaf$b;
    • canSkipElementChecks Link icon

      private boolean canSkipElementChecks
      Whether this builder is aware of the vertex format and can skip checks for the current target element while building a vertex in vertex(float, float, float, float, float, float, float, float, float, int, int, float, float, float).
      Mappings:
      Namespace Name Mixin selector
      named canSkipElementChecks Lnet/minecraft/client/render/BufferBuilder;canSkipElementChecks:Z
      intermediary field_21594 Lnet/minecraft/class_287;field_21594:Z
      official r Lezv;r:Z
    • hasOverlay Link icon

      private boolean hasOverlay
      Mappings:
      Namespace Name Mixin selector
      named hasOverlay Lnet/minecraft/client/render/BufferBuilder;hasOverlay:Z
      intermediary field_21595 Lnet/minecraft/class_287;field_21595:Z
      official s Lezv;s:Z
    • building Link icon

      private boolean building
      Mappings:
      Namespace Name Mixin selector
      named building Lnet/minecraft/client/render/BufferBuilder;building:Z
      intermediary field_1556 Lnet/minecraft/class_287;field_1556:Z
      official t Lezv;t:Z
    • sortingPrimitiveCenters Link icon

      @Nullable private @Nullable Vector3f[] sortingPrimitiveCenters
      Mappings:
      Namespace Name Mixin selector
      named sortingPrimitiveCenters Lnet/minecraft/client/render/BufferBuilder;sortingPrimitiveCenters:[Lorg/joml/Vector3f;
      intermediary field_27348 Lnet/minecraft/class_287;field_27348:[Lorg/joml/Vector3f;
      official u Lezv;u:[Lorg/joml/Vector3f;
    • sorter Link icon

      Mappings:
      Namespace Name Mixin selector
      named sorter Lnet/minecraft/client/render/BufferBuilder;sorter:Lcom/mojang/blaze3d/systems/VertexSorter;
      intermediary field_43358 Lnet/minecraft/class_287;field_43358:Lnet/minecraft/class_8251;
      official v Lezv;v:Lfai;
    • hasNoVertexBuffer Link icon

      private boolean hasNoVertexBuffer
      Mappings:
      Namespace Name Mixin selector
      named hasNoVertexBuffer Lnet/minecraft/client/render/BufferBuilder;hasNoVertexBuffer:Z
      intermediary field_27352 Lnet/minecraft/class_287;field_27352:Z
      official w Lezv;w:Z
  • Constructor Details Link icon

    • BufferBuilder Link icon

      public BufferBuilder(int initialCapacity)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/client/render/BufferBuilder;<init>(I)V
      intermediary <init> Lnet/minecraft/class_287;<init>(I)V
      official <init> Lezv;<init>(I)V
  • Method Details Link icon

    • grow Link icon

      private void grow()
      Mappings:
      Namespace Name Mixin selector
      named grow Lnet/minecraft/client/render/BufferBuilder;grow()V
      intermediary method_22892 Lnet/minecraft/class_287;method_22892()V
      official m Lezv;m()V
    • grow Link icon

      private void grow(int size)
      Mappings:
      Namespace Name Mixin selector
      named grow Lnet/minecraft/client/render/BufferBuilder;grow(I)V
      intermediary method_1335 Lnet/minecraft/class_287;method_1335(I)V
      official d Lezv;d(I)V
    • setSorter Link icon

      public void setSorter(VertexSorter sorter)
      Mappings:
      Namespace Name Mixin selector
      named setSorter Lnet/minecraft/client/render/BufferBuilder;setSorter(Lcom/mojang/blaze3d/systems/VertexSorter;)V
      intermediary method_49904 Lnet/minecraft/class_287;method_49904(Lnet/minecraft/class_8251;)V
      official a Lezv;a(Lfai;)V
    • getSortingData Link icon

      public BufferBuilder.TransparentSortingData getSortingData()
      Mappings:
      Namespace Name Mixin selector
      named getSortingData Lnet/minecraft/client/render/BufferBuilder;getSortingData()Lnet/minecraft/client/render/BufferBuilder$TransparentSortingData;
      intermediary method_1334 Lnet/minecraft/class_287;method_1334()Lnet/minecraft/class_287$class_5594;
      official a Lezv;a()Lezv$c;
    • ensureNotClosed Link icon

      private void ensureNotClosed()
      Mappings:
      Namespace Name Mixin selector
      named ensureNotClosed Lnet/minecraft/client/render/BufferBuilder;ensureNotClosed()V
      intermediary method_54559 Lnet/minecraft/class_287;method_54559()V
      official n Lezv;n()V
    • beginSortedIndexBuffer Link icon

      public void beginSortedIndexBuffer(BufferBuilder.TransparentSortingData state)
      Mappings:
      Namespace Name Mixin selector
      named beginSortedIndexBuffer Lnet/minecraft/client/render/BufferBuilder;beginSortedIndexBuffer(Lnet/minecraft/client/render/BufferBuilder$TransparentSortingData;)V
      intermediary method_1324 Lnet/minecraft/class_287;method_1324(Lnet/minecraft/class_287$class_5594;)V
      official a Lezv;a(Lezv$c;)V
    • begin Link icon

      public void begin(VertexFormat.DrawMode drawMode, VertexFormat format)
      Mappings:
      Namespace Name Mixin selector
      named begin Lnet/minecraft/client/render/BufferBuilder;begin(Lnet/minecraft/client/render/VertexFormat$DrawMode;Lnet/minecraft/client/render/VertexFormat;)V
      intermediary method_1328 Lnet/minecraft/class_287;method_1328(Lnet/minecraft/class_293$class_5596;Lnet/minecraft/class_293;)V
      official a Lezv;a(Lfaf$b;Lfaf;)V
    • setFormat Link icon

      private void setFormat(VertexFormat format)
      Mappings:
      Namespace Name Mixin selector
      named setFormat Lnet/minecraft/client/render/BufferBuilder;setFormat(Lnet/minecraft/client/render/VertexFormat;)V
      intermediary method_23918 Lnet/minecraft/class_287;method_23918(Lnet/minecraft/class_293;)V
      official a Lezv;a(Lfaf;)V
    • getIndexConsumer Link icon

      private IntConsumer getIndexConsumer(int offset, VertexFormat.IndexType indexType)
      Mappings:
      Namespace Name Mixin selector
      named getIndexConsumer Lnet/minecraft/client/render/BufferBuilder;getIndexConsumer(ILnet/minecraft/client/render/VertexFormat$IndexType;)Lit/unimi/dsi/fastutil/ints/IntConsumer;
      intermediary method_31949 Lnet/minecraft/class_287;method_31949(ILnet/minecraft/class_293$class_5595;)Lit/unimi/dsi/fastutil/ints/IntConsumer;
      official a Lezv;a(ILfaf$a;)Lit/unimi/dsi/fastutil/ints/IntConsumer;
    • buildPrimitiveCenters Link icon

      private Vector3f[] buildPrimitiveCenters()
      Mappings:
      Namespace Name Mixin selector
      named buildPrimitiveCenters Lnet/minecraft/client/render/BufferBuilder;buildPrimitiveCenters()[Lorg/joml/Vector3f;
      intermediary method_31954 Lnet/minecraft/class_287;method_31954()[Lorg/joml/Vector3f;
      official o Lezv;o()[Lorg/joml/Vector3f;
    • writeSortedIndices Link icon

      private void writeSortedIndices(VertexFormat.IndexType indexType)
      Mappings:
      Namespace Name Mixin selector
      named writeSortedIndices Lnet/minecraft/client/render/BufferBuilder;writeSortedIndices(Lnet/minecraft/client/render/VertexFormat$IndexType;)V
      intermediary method_31950 Lnet/minecraft/class_287;method_31950(Lnet/minecraft/class_293$class_5595;)V
      official a Lezv;a(Lfaf$a;)V
    • isBatchEmpty Link icon

      public boolean isBatchEmpty()
      Mappings:
      Namespace Name Mixin selector
      named isBatchEmpty Lnet/minecraft/client/render/BufferBuilder;isBatchEmpty()Z
      intermediary method_43574 Lnet/minecraft/class_287;method_43574()Z
      official b Lezv;b()Z
    • endNullable Link icon

      Builds a buffer if there are vertices in the current batch and resets the building state.
      Returns:
      the built buffer if there are vertices, otherwise null
      Throws:
      IllegalStateException - if this builder has not begun building
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named endNullable Lnet/minecraft/client/render/BufferBuilder;endNullable()Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;
      intermediary method_43575 Lnet/minecraft/class_287;method_43575()Lnet/minecraft/class_287$class_7433;
      official c Lezv;c()Lezv$b;
    • end Link icon

      Builds a buffer from the current batch and resets the building state.

      Unlike endNullable(), this always builds a buffer even if there are no vertices in the current batch.

      Returns:
      the buffer built from the current batch
      Throws:
      IllegalStateException - if this builder has not begun building
      Mappings:
      Namespace Name Mixin selector
      named end Lnet/minecraft/client/render/BufferBuilder;end()Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;
      intermediary method_1326 Lnet/minecraft/class_287;method_1326()Lnet/minecraft/class_287$class_7433;
      official d Lezv;d()Lezv$b;
    • ensureBuilding Link icon

      private void ensureBuilding()
      Mappings:
      Namespace Name Mixin selector
      named ensureBuilding Lnet/minecraft/client/render/BufferBuilder;ensureBuilding()V
      intermediary method_43577 Lnet/minecraft/class_287;method_43577()V
      official p Lezv;p()V
    • build Link icon

      private BufferBuilder.BuiltBuffer build()
      Mappings:
      Namespace Name Mixin selector
      named build Lnet/minecraft/client/render/BufferBuilder;build()Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;
      intermediary method_43578 Lnet/minecraft/class_287;method_43578()Lnet/minecraft/class_287$class_7433;
      official q Lezv;q()Lezv$b;
    • resetBuilding Link icon

      private void resetBuilding()
      Mappings:
      Namespace Name Mixin selector
      named resetBuilding Lnet/minecraft/client/render/BufferBuilder;resetBuilding()V
      intermediary method_43579 Lnet/minecraft/class_287;method_43579()V
      official r Lezv;r()V
    • putByte Link icon

      public void putByte(int index, byte value)
      Specified by:
      putByte in interface BufferVertexConsumer
      Mappings:
      Namespace Name Mixin selector
      named putByte Lnet/minecraft/client/render/BufferVertexConsumer;putByte(IB)V
      intermediary method_22896 Lnet/minecraft/class_4584;method_22896(IB)V
      official a Lezx;a(IB)V
    • putShort Link icon

      public void putShort(int index, short value)
      Specified by:
      putShort in interface BufferVertexConsumer
      Mappings:
      Namespace Name Mixin selector
      named putShort Lnet/minecraft/client/render/BufferVertexConsumer;putShort(IS)V
      intermediary method_22898 Lnet/minecraft/class_4584;method_22898(IS)V
      official a Lezx;a(IS)V
    • putFloat Link icon

      public void putFloat(int index, float value)
      Specified by:
      putFloat in interface BufferVertexConsumer
      Mappings:
      Namespace Name Mixin selector
      named putFloat Lnet/minecraft/client/render/BufferVertexConsumer;putFloat(IF)V
      intermediary method_22897 Lnet/minecraft/class_4584;method_22897(IF)V
      official a Lezx;a(IF)V
    • next Link icon

      public void next()
      Starts consuming the next vertex.

      This method must be called after specifying all elements in a vertex.

      Specified by:
      next in interface VertexConsumer
      Mappings:
      Namespace Name Mixin selector
      named next Lnet/minecraft/client/render/VertexConsumer;next()V
      intermediary method_1344 Lnet/minecraft/class_4588;method_1344()V
      official e Lfae;e()V
    • nextElement Link icon

      public void nextElement()
      Specified by:
      nextElement in interface BufferVertexConsumer
      Mappings:
      Namespace Name Mixin selector
      named nextElement Lnet/minecraft/client/render/BufferVertexConsumer;nextElement()V
      intermediary method_1325 Lnet/minecraft/class_4584;method_1325()V
      official f Lezx;f()V
    • color Link icon

      public VertexConsumer color(int red, int green, int blue, int alpha)
      Specifies the color element of the current vertex.
      Specified by:
      color in interface BufferVertexConsumer
      Specified by:
      color in interface VertexConsumer
      Returns:
      this consumer, for chaining
      Throws:
      IllegalStateException - if this consumer is not currently accepting a color element or if a color has been set in FixedColorVertexConsumer.fixedColor(int, int, int, int).
      Mappings:
      Namespace Name Mixin selector
      named color Lnet/minecraft/client/render/VertexConsumer;color(IIII)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_1336 Lnet/minecraft/class_4588;method_1336(IIII)Lnet/minecraft/class_4588;
      official a Lfae;a(IIII)Lfae;
    • vertex Link icon

      public void vertex(float x, float y, float z, float red, float green, float blue, float alpha, float u, float v, int overlay, int light, float normalX, float normalY, float normalZ)
      Specifies the position, color, texture, overlay, light, and normal elements of the current vertex and starts consuming the next vertex.
      Specified by:
      vertex in interface VertexConsumer
      Throws:
      IllegalStateException - if a color has been set in FixedColorVertexConsumer.fixedColor(int, int, int, int).
      Mappings:
      Namespace Name Mixin selector
      named vertex Lnet/minecraft/client/render/VertexConsumer;vertex(FFFFFFFFFIIFFF)V
      intermediary method_23919 Lnet/minecraft/class_4588;method_23919(FFFFFFFFFIIFFF)V
      official a Lfae;a(FFFFFFFFFIIFFF)V
    • releaseBuiltBuffer Link icon

      void releaseBuiltBuffer()
      Mappings:
      Namespace Name Mixin selector
      named releaseBuiltBuffer Lnet/minecraft/client/render/BufferBuilder;releaseBuiltBuffer()V
      intermediary method_43580 Lnet/minecraft/class_287;method_43580()V
      official s Lezv;s()V
    • clear Link icon

      public void clear()
      Mappings:
      Namespace Name Mixin selector
      named clear Lnet/minecraft/client/render/BufferBuilder;clear()V
      intermediary method_1343 Lnet/minecraft/class_287;method_1343()V
      official g Lezv;g()V
    • reset Link icon

      public void reset()
      Mappings:
      Namespace Name Mixin selector
      named reset Lnet/minecraft/client/render/BufferBuilder;reset()V
      intermediary method_23477 Lnet/minecraft/class_287;method_23477()V
      official h Lezv;h()V
    • close Link icon

      public void close()
      Mappings:
      Namespace Name Mixin selector
      named close Lnet/minecraft/client/render/BufferBuilder;close()V
      intermediary method_54558 Lnet/minecraft/class_287;method_54558()V
      official i Lezv;i()V
    • getCurrentElement Link icon

      public VertexFormatElement getCurrentElement()
      Specified by:
      getCurrentElement in interface BufferVertexConsumer
      Mappings:
      Namespace Name Mixin selector
      named getCurrentElement Lnet/minecraft/client/render/BufferVertexConsumer;getCurrentElement()Lnet/minecraft/client/render/VertexFormatElement;
      intermediary method_22900 Lnet/minecraft/class_4584;method_22900()Lnet/minecraft/class_296;
      official j Lezx;j()Lfag;
    • isBuilding Link icon

      public boolean isBuilding()
      Mappings:
      Namespace Name Mixin selector
      named isBuilding Lnet/minecraft/client/render/BufferBuilder;isBuilding()Z
      intermediary method_22893 Lnet/minecraft/class_287;method_22893()Z
      official k Lezv;k()Z
    • slice Link icon

      ByteBuffer slice(int start, int end)
      Mappings:
      Namespace Name Mixin selector
      named slice Lnet/minecraft/client/render/BufferBuilder;slice(II)Ljava/nio/ByteBuffer;
      intermediary method_43576 Lnet/minecraft/class_287;method_43576(II)Ljava/nio/ByteBuffer;
      official c Lezv;c(II)Ljava/nio/ByteBuffer;