WorldGenerationContext .java

net.minecraft.world.level.levelgen.WorldGenerationContext (class): members: getMinGenY, getGenDepth, seaLevel, minY, height. imports: LevelHeightAccessor.

net.minecraft.world.level.levelgenclass43 linescommon1.2 KB

API Surface (4)

WorldGenerationContext of(final LevelAccessor level)
int getMinGenY()
int getGenDepth()
int seaLevel()

Fields & Constants (3)

minY
height
seaLevel

Code Graph: Dependencies (4)

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

Full Source

WorldGenerationContext.java43 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen;
2
3
import net.minecraft.world.level.LevelAccessor;
4
import net.minecraft.world.level.LevelHeightAccessor;
5
import net.minecraft.world.level.WorldGenLevel;
6
import net.minecraft.world.level.chunk.ChunkGenerator;
7
8
public class WorldGenerationContext {
9
	private final int minY;
10
	private final int height;
11
	private final int seaLevel;
12
13
	public static WorldGenerationContext of(final LevelAccessor level) {
14
		return level instanceof WorldGenLevel worldGenLevel
15
			? new WorldGenerationContext(worldGenLevel.getLevel().getChunkSource().getGenerator(), level)
16
			: new WorldGenerationContext(level);
17
	}
18
19
	public WorldGenerationContext(final ChunkGenerator generator, final LevelHeightAccessor heightAccessor) {
20
		this.minY = Math.max(heightAccessor.getMinY(), generator.getMinY());
21
		this.height = Math.min(heightAccessor.getHeight(), generator.getGenDepth());
22
		this.seaLevel = generator.getSeaLevel();
23
	}
24
25
	private WorldGenerationContext(final LevelAccessor level) {
26
		this.minY = level.getMinY();
27
		this.height = level.getHeight();
28
		this.seaLevel = level.getSeaLevel();
29
	}
30
31
	public int getMinGenY() {
32
		return this.minY;
33
	}
34
35
	public int getGenDepth() {
36
		return this.height;
37
	}
38
39
	public int seaLevel() {
40
		return this.seaLevel;
41
	}
42
}
43

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