Package net.minecraft.world.server
Class ServerChunkProvider
- java.lang.Object
-
- net.minecraft.world.chunk.AbstractChunkProvider
-
- net.minecraft.world.server.ServerChunkProvider
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,IChunkLightProvider
public class ServerChunkProvider extends AbstractChunkProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
ServerChunkProvider.ChunkExecutor
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<ChunkStatus>
CHUNK_STATUSES
ChunkManager
chunkMap
private DimensionSavedDataManager
dataStorage
private TicketManager
distanceManager
ChunkGenerator
generator
private IChunk[]
lastChunk
private long[]
lastChunkPos
private ChunkStatus[]
lastChunkStatus
private long
lastInhabitedUpdate
private WorldEntitySpawner.EntityDensityManager
lastSpawnState
ServerWorld
level
private ServerWorldLightManager
lightEngine
private java.lang.Thread
mainThread
private ServerChunkProvider.ChunkExecutor
mainThreadProcessor
private boolean
spawnEnemies
private boolean
spawnFriendlies
-
Constructor Summary
Constructors Constructor Description ServerChunkProvider(ServerWorld p_i232603_1_, SaveFormat.LevelSave p_i232603_2_, com.mojang.datafixers.DataFixer p_i232603_3_, TemplateManager p_i232603_4_, java.util.concurrent.Executor p_i232603_5_, ChunkGenerator p_i232603_6_, int p_i232603_7_, boolean p_i232603_8_, IChunkStatusListener p_i232603_9_, java.util.function.Supplier<DimensionSavedDataManager> p_i232603_10_)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntity(Entity p_217230_1_)
<T> void
addRegionTicket(TicketType<T> p_217228_1_, ChunkPos p_217228_2_, int p_217228_3_, T p_217228_4_)
void
blockChanged(BlockPos p_217217_1_)
void
broadcast(Entity p_217218_1_, IPacket<?> p_217218_2_)
void
broadcastAndSend(Entity p_217216_1_, IPacket<?> p_217216_2_)
private boolean
checkChunkFuture(long p_222872_1_, java.util.function.Function<ChunkHolder,java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>>> p_222872_3_)
private boolean
chunkAbsent(ChunkHolder p_217224_1_, int p_217224_2_)
private void
clearCache()
void
close()
java.lang.String
gatherStats()
IChunk
getChunk(int p_212849_1_, int p_212849_2_, ChunkStatus p_212849_3_, boolean p_212849_4_)
java.lang.String
getChunkDebugData(ChunkPos p_217208_1_)
IBlockReader
getChunkForLighting(int p_217202_1_, int p_217202_2_)
java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>>
getChunkFuture(int p_217232_1_, int p_217232_2_, ChunkStatus p_217232_3_, boolean p_217232_4_)
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>>
getChunkFutureMainThread(int p_217233_1_, int p_217233_2_, ChunkStatus p_217233_3_, boolean p_217233_4_)
Chunk
getChunkNow(int p_225313_1_, int p_225313_2_)
DimensionSavedDataManager
getDataStorage()
private void
getFullChunk(long p_241098_1_, java.util.function.Consumer<Chunk> p_241098_3_)
ChunkGenerator
getGenerator()
WorldEntitySpawner.EntityDensityManager
getLastSpawnState()
World
getLevel()
ServerWorldLightManager
getLightEngine()
int
getLoadedChunksCount()
int
getPendingTasksCount()
PointOfInterestManager
getPoiManager()
int
getTickingGenerated()
private ChunkHolder
getVisibleChunkIfPresent(long p_217213_1_)
boolean
hasChunk(int p_73149_1_, int p_73149_2_)
boolean
isEntityTickingChunk(Entity p_217204_1_)
boolean
isEntityTickingChunk(ChunkPos p_222865_1_)
boolean
isTickingChunk(BlockPos p_222866_1_)
void
move(ServerPlayerEntity p_217221_1_)
void
onLightUpdate(LightType p_217201_1_, SectionPos p_217201_2_)
boolean
pollTask()
<T> void
registerTickingTicket(TicketType<T> type, ChunkPos pos, int distance, T value)
<T> void
releaseTickingTicket(TicketType<T> type, ChunkPos pos, int distance, T value)
void
removeEntity(Entity p_217226_1_)
<T> void
removeRegionTicket(TicketType<T> p_217222_1_, ChunkPos p_217222_2_, int p_217222_3_, T p_217222_4_)
private boolean
runDistanceManagerUpdates()
void
save(boolean p_217210_1_)
void
setSpawnSettings(boolean p_217203_1_, boolean p_217203_2_)
void
setViewDistance(int p_217219_1_)
private void
storeInCache(long p_225315_1_, IChunk p_225315_3_, ChunkStatus p_225315_4_)
void
tick(java.util.function.BooleanSupplier p_217207_1_)
private void
tickChunks()
void
updateChunkForced(ChunkPos p_217206_1_, boolean p_217206_2_)
-
Methods inherited from class net.minecraft.world.chunk.AbstractChunkProvider
getChunk
-
-
-
-
Field Detail
-
CHUNK_STATUSES
private static final java.util.List<ChunkStatus> CHUNK_STATUSES
-
distanceManager
private final TicketManager distanceManager
-
generator
public final ChunkGenerator generator
-
level
public final ServerWorld level
-
mainThread
private final java.lang.Thread mainThread
-
lightEngine
private final ServerWorldLightManager lightEngine
-
mainThreadProcessor
private final ServerChunkProvider.ChunkExecutor mainThreadProcessor
-
chunkMap
public final ChunkManager chunkMap
-
dataStorage
private final DimensionSavedDataManager dataStorage
-
lastInhabitedUpdate
private long lastInhabitedUpdate
-
spawnEnemies
private boolean spawnEnemies
-
spawnFriendlies
private boolean spawnFriendlies
-
lastChunkPos
private final long[] lastChunkPos
-
lastChunkStatus
private final ChunkStatus[] lastChunkStatus
-
lastChunk
private final IChunk[] lastChunk
-
lastSpawnState
@Nullable private WorldEntitySpawner.EntityDensityManager lastSpawnState
-
-
Constructor Detail
-
ServerChunkProvider
public ServerChunkProvider(ServerWorld p_i232603_1_, SaveFormat.LevelSave p_i232603_2_, com.mojang.datafixers.DataFixer p_i232603_3_, TemplateManager p_i232603_4_, java.util.concurrent.Executor p_i232603_5_, ChunkGenerator p_i232603_6_, int p_i232603_7_, boolean p_i232603_8_, IChunkStatusListener p_i232603_9_, java.util.function.Supplier<DimensionSavedDataManager> p_i232603_10_)
-
-
Method Detail
-
getLightEngine
public ServerWorldLightManager getLightEngine()
- Specified by:
getLightEngine
in classAbstractChunkProvider
-
getVisibleChunkIfPresent
@Nullable private ChunkHolder getVisibleChunkIfPresent(long p_217213_1_)
-
getTickingGenerated
public int getTickingGenerated()
-
storeInCache
private void storeInCache(long p_225315_1_, IChunk p_225315_3_, ChunkStatus p_225315_4_)
-
getChunk
@Nullable public IChunk getChunk(int p_212849_1_, int p_212849_2_, ChunkStatus p_212849_3_, boolean p_212849_4_)
- Specified by:
getChunk
in classAbstractChunkProvider
-
getChunkNow
@Nullable public Chunk getChunkNow(int p_225313_1_, int p_225313_2_)
- Overrides:
getChunkNow
in classAbstractChunkProvider
-
clearCache
private void clearCache()
-
getChunkFuture
public java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> getChunkFuture(int p_217232_1_, int p_217232_2_, ChunkStatus p_217232_3_, boolean p_217232_4_)
-
getChunkFutureMainThread
private java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<IChunk,ChunkHolder.IChunkLoadingError>> getChunkFutureMainThread(int p_217233_1_, int p_217233_2_, ChunkStatus p_217233_3_, boolean p_217233_4_)
-
chunkAbsent
private boolean chunkAbsent(@Nullable ChunkHolder p_217224_1_, int p_217224_2_)
-
hasChunk
public boolean hasChunk(int p_73149_1_, int p_73149_2_)
- Overrides:
hasChunk
in classAbstractChunkProvider
-
getChunkForLighting
public IBlockReader getChunkForLighting(int p_217202_1_, int p_217202_2_)
- Specified by:
getChunkForLighting
in interfaceIChunkLightProvider
- Overrides:
getChunkForLighting
in classAbstractChunkProvider
-
getLevel
public World getLevel()
-
pollTask
public boolean pollTask()
-
runDistanceManagerUpdates
private boolean runDistanceManagerUpdates()
-
isEntityTickingChunk
public boolean isEntityTickingChunk(Entity p_217204_1_)
- Overrides:
isEntityTickingChunk
in classAbstractChunkProvider
-
isEntityTickingChunk
public boolean isEntityTickingChunk(ChunkPos p_222865_1_)
- Overrides:
isEntityTickingChunk
in classAbstractChunkProvider
-
isTickingChunk
public boolean isTickingChunk(BlockPos p_222866_1_)
- Overrides:
isTickingChunk
in classAbstractChunkProvider
-
checkChunkFuture
private boolean checkChunkFuture(long p_222872_1_, java.util.function.Function<ChunkHolder,java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<Chunk,ChunkHolder.IChunkLoadingError>>> p_222872_3_)
-
save
public void save(boolean p_217210_1_)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Overrides:
close
in classAbstractChunkProvider
- Throws:
java.io.IOException
-
tick
public void tick(java.util.function.BooleanSupplier p_217207_1_)
-
tickChunks
private void tickChunks()
-
getFullChunk
private void getFullChunk(long p_241098_1_, java.util.function.Consumer<Chunk> p_241098_3_)
-
gatherStats
public java.lang.String gatherStats()
- Specified by:
gatherStats
in classAbstractChunkProvider
-
getPendingTasksCount
public int getPendingTasksCount()
-
getGenerator
public ChunkGenerator getGenerator()
-
getLoadedChunksCount
public int getLoadedChunksCount()
-
blockChanged
public void blockChanged(BlockPos p_217217_1_)
-
onLightUpdate
public void onLightUpdate(LightType p_217201_1_, SectionPos p_217201_2_)
-
addRegionTicket
public <T> void addRegionTicket(TicketType<T> p_217228_1_, ChunkPos p_217228_2_, int p_217228_3_, T p_217228_4_)
-
removeRegionTicket
public <T> void removeRegionTicket(TicketType<T> p_217222_1_, ChunkPos p_217222_2_, int p_217222_3_, T p_217222_4_)
-
registerTickingTicket
public <T> void registerTickingTicket(TicketType<T> type, ChunkPos pos, int distance, T value)
-
releaseTickingTicket
public <T> void releaseTickingTicket(TicketType<T> type, ChunkPos pos, int distance, T value)
-
updateChunkForced
public void updateChunkForced(ChunkPos p_217206_1_, boolean p_217206_2_)
- Overrides:
updateChunkForced
in classAbstractChunkProvider
-
move
public void move(ServerPlayerEntity p_217221_1_)
-
removeEntity
public void removeEntity(Entity p_217226_1_)
-
addEntity
public void addEntity(Entity p_217230_1_)
-
setViewDistance
public void setViewDistance(int p_217219_1_)
-
setSpawnSettings
public void setSpawnSettings(boolean p_217203_1_, boolean p_217203_2_)
- Overrides:
setSpawnSettings
in classAbstractChunkProvider
-
getChunkDebugData
public java.lang.String getChunkDebugData(ChunkPos p_217208_1_)
-
getDataStorage
public DimensionSavedDataManager getDataStorage()
-
getPoiManager
public PointOfInterestManager getPoiManager()
-
getLastSpawnState
@Nullable public WorldEntitySpawner.EntityDensityManager getLastSpawnState()
-
-