Package net.minecraft.world.server
Class ChunkManager
- java.lang.Object
-
- net.minecraft.world.chunk.storage.ChunkLoader
-
- net.minecraft.world.server.ChunkManager
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,ChunkHolder.IPlayerProvider
public class ChunkManager extends ChunkLoader implements ChunkHolder.IPlayerProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
ChunkManager.EntityTracker
(package private) class
ChunkManager.ProxyTicketManager
-
Field Summary
Fields Modifier and Type Field Description private it.unimi.dsi.fastutil.longs.Long2ByteMap
chunkTypeCache
private ChunkManager.ProxyTicketManager
distanceManager
private it.unimi.dsi.fastutil.longs.LongSet
entitiesInLevel
private it.unimi.dsi.fastutil.ints.Int2ObjectMap<ChunkManager.EntityTracker>
entityMap
private ChunkGenerator
generator
private ServerWorld
level
private ServerWorldLightManager
lightEngine
private static org.apache.logging.log4j.Logger
LOGGER
private ThreadTaskExecutor<java.lang.Runnable>
mainThreadExecutor
private ITaskExecutor<ChunkTaskPriorityQueueSorter.FunctionEntry<java.lang.Runnable>>
mainThreadMailbox
static int
MAX_CHUNK_DISTANCE
private boolean
modified
private java.util.function.Supplier<DimensionSavedDataManager>
overworldDataStorage
private it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder>
pendingUnloads
private PlayerGenerationTracker
playerMap
private PointOfInterestManager
poiManager
private IChunkStatusListener
progressListener
private ChunkTaskPriorityQueueSorter
queueSorter
private java.io.File
storageFolder
private TemplateManager
structureManager
private java.util.concurrent.atomic.AtomicInteger
tickingGenerated
private it.unimi.dsi.fastutil.longs.LongSet
toDrop
private java.util.Queue<java.lang.Runnable>
unloadQueue
private it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder>
updatingChunkMap
private int
viewDistance
private it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder>
visibleChunkMap
private ITaskExecutor<ChunkTaskPriorityQueueSorter.FunctionEntry<java.lang.Runnable>>
worldgenMailbox
-
Fields inherited from class net.minecraft.world.chunk.storage.ChunkLoader
fixerUpper
-
-
Constructor Summary
Constructors Constructor Description ChunkManager(ServerWorld p_i232602_1_, SaveFormat.LevelSave p_i232602_2_, com.mojang.datafixers.DataFixer p_i232602_3_, TemplateManager p_i232602_4_, java.util.concurrent.Executor p_i232602_5_, ThreadTaskExecutor<java.lang.Runnable> p_i232602_6_, IChunkLightProvider p_i232602_7_, ChunkGenerator p_i232602_8_, IChunkStatusListener p_i232602_9_, java.util.function.Supplier<DimensionSavedDataManager> p_i232602_10_, int p_i232602_11_, boolean p_i232602_12_)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addEntity(Entity p_219210_1_)
protected void
broadcast(Entity p_219222_1_, IPacket<?> p_219222_2_)
protected void
broadcastAndSend(Entity p_219225_1_, IPacket<?> p_219225_2_)
private static int
checkerboardDistance(ChunkPos p_219232_0_, int p_219232_1_, int p_219232_2_)
private static int
checkerboardDistance(ChunkPos p_219215_0_, ServerPlayerEntity p_219215_1_, boolean p_219215_2_)
void
close()
(package private) void
dumpChunks(java.io.Writer p_225406_1_)
private static double
euclideanDistanceSquared(ChunkPos p_219217_0_, Entity p_219217_1_)
java.lang.String
getChunkDebugData(ChunkPos p_219170_1_)
protected java.util.function.IntSupplier
getChunkQueueLevel(long p_219191_1_)
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<java.util.List<IChunk>,ChunkHolder.IChunkLoadingError>>
getChunkRangeFuture(ChunkPos p_219236_1_, int p_219236_2_, java.util.function.IntFunction<ChunkStatus> p_219236_3_)
protected java.lang.Iterable<ChunkHolder>
getChunks()
private ChunkStatus
getDependencyStatus(ChunkStatus p_219205_1_, int p_219205_2_)
protected ChunkManager.ProxyTicketManager
getDistanceManager()
java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>>
getEntityTickingRangeFuture(ChunkPos p_219188_1_)
protected ServerWorldLightManager
getLightEngine()
java.util.stream.Stream<ServerPlayerEntity>
getPlayers(ChunkPos p_219097_1_, boolean p_219097_2_)
protected PointOfInterestManager
getPoiManager()
int
getTickingGenerated()
protected ChunkHolder
getUpdatingChunkIfPresent(long p_219220_1_)
protected ChunkHolder
getVisibleChunkIfPresent(long p_219219_1_)
private boolean
isExistingChunkFull(ChunkPos p_241090_1_)
private byte
markPosition(ChunkPos p_241088_1_, ChunkStatus.Type p_241088_2_)
private void
markPositionReplaceable(ChunkPos p_241089_1_)
void
move(ServerPlayerEntity p_219183_1_)
(package private) boolean
noPlayersCloseForSpawning(ChunkPos p_219243_1_)
java.util.concurrent.CompletableFuture<java.lang.Void>
packTicks(Chunk p_222973_1_)
private void
playerLoadedChunk(ServerPlayerEntity p_219180_1_, IPacket<?>[] p_219180_2_, Chunk p_219180_3_)
java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>>
postProcess(ChunkHolder p_219179_1_)
private static java.lang.String
printFuture(java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> p_225402_0_)
private void
processUnloads(java.util.function.BooleanSupplier p_223155_1_)
protected boolean
promoteChunkMap()
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>>
protoChunkToFullChunk(ChunkHolder p_219200_1_)
private CompoundNBT
readChunk(ChunkPos p_219178_1_)
protected void
releaseLightTicket(ChunkPos p_219209_1_)
protected void
removeEntity(Entity p_219231_1_)
private boolean
save(IChunk p_219229_1_)
protected void
saveAllChunks(boolean p_219177_1_)
java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>>
schedule(ChunkHolder p_219244_1_, ChunkStatus p_219244_2_)
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>>
scheduleChunkGeneration(ChunkHolder p_223156_1_, ChunkStatus p_223156_2_)
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>>
scheduleChunkLoad(ChunkPos p_223172_1_)
private void
scheduleUnload(long p_219212_1_, ChunkHolder p_219212_3_)
protected void
setViewDistance(int p_219175_1_)
int
size()
private boolean
skipPlayer(ServerPlayerEntity p_219187_1_)
protected void
tick()
protected void
tick(java.util.function.BooleanSupplier p_219204_1_)
java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>>
unpackTicks(ChunkHolder p_222961_1_)
private ChunkHolder
updateChunkScheduling(long p_219213_1_, int p_219213_3_, ChunkHolder p_219213_4_, int p_219213_5_)
protected void
updateChunkTracking(ServerPlayerEntity p_219199_1_, ChunkPos p_219199_2_, IPacket<?>[] p_219199_3_, boolean p_219199_4_, boolean p_219199_5_)
private SectionPos
updatePlayerPos(ServerPlayerEntity p_223489_1_)
(package private) void
updatePlayerStatus(ServerPlayerEntity p_219234_1_, boolean p_219234_2_)
-
Methods inherited from class net.minecraft.world.chunk.storage.ChunkLoader
flushWorker, getVersion, read, upgradeChunkTag, write
-
-
-
-
Field Detail
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
MAX_CHUNK_DISTANCE
public static final int MAX_CHUNK_DISTANCE
-
updatingChunkMap
private final it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> updatingChunkMap
-
visibleChunkMap
private volatile it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> visibleChunkMap
-
pendingUnloads
private final it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> pendingUnloads
-
entitiesInLevel
private final it.unimi.dsi.fastutil.longs.LongSet entitiesInLevel
-
level
private final ServerWorld level
-
lightEngine
private final ServerWorldLightManager lightEngine
-
mainThreadExecutor
private final ThreadTaskExecutor<java.lang.Runnable> mainThreadExecutor
-
generator
private final ChunkGenerator generator
-
overworldDataStorage
private final java.util.function.Supplier<DimensionSavedDataManager> overworldDataStorage
-
poiManager
private final PointOfInterestManager poiManager
-
toDrop
private final it.unimi.dsi.fastutil.longs.LongSet toDrop
-
modified
private boolean modified
-
queueSorter
private final ChunkTaskPriorityQueueSorter queueSorter
-
worldgenMailbox
private final ITaskExecutor<ChunkTaskPriorityQueueSorter.FunctionEntry<java.lang.Runnable>> worldgenMailbox
-
mainThreadMailbox
private final ITaskExecutor<ChunkTaskPriorityQueueSorter.FunctionEntry<java.lang.Runnable>> mainThreadMailbox
-
progressListener
private final IChunkStatusListener progressListener
-
distanceManager
private final ChunkManager.ProxyTicketManager distanceManager
-
tickingGenerated
private final java.util.concurrent.atomic.AtomicInteger tickingGenerated
-
structureManager
private final TemplateManager structureManager
-
storageFolder
private final java.io.File storageFolder
-
playerMap
private final PlayerGenerationTracker playerMap
-
entityMap
private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<ChunkManager.EntityTracker> entityMap
-
chunkTypeCache
private final it.unimi.dsi.fastutil.longs.Long2ByteMap chunkTypeCache
-
unloadQueue
private final java.util.Queue<java.lang.Runnable> unloadQueue
-
viewDistance
private int viewDistance
-
-
Constructor Detail
-
ChunkManager
public ChunkManager(ServerWorld p_i232602_1_, SaveFormat.LevelSave p_i232602_2_, com.mojang.datafixers.DataFixer p_i232602_3_, TemplateManager p_i232602_4_, java.util.concurrent.Executor p_i232602_5_, ThreadTaskExecutor<java.lang.Runnable> p_i232602_6_, IChunkLightProvider p_i232602_7_, ChunkGenerator p_i232602_8_, IChunkStatusListener p_i232602_9_, java.util.function.Supplier<DimensionSavedDataManager> p_i232602_10_, int p_i232602_11_, boolean p_i232602_12_)
-
-
Method Detail
-
euclideanDistanceSquared
private static double euclideanDistanceSquared(ChunkPos p_219217_0_, Entity p_219217_1_)
-
checkerboardDistance
private static int checkerboardDistance(ChunkPos p_219215_0_, ServerPlayerEntity p_219215_1_, boolean p_219215_2_)
-
checkerboardDistance
private static int checkerboardDistance(ChunkPos p_219232_0_, int p_219232_1_, int p_219232_2_)
-
getLightEngine
protected ServerWorldLightManager getLightEngine()
-
getUpdatingChunkIfPresent
@Nullable protected ChunkHolder getUpdatingChunkIfPresent(long p_219220_1_)
-
getVisibleChunkIfPresent
@Nullable protected ChunkHolder getVisibleChunkIfPresent(long p_219219_1_)
-
getChunkQueueLevel
protected java.util.function.IntSupplier getChunkQueueLevel(long p_219191_1_)
-
getChunkDebugData
public java.lang.String getChunkDebugData(ChunkPos p_219170_1_)
-
getChunkRangeFuture
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<java.util.List<IChunk>,ChunkHolder.IChunkLoadingError>> getChunkRangeFuture(ChunkPos p_219236_1_, int p_219236_2_, java.util.function.IntFunction<ChunkStatus> p_219236_3_)
-
getEntityTickingRangeFuture
public java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> getEntityTickingRangeFuture(ChunkPos p_219188_1_)
-
updateChunkScheduling
@Nullable private ChunkHolder updateChunkScheduling(long p_219213_1_, int p_219213_3_, @Nullable ChunkHolder p_219213_4_, int p_219213_5_)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Overrides:
close
in classChunkLoader
- Throws:
java.io.IOException
-
saveAllChunks
protected void saveAllChunks(boolean p_219177_1_)
-
tick
protected void tick(java.util.function.BooleanSupplier p_219204_1_)
-
processUnloads
private void processUnloads(java.util.function.BooleanSupplier p_223155_1_)
-
scheduleUnload
private void scheduleUnload(long p_219212_1_, ChunkHolder p_219212_3_)
-
promoteChunkMap
protected boolean promoteChunkMap()
-
schedule
public java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> schedule(ChunkHolder p_219244_1_, ChunkStatus p_219244_2_)
-
scheduleChunkLoad
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> scheduleChunkLoad(ChunkPos p_223172_1_)
-
markPositionReplaceable
private void markPositionReplaceable(ChunkPos p_241089_1_)
-
markPosition
private byte markPosition(ChunkPos p_241088_1_, ChunkStatus.Type p_241088_2_)
-
scheduleChunkGeneration
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> scheduleChunkGeneration(ChunkHolder p_223156_1_, ChunkStatus p_223156_2_)
-
releaseLightTicket
protected void releaseLightTicket(ChunkPos p_219209_1_)
-
getDependencyStatus
private ChunkStatus getDependencyStatus(ChunkStatus p_219205_1_, int p_219205_2_)
-
protoChunkToFullChunk
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> protoChunkToFullChunk(ChunkHolder p_219200_1_)
-
postProcess
public java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> postProcess(ChunkHolder p_219179_1_)
-
unpackTicks
public java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> unpackTicks(ChunkHolder p_222961_1_)
-
getTickingGenerated
public int getTickingGenerated()
-
save
private boolean save(IChunk p_219229_1_)
-
isExistingChunkFull
private boolean isExistingChunkFull(ChunkPos p_241090_1_)
-
setViewDistance
protected void setViewDistance(int p_219175_1_)
-
updateChunkTracking
protected void updateChunkTracking(ServerPlayerEntity p_219199_1_, ChunkPos p_219199_2_, IPacket<?>[] p_219199_3_, boolean p_219199_4_, boolean p_219199_5_)
-
size
public int size()
-
getDistanceManager
protected ChunkManager.ProxyTicketManager getDistanceManager()
-
getChunks
protected java.lang.Iterable<ChunkHolder> getChunks()
-
dumpChunks
void dumpChunks(java.io.Writer p_225406_1_) throws java.io.IOException
- Throws:
java.io.IOException
-
printFuture
private static java.lang.String printFuture(java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> p_225402_0_)
-
readChunk
@Nullable private CompoundNBT readChunk(ChunkPos p_219178_1_) throws java.io.IOException
- Throws:
java.io.IOException
-
noPlayersCloseForSpawning
boolean noPlayersCloseForSpawning(ChunkPos p_219243_1_)
-
skipPlayer
private boolean skipPlayer(ServerPlayerEntity p_219187_1_)
-
updatePlayerStatus
void updatePlayerStatus(ServerPlayerEntity p_219234_1_, boolean p_219234_2_)
-
updatePlayerPos
private SectionPos updatePlayerPos(ServerPlayerEntity p_223489_1_)
-
move
public void move(ServerPlayerEntity p_219183_1_)
-
getPlayers
public java.util.stream.Stream<ServerPlayerEntity> getPlayers(ChunkPos p_219097_1_, boolean p_219097_2_)
- Specified by:
getPlayers
in interfaceChunkHolder.IPlayerProvider
-
addEntity
protected void addEntity(Entity p_219210_1_)
-
removeEntity
protected void removeEntity(Entity p_219231_1_)
-
tick
protected void tick()
-
playerLoadedChunk
private void playerLoadedChunk(ServerPlayerEntity p_219180_1_, IPacket<?>[] p_219180_2_, Chunk p_219180_3_)
-
getPoiManager
protected PointOfInterestManager getPoiManager()
-
packTicks
public java.util.concurrent.CompletableFuture<java.lang.Void> packTicks(Chunk p_222973_1_)
-
-