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/BufferBuilderintermediary net/minecraft/class_287official ezu
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassAn output ofBufferBuilder.static final recordstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate ByteBufferprivate booleanprivate intprivate booleanWhether 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 booleanprivate @Nullable VertexFormatElementprivate intprivate VertexFormat.DrawModeprivate intprivate VertexFormatprivate booleanprivate booleanprivate static final Loggerprivate static final intprivate @Nullable VertexSorterprivate @Nullable Vector3f[]private intFields inherited from class net.minecraft.client.render.FixedColorVertexConsumer
colorFixed, fixedAlpha, fixedBlue, fixedGreen, fixedRed -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbegin(VertexFormat.DrawMode drawMode, VertexFormat format) voidprivate BufferBuilder.BuiltBufferbuild()private Vector3f[]voidclear()voidclose()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.@Nullable BufferBuilder.BuiltBufferBuilds a buffer if there are vertices in the current batch and resets the building state.private voidprivate voidprivate IntConsumergetIndexConsumer(int offset, VertexFormat.IndexType indexType) private voidgrow()private voidgrow(int size) booleanbooleanvoidnext()Starts consuming the next vertex.voidvoidputByte(int index, byte value) voidputFloat(int index, float value) voidputShort(int index, short value) (package private) voidvoidreset()private voidprivate voidsetFormat(VertexFormat format) voidsetSorter(VertexSorter sorter) (package private) ByteBufferslice(int start, int end) voidvertex(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 voidwriteSortedIndices(VertexFormat.IndexType indexType) Methods inherited from class net.minecraft.client.render.FixedColorVertexConsumer
fixedColor, unfixColorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.render.BufferVertexConsumer
light, normal, overlay, texture, uv, vertexMethods 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_CHANGELnet/minecraft/client/render/BufferBuilder;ROUND_SIZE_CHANGE:Iintermediary field_46839Lnet/minecraft/class_287;field_46839:Iofficial fLezu;f:I
-
LOGGER
- Mappings:
Namespace Name Mixin selector named LOGGERLnet/minecraft/client/render/BufferBuilder;LOGGER:Lorg/slf4j/Logger;intermediary field_1557Lnet/minecraft/class_287;field_1557:Lorg/slf4j/Logger;official gLezu;g:Lorg/slf4j/Logger;
-
buffer
- Mappings:
Namespace Name Mixin selector named bufferLnet/minecraft/client/render/BufferBuilder;buffer:Ljava/nio/ByteBuffer;intermediary field_1555Lnet/minecraft/class_287;field_1555:Ljava/nio/ByteBuffer;official hLezu;h:Ljava/nio/ByteBuffer;
-
closed
private boolean closed- Mappings:
Namespace Name Mixin selector named closedLnet/minecraft/client/render/BufferBuilder;closed:Zintermediary field_46840Lnet/minecraft/class_287;field_46840:Zofficial iLezu;i:Z
-
builtBufferCount
private int builtBufferCount- Mappings:
Namespace Name Mixin selector named builtBufferCountLnet/minecraft/client/render/BufferBuilder;builtBufferCount:Iintermediary field_39061Lnet/minecraft/class_287;field_39061:Iofficial jLezu;j:I
-
batchOffset
private int batchOffset- Mappings:
Namespace Name Mixin selector named batchOffsetLnet/minecraft/client/render/BufferBuilder;batchOffset:Iintermediary field_39062Lnet/minecraft/class_287;field_39062:Iofficial kLezu;k:I
-
elementOffset
private int elementOffset- Mappings:
Namespace Name Mixin selector named elementOffsetLnet/minecraft/client/render/BufferBuilder;elementOffset:Iintermediary field_20884Lnet/minecraft/class_287;field_20884:Iofficial lLezu;l:I
-
vertexCount
private int vertexCount- Mappings:
Namespace Name Mixin selector named vertexCountLnet/minecraft/client/render/BufferBuilder;vertexCount:Iintermediary field_1554Lnet/minecraft/class_287;field_1554:Iofficial mLezu;m:I
-
currentElement
- Mappings:
Namespace Name Mixin selector named currentElementLnet/minecraft/client/render/BufferBuilder;currentElement:Lnet/minecraft/client/render/VertexFormatElement;intermediary field_1558Lnet/minecraft/class_287;field_1558:Lnet/minecraft/class_296;official nLezu;n:Lfaf;
-
currentElementId
private int currentElementId- Mappings:
Namespace Name Mixin selector named currentElementIdLnet/minecraft/client/render/BufferBuilder;currentElementId:Iintermediary field_1553Lnet/minecraft/class_287;field_1553:Iofficial oLezu;o:I
-
format
- Mappings:
Namespace Name Mixin selector named formatLnet/minecraft/client/render/BufferBuilder;format:Lnet/minecraft/client/render/VertexFormat;intermediary field_1565Lnet/minecraft/class_287;field_1565:Lnet/minecraft/class_293;official pLezu;p:Lfae;
-
drawMode
- Mappings:
Namespace Name Mixin selector named drawModeLnet/minecraft/client/render/BufferBuilder;drawMode:Lnet/minecraft/client/render/VertexFormat$DrawMode;intermediary field_1567Lnet/minecraft/class_287;field_1567:Lnet/minecraft/class_293$class_5596;official qLezu;q:Lfae$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 canSkipElementChecksLnet/minecraft/client/render/BufferBuilder;canSkipElementChecks:Zintermediary field_21594Lnet/minecraft/class_287;field_21594:Zofficial rLezu;r:Z
-
hasOverlay
private boolean hasOverlay- Mappings:
Namespace Name Mixin selector named hasOverlayLnet/minecraft/client/render/BufferBuilder;hasOverlay:Zintermediary field_21595Lnet/minecraft/class_287;field_21595:Zofficial sLezu;s:Z
-
building
private boolean building- Mappings:
Namespace Name Mixin selector named buildingLnet/minecraft/client/render/BufferBuilder;building:Zintermediary field_1556Lnet/minecraft/class_287;field_1556:Zofficial tLezu;t:Z
-
sortingPrimitiveCenters
- Mappings:
Namespace Name Mixin selector named sortingPrimitiveCentersLnet/minecraft/client/render/BufferBuilder;sortingPrimitiveCenters:[Lorg/joml/Vector3f;intermediary field_27348Lnet/minecraft/class_287;field_27348:[Lorg/joml/Vector3f;official uLezu;u:[Lorg/joml/Vector3f;
-
sorter
- Mappings:
Namespace Name Mixin selector named sorterLnet/minecraft/client/render/BufferBuilder;sorter:Lcom/mojang/blaze3d/systems/VertexSorter;intermediary field_43358Lnet/minecraft/class_287;field_43358:Lnet/minecraft/class_8251;official vLezu;v:Lfah;
-
hasNoVertexBuffer
private boolean hasNoVertexBuffer- Mappings:
Namespace Name Mixin selector named hasNoVertexBufferLnet/minecraft/client/render/BufferBuilder;hasNoVertexBuffer:Zintermediary field_27352Lnet/minecraft/class_287;field_27352:Zofficial wLezu;w:Z
-
-
Constructor Details
-
BufferBuilder
public BufferBuilder(int initialCapacity) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/client/render/BufferBuilder;<init>(I)Vintermediary <init>Lnet/minecraft/class_287;<init>(I)Vofficial <init>Lezu;<init>(I)V
-
-
Method Details
-
grow
private void grow()- Mappings:
Namespace Name Mixin selector named growLnet/minecraft/client/render/BufferBuilder;grow()Vintermediary method_22892Lnet/minecraft/class_287;method_22892()Vofficial mLezu;m()V
-
grow
private void grow(int size) - Mappings:
Namespace Name Mixin selector named growLnet/minecraft/client/render/BufferBuilder;grow(I)Vintermediary method_1335Lnet/minecraft/class_287;method_1335(I)Vofficial dLezu;d(I)V
-
setSorter
- Mappings:
Namespace Name Mixin selector named setSorterLnet/minecraft/client/render/BufferBuilder;setSorter(Lcom/mojang/blaze3d/systems/VertexSorter;)Vintermediary method_49904Lnet/minecraft/class_287;method_49904(Lnet/minecraft/class_8251;)Vofficial aLezu;a(Lfah;)V
-
getSortingData
- Mappings:
Namespace Name Mixin selector named getSortingDataLnet/minecraft/client/render/BufferBuilder;getSortingData()Lnet/minecraft/client/render/BufferBuilder$TransparentSortingData;intermediary method_1334Lnet/minecraft/class_287;method_1334()Lnet/minecraft/class_287$class_5594;official aLezu;a()Lezu$c;
-
ensureNotClosed
private void ensureNotClosed()- Mappings:
Namespace Name Mixin selector named ensureNotClosedLnet/minecraft/client/render/BufferBuilder;ensureNotClosed()Vintermediary method_54559Lnet/minecraft/class_287;method_54559()Vofficial nLezu;n()V
-
beginSortedIndexBuffer
- Mappings:
Namespace Name Mixin selector named beginSortedIndexBufferLnet/minecraft/client/render/BufferBuilder;beginSortedIndexBuffer(Lnet/minecraft/client/render/BufferBuilder$TransparentSortingData;)Vintermediary method_1324Lnet/minecraft/class_287;method_1324(Lnet/minecraft/class_287$class_5594;)Vofficial aLezu;a(Lezu$c;)V
-
begin
- Mappings:
Namespace Name Mixin selector named beginLnet/minecraft/client/render/BufferBuilder;begin(Lnet/minecraft/client/render/VertexFormat$DrawMode;Lnet/minecraft/client/render/VertexFormat;)Vintermediary method_1328Lnet/minecraft/class_287;method_1328(Lnet/minecraft/class_293$class_5596;Lnet/minecraft/class_293;)Vofficial aLezu;a(Lfae$b;Lfae;)V
-
setFormat
- Mappings:
Namespace Name Mixin selector named setFormatLnet/minecraft/client/render/BufferBuilder;setFormat(Lnet/minecraft/client/render/VertexFormat;)Vintermediary method_23918Lnet/minecraft/class_287;method_23918(Lnet/minecraft/class_293;)Vofficial aLezu;a(Lfae;)V
-
getIndexConsumer
- Mappings:
Namespace Name Mixin selector named getIndexConsumerLnet/minecraft/client/render/BufferBuilder;getIndexConsumer(ILnet/minecraft/client/render/VertexFormat$IndexType;)Lit/unimi/dsi/fastutil/ints/IntConsumer;intermediary method_31949Lnet/minecraft/class_287;method_31949(ILnet/minecraft/class_293$class_5595;)Lit/unimi/dsi/fastutil/ints/IntConsumer;official aLezu;a(ILfae$a;)Lit/unimi/dsi/fastutil/ints/IntConsumer;
-
buildPrimitiveCenters
- Mappings:
Namespace Name Mixin selector named buildPrimitiveCentersLnet/minecraft/client/render/BufferBuilder;buildPrimitiveCenters()[Lorg/joml/Vector3f;intermediary method_31954Lnet/minecraft/class_287;method_31954()[Lorg/joml/Vector3f;official oLezu;o()[Lorg/joml/Vector3f;
-
writeSortedIndices
- Mappings:
Namespace Name Mixin selector named writeSortedIndicesLnet/minecraft/client/render/BufferBuilder;writeSortedIndices(Lnet/minecraft/client/render/VertexFormat$IndexType;)Vintermediary method_31950Lnet/minecraft/class_287;method_31950(Lnet/minecraft/class_293$class_5595;)Vofficial aLezu;a(Lfae$a;)V
-
isBatchEmpty
public boolean isBatchEmpty()- Mappings:
Namespace Name Mixin selector named isBatchEmptyLnet/minecraft/client/render/BufferBuilder;isBatchEmpty()Zintermediary method_43574Lnet/minecraft/class_287;method_43574()Zofficial bLezu;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 endNullableLnet/minecraft/client/render/BufferBuilder;endNullable()Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;intermediary method_43575Lnet/minecraft/class_287;method_43575()Lnet/minecraft/class_287$class_7433;official cLezu;c()Lezu$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 endLnet/minecraft/client/render/BufferBuilder;end()Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;intermediary method_1326Lnet/minecraft/class_287;method_1326()Lnet/minecraft/class_287$class_7433;official dLezu;d()Lezu$b;
-
ensureBuilding
private void ensureBuilding()- Mappings:
Namespace Name Mixin selector named ensureBuildingLnet/minecraft/client/render/BufferBuilder;ensureBuilding()Vintermediary method_43577Lnet/minecraft/class_287;method_43577()Vofficial pLezu;p()V
-
build
- Mappings:
Namespace Name Mixin selector named buildLnet/minecraft/client/render/BufferBuilder;build()Lnet/minecraft/client/render/BufferBuilder$BuiltBuffer;intermediary method_43578Lnet/minecraft/class_287;method_43578()Lnet/minecraft/class_287$class_7433;official qLezu;q()Lezu$b;
-
resetBuilding
private void resetBuilding()- Mappings:
Namespace Name Mixin selector named resetBuildingLnet/minecraft/client/render/BufferBuilder;resetBuilding()Vintermediary method_43579Lnet/minecraft/class_287;method_43579()Vofficial rLezu;r()V
-
putByte
public void putByte(int index, byte value) - Specified by:
putBytein interfaceBufferVertexConsumer- Mappings:
Namespace Name Mixin selector named putByteLnet/minecraft/client/render/BufferVertexConsumer;putByte(IB)Vintermediary method_22896Lnet/minecraft/class_4584;method_22896(IB)Vofficial aLezw;a(IB)V
-
putShort
public void putShort(int index, short value) - Specified by:
putShortin interfaceBufferVertexConsumer- Mappings:
Namespace Name Mixin selector named putShortLnet/minecraft/client/render/BufferVertexConsumer;putShort(IS)Vintermediary method_22898Lnet/minecraft/class_4584;method_22898(IS)Vofficial aLezw;a(IS)V
-
putFloat
public void putFloat(int index, float value) - Specified by:
putFloatin interfaceBufferVertexConsumer- Mappings:
Namespace Name Mixin selector named putFloatLnet/minecraft/client/render/BufferVertexConsumer;putFloat(IF)Vintermediary method_22897Lnet/minecraft/class_4584;method_22897(IF)Vofficial aLezw;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:
nextin interfaceVertexConsumer- Mappings:
Namespace Name Mixin selector named nextLnet/minecraft/client/render/VertexConsumer;next()Vintermediary method_1344Lnet/minecraft/class_4588;method_1344()Vofficial eLfad;e()V
-
nextElement
public void nextElement()- Specified by:
nextElementin interfaceBufferVertexConsumer- Mappings:
Namespace Name Mixin selector named nextElementLnet/minecraft/client/render/BufferVertexConsumer;nextElement()Vintermediary method_1325Lnet/minecraft/class_4584;method_1325()Vofficial fLezw;f()V
-
color
Specifies the color element of the current vertex.- Specified by:
colorin interfaceBufferVertexConsumer- Specified by:
colorin 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 colorLnet/minecraft/client/render/VertexConsumer;color(IIII)Lnet/minecraft/client/render/VertexConsumer;intermediary method_1336Lnet/minecraft/class_4588;method_1336(IIII)Lnet/minecraft/class_4588;official aLfad;a(IIII)Lfad;
-
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:
vertexin interfaceVertexConsumer- Throws:
IllegalStateException- if a color has been set inFixedColorVertexConsumer.fixedColor(int, int, int, int).- Mappings:
Namespace Name Mixin selector named vertexLnet/minecraft/client/render/VertexConsumer;vertex(FFFFFFFFFIIFFF)Vintermediary method_23919Lnet/minecraft/class_4588;method_23919(FFFFFFFFFIIFFF)Vofficial aLfad;a(FFFFFFFFFIIFFF)V
-
releaseBuiltBuffer
void releaseBuiltBuffer()- Mappings:
Namespace Name Mixin selector named releaseBuiltBufferLnet/minecraft/client/render/BufferBuilder;releaseBuiltBuffer()Vintermediary method_43580Lnet/minecraft/class_287;method_43580()Vofficial sLezu;s()V
-
clear
public void clear()- Mappings:
Namespace Name Mixin selector named clearLnet/minecraft/client/render/BufferBuilder;clear()Vintermediary method_1343Lnet/minecraft/class_287;method_1343()Vofficial gLezu;g()V
-
reset
public void reset()- Mappings:
Namespace Name Mixin selector named resetLnet/minecraft/client/render/BufferBuilder;reset()Vintermediary method_23477Lnet/minecraft/class_287;method_23477()Vofficial hLezu;h()V
-
close
public void close()- Mappings:
Namespace Name Mixin selector named closeLnet/minecraft/client/render/BufferBuilder;close()Vintermediary method_54558Lnet/minecraft/class_287;method_54558()Vofficial iLezu;i()V
-
getCurrentElement
- Specified by:
getCurrentElementin interfaceBufferVertexConsumer- Mappings:
Namespace Name Mixin selector named getCurrentElementLnet/minecraft/client/render/BufferVertexConsumer;getCurrentElement()Lnet/minecraft/client/render/VertexFormatElement;intermediary method_22900Lnet/minecraft/class_4584;method_22900()Lnet/minecraft/class_296;official jLezw;j()Lfaf;
-
isBuilding
public boolean isBuilding()- Mappings:
Namespace Name Mixin selector named isBuildingLnet/minecraft/client/render/BufferBuilder;isBuilding()Zintermediary method_22893Lnet/minecraft/class_287;method_22893()Zofficial kLezu;k()Z
-
slice
- Mappings:
Namespace Name Mixin selector named sliceLnet/minecraft/client/render/BufferBuilder;slice(II)Ljava/nio/ByteBuffer;intermediary method_43576Lnet/minecraft/class_287;method_43576(II)Ljava/nio/ByteBuffer;official cLezu;c(II)Ljava/nio/ByteBuffer;
-