SectionBufferBuilderPack .java

net.minecraft.client.renderer.SectionBufferBuilderPack (class): members: TOTAL_BUFFERS_SIZE, discardAll, clearAll, buffers, buffer, close. imports: Util.

net.minecraft.client.rendererclass33 linesclient1.1 KB

Implements

API Surface (4)

ByteBufferBuilder buffer(final ChunkSectionLayer layer)
void clearAll()
void discardAll()
void close()

Fields & Constants (2)

TOTAL_BUFFERS_SIZE
buffers

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

SectionBufferBuilderPack.java33 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer;
2
3
import com.mojang.blaze3d.vertex.ByteBufferBuilder;
4
import java.util.Arrays;
5
import java.util.Map;
6
import net.fabricmc.api.EnvType;
7
import net.fabricmc.api.Environment;
8
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
9
import net.minecraft.util.Util;
10
11
@Environment(EnvType.CLIENT)
12
public class SectionBufferBuilderPack implements AutoCloseable {
13
	public static final int TOTAL_BUFFERS_SIZE = Arrays.stream(ChunkSectionLayer.values()).mapToInt(ChunkSectionLayer::bufferSize).sum();
14
	private final Map<ChunkSectionLayer, ByteBufferBuilder> buffers = Util.makeEnumMap(ChunkSectionLayer.class, layer -> new ByteBufferBuilder(layer.bufferSize()));
15
16
	public ByteBufferBuilder buffer(final ChunkSectionLayer layer) {
17
		return this.buffers.get(layer);
18
	}
19
20
	public void clearAll() {
21
		this.buffers.values().forEach(ByteBufferBuilder::clear);
22
	}
23
24
	public void discardAll() {
25
		this.buffers.values().forEach(ByteBufferBuilder::discard);
26
	}
27
28
	@Override
29
	public void close() {
30
		this.buffers.values().forEach(ByteBufferBuilder::close);
31
	}
32
}
33

Decompiled Minecraft 26.3 source of SectionBufferBuilderPack (net/minecraft/client/renderer/SectionBufferBuilderPack.java) with Mojang official mappings, stored verbatim on the site.