Package net.minecraft.world.level.chunk
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 BiomeManager.NoiseBiomeSource, LightChunk, StructureAccess, IAttachmentHolder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final record
static final record
Nested classes/interfaces inherited from interface net.minecraft.world.level.BlockGetter
BlockGetter.BlockStepVisitor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AttachmentHolder.AsField
protected BlendingData
protected final Map
<BlockPos, BlockEntity> private BiomeGenerationSettings
Deprecated.protected final ChunkPos
private static final it.unimi.dsi.fastutil.longs.LongSet
protected final Map
<Heightmap.Types, Heightmap> private long
private boolean
protected final LevelHeightAccessor
private static final org.slf4j.Logger
static final int
protected NoiseChunk
protected final Map
<BlockPos, CompoundTag> protected final it.unimi.dsi.fastutil.shorts.ShortList[]
protected final LevelChunkSection[]
protected ChunkSkyLightSources
private final Map
<Structure, StructureStart> private boolean
protected final UpgradeData
Fields inherited from interface net.minecraft.world.level.BlockGetter
MAX_BLOCK_ITERATIONS_ALONG_TRAVEL
-
Constructor Summary
ConstructorsConstructorDescriptionChunkAccess
(ChunkPos pChunkPos, UpgradeData pUpgradeData, LevelHeightAccessor pLevelHeightAccessor, Registry<Biome> pBiomeRegistry, long pInhabitedTime, LevelChunkSection[] pSections, BlendingData pBlendingData) -
Method Summary
Modifier and TypeMethodDescriptionabstract void
void
addPackedPostProcess
(it.unimi.dsi.fastutil.shorts.ShortList p_364924_, int p_62093_) void
addReferenceForStructure
(Structure pStructure, long pReference) boolean
carverBiome
(Supplier<BiomeGenerationSettings> pCaverBiomeSettingsSupplier) Deprecated.void
fillBiomesFromNoise
(BiomeResolver pResolver, Climate.Sampler pSampler) final void
findBlockLightSources
(BiConsumer<BlockPos, BlockState> pOutput) void
findBlocks
(Predicate<BlockState> pPredicate, BiConsumer<BlockPos, BlockState> pOutput) void
findBlocks
(Predicate<BlockState> p_285343_, BiPredicate<BlockState, BlockPos> fineFilter, BiConsumer<BlockPos, BlockState> p_285030_) protected AttachmentHolder.AsField
getBlockEntityNbt
(BlockPos pPos) abstract CompoundTag
getBlockEntityNbtForSaving
(BlockPos pPos, HolderLookup.Provider pRegistries) abstract TickContainerAccess
<Block> <T> T
getData
(AttachmentType<T> type) Returns the data attachment of the given type.<T> T
getExistingDataOrNull
(AttachmentType<T> type) abstract TickContainerAccess
<Fluid> int
int
getHeight
(Heightmap.Types pType, int pX, int pZ) int
int
Deprecated, for removal: This API element is subject to removal in a future version.long
getLevel()
getListenerRegistry
(int pSectionY) int
getMinY()
getNoiseBiome
(int pX, int pY, int pZ) Gets the biome at the given quart positions.getOrCreateNoiseChunk
(Function<ChunkAccess, NoiseChunk> pNoiseChunkCreator) static it.unimi.dsi.fastutil.shorts.ShortList
getOrCreateOffsetList
(it.unimi.dsi.fastutil.shorts.ShortList[] p_62096_, int p_62097_) abstract ChunkStatus
getPos()
it.unimi.dsi.fastutil.shorts.ShortList[]
it.unimi.dsi.fastutil.longs.LongSet
getReferencesForStructure
(Structure p_223017_) getSection
(int pIndex) getStartForStructure
(Structure pStructure) abstract ChunkAccess.PackedTicks
getTicksForSerialization
(long pGametime) boolean
boolean
Returnstrue
if there is any data attachments,false
otherwise.boolean
hasData
(AttachmentType<?> type) Returnstrue
if there is a data attachment of the give type,false
otherwise.boolean
void
incrementInhabitedTime
(long pAmount) void
boolean
boolean
boolean
boolean
boolean
isYSpaceEmpty
(int pStartY, int pEndY) void
void
static ProblemReporter.PathElement
problemPath
(ChunkPos pPos) final void
readAttachmentsFromNBT
(HolderLookup.Provider provider, CompoundTag tag) FOR INTERNAL USE ONLYabstract void
removeBlockEntity
(BlockPos pPos) <T> T
removeData
(AttachmentType<T> type) Removes the data attachment of the given type.private static void
replaceMissingSections
(Registry<Biome> pBiomeRegistry, LevelChunkSection[] pSections) void
setAllReferences
(Map<Structure, it.unimi.dsi.fastutil.longs.LongSet> pStructureReferencesMap) void
setAllStarts
(Map<Structure, StructureStart> pStructureStarts) abstract void
setBlockEntity
(BlockEntity pBlockEntity) void
setBlockEntityNbt
(CompoundTag pTag) setBlockState
(BlockPos pPos, BlockState pState) abstract BlockState
setBlockState
(BlockPos pPos, BlockState pState, int pFlags) <T> T
setData
(AttachmentType<T> type, T data) Sets the data attachment of the given type.void
setHeightmap
(Heightmap.Types pType, long[] pData) void
setInhabitedTime
(long pInhabitedTime) void
setLightCorrect
(boolean pLightCorrect) void
setStartForStructure
(Structure pStructure, StructureStart pStructureStart) boolean
final CompoundTag
writeAttachmentsToNBT
(HolderLookup.Provider provider) FOR INTERNAL USE ONLYMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.level.BlockGetter
clip, clipWithInteractionOverride, getBlockEntity, getBlockEntity, getBlockFloorHeight, getBlockFloorHeight, getBlockState, getBlockStates, getFluidState, getLightEmission, isBlockInLine
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockGetterExtension
getAuxLightManager, getAuxLightManager, getModelData
Methods inherited from interface net.minecraft.world.level.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 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 pChunkPos, UpgradeData pUpgradeData, LevelHeightAccessor pLevelHeightAccessor, Registry<Biome> pBiomeRegistry, long pInhabitedTime, @Nullable LevelChunkSection[] pSections, @Nullable BlendingData pBlendingData)
-
-
Method Details
-
replaceMissingSections
private static void replaceMissingSections(Registry<Biome> pBiomeRegistry, LevelChunkSection[] pSections) -
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:
getStartForStructure
in interfaceStructureAccess
-
setStartForStructure
- Specified by:
setStartForStructure
in interfaceStructureAccess
-
getAllStarts
-
setAllStarts
-
getReferencesForStructure
- Specified by:
getReferencesForStructure
in interfaceStructureAccess
-
addReferenceForStructure
- Specified by:
addReferenceForStructure
in interfaceStructureAccess
-
getAllReferences
- Specified by:
getAllReferences
in interfaceStructureAccess
-
setAllReferences
public void setAllReferences(Map<Structure, it.unimi.dsi.fastutil.longs.LongSet> pStructureReferencesMap) - Specified by:
setAllReferences
in interfaceStructureAccess
-
isYSpaceEmpty
public boolean isYSpaceEmpty(int pStartY, int pEndY) -
markUnsaved
public void markUnsaved() -
tryMarkSaved
public boolean tryMarkSaved() -
isUnsaved
public boolean isUnsaved() -
getPersistedStatus
-
getHighestGeneratedStatus
-
removeBlockEntity
-
markPosForPostprocessing
-
getPostProcessing
public it.unimi.dsi.fastutil.shorts.ShortList[] getPostProcessing() -
addPackedPostProcess
public void addPackedPostProcess(it.unimi.dsi.fastutil.shorts.ShortList p_364924_, int p_62093_) -
setBlockEntityNbt
-
getBlockEntityNbt
-
getBlockEntityNbtForSaving
@Nullable public abstract CompoundTag getBlockEntityNbtForSaving(BlockPos pPos, HolderLookup.Provider pRegistries) -
findBlockLightSources
- Specified by:
findBlockLightSources
in interfaceLightChunk
-
findBlocks
-
findBlocks
public void findBlocks(Predicate<BlockState> p_285343_, BiPredicate<BlockState, BlockPos> fineFilter, BiConsumer<BlockPos, BlockState> p_285030_) -
getBlockTicks
-
getFluidTicks
-
canBeSerialized
public boolean canBeSerialized() -
getTicksForSerialization
-
getUpgradeData
-
isOldNoiseGeneration
public boolean isOldNoiseGeneration() -
getBlendingData
-
getInhabitedTime
public long getInhabitedTime() -
incrementInhabitedTime
public void incrementInhabitedTime(long pAmount) -
setInhabitedTime
public void setInhabitedTime(long pInhabitedTime) -
getOrCreateOffsetList
public static it.unimi.dsi.fastutil.shorts.ShortList getOrCreateOffsetList(it.unimi.dsi.fastutil.shorts.ShortList[] p_62096_, int p_62097_) -
isLightCorrect
public boolean isLightCorrect() -
setLightCorrect
public void setLightCorrect(boolean pLightCorrect) -
getMinY
public int getMinY()- Specified by:
getMinY
in interfaceLevelHeightAccessor
-
getHeight
public int getHeight()- Specified by:
getHeight
in interfaceLevelHeightAccessor
-
getOrCreateNoiseChunk
-
carverBiome
@Deprecated public BiomeGenerationSettings carverBiome(Supplier<BiomeGenerationSettings> pCaverBiomeSettingsSupplier) Deprecated. -
getNoiseBiome
Gets 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:
getNoiseBiome
in interfaceBiomeManager.NoiseBiomeSource
-
fillBiomesFromNoise
-
hasAnyStructureReferences
public boolean hasAnyStructureReferences() -
getBelowZeroRetrogen
-
isUpgrading
public boolean isUpgrading() -
getHeightAccessorForGeneration
-
initializeLightSources
public void initializeLightSources() -
getSkyLightSources
- Specified by:
getSkyLightSources
in interfaceLightChunk
-
hasAttachments
public boolean hasAttachments()Description copied from interface:IAttachmentHolder
Returnstrue
if there is any data attachments,false
otherwise.- Specified by:
hasAttachments
in interfaceIAttachmentHolder
-
hasData
Description copied from interface:IAttachmentHolder
Returnstrue
if there is a data attachment of the give type,false
otherwise.- Specified by:
hasData
in interfaceIAttachmentHolder
-
getData
Description copied from interface:IAttachmentHolder
Returns 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:
getData
in interfaceIAttachmentHolder
- Returns:
- the data attachment of the given type
-
getExistingDataOrNull
- Specified by:
getExistingDataOrNull
in 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:IAttachmentHolder
Sets the data attachment of the given type.- Specified by:
setData
in interfaceIAttachmentHolder
- Returns:
- the previous value for that attachment type, if any, or
null
if there was none
-
removeData
Description copied from interface:IAttachmentHolder
Removes the data attachment of the given type.- Specified by:
removeData
in interfaceIAttachmentHolder
- Returns:
- the previous value for that attachment type, if any, or
null
if 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
-