LoadingChunkTracker .java

net.minecraft.server.level.LoadingChunkTracker (class): members: runDistanceUpdates, distanceManager, getLevelFromSource, ticketStorage, MAX_LEVEL.

net.minecraft.server.levelclass50 linesserverextends ChunkTracker1.4 KB

API Surface (4)

int getLevelFromSource(final long to)
int getLevel(final long node)
void setLevel(final long node, final int level)
int runDistanceUpdates(final int count)

Fields & Constants (3)

MAX_LEVEL
distanceManager
ticketStorage

Code Graph: Dependencies (4)

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

Full Source

LoadingChunkTracker.java50 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.server.level;
2
3
import net.minecraft.world.level.TicketStorage;
4
5
public class LoadingChunkTracker extends ChunkTracker {
6
	private static final int MAX_LEVEL = ChunkLevel.MAX_LEVEL + 1;
7
	private final DistanceManager distanceManager;
8
	private final TicketStorage ticketStorage;
9
10
	public LoadingChunkTracker(final DistanceManager distanceManager, final TicketStorage ticketStorage) {
11
		super(MAX_LEVEL + 1, 16, 256);
12
		this.distanceManager = distanceManager;
13
		this.ticketStorage = ticketStorage;
14
		ticketStorage.setLoadingChunkUpdatedListener(this::update);
15
	}
16
17
	@Override
18
	protected int getLevelFromSource(final long to) {
19
		return this.ticketStorage.getTicketLevelAt(to, false);
20
	}
21
22
	@Override
23
	protected int getLevel(final long node) {
24
		if (!this.distanceManager.isChunkToRemove(node)) {
25
			ChunkHolder chunk = this.distanceManager.getChunk(node);
26
			if (chunk != null) {
27
				return chunk.getTicketLevel();
28
			}
29
		}
30
31
		return MAX_LEVEL;
32
	}
33
34
	@Override
35
	protected void setLevel(final long node, final int level) {
36
		ChunkHolder chunk = this.distanceManager.getChunk(node);
37
		int oldLevel = chunk == null ? MAX_LEVEL : chunk.getTicketLevel();
38
		if (oldLevel != level) {
39
			chunk = this.distanceManager.updateChunkScheduling(node, level, chunk, oldLevel);
40
			if (chunk != null) {
41
				this.distanceManager.chunksToUpdateFutures.add(chunk);
42
			}
43
		}
44
	}
45
46
	public int runDistanceUpdates(final int count) {
47
		return this.runUpdates(count);
48
	}
49
}
50

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