Class BufferBuilder

java.lang.Object
net.minecraft.client.render.BufferBuilder
All Implemented Interfaces:
VertexConsumer

@Environment(CLIENT) public class BufferBuilder extends Object implements VertexConsumer
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

invalid reference
GameRenderer#getRenderTypeLinesProgram
.
Mappings:
Namespace Name
named net/minecraft/client/render/BufferBuilder
intermediary net/minecraft/class_287
official fgm
  • Field Details

    • field_52068

      private static final long field_52068
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_52068 Lnet/minecraft/client/render/BufferBuilder;field_52068:J
      intermediary field_52068 Lnet/minecraft/class_287;field_52068:J
      official a Lfgm;a:J
    • field_52069

      private static final long field_52069
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_52069 Lnet/minecraft/client/render/BufferBuilder;field_52069:J
      intermediary field_52069 Lnet/minecraft/class_287;field_52069:J
      official b Lfgm;b:J
    • LITTLE_ENDIAN

      private static final boolean LITTLE_ENDIAN
      Mappings:
      Namespace Name Mixin selector
      named LITTLE_ENDIAN Lnet/minecraft/client/render/BufferBuilder;LITTLE_ENDIAN:Z
      intermediary field_52070 Lnet/minecraft/class_287;field_52070:Z
      official c Lfgm;c:Z
    • allocator

      private final BufferAllocator allocator
      Mappings:
      Namespace Name Mixin selector
      named allocator Lnet/minecraft/client/render/BufferBuilder;allocator:Lnet/minecraft/client/util/BufferAllocator;
      intermediary field_52071 Lnet/minecraft/class_287;field_52071:Lnet/minecraft/class_9799;
      official d Lfgm;d:Lfgo;
    • vertexPointer

      private long vertexPointer
      Mappings:
      Namespace Name Mixin selector
      named vertexPointer Lnet/minecraft/client/render/BufferBuilder;vertexPointer:J
      intermediary field_52072 Lnet/minecraft/class_287;field_52072:J
      official e Lfgm;e:J
    • vertexCount

      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 f Lfgm;f:I
    • format

      private final 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 g Lfgm;g:Lfgw;
    • drawMode

      private final VertexFormat.DrawMode drawMode
      Mappings:
      Namespace Name Mixin selector
      named drawMode Lnet/minecraft/client/render/BufferBuilder;drawMode:Lnet/minecraft/client/render/VertexFormat$DrawMode;
      intermediary field_52073 Lnet/minecraft/class_287;field_52073:Lnet/minecraft/class_293$class_5596;
      official h Lfgm;h:Lfgw$c;
    • canSkipElementChecks

      private final 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
      invalid reference
      #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 i Lfgm;i:Z
    • hasOverlay

      private final 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 j Lfgm;j:Z
    • vertexSizeByte

      private final int vertexSizeByte
      Mappings:
      Namespace Name Mixin selector
      named vertexSizeByte Lnet/minecraft/client/render/BufferBuilder;vertexSizeByte:I
      intermediary field_52074 Lnet/minecraft/class_287;field_52074:I
      official k Lfgm;k:I
    • requiredMask

      private final int requiredMask
      Mappings:
      Namespace Name Mixin selector
      named requiredMask Lnet/minecraft/client/render/BufferBuilder;requiredMask:I
      intermediary field_52075 Lnet/minecraft/class_287;field_52075:I
      official l Lfgm;l:I
    • offsetsByElementId

      private final int[] offsetsByElementId
      Mappings:
      Namespace Name Mixin selector
      named offsetsByElementId Lnet/minecraft/client/render/BufferBuilder;offsetsByElementId:[I
      intermediary field_52076 Lnet/minecraft/class_287;field_52076:[I
      official m Lfgm;m:[I
    • currentMask

      private int currentMask
      Mappings:
      Namespace Name Mixin selector
      named currentMask Lnet/minecraft/client/render/BufferBuilder;currentMask:I
      intermediary field_52077 Lnet/minecraft/class_287;field_52077:I
      official n Lfgm;n:I
    • building

      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 o Lfgm;o:Z
  • Constructor Details

    • BufferBuilder

      public BufferBuilder(BufferAllocator allocator, VertexFormat.DrawMode drawMode, VertexFormat format)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/client/render/BufferBuilder;<init>(Lnet/minecraft/client/util/BufferAllocator;Lnet/minecraft/client/render/VertexFormat$DrawMode;Lnet/minecraft/client/render/VertexFormat;)V
      intermediary <init> Lnet/minecraft/class_287;<init>(Lnet/minecraft/class_9799;Lnet/minecraft/class_293$class_5596;Lnet/minecraft/class_293;)V
      official <init> Lfgm;<init>(Lfgo;Lfgw$c;Lfgw;)V
  • Method Details

    • endNullable

      @Nullable public @Nullable BuiltBuffer endNullable()
      Mappings:
      Namespace Name Mixin selector
      named endNullable Lnet/minecraft/client/render/BufferBuilder;endNullable()Lnet/minecraft/client/render/BuiltBuffer;
      intermediary method_60794 Lnet/minecraft/class_287;method_60794()Lnet/minecraft/class_9801;
      official a Lfgm;a()Lfgq;
    • end

      public BuiltBuffer end()
      Mappings:
      Namespace Name Mixin selector
      named end Lnet/minecraft/client/render/BufferBuilder;end()Lnet/minecraft/client/render/BuiltBuffer;
      intermediary method_60800 Lnet/minecraft/class_287;method_60800()Lnet/minecraft/class_9801;
      official b Lfgm;b()Lfgq;
    • ensureBuilding

      private void ensureBuilding()
      Mappings:
      Namespace Name Mixin selector
      named ensureBuilding Lnet/minecraft/client/render/BufferBuilder;ensureBuilding()V
      intermediary method_60802 Lnet/minecraft/class_287;method_60802()V
      official c Lfgm;c()V
    • build

      @Nullable private @Nullable BuiltBuffer build()
      Mappings:
      Namespace Name Mixin selector
      named build Lnet/minecraft/client/render/BufferBuilder;build()Lnet/minecraft/client/render/BuiltBuffer;
      intermediary method_60804 Lnet/minecraft/class_287;method_60804()Lnet/minecraft/class_9801;
      official d Lfgm;d()Lfgq;
    • beginVertex

      private long beginVertex()
      Mappings:
      Namespace Name Mixin selector
      named beginVertex Lnet/minecraft/client/render/BufferBuilder;beginVertex()J
      intermediary method_60805 Lnet/minecraft/class_287;method_60805()J
      official e Lfgm;e()J
    • beginElement

      private long beginElement(VertexFormatElement element)
      Mappings:
      Namespace Name Mixin selector
      named beginElement Lnet/minecraft/client/render/BufferBuilder;beginElement(Lnet/minecraft/client/render/VertexFormatElement;)J
      intermediary method_60798 Lnet/minecraft/class_287;method_60798(Lnet/minecraft/class_296;)J
      official a Lfgm;a(Lfgx;)J
    • endVertex

      private void endVertex()
      Mappings:
      Namespace Name Mixin selector
      named endVertex Lnet/minecraft/client/render/BufferBuilder;endVertex()V
      intermediary method_60806 Lnet/minecraft/class_287;method_60806()V
      official f Lfgm;f()V
    • putColor

      private static void putColor(long pointer, int argb)
      Mappings:
      Namespace Name Mixin selector
      named putColor Lnet/minecraft/client/render/BufferBuilder;putColor(JI)V
      intermediary method_60797 Lnet/minecraft/class_287;method_60797(JI)V
      official a Lfgm;a(JI)V
    • putInt

      private static void putInt(long pointer, int i)
      Mappings:
      Namespace Name Mixin selector
      named putInt Lnet/minecraft/client/render/BufferBuilder;putInt(JI)V
      intermediary method_60801 Lnet/minecraft/class_287;method_60801(JI)V
      official b Lfgm;b(JI)V
    • vertex

      public VertexConsumer vertex(float x, float y, float z)
      Specifies the
      invalid reference
      position element
      of the current vertex.

      This is typically the first element in a vertex, hence the name.

      Specified by:
      vertex in interface VertexConsumer
      Returns:
      this consumer, for chaining
      Throws:
      IllegalStateException - if this consumer is not currently accepting a position element.
      Mappings:
      Namespace Name Mixin selector
      named vertex Lnet/minecraft/client/render/VertexConsumer;vertex(FFF)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_22912 Lnet/minecraft/class_4588;method_22912(FFF)Lnet/minecraft/class_4588;
      official a Lfgv;a(FFF)Lfgv;
    • color

      public VertexConsumer color(int red, int green, int blue, int alpha)
      Specifies the
      invalid reference
      color element
      of the current vertex.
      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
      invalid reference
      #fixedColor
      .
      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 Lfgv;a(IIII)Lfgv;
    • color

      public VertexConsumer color(int argb)
      Specifies the
      invalid reference
      color element
      of the current vertex.
      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
      invalid reference
      #fixedColor
      .
      Mappings:
      Namespace Name Mixin selector
      named color Lnet/minecraft/client/render/VertexConsumer;color(I)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_39415 Lnet/minecraft/class_4588;method_39415(I)Lnet/minecraft/class_4588;
      official a Lfgv;a(I)Lfgv;
    • texture

      public VertexConsumer texture(float u, float v)
      Specifies the
      invalid reference
      texture element
      of the current vertex.
      Specified by:
      texture in interface VertexConsumer
      Returns:
      this consumer, for chaining
      Throws:
      IllegalStateException - if this consumer is not currently accepting a texture element.
      Mappings:
      Namespace Name Mixin selector
      named texture Lnet/minecraft/client/render/VertexConsumer;texture(FF)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_22913 Lnet/minecraft/class_4588;method_22913(FF)Lnet/minecraft/class_4588;
      official a Lfgv;a(FF)Lfgv;
    • overlay

      public VertexConsumer overlay(int u, int v)
      Specifies the
      invalid reference
      overlay element
      of the current vertex.
      Specified by:
      overlay in interface VertexConsumer
      Returns:
      this consumer, for chaining
      Throws:
      IllegalStateException - if this consumer is not currently accepting an overlay element.
      Mappings:
      Namespace Name Mixin selector
      named overlay Lnet/minecraft/client/render/VertexConsumer;overlay(II)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_60796 Lnet/minecraft/class_4588;method_60796(II)Lnet/minecraft/class_4588;
      official a Lfgv;a(II)Lfgv;
    • overlay

      public VertexConsumer overlay(int uv)
      Specifies the
      invalid reference
      overlay element
      of the current vertex.
      Specified by:
      overlay in interface VertexConsumer
      Returns:
      this consumer, for chaining
      Throws:
      IllegalStateException - if this consumer is not currently accepting an overlay element.
      Mappings:
      Namespace Name Mixin selector
      named overlay Lnet/minecraft/client/render/VertexConsumer;overlay(I)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_22922 Lnet/minecraft/class_4588;method_22922(I)Lnet/minecraft/class_4588;
      official b Lfgv;b(I)Lfgv;
    • light

      public VertexConsumer light(int u, int v)
      Specifies the
      invalid reference
      light element
      of the current vertex.
      Specified by:
      light in interface VertexConsumer
      Returns:
      this consumer, for chaining
      Throws:
      IllegalStateException - if this consumer is not currently accepting a light element.
      Mappings:
      Namespace Name Mixin selector
      named light Lnet/minecraft/client/render/VertexConsumer;light(II)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_22921 Lnet/minecraft/class_4588;method_22921(II)Lnet/minecraft/class_4588;
      official b Lfgv;b(II)Lfgv;
    • light

      public VertexConsumer light(int uv)
      Specifies the
      invalid reference
      light element
      of the current vertex.
      Specified by:
      light in interface VertexConsumer
      Returns:
      this consumer, for chaining
      Throws:
      IllegalStateException - if this consumer is not currently accepting a light element.
      Mappings:
      Namespace Name Mixin selector
      named light Lnet/minecraft/client/render/VertexConsumer;light(I)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_60803 Lnet/minecraft/class_4588;method_60803(I)Lnet/minecraft/class_4588;
      official c Lfgv;c(I)Lfgv;
    • putUv

      private VertexConsumer putUv(short u, short v, VertexFormatElement element)
      Mappings:
      Namespace Name Mixin selector
      named putUv Lnet/minecraft/client/render/BufferBuilder;putUv(SSLnet/minecraft/client/render/VertexFormatElement;)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_60799 Lnet/minecraft/class_287;method_60799(SSLnet/minecraft/class_296;)Lnet/minecraft/class_4588;
      official a Lfgm;a(SSLfgx;)Lfgv;
    • normal

      public VertexConsumer normal(float x, float y, float z)
      Specifies the
      invalid reference
      normal element
      of the current vertex.
      Specified by:
      normal in interface VertexConsumer
      Returns:
      this consumer, for chaining
      Throws:
      IllegalStateException - if this consumer is not currently accepting a normal element.
      Mappings:
      Namespace Name Mixin selector
      named normal Lnet/minecraft/client/render/VertexConsumer;normal(FFF)Lnet/minecraft/client/render/VertexConsumer;
      intermediary method_22914 Lnet/minecraft/class_4588;method_22914(FFF)Lnet/minecraft/class_4588;
      official b Lfgv;b(FFF)Lfgv;
    • floatToByte

      private static byte floatToByte(float f)
      Mappings:
      Namespace Name Mixin selector
      named floatToByte Lnet/minecraft/client/render/BufferBuilder;floatToByte(F)B
      intermediary method_60795 Lnet/minecraft/class_287;method_60795(F)B
      official a Lfgm;a(F)B
    • vertex

      public void vertex(float x, float y, float z, int color, float u, float v, int overlay, int light, float normalX, float normalY, float normalZ)
      Specifies the
      invalid reference
      position
      ,
      invalid reference
      color
      ,
      invalid reference
      texture
      ,
      invalid reference
      overlay
      ,
      invalid reference
      light
      , and
      invalid reference
      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
      invalid reference
      #fixedColor
      .
      Mappings:
      Namespace Name Mixin selector
      named vertex Lnet/minecraft/client/render/VertexConsumer;vertex(FFFIFFIIFFF)V
      intermediary method_23919 Lnet/minecraft/class_4588;method_23919(FFFIFFIIFFF)V
      official a Lfgv;a(FFFIFFIIFFF)V