Package net.minecraft.client.render
Class BufferBuilder
java.lang.Object
net.minecraft.client.render.FixedColorVertexConsumer
net.minecraft.client.render.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
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
An output ofBufferBuilder
.static final record
static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
private ByteBuffer
private boolean
private int
private boolean
Whether this builder is aware of the vertex format and can skip checks for the current target element while building a vertex invertex(float, float, float, float, float, float, float, float, float, int, int, float, float, float)
.private boolean
private @Nullable VertexFormatElement
private int
private VertexFormat.DrawMode
private int
private VertexFormat
private boolean
private boolean
private static final Logger
private static final int
private @Nullable VertexSorter
private int
Fields inherited from class net.minecraft.client.render.FixedColorVertexConsumer
colorFixed, fixedAlpha, fixedBlue, fixedGreen, fixedRed
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
begin
(VertexFormat.DrawMode drawMode, VertexFormat format) void
private BufferBuilder.BuiltBuffer
build()
private Vector3f[]
void
clear()
void
close()
color
(int red, int green, int blue, int alpha) Specifies the color element of the current vertex.end()
Builds a buffer from the current batch and resets the building state.Builds a buffer if there are vertices in the current batch and resets the building state.private void
private void
private IntConsumer
getIndexConsumer
(int offset, VertexFormat.IndexType indexType) private void
grow()
private void
grow
(int size) boolean
boolean
void
next()
Starts consuming the next vertex.void
void
putByte
(int index, byte value) void
putFloat
(int index, float value) void
putShort
(int index, short value) (package private) void
void
reset()
private void
private void
setFormat
(VertexFormat format) void
setSorter
(VertexSorter sorter) (package private) ByteBuffer
slice
(int start, int end) 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) private void
writeSortedIndices
(VertexFormat.IndexType indexType) Methods inherited from class net.minecraft.client.render.FixedColorVertexConsumer
fixedColor, unfixColor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.client.render.BufferVertexConsumer
light, normal, overlay, texture, uv, vertex
Methods inherited from interface net.minecraft.client.render.VertexConsumer
color, color, fixedColor, light, normal, overlay, quad, quad, unfixColor, vertex, vertex
-
Field Details
-
ROUND_SIZE_CHANGE
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
- 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
- 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
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
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
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
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
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
- 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
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
- 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
- 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
private boolean canSkipElementChecksWhether this builder is aware of the vertex format and can skip checks for the current target element while building a vertex invertex(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
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
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
- 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
- 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
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
-
BufferBuilder
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
-
grow
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
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
- 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
- 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
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
- 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
- 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
- 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
- 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
- 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
- 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
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
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
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
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
- 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
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
public void putByte(int index, byte value) - Specified by:
putByte
in interfaceBufferVertexConsumer
- 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
public void putShort(int index, short value) - Specified by:
putShort
in interfaceBufferVertexConsumer
- 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
public void putFloat(int index, float value) - Specified by:
putFloat
in interfaceBufferVertexConsumer
- 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
public void next()Starts consuming the next vertex.This method must be called after specifying all elements in a vertex.
- Specified by:
next
in interfaceVertexConsumer
- 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
public void nextElement()- Specified by:
nextElement
in interfaceBufferVertexConsumer
- 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
Specifies the color element of the current vertex.- Specified by:
color
in interfaceBufferVertexConsumer
- Specified by:
color
in interfaceVertexConsumer
- Returns:
- this consumer, for chaining
- Throws:
IllegalStateException
- if this consumer is not currently accepting a color element or if a color has been set inFixedColorVertexConsumer.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
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 interfaceVertexConsumer
- Throws:
IllegalStateException
- if a color has been set inFixedColorVertexConsumer.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
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
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
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
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
- Specified by:
getCurrentElement
in interfaceBufferVertexConsumer
- 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
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
- 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;
-