Class ChunkAccess
java.lang.Object
net.minecraft.world.level.chunk.ChunkAccess
- All Implemented Interfaces:
BiomeManager.NoiseBiomeSource, BlockGetter, LightChunk, StructureAccess, LevelHeightAccessor, IAttachmentHolder, IBlockGetterExtension
- Direct Known Subclasses:
LevelChunk, ProtoChunk
public abstract class ChunkAccess
extends Object
implements LightChunk, StructureAccess, BiomeManager.NoiseBiomeSource, IAttachmentHolder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordstatic final recordNested classes/interfaces inherited from interface BlockGetter
BlockGetter.BlockStepVisitor -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AttachmentHolder.AsFieldprotected final @Nullable BlendingDataprotected final Map<BlockPos, BlockEntity> private @Nullable BiomeGenerationSettingsDeprecated.protected final ChunkPosprivate static final it.unimi.dsi.fastutil.longs.LongSetprotected final Map<Heightmap.Types, Heightmap> private longprivate booleanprotected final LevelHeightAccessorprivate static final org.slf4j.Loggerstatic final intprotected @Nullable NoiseChunkprotected final Map<BlockPos, CompoundTag> protected final @Nullable it.unimi.dsi.fastutil.shorts.ShortList[]protected final LevelChunkSection[]protected ChunkSkyLightSourcesprivate final Map<Structure, StructureStart> private booleanprotected final UpgradeData -
Constructor Summary
ConstructorsConstructorDescriptionChunkAccess(ChunkPos chunkPos, UpgradeData upgradeData, LevelHeightAccessor levelHeightAccessor, PalettedContainerFactory containerFactory, long inhabitedTime, LevelChunkSection @Nullable [] sections, @Nullable BlendingData blendingData) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidvoidaddPackedPostProcess(it.unimi.dsi.fastutil.shorts.ShortList packedOffsets, int sectionIndex) voidaddReferenceForStructure(Structure structure, long reference) booleancarverBiome(Supplier<BiomeGenerationSettings> source) Deprecated.voidfillBiomesFromNoise(BiomeResolver biomeResolver, Climate.Sampler sampler) final voidfindBlockLightSources(BiConsumer<BlockPos, BlockState> consumer) voidfindBlocks(Predicate<BlockState> predicate, BiConsumer<BlockPos, BlockState> consumer) voidfindBlocks(Predicate<BlockState> predicate, BiPredicate<BlockState, BlockPos> fineFilter, BiConsumer<BlockPos, BlockState> consumer) @Nullable BelowZeroRetrogen@Nullable BlendingData@Nullable CompoundTaggetBlockEntityNbt(BlockPos blockPos) abstract @Nullable CompoundTaggetBlockEntityNbtForSaving(BlockPos blockPos, HolderLookup.Provider registryAccess) abstract TickContainerAccess<Block> <T> TgetData(AttachmentType<T> type) Returns the data attachment of the given type.<T> @Nullable TgetExistingDataOrNull(AttachmentType<T> type) abstract TickContainerAccess<Fluid> intintgetHeight(Heightmap.Types type, int x, int z) intintDeprecated, for removal: This API element is subject to removal in a future version.long@Nullable LevelgetLevel()getListenerRegistry(int section) intgetMinY()getNoiseBiome(int quartX, int quartY, int quartZ) Gets the biome at the given quart positions.getOrCreateNoiseChunk(Function<ChunkAccess, NoiseChunk> factory) static it.unimi.dsi.fastutil.shorts.ShortListgetOrCreateOffsetList(@Nullable it.unimi.dsi.fastutil.shorts.ShortList[] list, int sectionIndex) abstract ChunkStatusgetPos()@Nullable it.unimi.dsi.fastutil.shorts.ShortList[]it.unimi.dsi.fastutil.longs.LongSetgetReferencesForStructure(Structure structure) getSection(int sectionIndex) @Nullable StructureStartgetStartForStructure(Structure structure) abstract ChunkAccess.PackedTicksgetTicksForSerialization(long currentTick) booleanbooleanReturnstrueif there is any data attachments,falseotherwise.booleanhasData(AttachmentType<?> type) Returnstrueif there is a data attachment of the give type,falseotherwise.booleanvoidincrementInhabitedTime(long inhabitedTimeDelta) voidbooleanbooleanbooleanbooleanbooleanisYSpaceEmpty(int yStartInclusive, int yEndInclusive) voidmarkPosForPostprocessing(BlockPos blockPos) voidstatic ProblemReporter.PathElementproblemPath(ChunkPos pos) final voidreadAttachmentsFromNBT(HolderLookup.Provider provider, CompoundTag tag) FOR INTERNAL USE ONLYabstract void<T> @Nullable TremoveData(AttachmentType<T> type) Removes the data attachment of the given type.private static voidreplaceMissingSections(PalettedContainerFactory containerFactory, LevelChunkSection[] sections) voidsetAllReferences(Map<Structure, it.unimi.dsi.fastutil.longs.LongSet> data) voidsetAllStarts(Map<Structure, StructureStart> starts) abstract voidsetBlockEntity(BlockEntity blockEntity) voidsetBlockEntityNbt(CompoundTag entityTag) @Nullable BlockStatesetBlockState(BlockPos pos, BlockState state) abstract @Nullable BlockStatesetBlockState(BlockPos pos, BlockState state, int flags) <T> @Nullable TsetData(AttachmentType<T> type, T data) Sets the data attachment of the given type.voidsetHeightmap(Heightmap.Types key, long[] data) voidsetInhabitedTime(long inhabitedTime) voidsetLightCorrect(boolean isLightCorrect) voidsetStartForStructure(Structure structure, StructureStart structureStart) booleanfinal @Nullable CompoundTagwriteAttachmentsToNBT(HolderLookup.Provider provider) FOR INTERNAL USE ONLYMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BlockGetter
clip, clipWithInteractionOverride, getBlockEntity, getBlockEntity, getBlockFloorHeight, getBlockFloorHeight, getBlockState, getBlockStates, getFluidState, getLightEmission, isBlockInLineMethods inherited from interface IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncData, syncDataMethods inherited from interface IBlockGetterExtension
getAuxLightManager, getAuxLightManager, getModelDataMethods inherited from interface LevelHeightAccessor
getMaxSectionY, getMaxY, getMinSectionY, getSectionIndex, getSectionIndexFromSectionY, getSectionsCount, getSectionYFromSectionIndex, isInsideBuildHeight, isOutsideBuildHeight, isOutsideBuildHeight
-
Field Details
-
NO_FILLED_SECTION
public static final int NO_FILLED_SECTION- See Also:
-
LOGGER
private static final org.slf4j.Logger LOGGER -
EMPTY_REFERENCE_SET
private static final it.unimi.dsi.fastutil.longs.LongSet EMPTY_REFERENCE_SET -
postProcessing
protected final @Nullable it.unimi.dsi.fastutil.shorts.ShortList[] postProcessing -
unsaved
private volatile boolean unsaved -
isLightCorrect
private volatile boolean isLightCorrect -
chunkPos
-
inhabitedTime
private long inhabitedTime -
carverBiomeSettings
Deprecated. -
noiseChunk
-
upgradeData
-
blendingData
-
heightmaps
-
skyLightSources
-
structureStarts
-
structuresRefences
-
pendingBlockEntities
-
blockEntities
-
levelHeightAccessor
-
sections
-
attachmentHolder
-
-
Constructor Details
-
ChunkAccess
public ChunkAccess(ChunkPos chunkPos, UpgradeData upgradeData, LevelHeightAccessor levelHeightAccessor, PalettedContainerFactory containerFactory, long inhabitedTime, LevelChunkSection @Nullable [] sections, @Nullable BlendingData blendingData)
-
-
Method Details
-
replaceMissingSections
private static void replaceMissingSections(PalettedContainerFactory containerFactory, LevelChunkSection[] sections) -
getListenerRegistry
-
setBlockState
-
setBlockState
-
setBlockEntity
-
addEntity
-
getHighestFilledSectionIndex
public int getHighestFilledSectionIndex() -
getHighestSectionPosition
Deprecated, for removal: This API element is subject to removal in a future version. -
getBlockEntitiesPos
-
getSections
-
getSection
-
getHeightmaps
-
setHeightmap
-
getOrCreateHeightmapUnprimed
-
hasPrimedHeightmap
-
getHeight
-
getPos
-
getStartForStructure
- Specified by:
getStartForStructurein interfaceStructureAccess
-
setStartForStructure
- Specified by:
setStartForStructurein interfaceStructureAccess
-
getAllStarts
-
setAllStarts
-
getReferencesForStructure
- Specified by:
getReferencesForStructurein interfaceStructureAccess
-
addReferenceForStructure
- Specified by:
addReferenceForStructurein interfaceStructureAccess
-
getAllReferences
- Specified by:
getAllReferencesin interfaceStructureAccess
-
setAllReferences
- Specified by:
setAllReferencesin interfaceStructureAccess
-
isYSpaceEmpty
public boolean isYSpaceEmpty(int yStartInclusive, int yEndInclusive) -
markUnsaved
public void markUnsaved() -
tryMarkSaved
public boolean tryMarkSaved() -
isUnsaved
public boolean isUnsaved() -
getPersistedStatus
-
getHighestGeneratedStatus
-
removeBlockEntity
-
markPosForPostprocessing
-
getPostProcessing
public @Nullable it.unimi.dsi.fastutil.shorts.ShortList[] getPostProcessing() -
addPackedPostProcess
public void addPackedPostProcess(it.unimi.dsi.fastutil.shorts.ShortList packedOffsets, int sectionIndex) -
setBlockEntityNbt
-
getBlockEntityNbt
-
getBlockEntityNbtForSaving
public abstract @Nullable CompoundTag getBlockEntityNbtForSaving(BlockPos blockPos, HolderLookup.Provider registryAccess) -
findBlockLightSources
- Specified by:
findBlockLightSourcesin interfaceLightChunk
-
findBlocks
-
findBlocks
public void findBlocks(Predicate<BlockState> predicate, BiPredicate<BlockState, BlockPos> fineFilter, BiConsumer<BlockPos, BlockState> consumer) -
getBlockTicks
-
getFluidTicks
-
canBeSerialized
public boolean canBeSerialized() -
getTicksForSerialization
-
getUpgradeData
-
isOldNoiseGeneration
public boolean isOldNoiseGeneration() -
getBlendingData
-
getInhabitedTime
public long getInhabitedTime() -
incrementInhabitedTime
public void incrementInhabitedTime(long inhabitedTimeDelta) -
setInhabitedTime
public void setInhabitedTime(long inhabitedTime) -
getOrCreateOffsetList
public static it.unimi.dsi.fastutil.shorts.ShortList getOrCreateOffsetList(@Nullable it.unimi.dsi.fastutil.shorts.ShortList[] list, int sectionIndex) -
isLightCorrect
public boolean isLightCorrect() -
setLightCorrect
public void setLightCorrect(boolean isLightCorrect) -
getMinY
public int getMinY()- Specified by:
getMinYin interfaceLevelHeightAccessor
-
getHeight
public int getHeight()- Specified by:
getHeightin interfaceLevelHeightAccessor
-
getOrCreateNoiseChunk
-
carverBiome
Deprecated. -
getNoiseBiome
Description copied from interface:BiomeManager.NoiseBiomeSourceGets the biome at the given quart positions. Note that the coordinates passed into this method are 1/4 the scale of block coordinates.- Specified by:
getNoiseBiomein interfaceBiomeManager.NoiseBiomeSource
-
fillBiomesFromNoise
-
hasAnyStructureReferences
public boolean hasAnyStructureReferences() -
getBelowZeroRetrogen
-
isUpgrading
public boolean isUpgrading() -
getHeightAccessorForGeneration
-
initializeLightSources
public void initializeLightSources() -
getSkyLightSources
- Specified by:
getSkyLightSourcesin interfaceLightChunk
-
hasAttachments
public boolean hasAttachments()Description copied from interface:IAttachmentHolderReturnstrueif there is any data attachments,falseotherwise.- Specified by:
hasAttachmentsin interfaceIAttachmentHolder
-
hasData
Description copied from interface:IAttachmentHolderReturnstrueif there is a data attachment of the give type,falseotherwise.- Specified by:
hasDatain interfaceIAttachmentHolder
-
getData
Description copied from interface:IAttachmentHolderReturns the data attachment of the given type.If there is no data attachment of the given type, the default value is stored in this holder and returned.
- Specified by:
getDatain interfaceIAttachmentHolder- Returns:
- the data attachment of the given type
-
getExistingDataOrNull
- Specified by:
getExistingDataOrNullin interfaceIAttachmentHolder- Returns:
- an existing data attachment value of the given type, or null if there is no data attachment of the given type
-
setData
Description copied from interface:IAttachmentHolderSets the data attachment of the given type.- Specified by:
setDatain interfaceIAttachmentHolder- Returns:
- the previous value for that attachment type, if any, or
nullif there was none
-
removeData
Description copied from interface:IAttachmentHolderRemoves the data attachment of the given type.- Specified by:
removeDatain interfaceIAttachmentHolder- Returns:
- the previous value for that attachment type, if any, or
nullif there was none
-
writeAttachmentsToNBT
FOR INTERNAL USE ONLYOnly public for use in
SerializableChunkData. -
readAttachmentsFromNBT
FOR INTERNAL USE ONLYOnly public for use in
SerializableChunkData. -
getAttachmentHolder
-
getLevel
-
problemPath
-
problemPath
-