ChunkSource .java

net.minecraft.world.level.chunk.ChunkSource (class): members: onSectionEmptinessChanged, getChunkNow, getLoadedChunksCount, getChunkForLighting, hasChunk.

net.minecraft.world.level.chunkclass57 linescommon1.7 KB

Implements

API Surface (6)

boolean hasChunk(final int x, final int z)
void onSectionEmptinessChanged(final int sectionX, final int sectionY, final int sectionZ, final boolean empty)
void close()
void setSpawnSettings(final boolean spawnEnemies)
boolean updateChunkForced(final ChunkPos pos, final boolean forced)
LongSet getForceLoadedChunks()

Code Graph: Dependencies (7)

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

Full Source

ChunkSource.java57 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.chunk;
2
3
import it.unimi.dsi.fastutil.longs.LongSet;
4
import java.io.IOException;
5
import java.util.function.BooleanSupplier;
6
import net.minecraft.world.level.ChunkPos;
7
import net.minecraft.world.level.chunk.status.ChunkStatus;
8
import net.minecraft.world.level.lighting.LevelLightEngine;
9
import org.jspecify.annotations.Nullable;
10
11
public abstract class ChunkSource implements AutoCloseable, LightChunkGetter {
12
	public @Nullable LevelChunk getChunk(final int x, final int z, final boolean loadOrGenerate) {
13
		return (LevelChunk)this.getChunk(x, z, ChunkStatus.FULL, loadOrGenerate);
14
	}
15
16
	public @Nullable LevelChunk getChunkNow(final int x, final int z) {
17
		return this.getChunk(x, z, false);
18
	}
19
20
	@Override
21
	public @Nullable LightChunk getChunkForLighting(final int x, final int z) {
22
		return this.getChunk(x, z, ChunkStatus.EMPTY, false);
23
	}
24
25
	public boolean hasChunk(final int x, final int z) {
26
		return this.getChunk(x, z, ChunkStatus.FULL, false) != null;
27
	}
28
29
	public abstract @Nullable ChunkAccess getChunk(int x, int z, ChunkStatus targetStatus, boolean loadOrGenerate);
30
31
	public abstract void tick(BooleanSupplier haveTime, final boolean tickChunks);
32
33
	public void onSectionEmptinessChanged(final int sectionX, final int sectionY, final int sectionZ, final boolean empty) {
34
	}
35
36
	public abstract String gatherStats();
37
38
	public abstract int getLoadedChunksCount();
39
40
	@Override
41
	public void close() throws IOException {
42
	}
43
44
	public abstract LevelLightEngine getLightEngine();
45
46
	public void setSpawnSettings(final boolean spawnEnemies) {
47
	}
48
49
	public boolean updateChunkForced(final ChunkPos pos, final boolean forced) {
50
		return false;
51
	}
52
53
	public LongSet getForceLoadedChunks() {
54
		return LongSet.of();
55
	}
56
}
57

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