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 final List<LevelChunk> private final TicketStorage -
Constructor Summary
ConstructorsConstructorDescriptionServerChunkCache(ServerLevel pLevel, LevelStorageSource.LevelStorageAccess pStorageSource, com.mojang.datafixers.DataFixer pFixerUpper, StructureTemplateManager pStructureManager, Executor pDispatcher, ChunkGenerator pGenerator, int pViewDistance, int pSimulationDistance, boolean pSync, ChunkStatusUpdateListener pChunkStatusListener, Supplier<DimensionDataStorage> pOverworldDataStorage) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddTicketAndLoadWithRadius(TicketType pTicketType, ChunkPos pChunkPos, int pRadius) voidaddTicketWithRadius(TicketType pTicket, ChunkPos pChunkPos, int pRadius) voidblockChanged(BlockPos pPos) private voidbroadcastChangedChunks(ProfilerFiller pProfiler) private booleanchunkAbsent(ChunkHolder pChunkHolder, int pStatus) private voidvoidclose()voidgetChunk(int p_8360_, int p_8361_, ChunkStatus p_330876_, boolean p_8363_) getChunkDebugData(ChunkPos pChunkPos) getChunkForLighting(int p_8454_, int p_8455_) 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) it.unimi.dsi.fastutil.longs.LongSetprivate voidgetFullChunk(long pChunkPos, Consumer<LevelChunk> pFullChunkGetter) getLevel()intintprivate ChunkHoldergetVisibleChunkIfPresent(long pChunkPos) booleanbooleanhasChunk(int pX, int pZ) Checks to see if a chunk exists at x, zbooleanisPositionTicking(long pChunkPos) voidmove(ServerPlayer pPlayer) voidonChunkReadyToSend(ChunkHolder pChunkHolder) voidonLightUpdate(LightLayer pType, SectionPos pPos) booleanpollTask()voidremoveEntity(Entity pEntity) voidremoveTicketWithRadius(TicketType pTicket, ChunkPos pChunkPos, int pRadius) (package private) booleanvoidsave(boolean pFlush) voidsendToTrackingPlayers(Entity pEntity, Packet<? super ClientGamePacketListener> pPacket) voidsendToTrackingPlayersAndSelf(Entity pEntity, Packet<? super ClientGamePacketListener> pPacket) voidsetSimulationDistance(int pSimulationDistance) voidsetSpawnSettings(boolean p_8425_) voidsetViewDistance(int pViewDistance) private voidstoreInCache(long pChunkPos, ChunkAccess pChunk, ChunkStatus pChunkStatus) voidtick(BooleanSupplier p_201913_, boolean p_201914_) private voidprivate voidtickChunks(ProfilerFiller pProfiler, long pTimeInhabited) private voidtickSpawningChunk(LevelChunk pChunk, long pTimeInhabited, List<MobCategory> pSpawnCategories, NaturalSpawner.SpawnState pSpawnState) booleanupdateChunkForced(ChunkPos p_8400_, boolean p_8401_) 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
self, sendToTrackingPlayers, sendToTrackingPlayersAndSelf
-
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 -
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 pLevel, LevelStorageSource.LevelStorageAccess pStorageSource, com.mojang.datafixers.DataFixer pFixerUpper, StructureTemplateManager pStructureManager, Executor pDispatcher, ChunkGenerator pGenerator, int pViewDistance, int pSimulationDistance, boolean pSync, ChunkStatusUpdateListener pChunkStatusListener, Supplier<DimensionDataStorage> pOverworldDataStorage)
-
-
Method Details
-
getLightEngine
- Specified by:
getLightEnginein classChunkSource
-
getVisibleChunkIfPresent
-
storeInCache
-
getChunk
@Nullable public ChunkAccess getChunk(int p_8360_, int p_8361_, ChunkStatus p_330876_, boolean p_8363_) - 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() -
broadcastChangedChunks
-
tickChunks
-
tickSpawningChunk
private void tickSpawningChunk(LevelChunk pChunk, long pTimeInhabited, List<MobCategory> pSpawnCategories, NaturalSpawner.SpawnState pSpawnState) -
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
-
hasActiveTickets
public boolean hasActiveTickets() -
addTicket
-
addTicketAndLoadWithRadius
public CompletableFuture<?> addTicketAndLoadWithRadius(TicketType pTicketType, ChunkPos pChunkPos, int pRadius) -
addTicketWithRadius
-
removeTicketWithRadius
-
updateChunkForced
- Overrides:
updateChunkForcedin classChunkSource
-
getForceLoadedChunks
public it.unimi.dsi.fastutil.longs.LongSet getForceLoadedChunks()- Overrides:
getForceLoadedChunksin classChunkSource
-
move
-
removeEntity
-
addEntity
-
sendToTrackingPlayersAndSelf
public void sendToTrackingPlayersAndSelf(Entity pEntity, Packet<? super ClientGamePacketListener> pPacket) -
sendToTrackingPlayers
-
setViewDistance
public void setViewDistance(int pViewDistance) -
setSimulationDistance
public void setSimulationDistance(int pSimulationDistance) -
setSpawnSettings
public void setSpawnSettings(boolean p_8425_) - Overrides:
setSpawnSettingsin classChunkSource
-
getChunkDebugData
-
getDataStorage
-
getPoiManager
-
chunkScanner
-
getLastSpawnState
-
deactivateTicketsOnClosing
public void deactivateTicketsOnClosing() -
onChunkReadyToSend
-