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 official epw
intermediary net/minecraft/class_287
named net/minecraft/client/render/BufferBuilder
-
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
-
Field Details
-
ROUND_SIZE_CHANGE
private static final int ROUND_SIZE_CHANGE- See Also:
- Mappings:
Namespace Name Mixin selector official f
Lepw;f:I
intermediary field_46839
Lnet/minecraft/class_287;field_46839:I
named ROUND_SIZE_CHANGE
Lnet/minecraft/client/render/BufferBuilder;ROUND_SIZE_CHANGE:I
-
LOGGER
- Mappings:
Namespace Name Mixin selector official g
Lepw;g:Lorg/slf4j/Logger;
intermediary field_1557
Lnet/minecraft/class_287;field_1557:Lorg/slf4j/Logger;
named LOGGER
Lnet/minecraft/client/render/BufferBuilder;LOGGER:Lorg/slf4j/Logger;
-
buffer
- Mappings:
Namespace Name Mixin selector official h
Lepw;h:Ljava/nio/ByteBuffer;
intermediary field_1555
Lnet/minecraft/class_287;field_1555:Ljava/nio/ByteBuffer;
named buffer
Lnet/minecraft/client/render/BufferBuilder;buffer:Ljava/nio/ByteBuffer;
-
closed
private boolean closed- Mappings:
Namespace Name Mixin selector official i
Lepw;i:Z
intermediary field_46840
Lnet/minecraft/class_287;field_46840:Z
named closed
Lnet/minecraft/client/render/BufferBuilder;closed:Z
-
builtBufferCount
private int builtBufferCount- Mappings:
Namespace Name Mixin selector official j
Lepw;j:I
intermediary field_39061
Lnet/minecraft/class_287;field_39061:I
named builtBufferCount
Lnet/minecraft/client/render/BufferBuilder;builtBufferCount:I
-
batchOffset
private int batchOffset- Mappings:
Namespace Name Mixin selector official k
Lepw;k:I
intermediary field_39062
Lnet/minecraft/class_287;field_39062:I
named batchOffset
Lnet/minecraft/client/render/BufferBuilder;batchOffset:I
-
elementOffset
private int elementOffset- Mappings:
Namespace Name Mixin selector official l
Lepw;l:I
intermediary field_20884
Lnet/minecraft/class_287;field_20884:I
named elementOffset
Lnet/minecraft/client/render/BufferBuilder;elementOffset:I
-
vertexCount
private int vertexCount- Mappings:
Namespace Name Mixin selector official m
Lepw;m:I
intermediary field_1554
Lnet/minecraft/class_287;field_1554:I
named vertexCount
Lnet/minecraft/client/render/BufferBuilder;vertexCount:I
-
currentElement
- Mappings:
Namespace Name Mixin selector official n
Lepw;n:Leqh;
intermediary field_1558
Lnet/minecraft/class_287;field_1558:Lnet/minecraft/class_296;
named currentElement
Lnet/minecraft/client/render/BufferBuilder;currentElement:Lnet/minecraft/client/render/VertexFormatElement;
-
currentElementId
private int currentElementId- Mappings:
Namespace Name Mixin selector official o
Lepw;o:I
intermediary field_1553
Lnet/minecraft/class_287;field_1553:I
named currentElementId
Lnet/minecraft/client/render/BufferBuilder;currentElementId:I
-
format
- Mappings:
Namespace Name Mixin selector official p
Lepw;p:Leqg;
intermediary field_1565
Lnet/minecraft/class_287;field_1565:Lnet/minecraft/class_293;
named format
Lnet/minecraft/client/render/BufferBuilder;format:Lnet/minecraft/client/render/VertexFormat;
-
drawMode
- Mappings:
Namespace Name Mixin selector official q
Lepw;q:Leqg$b;
intermediary field_1567
Lnet/minecraft/class_287;field_1567:Lnet/minecraft/class_293$class_5596;
named drawMode
Lnet/minecraft/client/render/BufferBuilder;drawMode:Lnet/minecraft/client/render/VertexFormat$DrawMode;
-
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 official r
Lepw;r:Z
intermediary field_21594
Lnet/minecraft/class_287;field_21594:Z
named canSkipElementChecks
Lnet/minecraft/client/render/BufferBuilder;canSkipElementChecks:Z
-
hasOverlay
private boolean hasOverlay- Mappings:
Namespace Name Mixin selector official s
Lepw;s:Z
intermediary field_21595
Lnet/minecraft/class_287;field_21595:Z
named hasOverlay
Lnet/minecraft/client/render/BufferBuilder;hasOverlay:Z
-
building
private boolean building- Mappings:
Namespace Name Mixin selector official t
Lepw;t:Z
intermediary field_1556
Lnet/minecraft/class_287;field_1556:Z
named building
Lnet/minecraft/client/render/BufferBuilder;building:Z
-
sortingPrimitiveCenters
- Mappings:
Namespace Name Mixin selector official u
Lepw;u:[Lorg/joml/Vector3f;
intermediary field_27348
Lnet/minecraft/class_287;field_27348:[Lorg/joml/Vector3f;
named sortingPrimitiveCenters
Lnet/minecraft/client/render/BufferBuilder;sortingPrimitiveCenters:[Lorg/joml/Vector3f;
-
sorter
- Mappings:
Namespace Name Mixin selector official v
Lepw;v:Leqj;
intermediary field_43358
Lnet/minecraft/class_287;field_43358:Lnet/minecraft/class_8251;
named sorter
Lnet/minecraft/client/render/BufferBuilder;sorter:Lcom/mojang/blaze3d/systems/VertexSorter;
-
hasNoVertexBuffer
private boolean hasNoVertexBuffer- Mappings:
Namespace Name Mixin selector official w
Lepw;w:Z
intermediary field_27352
Lnet/minecraft/class_287;field_27352:Z
named hasNoVertexBuffer
Lnet/minecraft/client/render/BufferBuilder;hasNoVertexBuffer:Z
-
-
Constructor Details
-
BufferBuilder
public BufferBuilder(int initialCapacity) - Mappings:
Namespace Name Mixin selector official <init>
Lepw;<init>(I)V
intermediary <init>
Lnet/minecraft/class_287;<init>(I)V
named <init>
Lnet/minecraft/client/render/BufferBuilder;<init>(I)V
-
-
Method Details
-
grow
private void grow()- Mappings:
Namespace Name Mixin selector official m
Lepw;m()V
intermediary method_22892
Lnet/minecraft/class_287;method_22892()V
named grow
Lnet/minecraft/client/render/BufferBuilder;grow()V
-
grow
private void grow(int size) - Mappings:
Namespace Name Mixin selector official d
Lepw;d(I)V
intermediary method_1335
Lnet/minecraft/class_287;method_1335(I)V
named grow
Lnet/minecraft/client/render/BufferBuilder;grow(I)V
-
setSorter
- Mappings:
Namespace Name Mixin selector official a
Lepw;a(Leqj;)V
intermediary method_49904
Lnet/minecraft/class_287;method_49904(Lnet/minecraft/class_8251;)V
named setSorter
Lnet/minecraft/client/render/BufferBuilder;setSorter(Lcom/mojang/blaze3d/systems/VertexSorter;)V
-
getSortingData
- Mappings:
Namespace Name Mixin selector official a
Lepw;a()Lepw$c;
intermediary method_1334
Lnet/minecraft/class_287;method_1334()Lnet/minecraft/class_287$class_5594;
named getSortingData
Lnet/minecraft/client/render/BufferBuilder;getSortingData()Lnet/minecraft/client/render/BufferBuilder$TransparentSortingData;
-
ensureNotClosed
private void ensureNotClosed()- Mappings:
Namespace Name Mixin selector official n
Lepw;n()V
intermediary method_54559
Lnet/minecraft/class_287;method_54559()V
named ensureNotClosed
Lnet/minecraft/client/render/BufferBuilder;ensureNotClosed()V
-
beginSortedIndexBuffer
- Mappings:
Namespace Name Mixin selector official a
Lepw;a(Lepw$c;)V
intermediary method_1324
Lnet/minecraft/class_287;method_1324(Lnet/minecraft/class_287$class_5594;)V
named beginSortedIndexBuffer
Lnet/minecraft/client/render/BufferBuilder;beginSortedIndexBuffer(Lnet/minecraft/client/render/BufferBuilder$TransparentSortingData;)V
-
begin
- Mappings:
Namespace Name Mixin selector official a
Lepw;a(Leqg$b;Leqg;)V
intermediary method_1328
Lnet/minecraft/class_287;method_1328(Lnet/minecraft/class_293$class_5596;Lnet/minecraft/class_293;)V
named begin
Lnet/minecraft/client/render/BufferBuilder;begin(Lnet/minecraft/client/render/VertexFormat$DrawMode;Lnet/minecraft/client/render/VertexFormat;)V
-
setFormat
- Mappings:
Namespace Name Mixin selector official a
Lepw;a(Leqg;)V
intermediary method_23918
Lnet/minecraft/class_287;method_23918(Lnet/minecraft/class_293;)V
named setFormat
Lnet/minecraft/client/render/BufferBuilder;setFormat(Lnet/minecraft/client/render/VertexFormat;)V
-
getIndexConsumer
- Mappings:
Namespace Name Mixin selector official a
Lepw;a(ILeqg$a;)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;
named getIndexConsumer
Lnet/minecraft/client/render/BufferBuilder;getIndexConsumer(ILnet/minecraft/client/render/VertexFormat$IndexType;)Lit/unimi/dsi/fastutil/ints/IntConsumer;
-
buildPrimitiveCenters
- Mappings:
Namespace Name Mixin selector official o
Lepw;o()[Lorg/joml/Vector3f;
intermediary method_31954
Lnet/minecraft/class_287;method_31954()[Lorg/joml/Vector3f;
named buildPrimitiveCenters
Lnet/minecraft/client/render/BufferBuilder;buildPrimitiveCenters()[Lorg/joml/Vector3f;
-
writeSortedIndices
- Mappings:
Namespace Name Mixin selector official a
Lepw;a(Leqg$a;)V
intermediary method_31950
Lnet/minecraft/class_287;method_31950(Lnet/minecraft/class_293$class_5595;)V
named writeSortedIndices
Lnet/minecraft/client/render/BufferBuilder;writeSortedIndices(Lnet/minecraft/client/render/VertexFormat$IndexType;)V
-
isBatchEmpty
public boolean isBatchEmpty()- Mappings:
Namespace Name Mixin selector official b
Lepw;b()Z
intermediary method_43574
Lnet/minecraft/class_287;method_43574()Z
named isBatchEmpty
Lnet/minecraft/client/render/BufferBuilder;isBatchEmpty()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 official c
Lepw;c()Lepw$b;
intermediary method_43575
Lnet/minecraft/class_287;method_43575()Lnet/minecraft/class_287$class_7433;
named endNullable
Lnet/minecraft/client/render/BufferBuilder;endNullable()Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;
-
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 official d
Lepw;d()Lepw$b;
intermediary method_1326
Lnet/minecraft/class_287;method_1326()Lnet/minecraft/class_287$class_7433;
named end
Lnet/minecraft/client/render/BufferBuilder;end()Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;
-
ensureBuilding
private void ensureBuilding()- Mappings:
Namespace Name Mixin selector official p
Lepw;p()V
intermediary method_43577
Lnet/minecraft/class_287;method_43577()V
named ensureBuilding
Lnet/minecraft/client/render/BufferBuilder;ensureBuilding()V
-
build
- Mappings:
Namespace Name Mixin selector official q
Lepw;q()Lepw$b;
intermediary method_43578
Lnet/minecraft/class_287;method_43578()Lnet/minecraft/class_287$class_7433;
named build
Lnet/minecraft/client/render/BufferBuilder;build()Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;
-
resetBuilding
private void resetBuilding()- Mappings:
Namespace Name Mixin selector official r
Lepw;r()V
intermediary method_43579
Lnet/minecraft/class_287;method_43579()V
named resetBuilding
Lnet/minecraft/client/render/BufferBuilder;resetBuilding()V
-
putByte
public void putByte(int index, byte value) - Specified by:
putByte
in interfaceBufferVertexConsumer
- Mappings:
Namespace Name Mixin selector official a
Lepy;a(IB)V
intermediary method_22896
Lnet/minecraft/class_4584;method_22896(IB)V
named putByte
Lnet/minecraft/client/render/BufferVertexConsumer;putByte(IB)V
-
putShort
public void putShort(int index, short value) - Specified by:
putShort
in interfaceBufferVertexConsumer
- Mappings:
Namespace Name Mixin selector official a
Lepy;a(IS)V
intermediary method_22898
Lnet/minecraft/class_4584;method_22898(IS)V
named putShort
Lnet/minecraft/client/render/BufferVertexConsumer;putShort(IS)V
-
putFloat
public void putFloat(int index, float value) - Specified by:
putFloat
in interfaceBufferVertexConsumer
- Mappings:
Namespace Name Mixin selector official a
Lepy;a(IF)V
intermediary method_22897
Lnet/minecraft/class_4584;method_22897(IF)V
named putFloat
Lnet/minecraft/client/render/BufferVertexConsumer;putFloat(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 official e
Leqf;e()V
intermediary method_1344
Lnet/minecraft/class_4588;method_1344()V
named next
Lnet/minecraft/client/render/VertexConsumer;next()V
-
nextElement
public void nextElement()- Specified by:
nextElement
in interfaceBufferVertexConsumer
- Mappings:
Namespace Name Mixin selector official f
Lepy;f()V
intermediary method_1325
Lnet/minecraft/class_4584;method_1325()V
named nextElement
Lnet/minecraft/client/render/BufferVertexConsumer;nextElement()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
- Mappings:
Namespace Name Mixin selector official a
Leqf;a(IIII)Leqf;
intermediary method_1336
Lnet/minecraft/class_4588;method_1336(IIII)Lnet/minecraft/class_4588;
named color
Lnet/minecraft/client/render/VertexConsumer;color(IIII)Lnet/minecraft/client/render/VertexConsumer;
-
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
- Mappings:
Namespace Name Mixin selector official a
Leqf;a(FFFFFFFFFIIFFF)V
intermediary method_23919
Lnet/minecraft/class_4588;method_23919(FFFFFFFFFIIFFF)V
named vertex
Lnet/minecraft/client/render/VertexConsumer;vertex(FFFFFFFFFIIFFF)V
-
releaseBuiltBuffer
void releaseBuiltBuffer()- Mappings:
Namespace Name Mixin selector official s
Lepw;s()V
intermediary method_43580
Lnet/minecraft/class_287;method_43580()V
named releaseBuiltBuffer
Lnet/minecraft/client/render/BufferBuilder;releaseBuiltBuffer()V
-
clear
public void clear()- Mappings:
Namespace Name Mixin selector official g
Lepw;g()V
intermediary method_1343
Lnet/minecraft/class_287;method_1343()V
named clear
Lnet/minecraft/client/render/BufferBuilder;clear()V
-
reset
public void reset()- Mappings:
Namespace Name Mixin selector official h
Lepw;h()V
intermediary method_23477
Lnet/minecraft/class_287;method_23477()V
named reset
Lnet/minecraft/client/render/BufferBuilder;reset()V
-
close
public void close()- Mappings:
Namespace Name Mixin selector official i
Lepw;i()V
intermediary method_54558
Lnet/minecraft/class_287;method_54558()V
named close
Lnet/minecraft/client/render/BufferBuilder;close()V
-
getCurrentElement
- Specified by:
getCurrentElement
in interfaceBufferVertexConsumer
- Mappings:
Namespace Name Mixin selector official j
Lepy;j()Leqh;
intermediary method_22900
Lnet/minecraft/class_4584;method_22900()Lnet/minecraft/class_296;
named getCurrentElement
Lnet/minecraft/client/render/BufferVertexConsumer;getCurrentElement()Lnet/minecraft/client/render/VertexFormatElement;
-
isBuilding
public boolean isBuilding()- Mappings:
Namespace Name Mixin selector official k
Lepw;k()Z
intermediary method_22893
Lnet/minecraft/class_287;method_22893()Z
named isBuilding
Lnet/minecraft/client/render/BufferBuilder;isBuilding()Z
-
slice
- Mappings:
Namespace Name Mixin selector official c
Lepw;c(II)Ljava/nio/ByteBuffer;
intermediary method_43576
Lnet/minecraft/class_287;method_43576(II)Ljava/nio/ByteBuffer;
named slice
Lnet/minecraft/client/render/BufferBuilder;slice(II)Ljava/nio/ByteBuffer;
-