Package net.minecraft.server.level
Class ServerChunkCache
java.lang.Object
net.minecraft.world.level.chunk.ChunkSource
net.minecraft.server.level.ServerChunkCache
- All Implemented Interfaces:
AutoCloseable,LightChunkGetter,IServerChunkCacheExtension
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final Set<ChunkHolder> final ChunkMapprivate final DimensionDataStorageprivate final DistanceManagerprivate final ChunkAccess[]private final long[]private final ChunkStatus[]private longprivate NaturalSpawner.SpawnStatefinal ServerLevel(package private) final ThreadedLevelLightEngineprivate static final org.slf4j.Logger(package private) final Threadprivate final ServerChunkCache.MainThreadExecutorprivate booleanprivate booleanprivate final List<LevelChunk> private final TicketStorage -
Constructor Summary
ConstructorsConstructorDescriptionServerChunkCache(ServerLevel level, LevelStorageSource.LevelStorageAccess levelStorageAccess, com.mojang.datafixers.DataFixer fixerUpper, StructureTemplateManager structureManager, Executor dispatcher, ChunkGenerator generator, int viewDistance, int simulationDistance, boolean sync, ChunkProgressListener progressListener, ChunkStatusUpdateListener chunkStatusListener, Supplier<DimensionDataStorage> overworldDataStorage) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddTicketWithRadius(TicketType ticket, ChunkPos chunkPos, int radius) voidblockChanged(BlockPos pos) voidvoidbroadcastAndSend(Entity entity, Packet<?> packet) private voidbroadcastChangedChunks(ProfilerFiller profiler) private booleanchunkAbsent(ChunkHolder chunkHolder, int status) private voidvoidclose()voidgetChunk(int x, int z, ChunkStatus chunkStatus, boolean requireChunk) getChunkDebugData(ChunkPos chunkPos) getChunkForLighting(int chunkX, int chunkZ) getChunkFuture(int x, int z, ChunkStatus chunkStatus, boolean requireChunk) private CompletableFuture<ChunkResult<ChunkAccess>> getChunkFutureMainThread(int x, int z, ChunkStatus chunkStatus, boolean requireChunk) getChunkNow(int chunkX, int chunkZ) it.unimi.dsi.fastutil.longs.LongSetprivate voidgetFullChunk(long chunkPos, Consumer<LevelChunk> fullChunkGetter) getLevel()intintintprivate ChunkHoldergetVisibleChunkIfPresent(long chunkPos) booleanhasChunk(int x, int z) Checks to see if a chunk exists at x, zbooleanisPositionTicking(long chunkPos) voidmove(ServerPlayer player) voidonChunkReadyToSend(ChunkHolder chunkHolder) voidonLightUpdate(LightLayer type, SectionPos pos) booleanpollTask()voidremoveEntity(Entity entity) voidremoveTicketWithRadius(TicketType ticket, ChunkPos chunkPos, int radius) (package private) booleanvoidsave(boolean flush) voidsetSimulationDistance(int simulationDistance) voidsetSpawnSettings(boolean spawnSettings) voidsetViewDistance(int viewDistance) private voidstoreInCache(long chunkPos, ChunkAccess chunk, ChunkStatus chunkStatus) voidtick(BooleanSupplier hasTimeLeft, boolean tickChunks) private voidprivate voidtickChunks(ProfilerFiller profiler, long timeInhabited) private voidtickSpawningChunk(LevelChunk chunk, long timeInhabited, List<MobCategory> spawnCategories, NaturalSpawner.SpawnState spawnState) booleanupdateChunkForced(ChunkPos chunkPos, boolean add) Methods inherited from class net.minecraft.world.level.chunk.ChunkSource
getChunk, onSectionEmptinessChangedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.common.extensions.IServerChunkCacheExtension
broadcast, broadcastAndSend, self
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
distanceManager
-
level
-
mainThread
-
lightEngine
-
mainThreadProcessor
-
chunkMap
-
dataStorage
-
ticketStorage
-
lastInhabitedUpdate
private long lastInhabitedUpdate -
spawnEnemies
private boolean spawnEnemies -
spawnFriendlies
private boolean spawnFriendlies -
CACHE_SIZE
private static final int CACHE_SIZE- See Also:
-
lastChunkPos
private final long[] lastChunkPos -
lastChunkStatus
-
lastChunk
-
spawningChunks
-
chunkHoldersToBroadcast
-
lastSpawnState
-
-
Constructor Details
-
ServerChunkCache
public ServerChunkCache(ServerLevel level, LevelStorageSource.LevelStorageAccess levelStorageAccess, com.mojang.datafixers.DataFixer fixerUpper, StructureTemplateManager structureManager, Executor dispatcher, ChunkGenerator generator, int viewDistance, int simulationDistance, boolean sync, ChunkProgressListener progressListener, ChunkStatusUpdateListener chunkStatusListener, Supplier<DimensionDataStorage> overworldDataStorage)
-
-
Method Details
-
getLightEngine
- Specified by:
getLightEnginein classChunkSource
-
getVisibleChunkIfPresent
-
getTickingGenerated
public int getTickingGenerated() -
storeInCache
-
getChunk
- Specified by:
getChunkin classChunkSource
-
getChunkNow
- Overrides:
getChunkNowin classChunkSource
-
clearCache
private void clearCache() -
getChunkFuture
public CompletableFuture<ChunkResult<ChunkAccess>> getChunkFuture(int x, int z, ChunkStatus chunkStatus, boolean requireChunk) -
getChunkFutureMainThread
private CompletableFuture<ChunkResult<ChunkAccess>> getChunkFutureMainThread(int x, int z, ChunkStatus chunkStatus, boolean requireChunk) -
chunkAbsent
-
hasChunk
public boolean hasChunk(int x, int z) Checks to see if a chunk exists at x, z- Overrides:
hasChunkin classChunkSource- Returns:
trueif a chunk is loaded at the provided position, without forcing a chunk load.
-
getChunkForLighting
- Specified by:
getChunkForLightingin interfaceLightChunkGetter- Overrides:
getChunkForLightingin classChunkSource
-
getLevel
- Specified by:
getLevelin interfaceLightChunkGetter
-
pollTask
public boolean pollTask() -
runDistanceManagerUpdates
boolean runDistanceManagerUpdates() -
isPositionTicking
public boolean isPositionTicking(long chunkPos) -
save
public void save(boolean flush) -
close
- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classChunkSource- Throws:
IOException
-
tick
- Specified by:
tickin classChunkSource
-
tickChunks
private void tickChunks() -
broadcastChangedChunks
-
tickChunks
-
tickSpawningChunk
private void tickSpawningChunk(LevelChunk chunk, long timeInhabited, List<MobCategory> spawnCategories, NaturalSpawner.SpawnState spawnState) -
getFullChunk
-
gatherStats
- Specified by:
gatherStatsin classChunkSource
-
getPendingTasksCount
public int getPendingTasksCount() -
getGenerator
-
getGeneratorState
-
randomState
-
getLoadedChunksCount
public int getLoadedChunksCount()- Specified by:
getLoadedChunksCountin classChunkSource
-
blockChanged
-
onLightUpdate
- Specified by:
onLightUpdatein interfaceLightChunkGetter
-
addTicket
-
addTicketWithRadius
-
removeTicketWithRadius
-
updateChunkForced
- Overrides:
updateChunkForcedin classChunkSource
-
getForceLoadedChunks
public it.unimi.dsi.fastutil.longs.LongSet getForceLoadedChunks()- Overrides:
getForceLoadedChunksin classChunkSource
-
move
-
removeEntity
-
addEntity
-
broadcastAndSend
-
broadcast
-
setViewDistance
public void setViewDistance(int viewDistance) -
setSimulationDistance
public void setSimulationDistance(int simulationDistance) -
setSpawnSettings
public void setSpawnSettings(boolean spawnSettings) - Overrides:
setSpawnSettingsin classChunkSource
-
getChunkDebugData
-
getDataStorage
-
getPoiManager
-
chunkScanner
-
getLastSpawnState
-
deactivateTicketsOnClosing
public void deactivateTicketsOnClosing() -
onChunkReadyToSend
-