public class WorldChunk extends Object implements Chunk
| Modifier and Type | Class and Description |
|---|---|
static class |
WorldChunk.CreationType |
| Constructor and Description |
|---|
WorldChunk(World world,
ChunkPos chunkPos,
BiomeArray biomeArray) |
WorldChunk(World world,
ChunkPos chunkPos,
BiomeArray biomeArray,
UpgradeData upgradeData,
TickScheduler<Block> blockTickScheduler,
TickScheduler<Fluid> fluidTickScheduler,
long inhabitedTime,
ChunkSection[] chunkSection,
Consumer<WorldChunk> loadToWorldConsumer) |
WorldChunk(World world,
ProtoChunk protoChunk) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCarvingMask, getHighestNonEmptySection, getHighestNonEmptySectionYOffset, getList, markBlockForPostProcessing, markBlockForPostProcessing, method_12228getHeight, getLuminance, getMaxLightLevel, rayTrace, rayTrace, rayTraceBlockprivate static final Logger LOGGER
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<String,StructureStart> structureStarts
private final Map<String,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 chunkPos, BiomeArray biomeArray)
public WorldChunk(World world, ChunkPos chunkPos, BiomeArray biomeArray, UpgradeData upgradeData, TickScheduler<Block> blockTickScheduler, TickScheduler<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable ChunkSection[] chunkSection, @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 int2)
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 method_20598(BlockPos blockPos)
method_20598 in interface Chunkpublic void removeBlockEntity(BlockPos pos)
removeBlockEntity in interface Chunkpublic void loadToWorld()
public void markDirty()
public void getEntities(@Nullable Entity except, Box box, List<Entity> entityList, @Nullable Predicate<? super Entity> predicate)
public <T extends Entity> void getEntities(@Nullable EntityType<?> type, Box box, List<? super T> list, Predicate<? super T> predicate)
public <T extends Entity> void getEntities(Class<? extends T> entityClass, Box box, List<T> result, @Nullable Predicate<? super T> predicate)
public boolean isEmpty()
@Environment(value=CLIENT) public void loadFromPacket(@Nullable BiomeArray biomeArray, PacketByteBuf packetByteBuf, CompoundTag compoundTag, int int2)
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 getBlockEntityTagAt(BlockPos pos)
getBlockEntityTagAt 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(String structure)
getStructureStart in interface StructureHolderpublic void setStructureStart(String structure, StructureStart start)
setStructureStart in interface StructureHolderpublic Map<String,StructureStart> getStructureStarts()
getStructureStarts in interface Chunkpublic void setStructureStarts(Map<String,StructureStart> map)
setStructureStarts in interface Chunkpublic it.unimi.dsi.fastutil.longs.LongSet getStructureReferences(String structure)
getStructureReferences in interface StructureHolderpublic void addStructureReference(String structure, long reference)
addStructureReference in interface StructureHolderpublic Map<String,it.unimi.dsi.fastutil.longs.LongSet> getStructureReferences()
getStructureReferences in interface StructureHolderpublic void setStructureReferences(Map<String,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