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
-
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 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<T> voidaddRegionTicket(TicketType<T> p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_) <T> voidaddRegionTicket(TicketType<T> p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_, boolean forceTicks) voidblockChanged(BlockPos p_8451_) voidvoidbroadcastAndSend(Entity p_8395_, Packet<?> p_8396_) private booleanchunkAbsent(ChunkHolder p_8417_, int p_8418_) private voidvoidclose()getChunk(int p_8360_, int p_8361_, ChunkStatus p_334940_, boolean p_8363_) getChunkDebugData(ChunkPos p_8449_) getChunkForLighting(int p_8454_, int p_8455_) getChunkFuture(int p_8432_, int p_8433_, ChunkStatus p_329681_, boolean p_8435_) private CompletableFuture<ChunkResult<ChunkAccess>> getChunkFutureMainThread(int p_8457_, int p_8458_, ChunkStatus p_334479_, boolean p_8460_) getChunkNow(int p_8357_, int p_8358_) private voidgetFullChunk(long p_8371_, Consumer<LevelChunk> p_8372_) getLevel()intintintprivate ChunkHoldergetVisibleChunkIfPresent(long p_8365_) booleanhasChunk(int p_8429_, int p_8430_) booleanisPositionTicking(long p_143240_) voidmove(ServerPlayer p_8386_) voidonLightUpdate(LightLayer p_8403_, SectionPos p_8404_) booleanpollTask()voidremoveEntity(Entity p_8444_) <T> voidremoveRegionTicket(TicketType<T> p_8439_, ChunkPos p_8440_, int p_8441_, T p_8442_) <T> voidremoveRegionTicket(TicketType<T> p_8439_, ChunkPos p_8440_, int p_8441_, T p_8442_, boolean forceTicks) void(package private) booleanvoidsave(boolean p_8420_) voidsetSimulationDistance(int p_184027_) voidsetSpawnSettings(boolean p_8425_, boolean p_8426_) voidsetViewDistance(int p_8355_) private voidstoreInCache(long p_8367_, ChunkAccess p_8368_, ChunkStatus p_333650_) voidtick(BooleanSupplier p_201913_, boolean p_201914_) private voidvoidupdateChunkForced(ChunkPos p_8400_, boolean p_8401_) Methods inherited from class net.minecraft.world.level.chunk.ChunkSource
getChunk
-
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 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:
getLightEnginein classChunkSource
-
getVisibleChunkIfPresent
-
getTickingGenerated
public int getTickingGenerated() -
storeInCache
-
getChunk
@Nullable public ChunkAccess getChunk(int p_8360_, int p_8361_, ChunkStatus p_334940_, boolean p_8363_) - Specified by:
getChunkin classChunkSource
-
getChunkNow
- Overrides:
getChunkNowin classChunkSource
-
clearCache
private void clearCache() -
getChunkFuture
public CompletableFuture<ChunkResult<ChunkAccess>> getChunkFuture(int p_8432_, int p_8433_, ChunkStatus p_329681_, boolean p_8435_) -
getChunkFutureMainThread
private CompletableFuture<ChunkResult<ChunkAccess>> getChunkFutureMainThread(int p_8457_, int p_8458_, ChunkStatus p_334479_, boolean p_8460_) -
chunkAbsent
-
hasChunk
public boolean hasChunk(int p_8429_, int p_8430_) - Overrides:
hasChunkin classChunkSource
-
getChunkForLighting
- Specified by:
getChunkForLightingin interfaceLightChunkGetter- Overrides:
getChunkForLightingin classChunkSource
-
getLevel
-
pollTask
public boolean pollTask() -
runDistanceManagerUpdates
boolean runDistanceManagerUpdates() -
isPositionTicking
public boolean isPositionTicking(long p_143240_) -
save
public void save(boolean p_8420_) -
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
-
addRegionTicket
-
addRegionTicket
public <T> void addRegionTicket(TicketType<T> p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_, boolean forceTicks) -
removeRegionTicket
-
removeRegionTicket
public <T> void removeRegionTicket(TicketType<T> p_8439_, ChunkPos p_8440_, int p_8441_, T p_8442_, boolean forceTicks) -
updateChunkForced
- Overrides:
updateChunkForcedin 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_, boolean p_8426_) - Overrides:
setSpawnSettingsin classChunkSource
-
getChunkDebugData
-
getDataStorage
-
getPoiManager
-
chunkScanner
-
getLastSpawnState
-
removeTicketsOnClosing
public void removeTicketsOnClosing()
-