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
-
Field Summary
Modifier and TypeFieldDescriptionprivate static int
private static List<ChunkStatus>
private DimensionDataStorage
private DistanceManager
private ChunkAccess[]
private long[]
private ChunkStatus[]
private long
private NaturalSpawner.SpawnState
(package private) ThreadedLevelLightEngine
(package private) Thread
private boolean
private boolean
-
Constructor Summary
ConstructorDescriptionServerChunkCache(ServerLevel p_143228_, LevelStorageSource.LevelStorageAccess p_143229_, com.mojang.datafixers.DataFixer p_143230_, StructureManager p_143231_, Executor p_143232_, ChunkGenerator p_143233_, int p_143234_, boolean p_143235_, ChunkProgressListener p_143236_, ChunkStatusUpdateListener p_143237_, Supplier<DimensionDataStorage> p_143238_)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
<T> void
addRegionTicket(TicketType<T> p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_)
void
blockChanged(BlockPos p_8451_)
void
void
broadcastAndSend(Entity p_8395_, Packet<?> p_8396_)
private boolean
checkChunkFuture(long p_8374_, Function<ChunkHolder,CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk,ChunkHolder.ChunkLoadingFailure>>> p_8375_)
private boolean
chunkAbsent(ChunkHolder p_8417_, int p_8418_)
private void
void
close()
getChunk(int p_8360_, int p_8361_, ChunkStatus p_8362_, boolean p_8363_)
getChunkDebugData(ChunkPos p_8449_)
getChunkForLighting(int p_8454_, int p_8455_)
CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,ChunkHolder.ChunkLoadingFailure>>
getChunkFuture(int p_8432_, int p_8433_, ChunkStatus p_8434_, boolean p_8435_)
private CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,ChunkHolder.ChunkLoadingFailure>>
getChunkFutureMainThread(int p_8457_, int p_8458_, ChunkStatus p_8459_, boolean p_8460_)
getChunkNow(int p_8357_, int p_8358_)
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
onLightUpdate(LightLayer p_8403_, SectionPos p_8404_)
boolean
pollTask()
<T> void
registerTickingTicket(TicketType<T> type, ChunkPos pos, int distance, T value)
<T> void
releaseTickingTicket(TicketType<T> type, ChunkPos pos, int distance, T value)
void
removeEntity(Entity p_8444_)
<T> void
removeRegionTicket(TicketType<T> p_8439_, ChunkPos p_8440_, int p_8441_, T p_8442_)
(package private) boolean
void
save(boolean p_8420_)
void
setSpawnSettings(boolean p_8425_, boolean p_8426_)
void
setViewDistance(int p_8355_)
private void
storeInCache(long p_8367_, ChunkAccess p_8368_, ChunkStatus p_8369_)
void
tick(BooleanSupplier p_8415_)
private void
void
updateChunkForced(ChunkPos p_8400_, boolean p_8401_)
Methods inherited from class net.minecraft.world.level.chunk.ChunkSource
getChunk
-
Field Details
-
CHUNK_STATUSES
-
distanceManager
-
generator
-
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:
- Constant Field Values
-
lastChunkPos
private final long[] lastChunkPos -
lastChunkStatus
-
lastChunk
-
lastSpawnState
-
-
Constructor Details
-
ServerChunkCache
public ServerChunkCache(ServerLevel p_143228_, LevelStorageSource.LevelStorageAccess p_143229_, com.mojang.datafixers.DataFixer p_143230_, StructureManager p_143231_, Executor p_143232_, ChunkGenerator p_143233_, int p_143234_, boolean p_143235_, ChunkProgressListener p_143236_, ChunkStatusUpdateListener p_143237_, Supplier<DimensionDataStorage> p_143238_)
-
-
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_8362_, boolean p_8363_)- Specified by:
getChunk
in classChunkSource
-
getChunkNow
- Overrides:
getChunkNow
in classChunkSource
-
clearCache
private void clearCache() -
getChunkFuture
public CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,ChunkHolder.ChunkLoadingFailure>> getChunkFuture(int p_8432_, int p_8433_, ChunkStatus p_8434_, boolean p_8435_) -
getChunkFutureMainThread
private CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int p_8457_, int p_8458_, ChunkStatus p_8459_, 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
-
pollTask
public boolean pollTask() -
runDistanceManagerUpdates
boolean runDistanceManagerUpdates() -
isPositionTicking
public boolean isPositionTicking(long p_143240_) -
checkChunkFuture
private boolean checkChunkFuture(long p_8374_, Function<ChunkHolder,CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk,ChunkHolder.ChunkLoadingFailure>>> p_8375_) -
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() -
getFullChunk
-
gatherStats
- Specified by:
gatherStats
in classChunkSource
-
getPendingTasksCount
public int getPendingTasksCount() -
getGenerator
-
getLoadedChunksCount
public int getLoadedChunksCount()- Specified by:
getLoadedChunksCount
in classChunkSource
-
blockChanged
-
onLightUpdate
-
addRegionTicket
-
removeRegionTicket
public <T> void removeRegionTicket(TicketType<T> p_8439_, ChunkPos p_8440_, int p_8441_, T p_8442_) -
registerTickingTicket
-
releaseTickingTicket
-
updateChunkForced
- Overrides:
updateChunkForced
in classChunkSource
-
move
-
removeEntity
-
addEntity
-
broadcastAndSend
-
broadcast
-
setViewDistance
public void setViewDistance(int p_8355_) -
setSpawnSettings
public void setSpawnSettings(boolean p_8425_, boolean p_8426_)- Overrides:
setSpawnSettings
in classChunkSource
-
getChunkDebugData
-
getDataStorage
-
getPoiManager
-
getLastSpawnState
-