package net.minecraft.client.renderer;

import java.util.stream.Collectors;
import com.mojang.blaze3d.vertex.BufferBuilder;
import java.util.Map;

public class ChunkBufferBuilderPack {
    private final Map<RenderType, BufferBuilder> builders;
    
    public ChunkBufferBuilderPack() {
        this.builders = RenderType.chunkBufferLayers().stream().collect(Collectors.toMap(drb -> drb, drb -> new BufferBuilder(drb.bufferSize())));
    }
    
    public BufferBuilder builder(final RenderType drb) {
        return this.builders.get(drb);
    }
    
    public void clearAll() {
        this.builders.values().forEach(BufferBuilder::clear);
    }
    
    public void discardAll() {
        this.builders.values().forEach(BufferBuilder::discard);
    }
}
