ScopedDensityBuffer .java

net.minecraft.world.level.levelgen.densityfunction.ScopedDensityBuffer (class): members: arena, age, closed, close. strings: "Buffer is already in use".

net.minecraft.world.level.levelgen.densityfunctionclass40 linescommonextends DensityBuffer863 B

Implements

API Surface (1)

void close()

Fields & Constants (3)

arena
age
closed

String literals (2)

"Cannot set size larger than buffer capacity"
"Buffer is already in use"

Code Graph: Dependencies (2)

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

Full Source

ScopedDensityBuffer.java40 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.densityfunction;
2
3
public class ScopedDensityBuffer extends DensityBuffer implements AutoCloseable {
4
	private final DensityBufferArena arena;
5
	private int age;
6
	private boolean closed;
7
8
	ScopedDensityBuffer(final DensityBufferArena arena, final int capacity, final int size) {
9
		super(capacity);
10
		this.size = size;
11
		this.arena = arena;
12
	}
13
14
	void restore(final int size) {
15
		if (size > this.values.length) {
16
			throw new IllegalArgumentException("Cannot set size larger than buffer capacity");
17
		}
18
19
		if (!this.closed) {
20
			throw new IllegalArgumentException("Buffer is already in use");
21
		}
22
23
		this.age = 0;
24
		this.closed = false;
25
		this.size = size;
26
	}
27
28
	int incrementAge() {
29
		return ++this.age;
30
	}
31
32
	@Override
33
	public void close() {
34
		if (!this.closed) {
35
			this.closed = true;
36
			this.arena.release(this);
37
		}
38
	}
39
}
40

Decompiled Minecraft 26.3 source of ScopedDensityBuffer (net/minecraft/world/level/levelgen/densityfunction/ScopedDensityBuffer.java) with Mojang official mappings, stored verbatim on the site.