public class WorldChunk extends Object implements Chunk
| Modifier and Type | Class and Description |
|---|---|
static class |
WorldChunk.CreationType |
| Constructor and Description |
|---|
WorldChunk(World world,
ChunkPos pos,
BiomeArray biomes) |
WorldChunk(World world,
ChunkPos pos,
BiomeArray biomes,
UpgradeData upgradeData,
TickScheduler<Block> blockTickScheduler,
TickScheduler<Fluid> fluidTickScheduler,
long inhabitedTime,
ChunkSection[] sections,
Consumer<WorldChunk> loadToWorldConsumer) |
WorldChunk(World world,
ProtoChunk protoChunk) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitareSectionsEmptyBetween, getHighestNonEmptySection, getHighestNonEmptySectionYOffset, getList, markBlockForPostProcessing, markBlockForPostProcessinggetDismountHeight, getDismountHeight, getHeight, getLuminance, getMaxLightLevel, method_29546, raycast, raycast, raycastBlockprivate static final Logger LOGGER
@Nullable public static final ChunkSection EMPTY_SECTION
private final ChunkSection[] sections
private BiomeArray biomeArray
private final Map<BlockPos,CompoundTag> pendingBlockEntityTags
private boolean loadedToWorld
private final World world
private final Map<Heightmap.Type,Heightmap> heightmaps
private final UpgradeData upgradeData
private final Map<BlockPos,BlockEntity> blockEntities
private final TypeFilterableList<Entity>[] entitySections
private final Map<StructureFeature<?>,StructureStart<?>> structureStarts
private final Map<StructureFeature<?>,it.unimi.dsi.fastutil.longs.LongSet> structureReferences
private final it.unimi.dsi.fastutil.shorts.ShortList[] postProcessingLists
private TickScheduler<Block> blockTickScheduler
private TickScheduler<Fluid> fluidTickScheduler
private boolean unsaved
private long lastSaveTime
private volatile boolean shouldSave
private long inhabitedTime
@Nullable private Supplier<ChunkHolder.LevelType> levelTypeProvider
@Nullable private Consumer<WorldChunk> loadToWorldConsumer
private final ChunkPos pos
private volatile boolean lightOn
public WorldChunk(World world, ChunkPos pos, BiomeArray biomes)
public WorldChunk(World world, ChunkPos pos, BiomeArray biomes, UpgradeData upgradeData, TickScheduler<Block> blockTickScheduler, TickScheduler<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable ChunkSection[] sections, @Nullable Consumer<WorldChunk> loadToWorldConsumer)
public WorldChunk(World world, ProtoChunk protoChunk)
public Heightmap getHeightmap(Heightmap.Type type)
getHeightmap in interface Chunkpublic Set<BlockPos> getBlockEntityPositions()
getBlockEntityPositions in interface Chunkpublic ChunkSection[] getSectionArray()
getSectionArray in interface Chunkpublic BlockState getBlockState(BlockPos pos)
getBlockState in interface BlockViewpublic FluidState getFluidState(BlockPos pos)
getFluidState in interface BlockViewpublic FluidState getFluidState(int x, int y, int z)
@Nullable public BlockState setBlockState(BlockPos pos, BlockState state, boolean moved)
setBlockState in interface Chunk@Nullable public LightingProvider getLightingProvider()
public void setHeightmap(Heightmap.Type type, long[] heightmap)
setHeightmap in interface Chunkpublic void remove(Entity entity)
public void remove(Entity entity, int section)
public int sampleHeightmap(Heightmap.Type type, int x, int z)
sampleHeightmap in interface Chunk@Nullable private BlockEntity createBlockEntity(BlockPos pos)
@Nullable public BlockEntity getBlockEntity(BlockPos pos)
getBlockEntity in interface BlockView@Nullable public BlockEntity getBlockEntity(BlockPos pos, WorldChunk.CreationType creationType)
public void addBlockEntity(BlockEntity blockEntity)
public void setBlockEntity(BlockPos pos, BlockEntity blockEntity)
setBlockEntity in interface Chunkpublic void addPendingBlockEntityTag(CompoundTag tag)
addPendingBlockEntityTag in interface Chunk@Nullable public CompoundTag getPackedBlockEntityTag(BlockPos pos)
getPackedBlockEntityTag in interface Chunkpublic void removeBlockEntity(BlockPos pos)
removeBlockEntity in interface Chunkpublic void loadToWorld()
public void markDirty()
public void collectOtherEntities(@Nullable Entity except, Box box, List<Entity> entityList, @Nullable Predicate<? super Entity> predicate)
public <T extends Entity> void collectEntities(@Nullable EntityType<?> type, Box box, List<? super T> result, Predicate<? super T> predicate)
null is passed as the entity type filter, care should be
taken that the type argument T is set to Entity, otherwise heap pollution in
the output list or ClassCastException can occur.type - the entity type of the entities to collect, or null to collect entities of all types.box - the box within which collected entities must beresult - a list in which to store the collected entitiespredicate - a predicate which entities must satisfy in order to be collectedpublic <T extends Entity> void collectEntitiesByClass(Class<? extends T> entityClass, Box box, List<T> result, @Nullable Predicate<? super T> predicate)
entityClass - the class object representing the type collected entities must extendbox - the box in which to collect entitiesresult - a list in which to store the collected entitiespredicate - a predicate which entities must satisfy in order to be collectedpublic boolean isEmpty()
@Environment(value=CLIENT) public void loadFromPacket(@Nullable BiomeArray biomes, PacketByteBuf buf, CompoundTag tag, int verticalStripBitmask)
public BiomeArray getBiomeArray()
getBiomeArray in interface Chunkpublic void setLoadedToWorld(boolean loaded)
public World getWorld()
public Collection<Map.Entry<Heightmap.Type,Heightmap>> getHeightmaps()
getHeightmaps in interface Chunkpublic Map<BlockPos,BlockEntity> getBlockEntities()
public TypeFilterableList<Entity>[] getEntitySectionArray()
public CompoundTag getBlockEntityTag(BlockPos pos)
getBlockEntityTag in interface Chunkpublic Stream<BlockPos> getLightSourcesStream()
getLightSourcesStream in interface Chunkpublic TickScheduler<Block> getBlockTickScheduler()
getBlockTickScheduler in interface Chunkpublic TickScheduler<Fluid> getFluidTickScheduler()
getFluidTickScheduler in interface Chunkpublic void setShouldSave(boolean shouldSave)
setShouldSave in interface Chunkpublic boolean needsSaving()
needsSaving in interface Chunkpublic void setUnsaved(boolean unsaved)
public void setLastSaveTime(long lastSaveTime)
setLastSaveTime in interface Chunk@Nullable public StructureStart<?> getStructureStart(StructureFeature<?> structure)
getStructureStart in interface StructureHolderpublic void setStructureStart(StructureFeature<?> structure, StructureStart<?> start)
setStructureStart in interface StructureHolderpublic Map<StructureFeature<?>,StructureStart<?>> getStructureStarts()
getStructureStarts in interface Chunkpublic void setStructureStarts(Map<StructureFeature<?>,StructureStart<?>> structureStarts)
setStructureStarts in interface Chunkpublic it.unimi.dsi.fastutil.longs.LongSet getStructureReferences(StructureFeature<?> structure)
getStructureReferences in interface StructureHolderpublic void addStructureReference(StructureFeature<?> structure, long reference)
addStructureReference in interface StructureHolderpublic Map<StructureFeature<?>,it.unimi.dsi.fastutil.longs.LongSet> getStructureReferences()
getStructureReferences in interface StructureHolderpublic void setStructureReferences(Map<StructureFeature<?>,it.unimi.dsi.fastutil.longs.LongSet> structureReferences)
setStructureReferences in interface StructureHolderpublic long getInhabitedTime()
getInhabitedTime in interface Chunkpublic void setInhabitedTime(long inhabitedTime)
setInhabitedTime in interface Chunkpublic void runPostProcessing()
@Nullable private BlockEntity loadBlockEntity(BlockPos pos, CompoundTag tag)
public UpgradeData getUpgradeData()
getUpgradeData in interface Chunkpublic it.unimi.dsi.fastutil.shorts.ShortList[] getPostProcessingLists()
getPostProcessingLists in interface Chunkpublic void disableTickSchedulers()
public void enableTickSchedulers(ServerWorld world)
public ChunkStatus getStatus()
public ChunkHolder.LevelType getLevelType()
public void setLevelTypeProvider(Supplier<ChunkHolder.LevelType> levelTypeProvider)
public void setLightOn(boolean lightOn)
setLightOn in interface Chunk