public class ServerChunkManager extends ChunkManager
Modifier and Type | Class and Description |
---|---|
(package private) class |
ServerChunkManager.MainThreadExecutor |
Modifier and Type | Field and Description |
---|---|
private static List<ChunkStatus> |
CHUNK_STATUSES |
private Chunk[] |
chunkCache |
private ChunkGenerator<?> |
chunkGenerator |
private long[] |
chunkPosCache |
private static int |
CHUNKS_ELIGIBLE_FOR_SPAWNING |
private ChunkStatus[] |
chunkStatusCache |
private long |
lastMobSpawningTime |
private ServerLightingProvider |
lightProvider |
private ServerChunkManager.MainThreadExecutor |
mainThreadExecutor |
private PersistentStateManager |
persistentStateManager |
private Thread |
serverThread |
private boolean |
spawnAnimals |
private boolean |
spawnMonsters |
ThreadedAnvilChunkStorage |
threadedAnvilChunkStorage |
private ChunkTicketManager |
ticketManager |
private ServerWorld |
world |
Constructor and Description |
---|
ServerChunkManager(ServerWorld world,
File worldDirectory,
com.mojang.datafixers.DataFixer dataFixer,
StructureManager structureManager,
Executor workerExecutor,
ChunkGenerator<?> chunkGenerator,
int viewDistance,
boolean bool,
WorldGenerationProgressListener worldGenerationProgressListener,
Supplier<PersistentStateManager> supplier) |
getWorldChunk
private static final int CHUNKS_ELIGIBLE_FOR_SPAWNING
private static final List<ChunkStatus> CHUNK_STATUSES
private final ChunkTicketManager ticketManager
private final ChunkGenerator<?> chunkGenerator
private final ServerWorld world
private final Thread serverThread
private final ServerLightingProvider lightProvider
private final ServerChunkManager.MainThreadExecutor mainThreadExecutor
public final ThreadedAnvilChunkStorage threadedAnvilChunkStorage
private final PersistentStateManager persistentStateManager
private long lastMobSpawningTime
private boolean spawnMonsters
private boolean spawnAnimals
private final long[] chunkPosCache
private final ChunkStatus[] chunkStatusCache
private final Chunk[] chunkCache
public ServerChunkManager(ServerWorld world, File worldDirectory, com.mojang.datafixers.DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator<?> chunkGenerator, int viewDistance, boolean bool, WorldGenerationProgressListener worldGenerationProgressListener, Supplier<PersistentStateManager> supplier)
public ServerLightingProvider getLightingProvider()
getLightingProvider
in class ChunkManager
@Nullable private ChunkHolder getChunkHolder(long pos)
public int getTotalChunksLoadedCount()
private void putInCache(long pos, Chunk chunk, ChunkStatus status)
@Nullable public Chunk getChunk(int x, int z, ChunkStatus leastStatus, boolean create)
getChunk
in class ChunkManager
@Nullable public WorldChunk getWorldChunk(int chunkX, int chunkZ)
getWorldChunk
in class ChunkManager
private void initChunkCaches()
@Environment(value=CLIENT) public CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.Unloaded>> getChunkFutureSyncOnMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create)
private CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.Unloaded>> getChunkFuture(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create)
private boolean isMissingForLevel(@Nullable ChunkHolder holder, int maxLevel)
public boolean isChunkLoaded(int x, int z)
isChunkLoaded
in class ChunkManager
public BlockView getChunk(int chunkX, int chunkZ)
getChunk
in interface ChunkProvider
getChunk
in class ChunkManager
public World getWorld()
public boolean executeQueuedTasks()
private boolean tick()
public boolean shouldTickEntity(Entity entity)
shouldTickEntity
in class ChunkManager
public boolean shouldTickChunk(ChunkPos pos)
shouldTickChunk
in class ChunkManager
public boolean shouldTickBlock(BlockPos pos)
shouldTickBlock
in class ChunkManager
public boolean method_20727(Entity entity)
private boolean isFutureReady(long pos, Function<ChunkHolder,CompletableFuture<com.mojang.datafixers.util.Either<WorldChunk,ChunkHolder.Unloaded>>> futureFunction)
public void save(boolean flush)
public void close() throws IOException
close
in interface AutoCloseable
close
in class ChunkManager
IOException
public void tick(BooleanSupplier shouldKeepTicking)
tick
in class ChunkManager
private void tickChunks()
public String getDebugString()
getDebugString
in class ChunkManager
public int getPendingTasks()
public ChunkGenerator<?> getChunkGenerator()
public int getLoadedChunkCount()
public void markForUpdate(BlockPos pos)
public void onLightUpdate(LightType type, ChunkSectionPos chunkSectionPos)
public <T> void addTicket(ChunkTicketType<T> chunkTicketType, ChunkPos chunkPos, int int2, T t)
public <T> void removeTicket(ChunkTicketType<T> chunkTicketType, ChunkPos chunkPos, int int2, T t)
public void setChunkForced(ChunkPos pos, boolean forced)
setChunkForced
in class ChunkManager
public void updateCameraPosition(ServerPlayerEntity player)
public void unloadEntity(Entity entity)
public void loadEntity(Entity entity)
public void applyViewDistance(int watchDistance)
public void setMobSpawnOptions(boolean spawnMonsters, boolean spawnAnimals)
setMobSpawnOptions
in class ChunkManager
public PersistentStateManager getPersistentStateManager()
public PointOfInterestStorage getPointOfInterestStorage()