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
Modifier and TypeClassDescription(package private) static final record
(package private) final class
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
private static final List<ChunkStatus>
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
(package private) final Thread
private final ServerChunkCache.MainThreadExecutor
private boolean
private boolean
-
Constructor Summary
ConstructorDescriptionServerChunkCache
(ServerLevel p_184009_, LevelStorageSource.LevelStorageAccess p_184010_, com.mojang.datafixers.DataFixer p_184011_, StructureManager p_184012_, Executor p_184013_, ChunkGenerator p_184014_, int p_184015_, int p_184016_, boolean p_184017_, ChunkProgressListener p_184018_, ChunkStatusUpdateListener p_184019_, Supplier<DimensionDataStorage> p_184020_) -
Method Summary
Modifier and TypeMethodDescriptionvoid
<T> void
addRegionTicket
(TicketType<T> p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_) <T> void
addRegionTicket
(TicketType<T> p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_, boolean forceTicks) void
blockChanged
(BlockPos p_8451_) void
void
broadcastAndSend
(Entity p_8395_, Packet<?> p_8396_) 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) Deprecated, for removal: This API element is subject to removal in a future version.<T> void
releaseTickingTicket
(TicketType<T> type, ChunkPos pos, int distance, T value) Deprecated, for removal: This API element is subject to removal in a future version.void
removeEntity
(Entity p_8444_) <T> void
removeRegionTicket
(TicketType<T> p_8439_, ChunkPos p_8440_, int p_8441_, T p_8442_) <T> void
removeRegionTicket
(TicketType<T> p_8439_, ChunkPos p_8440_, int p_8441_, T p_8442_, boolean forceTicks) void
(package private) boolean
void
save
(boolean p_8420_) void
setSimulationDistance
(int p_184027_) 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_201913_, boolean p_201914_) 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
-
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_184009_, LevelStorageSource.LevelStorageAccess p_184010_, com.mojang.datafixers.DataFixer p_184011_, StructureManager p_184012_, Executor p_184013_, ChunkGenerator p_184014_, int p_184015_, int p_184016_, boolean p_184017_, ChunkProgressListener p_184018_, ChunkStatusUpdateListener p_184019_, Supplier<DimensionDataStorage> p_184020_)
-
-
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_) -
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
-
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) -
registerTickingTicket
@Deprecated(forRemoval=true, since="1.18.2") public <T> void registerTickingTicket(TicketType<T> type, ChunkPos pos, int distance, T value) Deprecated, for removal: This API element is subject to removal in a future version. -
releaseTickingTicket
@Deprecated(forRemoval=true, since="1.18.2") public <T> void releaseTickingTicket(TicketType<T> type, ChunkPos pos, int distance, T value) Deprecated, for removal: This API element is subject to removal in a future version. -
updateChunkForced
- Overrides:
updateChunkForced
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_, boolean p_8426_) - Overrides:
setSpawnSettings
in classChunkSource
-
getChunkDebugData
-
getDataStorage
-
getPoiManager
-
chunkScanner
-
getLastSpawnState
-
removeTicketsOnClosing
public void removeTicketsOnClosing()
-