Package net.minecraft.server.level
Class ChunkMap
java.lang.Object
net.minecraft.world.level.chunk.storage.ChunkStorage
net.minecraft.server.level.ChunkMap
- All Implemented Interfaces:
AutoCloseable
,ChunkHolder.PlayerProvider
-
Nested Class Summary
Modifier and TypeClassDescription(package private) class
(package private) class
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
private static final int
private static final byte
private static final byte
private static final byte
private final it.unimi.dsi.fastutil.longs.Long2LongMap
private final ChunkStatusUpdateListener
private final it.unimi.dsi.fastutil.longs.Long2ByteMap
private final ChunkMap.DistanceManager
private static final int
private final it.unimi.dsi.fastutil.longs.LongSet
private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<ChunkMap.TrackedEntity>
static final int
private ChunkGenerator
(package private) final ServerLevel
private final ThreadedLevelLightEngine
private static final org.slf4j.Logger
private final BlockableEventLoop<Runnable>
private final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>>
static final int
static final int
private static final int
private boolean
private final Supplier<DimensionDataStorage>
private final it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder>
private final PlayerMap
private final PoiManager
private final ChunkProgressListener
private final ChunkTaskPriorityQueueSorter
private RandomState
private final String
private final StructureTemplateManager
private final AtomicInteger
(package private) final it.unimi.dsi.fastutil.longs.LongSet
private final it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder>
(package private) int
private it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder>
private final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>>
Fields inherited from class net.minecraft.world.level.chunk.storage.ChunkStorage
fixerUpper, LAST_MONOLYTH_STRUCTURE_DATA_VERSION
-
Constructor Summary
ConstructorDescriptionChunkMap
(ServerLevel p_214836_, LevelStorageSource.LevelStorageAccess p_214837_, com.mojang.datafixers.DataFixer p_214838_, StructureTemplateManager p_214839_, Executor p_214840_, BlockableEventLoop<Runnable> p_214841_, LightChunkGetter p_214842_, ChunkGenerator p_214843_, ChunkProgressListener p_214844_, ChunkStatusUpdateListener p_214845_, Supplier<DimensionDataStorage> p_214846_, int p_214847_, boolean p_214848_) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
(package private) boolean
anyPlayerCloseEnoughForSpawning
(ChunkPos p_183880_) void
protected void
broadcastAndSend
(Entity p_140334_, Packet<?> p_140335_) void
close()
private ChunkAccess
createEmptyChunk
(ChunkPos p_214962_) debugFuturesAndCreateReportedException
(IllegalStateException p_203752_, String p_203753_) void
(package private) void
dumpChunks
(Writer p_140275_) private static double
euclideanDistanceSquared
(ChunkPos p_140227_, Entity p_140228_) protected ChunkGenerator
getChunkDebugData
(ChunkPos p_140205_) protected IntSupplier
getChunkQueueLevel
(long p_140372_) private CompletableFuture<com.mojang.datafixers.util.Either<List<ChunkAccess>,
ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture
(ChunkPos p_140211_, int p_140212_, IntFunction<ChunkStatus> p_140213_) protected Iterable<ChunkHolder>
private ChunkStatus
getDependencyStatus
(ChunkStatus p_140263_, int p_140264_) protected ThreadedLevelLightEngine
getPlayers
(ChunkPos p_183801_, boolean p_183802_) getPlayersCloseForSpawning
(ChunkPos p_183889_) protected PoiManager
int
protected ChunkHolder
getUpdatingChunkIfPresent
(long p_140175_) protected ChunkHolder
getVisibleChunkIfPresent
(long p_140328_) private com.mojang.datafixers.util.Either<ChunkAccess,
ChunkHolder.ChunkLoadingFailure> handleChunkLoadFailure
(Throwable p_214902_, ChunkPos p_214903_) boolean
hasWork()
private static boolean
isChunkDataValid
(CompoundTag p_214941_) static boolean
isChunkInRange
(int p_200879_, int p_200880_, int p_200881_, int p_200882_, int p_200883_) private static boolean
isChunkOnRangeBorder
(int p_183829_, int p_183830_, int p_183831_, int p_183832_, int p_183833_) private boolean
isExistingChunkFull
(ChunkPos p_140426_) private byte
markPosition
(ChunkPos p_140230_, ChunkStatus.ChunkType p_140231_) private void
markPositionReplaceable
(ChunkPos p_140423_) void
move
(ServerPlayer p_140185_) (package private) void
onFullChunkStatusChange
(ChunkPos p_143076_, ChunkHolder.FullChunkStatus p_143077_) private boolean
playerIsCloseEnoughForSpawning
(ServerPlayer p_183752_, ChunkPos p_183753_) private void
playerLoadedChunk
(ServerPlayer p_183761_, org.apache.commons.lang3.mutable.MutableObject<ClientboundLevelChunkWithLightPacket> p_183762_, LevelChunk p_183763_) private static void
postLoadProtoChunk
(ServerLevel p_143065_, List<CompoundTag> p_143066_) CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk,
ChunkHolder.ChunkLoadingFailure>> prepareAccessibleChunk
(ChunkHolder p_143110_) CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk,
ChunkHolder.ChunkLoadingFailure>> prepareEntityTickingChunk
(ChunkPos p_143118_) CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk,
ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk
(ChunkHolder p_143054_) private static String
printFuture
(CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> p_140279_) private void
processUnloads
(BooleanSupplier p_140354_) protected boolean
private CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,
ChunkHolder.ChunkLoadingFailure>> protoChunkToFullChunk
(ChunkHolder p_140384_) protected RandomState
private CompletableFuture<Optional<CompoundTag>>
protected void
releaseLightTicket
(ChunkPos p_140376_) protected void
removeEntity
(Entity p_140332_) private boolean
save
(ChunkAccess p_140259_) protected void
saveAllChunks
(boolean p_140319_) private boolean
saveChunkIfNeeded
(ChunkHolder p_198875_) CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,
ChunkHolder.ChunkLoadingFailure>> schedule
(ChunkHolder p_140293_, ChunkStatus p_140294_) private CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,
ChunkHolder.ChunkLoadingFailure>> scheduleChunkGeneration
(ChunkHolder p_140361_, ChunkStatus p_140362_) private CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,
ChunkHolder.ChunkLoadingFailure>> scheduleChunkLoad
(ChunkPos p_140418_) private void
scheduleUnload
(long p_140182_, ChunkHolder p_140183_) protected void
setViewDistance
(int p_140168_) int
size()
private boolean
skipPlayer
(ServerPlayer p_140330_) protected void
tick()
protected void
tick
(BooleanSupplier p_140281_) (package private) ChunkHolder
updateChunkScheduling
(long p_140177_, int p_140178_, ChunkHolder p_140179_, int p_140180_) protected void
updateChunkTracking
(ServerPlayer p_183755_, ChunkPos p_183756_, org.apache.commons.lang3.mutable.MutableObject<ClientboundLevelChunkWithLightPacket> p_183757_, boolean p_183758_, boolean p_183759_) private SectionPos
updatePlayerPos
(ServerPlayer p_140374_) (package private) void
updatePlayerStatus
(ServerPlayer p_140193_, boolean p_140194_) private CompoundTag
upgradeChunkTag
(CompoundTag p_214948_) Methods inherited from class net.minecraft.world.level.chunk.storage.ChunkStorage
chunkScanner, flushWorker, getVersion, injectDatafixingContext, isOldChunkAround, read, upgradeChunkTag, write
-
Field Details
-
CHUNK_TYPE_REPLACEABLE
private static final byte CHUNK_TYPE_REPLACEABLE- See Also:
-
CHUNK_TYPE_UNKNOWN
private static final byte CHUNK_TYPE_UNKNOWN- See Also:
-
CHUNK_TYPE_FULL
private static final byte CHUNK_TYPE_FULL- See Also:
-
LOGGER
private static final org.slf4j.Logger LOGGER -
CHUNK_SAVED_PER_TICK
private static final int CHUNK_SAVED_PER_TICK- See Also:
-
CHUNK_SAVED_EAGERLY_PER_TICK
private static final int CHUNK_SAVED_EAGERLY_PER_TICK- See Also:
-
EAGER_CHUNK_SAVE_COOLDOWN_IN_MILLIS
private static final int EAGER_CHUNK_SAVE_COOLDOWN_IN_MILLIS- See Also:
-
MIN_VIEW_DISTANCE
private static final int MIN_VIEW_DISTANCE- See Also:
-
MAX_VIEW_DISTANCE
public static final int MAX_VIEW_DISTANCE- See Also:
-
MAX_CHUNK_DISTANCE
public static final int MAX_CHUNK_DISTANCE -
FORCED_TICKET_LEVEL
public static final int FORCED_TICKET_LEVEL- See Also:
-
updatingChunkMap
private final it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> updatingChunkMap -
visibleChunkMap
private volatile it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> visibleChunkMap -
pendingUnloads
-
entitiesInLevel
private final it.unimi.dsi.fastutil.longs.LongSet entitiesInLevel -
level
-
lightEngine
-
mainThreadExecutor
-
generator
-
randomState
-
overworldDataStorage
-
poiManager
-
toDrop
final it.unimi.dsi.fastutil.longs.LongSet toDrop -
modified
private boolean modified -
queueSorter
-
worldgenMailbox
-
mainThreadMailbox
-
progressListener
-
chunkStatusListener
-
distanceManager
-
tickingGenerated
-
structureTemplateManager
-
storageName
-
playerMap
-
entityMap
-
chunkTypeCache
private final it.unimi.dsi.fastutil.longs.Long2ByteMap chunkTypeCache -
chunkSaveCooldowns
private final it.unimi.dsi.fastutil.longs.Long2LongMap chunkSaveCooldowns -
unloadQueue
-
viewDistance
int viewDistance
-
-
Constructor Details
-
ChunkMap
public ChunkMap(ServerLevel p_214836_, LevelStorageSource.LevelStorageAccess p_214837_, com.mojang.datafixers.DataFixer p_214838_, StructureTemplateManager p_214839_, Executor p_214840_, BlockableEventLoop<Runnable> p_214841_, LightChunkGetter p_214842_, ChunkGenerator p_214843_, ChunkProgressListener p_214844_, ChunkStatusUpdateListener p_214845_, Supplier<DimensionDataStorage> p_214846_, int p_214847_, boolean p_214848_)
-
-
Method Details
-
generator
-
randomState
-
debugReloadGenerator
public void debugReloadGenerator() -
euclideanDistanceSquared
-
isChunkInRange
public static boolean isChunkInRange(int p_200879_, int p_200880_, int p_200881_, int p_200882_, int p_200883_) -
isChunkOnRangeBorder
private static boolean isChunkOnRangeBorder(int p_183829_, int p_183830_, int p_183831_, int p_183832_, int p_183833_) -
getLightEngine
-
getUpdatingChunkIfPresent
-
getVisibleChunkIfPresent
-
getChunkQueueLevel
-
getChunkDebugData
-
getChunkRangeFuture
private CompletableFuture<com.mojang.datafixers.util.Either<List<ChunkAccess>,ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkPos p_140211_, int p_140212_, IntFunction<ChunkStatus> p_140213_) -
debugFuturesAndCreateReportedException
public ReportedException debugFuturesAndCreateReportedException(IllegalStateException p_203752_, String p_203753_) -
prepareEntityTickingChunk
public CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk,ChunkHolder.ChunkLoadingFailure>> prepareEntityTickingChunk(ChunkPos p_143118_) -
updateChunkScheduling
@Nullable ChunkHolder updateChunkScheduling(long p_140177_, int p_140178_, @Nullable ChunkHolder p_140179_, int p_140180_) -
close
- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classChunkStorage
- Throws:
IOException
-
saveAllChunks
protected void saveAllChunks(boolean p_140319_) -
tick
-
hasWork
public boolean hasWork() -
processUnloads
-
scheduleUnload
-
promoteChunkMap
protected boolean promoteChunkMap() -
schedule
public CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,ChunkHolder.ChunkLoadingFailure>> schedule(ChunkHolder p_140293_, ChunkStatus p_140294_) -
scheduleChunkLoad
private CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,ChunkHolder.ChunkLoadingFailure>> scheduleChunkLoad(ChunkPos p_140418_) -
isChunkDataValid
-
handleChunkLoadFailure
private com.mojang.datafixers.util.Either<ChunkAccess,ChunkHolder.ChunkLoadingFailure> handleChunkLoadFailure(Throwable p_214902_, ChunkPos p_214903_) -
createEmptyChunk
-
markPositionReplaceable
-
markPosition
-
scheduleChunkGeneration
private CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,ChunkHolder.ChunkLoadingFailure>> scheduleChunkGeneration(ChunkHolder p_140361_, ChunkStatus p_140362_) -
releaseLightTicket
-
getDependencyStatus
-
postLoadProtoChunk
-
protoChunkToFullChunk
private CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess,ChunkHolder.ChunkLoadingFailure>> protoChunkToFullChunk(ChunkHolder p_140384_) -
prepareTickingChunk
public CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk,ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk(ChunkHolder p_143054_) -
prepareAccessibleChunk
public CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk,ChunkHolder.ChunkLoadingFailure>> prepareAccessibleChunk(ChunkHolder p_143110_) -
getTickingGenerated
public int getTickingGenerated() -
saveChunkIfNeeded
-
save
-
isExistingChunkFull
-
setViewDistance
protected void setViewDistance(int p_140168_) -
updateChunkTracking
protected void updateChunkTracking(ServerPlayer p_183755_, ChunkPos p_183756_, org.apache.commons.lang3.mutable.MutableObject<ClientboundLevelChunkWithLightPacket> p_183757_, boolean p_183758_, boolean p_183759_) -
size
public int size() -
getDistanceManager
-
getChunks
-
dumpChunks
- Throws:
IOException
-
printFuture
private static String printFuture(CompletableFuture<com.mojang.datafixers.util.Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> p_140279_) -
readChunk
-
upgradeChunkTag
-
anyPlayerCloseEnoughForSpawning
-
getPlayersCloseForSpawning
-
playerIsCloseEnoughForSpawning
-
skipPlayer
-
updatePlayerStatus
-
updatePlayerPos
-
move
-
getPlayers
- Specified by:
getPlayers
in interfaceChunkHolder.PlayerProvider
-
addEntity
-
removeEntity
-
tick
protected void tick() -
broadcast
-
broadcastAndSend
-
playerLoadedChunk
private void playerLoadedChunk(ServerPlayer p_183761_, org.apache.commons.lang3.mutable.MutableObject<ClientboundLevelChunkWithLightPacket> p_183762_, LevelChunk p_183763_) -
getPoiManager
-
getStorageName
-
onFullChunkStatusChange
-