public class ChunkManager extends ChunkLoader implements ChunkHolder.IPlayerProvider
Modifier and Type | Class and Description |
---|---|
(package private) class |
ChunkManager.EntityTracker |
(package private) class |
ChunkManager.ProxyTicketManager |
Modifier and Type | Field and Description |
---|---|
private it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> |
chunksToUnload |
private java.io.File |
dimensionDirectory |
private it.unimi.dsi.fastutil.ints.Int2ObjectMap<ChunkManager.EntityTracker> |
entities |
private java.util.function.Supplier<DimensionSavedDataManager> |
field_219259_m |
private ChunkTaskPriorityQueueSorter |
field_219263_q |
private ITaskExecutor<ChunkTaskPriorityQueueSorter.FunctionEntry<java.lang.Runnable>> |
field_219264_r |
private ITaskExecutor<ChunkTaskPriorityQueueSorter.FunctionEntry<java.lang.Runnable>> |
field_219265_s |
private IChunkStatusListener |
field_219266_t |
private java.util.concurrent.atomic.AtomicInteger |
field_219268_v |
private ChunkGenerator<?> |
generator |
private it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> |
immutableLoadedChunks |
private boolean |
immutableLoadedChunksDirty |
private ServerWorldLightManager |
lightManager |
private it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> |
loadedChunks |
private it.unimi.dsi.fastutil.longs.LongSet |
loadedPositions |
private static org.apache.logging.log4j.Logger |
LOGGER |
private ThreadTaskExecutor<java.lang.Runnable> |
mainThread |
static int |
MAX_LOADED_LEVEL |
private PlayerGenerationTracker |
playerGenerationTracker |
private PointOfInterestManager |
pointOfInterestManager |
private java.util.Queue<java.lang.Runnable> |
saveTasks |
private TemplateManager |
templateManager |
private ChunkManager.ProxyTicketManager |
ticketManager |
private it.unimi.dsi.fastutil.longs.LongSet |
unloadableChunks |
private int |
viewDistance |
private ServerWorld |
world |
dataFixer
Constructor and Description |
---|
ChunkManager(ServerWorld worldIn,
java.io.File worldDirectory,
com.mojang.datafixers.DataFixer p_i51538_3_,
TemplateManager templateManagerIn,
java.util.concurrent.Executor p_i51538_5_,
ThreadTaskExecutor<java.lang.Runnable> mainThreadIn,
IChunkLightProvider p_i51538_7_,
ChunkGenerator<?> generatorIn,
IChunkStatusListener p_i51538_9_,
java.util.function.Supplier<DimensionSavedDataManager> p_i51538_10_,
int p_i51538_11_) |
Modifier and Type | Method and Description |
---|---|
private boolean |
cannotGenerateChunks(ServerPlayerEntity player) |
void |
close() |
java.lang.String |
func_219170_a(ChunkPos pos) |
int |
func_219174_c() |
java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> |
func_219179_a(ChunkHolder p_219179_1_) |
java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> |
func_219188_b(ChunkPos p_219188_1_) |
protected java.util.function.IntSupplier |
func_219191_c(long chunkPosIn) |
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> |
func_219200_b(ChunkHolder p_219200_1_) |
private ChunkStatus |
func_219205_a(ChunkStatus p_219205_1_,
int p_219205_2_) |
protected void |
func_219209_c(ChunkPos p_219209_1_) |
private static int |
func_219215_b(ChunkPos pos,
ServerPlayerEntity player,
boolean p_219215_2_) |
protected ChunkHolder |
func_219219_b(long chunkPosIn) |
protected ChunkHolder |
func_219220_a(long chunkPosIn) |
private boolean |
func_219229_a(IChunk chunkIn) |
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<java.util.List<IChunk>,ChunkHolder.IChunkLoadingError>> |
func_219236_a(ChunkPos pos,
int p_219236_2_,
java.util.function.IntFunction<ChunkStatus> p_219236_3_) |
java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> |
func_219244_a(ChunkHolder p_219244_1_,
ChunkStatus p_219244_2_) |
java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> |
func_222961_b(ChunkHolder p_222961_1_) |
java.util.concurrent.CompletableFuture<java.lang.Void> |
func_222973_a(Chunk p_222973_1_) |
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> |
func_223156_b(ChunkHolder p_223156_1_,
ChunkStatus p_223156_2_) |
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> |
func_223172_f(ChunkPos p_223172_1_) |
private SectionPos |
func_223489_c(ServerPlayerEntity p_223489_1_) |
private static java.lang.String |
func_225402_a(java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> p_225402_0_) |
(package private) void |
func_225406_a(java.io.Writer p_225406_1_) |
private static int |
getChunkDistance(ChunkPos chunkPosIn,
int x,
int y) |
private static double |
getDistanceSquaredToChunk(ChunkPos chunkPosIn,
Entity entityIn) |
protected ServerWorldLightManager |
getLightManager() |
int |
getLoadedChunkCount() |
protected java.lang.Iterable<ChunkHolder> |
getLoadedChunksIterable() |
protected PointOfInterestManager |
getPointOfInterestManager() |
protected ChunkManager.ProxyTicketManager |
getTicketManager() |
java.util.stream.Stream<ServerPlayerEntity> |
getTrackingPlayers(ChunkPos pos,
boolean boundaryOnly) |
(package private) boolean |
isOutsideSpawningRadius(ChunkPos chunkPosIn) |
private CompoundNBT |
loadChunkData(ChunkPos pos) |
protected boolean |
refreshOffThreadCache() |
protected void |
save(boolean flush) |
private void |
scheduleSave(long chunkPosIn,
ChunkHolder chunkHolderIn) |
private void |
scheduleUnloads(java.util.function.BooleanSupplier hasMoreTime) |
private void |
sendChunkData(ServerPlayerEntity player,
IPacket<?>[] packetCache,
Chunk chunkIn) |
protected void |
sendToAllTracking(Entity p_219222_1_,
IPacket<?> p_219222_2_) |
protected void |
sendToTrackingAndSelf(Entity p_219225_1_,
IPacket<?> p_219225_2_) |
private ChunkHolder |
setChunkLevel(long chunkPosIn,
int newLevel,
ChunkHolder holder,
int oldLevel) |
protected void |
setChunkLoadedAtClient(ServerPlayerEntity player,
ChunkPos chunkPosIn,
IPacket<?>[] packetCache,
boolean wasLoaded,
boolean load) |
(package private) void |
setPlayerTracking(ServerPlayerEntity player,
boolean track) |
protected void |
setViewDistance(int viewDistance) |
protected void |
tick(java.util.function.BooleanSupplier hasMoreTime) |
protected void |
tickEntityTracker() |
protected void |
track(Entity entityIn) |
protected void |
untrack(Entity p_219231_1_) |
void |
updatePlayerPosition(ServerPlayerEntity player) |
func_227079_i_, getDataVersion, readChunk, updateChunkData, writeChunk
private static final org.apache.logging.log4j.Logger LOGGER
public static final int MAX_LOADED_LEVEL
private final it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> loadedChunks
private volatile it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> immutableLoadedChunks
private final it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<ChunkHolder> chunksToUnload
private final it.unimi.dsi.fastutil.longs.LongSet loadedPositions
private final ServerWorld world
private final ServerWorldLightManager lightManager
private final ThreadTaskExecutor<java.lang.Runnable> mainThread
private final ChunkGenerator<?> generator
private final java.util.function.Supplier<DimensionSavedDataManager> field_219259_m
private final PointOfInterestManager pointOfInterestManager
private final it.unimi.dsi.fastutil.longs.LongSet unloadableChunks
private boolean immutableLoadedChunksDirty
private final ChunkTaskPriorityQueueSorter field_219263_q
private final ITaskExecutor<ChunkTaskPriorityQueueSorter.FunctionEntry<java.lang.Runnable>> field_219264_r
private final ITaskExecutor<ChunkTaskPriorityQueueSorter.FunctionEntry<java.lang.Runnable>> field_219265_s
private final IChunkStatusListener field_219266_t
private final ChunkManager.ProxyTicketManager ticketManager
private final java.util.concurrent.atomic.AtomicInteger field_219268_v
private final TemplateManager templateManager
private final java.io.File dimensionDirectory
private final PlayerGenerationTracker playerGenerationTracker
private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<ChunkManager.EntityTracker> entities
private final java.util.Queue<java.lang.Runnable> saveTasks
private int viewDistance
public ChunkManager(ServerWorld worldIn, java.io.File worldDirectory, com.mojang.datafixers.DataFixer p_i51538_3_, TemplateManager templateManagerIn, java.util.concurrent.Executor p_i51538_5_, ThreadTaskExecutor<java.lang.Runnable> mainThreadIn, IChunkLightProvider p_i51538_7_, ChunkGenerator<?> generatorIn, IChunkStatusListener p_i51538_9_, java.util.function.Supplier<DimensionSavedDataManager> p_i51538_10_, int p_i51538_11_)
private static double getDistanceSquaredToChunk(ChunkPos chunkPosIn, Entity entityIn)
private static int func_219215_b(ChunkPos pos, ServerPlayerEntity player, boolean p_219215_2_)
private static int getChunkDistance(ChunkPos chunkPosIn, int x, int y)
protected ServerWorldLightManager getLightManager()
@Nullable protected ChunkHolder func_219220_a(long chunkPosIn)
@Nullable protected ChunkHolder func_219219_b(long chunkPosIn)
protected java.util.function.IntSupplier func_219191_c(long chunkPosIn)
public java.lang.String func_219170_a(ChunkPos pos)
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<java.util.List<IChunk>,ChunkHolder.IChunkLoadingError>> func_219236_a(ChunkPos pos, int p_219236_2_, java.util.function.IntFunction<ChunkStatus> p_219236_3_)
public java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> func_219188_b(ChunkPos p_219188_1_)
@Nullable private ChunkHolder setChunkLevel(long chunkPosIn, int newLevel, @Nullable ChunkHolder holder, int oldLevel)
public void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in class ChunkLoader
java.io.IOException
protected void save(boolean flush)
protected void tick(java.util.function.BooleanSupplier hasMoreTime)
private void scheduleUnloads(java.util.function.BooleanSupplier hasMoreTime)
private void scheduleSave(long chunkPosIn, ChunkHolder chunkHolderIn)
protected boolean refreshOffThreadCache()
public java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> func_219244_a(ChunkHolder p_219244_1_, ChunkStatus p_219244_2_)
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> func_223172_f(ChunkPos p_223172_1_)
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> func_223156_b(ChunkHolder p_223156_1_, ChunkStatus p_223156_2_)
protected void func_219209_c(ChunkPos p_219209_1_)
private ChunkStatus func_219205_a(ChunkStatus p_219205_1_, int p_219205_2_)
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> func_219200_b(ChunkHolder p_219200_1_)
public java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> func_219179_a(ChunkHolder p_219179_1_)
public java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> func_222961_b(ChunkHolder p_222961_1_)
public int func_219174_c()
private boolean func_219229_a(IChunk chunkIn)
protected void setViewDistance(int viewDistance)
protected void setChunkLoadedAtClient(ServerPlayerEntity player, ChunkPos chunkPosIn, IPacket<?>[] packetCache, boolean wasLoaded, boolean load)
public int getLoadedChunkCount()
protected ChunkManager.ProxyTicketManager getTicketManager()
protected java.lang.Iterable<ChunkHolder> getLoadedChunksIterable()
void func_225406_a(java.io.Writer p_225406_1_) throws java.io.IOException
java.io.IOException
private static java.lang.String func_225402_a(java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>> p_225402_0_)
@Nullable private CompoundNBT loadChunkData(ChunkPos pos) throws java.io.IOException
java.io.IOException
boolean isOutsideSpawningRadius(ChunkPos chunkPosIn)
private boolean cannotGenerateChunks(ServerPlayerEntity player)
void setPlayerTracking(ServerPlayerEntity player, boolean track)
private SectionPos func_223489_c(ServerPlayerEntity p_223489_1_)
public void updatePlayerPosition(ServerPlayerEntity player)
public java.util.stream.Stream<ServerPlayerEntity> getTrackingPlayers(ChunkPos pos, boolean boundaryOnly)
getTrackingPlayers
in interface ChunkHolder.IPlayerProvider
protected void track(Entity entityIn)
protected void untrack(Entity p_219231_1_)
protected void tickEntityTracker()
protected void sendToTrackingAndSelf(Entity p_219225_1_, IPacket<?> p_219225_2_)
private void sendChunkData(ServerPlayerEntity player, IPacket<?>[] packetCache, Chunk chunkIn)
protected PointOfInterestManager getPointOfInterestManager()
public java.util.concurrent.CompletableFuture<java.lang.Void> func_222973_a(Chunk p_222973_1_)