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 int
private final Set
<ChunkHolder> final ChunkMap
private final DimensionDataStorage
private final DistanceManager
private final ChunkAccess[]
private final long[]
private final ChunkStatus[]
private long
private NaturalSpawner.SpawnState
final ServerLevel
(package private) final ThreadedLevelLightEngine
private static final org.slf4j.Logger
(package private) final Thread
private final ServerChunkCache.MainThreadExecutor
private boolean
private boolean
private final List
<LevelChunk> private final TicketStorage
-
Constructor Summary
ConstructorsConstructorDescriptionServerChunkCache
(ServerLevel p_214982_, LevelStorageSource.LevelStorageAccess p_214983_, com.mojang.datafixers.DataFixer p_214984_, StructureTemplateManager p_214985_, Executor p_214986_, ChunkGenerator p_214987_, int p_214988_, int p_214989_, boolean p_214990_, ChunkProgressListener p_214991_, ChunkStatusUpdateListener p_214992_, Supplier<DimensionDataStorage> p_214993_) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
addTicketWithRadius
(TicketType p_394166_, ChunkPos p_394235_, int p_393501_) void
blockChanged
(BlockPos p_8451_) void
void
broadcastAndSend
(Entity p_8395_, Packet<?> p_8396_) private void
broadcastChangedChunks
(ProfilerFiller p_360525_) private boolean
chunkAbsent
(ChunkHolder p_8417_, int p_8418_) private void
void
close()
void
getChunk
(int p_8360_, int p_8361_, ChunkStatus p_330876_, boolean p_8363_) getChunkDebugData
(ChunkPos p_8449_) getChunkForLighting
(int p_8454_, int p_8455_) getChunkFuture
(int p_8432_, int p_8433_, ChunkStatus p_330326_, boolean p_8435_) private CompletableFuture
<ChunkResult<ChunkAccess>> getChunkFutureMainThread
(int p_8457_, int p_8458_, ChunkStatus p_331599_, boolean p_8460_) getChunkNow
(int p_8357_, int p_8358_) it.unimi.dsi.fastutil.longs.LongSet
private void
getFullChunk
(long p_8371_, Consumer<LevelChunk> p_8372_) getLevel()
int
int
int
private ChunkHolder
getVisibleChunkIfPresent
(long p_8365_) boolean
hasChunk
(int p_8429_, int p_8430_) boolean
isPositionTicking
(long p_143240_) void
move
(ServerPlayer p_8386_) void
onChunkReadyToSend
(ChunkHolder p_381768_) void
onLightUpdate
(LightLayer p_8403_, SectionPos p_8404_) boolean
pollTask()
void
removeEntity
(Entity p_8444_) void
removeTicketWithRadius
(TicketType p_393514_, ChunkPos p_394302_, int p_393914_) (package private) boolean
void
save
(boolean p_8420_) void
setSimulationDistance
(int p_184027_) void
setSpawnSettings
(boolean p_8425_) void
setViewDistance
(int p_8355_) private void
storeInCache
(long p_8367_, ChunkAccess p_8368_, ChunkStatus p_331839_) void
tick
(BooleanSupplier p_201913_, boolean p_201914_) private void
private void
tickChunks
(ProfilerFiller p_364065_, long p_361343_) private void
tickSpawningChunk
(LevelChunk p_401862_, long p_401787_, List<MobCategory> p_401800_, NaturalSpawner.SpawnState p_401847_) boolean
updateChunkForced
(ChunkPos p_8400_, boolean p_8401_) Methods inherited from class net.minecraft.world.level.chunk.ChunkSource
getChunk, onSectionEmptinessChanged
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 p_214982_, LevelStorageSource.LevelStorageAccess p_214983_, com.mojang.datafixers.DataFixer p_214984_, StructureTemplateManager p_214985_, Executor p_214986_, ChunkGenerator p_214987_, int p_214988_, int p_214989_, boolean p_214990_, ChunkProgressListener p_214991_, ChunkStatusUpdateListener p_214992_, Supplier<DimensionDataStorage> p_214993_)
-
-
Method Details
-
getLightEngine
- Specified by:
getLightEngine
in classChunkSource
-
getVisibleChunkIfPresent
-
getTickingGenerated
public int getTickingGenerated() -
storeInCache
-
getChunk
@Nullable public ChunkAccess getChunk(int p_8360_, int p_8361_, ChunkStatus p_330876_, boolean p_8363_) - Specified by:
getChunk
in classChunkSource
-
getChunkNow
- Overrides:
getChunkNow
in classChunkSource
-
clearCache
private void clearCache() -
getChunkFuture
public CompletableFuture<ChunkResult<ChunkAccess>> getChunkFuture(int p_8432_, int p_8433_, ChunkStatus p_330326_, boolean p_8435_) -
getChunkFutureMainThread
private CompletableFuture<ChunkResult<ChunkAccess>> getChunkFutureMainThread(int p_8457_, int p_8458_, ChunkStatus p_331599_, boolean p_8460_) -
chunkAbsent
-
hasChunk
public boolean hasChunk(int p_8429_, int p_8430_) - Overrides:
hasChunk
in classChunkSource
-
getChunkForLighting
- Specified by:
getChunkForLighting
in interfaceLightChunkGetter
- Overrides:
getChunkForLighting
in classChunkSource
-
getLevel
- Specified by:
getLevel
in interfaceLightChunkGetter
-
pollTask
public boolean pollTask() -
runDistanceManagerUpdates
boolean runDistanceManagerUpdates() -
isPositionTicking
public boolean isPositionTicking(long p_143240_) -
save
public void save(boolean p_8420_) -
close
- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classChunkSource
- Throws:
IOException
-
tick
- Specified by:
tick
in classChunkSource
-
tickChunks
private void tickChunks() -
broadcastChangedChunks
-
tickChunks
-
tickSpawningChunk
private void tickSpawningChunk(LevelChunk p_401862_, long p_401787_, List<MobCategory> p_401800_, NaturalSpawner.SpawnState p_401847_) -
getFullChunk
-
gatherStats
- Specified by:
gatherStats
in classChunkSource
-
getPendingTasksCount
public int getPendingTasksCount() -
getGenerator
-
getGeneratorState
-
randomState
-
getLoadedChunksCount
public int getLoadedChunksCount()- Specified by:
getLoadedChunksCount
in classChunkSource
-
blockChanged
-
onLightUpdate
- Specified by:
onLightUpdate
in interfaceLightChunkGetter
-
addTicket
-
addTicketWithRadius
-
removeTicketWithRadius
-
updateChunkForced
- Overrides:
updateChunkForced
in classChunkSource
-
getForceLoadedChunks
public it.unimi.dsi.fastutil.longs.LongSet getForceLoadedChunks()- Overrides:
getForceLoadedChunks
in classChunkSource
-
move
-
removeEntity
-
addEntity
-
broadcastAndSend
-
broadcast
-
setViewDistance
public void setViewDistance(int p_8355_) -
setSimulationDistance
public void setSimulationDistance(int p_184027_) -
setSpawnSettings
public void setSpawnSettings(boolean p_8425_) - Overrides:
setSpawnSettings
in classChunkSource
-
getChunkDebugData
-
getDataStorage
-
getPoiManager
-
chunkScanner
-
getLastSpawnState
-
deactivateTicketsOnClosing
public void deactivateTicketsOnClosing() -
onChunkReadyToSend
-