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) static final record(package private) final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final List<ChunkStatus> final ChunkMapprivate final DimensionDataStorageprivate final DistanceManagerprivate final ChunkAccess[]private final long[]private final ChunkStatus[]private longprivate NaturalSpawner.SpawnStatefinal ServerLevel(package private) final ThreadedLevelLightEngine(package private) final Threadprivate final ServerChunkCache.MainThreadExecutorprivate booleanprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionServerChunkCache(ServerLevel pLevel, LevelStorageSource.LevelStorageAccess pLevelStorageAccess, com.mojang.datafixers.DataFixer pFixerUpper, StructureTemplateManager pStructureManager, Executor pDispatcher, ChunkGenerator pGenerator, int pViewDistance, int pSimulationDistance, boolean pSync, ChunkProgressListener pProgressListener, ChunkStatusUpdateListener pChunkStatusListener, Supplier<DimensionDataStorage> pOverworldDataStorage) -
Method Summary
Modifier and TypeMethodDescriptionvoid<T> voidaddRegionTicket(TicketType<T> pType, ChunkPos pPos, int pDistance, T pValue) <T> voidaddRegionTicket(TicketType<T> pType, ChunkPos pPos, int pDistance, T pValue, boolean forceTicks) voidblockChanged(BlockPos pPos) voidvoidbroadcastAndSend(Entity pEntity, Packet<?> pPacket) private booleanchunkAbsent(ChunkHolder pChunkHolder, int pStatus) private voidvoidclose()getChunk(int pX, int pZ, ChunkStatus pChunkStatus, boolean pRequireChunk) getChunkDebugData(ChunkPos pChunkPos) getChunkForLighting(int pChunkX, int pChunkZ) getChunkFuture(int pX, int pZ, ChunkStatus pChunkStatus, boolean pRequireChunk) private CompletableFuture<ChunkResult<ChunkAccess>> getChunkFutureMainThread(int pX, int pZ, ChunkStatus pChunkStatus, boolean pRequireChunk) getChunkNow(int pChunkX, int pChunkZ) private voidgetFullChunk(long p_8371_, Consumer<LevelChunk> p_8372_) getLevel()intintintprivate ChunkHoldergetVisibleChunkIfPresent(long pChunkPos) booleanhasChunk(int pX, int pZ) Checks to see if a chunk exists at x, zbooleanisPositionTicking(long pChunkPos) voidmove(ServerPlayer pPlayer) voidonLightUpdate(LightLayer pType, SectionPos pPos) booleanpollTask()voidremoveEntity(Entity pEntity) <T> voidremoveRegionTicket(TicketType<T> pType, ChunkPos pPos, int pDistance, T pValue) <T> voidremoveRegionTicket(TicketType<T> pType, ChunkPos pPos, int pDistance, T pValue, boolean forceTicks) void(package private) booleanvoidsave(boolean pFlush) voidsetSimulationDistance(int pSimulationDistance) voidsetSpawnSettings(boolean pHostile, boolean pPeaceful) voidsetViewDistance(int pViewDistance) private voidstoreInCache(long pChunkPos, ChunkAccess pChunk, ChunkStatus pChunkStatus) voidtick(BooleanSupplier pHasTimeLeft, boolean pTickChunks) private voidvoidupdateChunkForced(ChunkPos pPos, boolean pAdd) Methods inherited from class net.minecraft.world.level.chunk.ChunkSource
getChunkMethods 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
-
CHUNK_STATUSES
-
distanceManager
-
level
-
mainThread
-
lightEngine
-
mainThreadProcessor
-
chunkMap
-
dataStorage
-
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
-
lastSpawnState
-
-
Constructor Details
-
ServerChunkCache
public ServerChunkCache(ServerLevel pLevel, LevelStorageSource.LevelStorageAccess pLevelStorageAccess, com.mojang.datafixers.DataFixer pFixerUpper, StructureTemplateManager pStructureManager, Executor pDispatcher, ChunkGenerator pGenerator, int pViewDistance, int pSimulationDistance, boolean pSync, ChunkProgressListener pProgressListener, ChunkStatusUpdateListener pChunkStatusListener, Supplier<DimensionDataStorage> pOverworldDataStorage)
-
-
Method Details
-
getLightEngine
- Specified by:
getLightEnginein classChunkSource
-
getVisibleChunkIfPresent
-
getTickingGenerated
public int getTickingGenerated() -
storeInCache
-
getChunk
@Nullable public ChunkAccess getChunk(int pX, int pZ, ChunkStatus pChunkStatus, boolean pRequireChunk) - Specified by:
getChunkin classChunkSource
-
getChunkNow
- Overrides:
getChunkNowin classChunkSource
-
clearCache
private void clearCache() -
getChunkFuture
public CompletableFuture<ChunkResult<ChunkAccess>> getChunkFuture(int pX, int pZ, ChunkStatus pChunkStatus, boolean pRequireChunk) -
getChunkFutureMainThread
private CompletableFuture<ChunkResult<ChunkAccess>> getChunkFutureMainThread(int pX, int pZ, ChunkStatus pChunkStatus, boolean pRequireChunk) -
chunkAbsent
-
hasChunk
public boolean hasChunk(int pX, int pZ) 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 pChunkPos) -
save
public void save(boolean pFlush) -
close
- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classChunkSource- Throws:
IOException
-
tick
- Specified by:
tickin classChunkSource
-
tickChunks
private void tickChunks() -
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
-
addRegionTicket
-
addRegionTicket
public <T> void addRegionTicket(TicketType<T> pType, ChunkPos pPos, int pDistance, T pValue, boolean forceTicks) -
removeRegionTicket
-
removeRegionTicket
public <T> void removeRegionTicket(TicketType<T> pType, ChunkPos pPos, int pDistance, T pValue, boolean forceTicks) -
updateChunkForced
- Overrides:
updateChunkForcedin classChunkSource
-
move
-
removeEntity
-
addEntity
-
broadcastAndSend
-
broadcast
-
setViewDistance
public void setViewDistance(int pViewDistance) -
setSimulationDistance
public void setSimulationDistance(int pSimulationDistance) -
setSpawnSettings
public void setSpawnSettings(boolean pHostile, boolean pPeaceful) - Overrides:
setSpawnSettingsin classChunkSource
-
getChunkDebugData
-
getDataStorage
-
getPoiManager
-
chunkScanner
-
getLastSpawnState
-
removeTicketsOnClosing
public void removeTicketsOnClosing()
-