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 BlockGetter, BiomeManager.NoiseBiomeSource, LightChunk, StructureAccess, IAttachmentHolder
-
Nested Class Summary
-
Field Summary
Modifier 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> protected boolean
protected final UpgradeData
-
Constructor Summary
ConstructorDescriptionChunkAccess
(ChunkPos p_187621_, UpgradeData p_187622_, LevelHeightAccessor p_187623_, Registry<Biome> p_187624_, long p_187625_, LevelChunkSection[] p_187626_, BlendingData p_187627_) -
Method Summary
Modifier and TypeMethodDescriptionabstract void
void
addPackedPostProcess
(short p_62092_, int p_62093_) void
addReferenceForStructure
(Structure p_223007_, long p_223008_) carverBiome
(Supplier<BiomeGenerationSettings> p_223015_) Deprecated.void
fillBiomesFromNoise
(BiomeResolver p_187638_, Climate.Sampler p_187639_) final void
findBlockLightSources
(BiConsumer<BlockPos, BlockState> p_285269_) void
findBlocks
(BiPredicate<BlockState, BlockPos> p_285343_, BiConsumer<BlockPos, BlockState> p_285030_) Deprecated, for removal: This API element is subject to removal in a future version.void
findBlocks
(Predicate<BlockState> p_285343_, BiConsumer<BlockPos, BlockState> p_285030_) void
findBlocks
(Predicate<BlockState> p_285343_, BiPredicate<BlockState, BlockPos> fineFilter, BiConsumer<BlockPos, BlockState> p_285030_) protected AttachmentHolder.AsField
getBlockEntityNbt
(BlockPos p_62103_) abstract CompoundTag
getBlockEntityNbtForSaving
(BlockPos p_62104_, HolderLookup.Provider p_324415_) abstract TickContainerAccess
<Block> <T> T
getData
(AttachmentType<T> type) Returns the data attachment of the given type.<T> Optional
<T> getExistingData
(AttachmentType<T> type) Returns an optional possibly containing a data attachment value of the given type.abstract TickContainerAccess
<Fluid> int
int
getHeight
(Heightmap.Types p_62080_, int p_62081_, int p_62082_) int
int
Deprecated, for removal: This API element is subject to removal in a future version.long
getLevel()
getListenerRegistry
(int p_251437_) int
getNoiseBiome
(int p_204347_, int p_204348_, int p_204349_) getOrCreateHeightmapUnprimed
(Heightmap.Types p_62079_) getOrCreateNoiseChunk
(Function<ChunkAccess, NoiseChunk> p_223013_) static it.unimi.dsi.fastutil.shorts.ShortList
getOrCreateOffsetList
(it.unimi.dsi.fastutil.shorts.ShortList[] p_62096_, int p_62097_) getPos()
it.unimi.dsi.fastutil.shorts.ShortList[]
it.unimi.dsi.fastutil.longs.LongSet
getReferencesForStructure
(Structure p_223017_) getSection
(int p_187657_) getStartForStructure
(Structure p_223005_) abstract ChunkStatus
abstract ChunkAccess.TicksToSave
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
hasPrimedHeightmap
(Heightmap.Types p_187659_) void
incrementInhabitedTime
(long p_187633_) void
boolean
boolean
boolean
boolean
boolean
isYSpaceEmpty
(int p_62075_, int p_62076_) void
markPosForPostprocessing
(BlockPos p_62102_) final void
readAttachmentsFromNBT
(HolderLookup.Provider provider, CompoundTag tag) FOR INTERNAL USE ONLYabstract void
removeBlockEntity
(BlockPos p_62101_) <T> T
removeData
(AttachmentType<T> type) Removes the data attachment of the given type.private static void
replaceMissingSections
(Registry<Biome> p_281389_, LevelChunkSection[] p_282796_) void
setAllReferences
(Map<Structure, it.unimi.dsi.fastutil.longs.LongSet> p_187663_) void
setAllStarts
(Map<Structure, StructureStart> p_62090_) void
setBlendingData
(BlendingData p_187646_) abstract void
setBlockEntity
(BlockEntity p_156114_) void
setBlockEntityNbt
(CompoundTag p_62091_) abstract BlockState
setBlockState
(BlockPos p_62087_, BlockState p_62088_, boolean p_62089_) <T> T
setData
(AttachmentType<T> type, T data) Sets the data attachment of the given type.void
setHeightmap
(Heightmap.Types p_62083_, long[] p_62084_) void
setInhabitedTime
(long p_62099_) void
setLightCorrect
(boolean p_62100_) void
setStartForStructure
(Structure p_223010_, StructureStart p_223011_) void
setUnsaved
(boolean p_62094_) 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, getMaxLightLevel, isBlockInLine
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, 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
getMaxBuildHeight, getMaxSection, getMinSection, getSectionIndex, getSectionIndexFromSectionY, getSectionsCount, getSectionYFromSectionIndex, 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
protected 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 p_187621_, UpgradeData p_187622_, LevelHeightAccessor p_187623_, Registry<Biome> p_187624_, long p_187625_, @Nullable LevelChunkSection[] p_187626_, @Nullable BlendingData p_187627_)
-
-
Method Details
-
replaceMissingSections
private static void replaceMissingSections(Registry<Biome> p_281389_, LevelChunkSection[] p_282796_) -
getListenerRegistry
-
setBlockState
@Nullable public abstract BlockState setBlockState(BlockPos p_62087_, BlockState p_62088_, boolean p_62089_) -
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
- Specified by:
setAllReferences
in interfaceStructureAccess
-
isYSpaceEmpty
public boolean isYSpaceEmpty(int p_62075_, int p_62076_) -
setUnsaved
public void setUnsaved(boolean p_62094_) -
isUnsaved
public boolean isUnsaved() -
getStatus
-
getHighestGeneratedStatus
-
removeBlockEntity
-
markPosForPostprocessing
-
getPostProcessing
public it.unimi.dsi.fastutil.shorts.ShortList[] getPostProcessing() -
addPackedPostProcess
public void addPackedPostProcess(short p_62092_, int p_62093_) -
setBlockEntityNbt
-
getBlockEntityNbt
-
getBlockEntityNbtForSaving
@Nullable public abstract CompoundTag getBlockEntityNbtForSaving(BlockPos p_62104_, HolderLookup.Provider p_324415_) -
findBlockLightSources
- Specified by:
findBlockLightSources
in interfaceLightChunk
-
findBlocks
-
findBlocks
@Deprecated(forRemoval=true) public void findBlocks(BiPredicate<BlockState, BlockPos> p_285343_, BiConsumer<BlockPos, BlockState> p_285030_) Deprecated, for removal: This API element is subject to removal in a future version. -
findBlocks
public void findBlocks(Predicate<BlockState> p_285343_, BiPredicate<BlockState, BlockPos> fineFilter, BiConsumer<BlockPos, BlockState> p_285030_) -
getBlockTicks
-
getFluidTicks
-
getTicksForSerialization
-
getUpgradeData
-
isOldNoiseGeneration
public boolean isOldNoiseGeneration() -
getBlendingData
-
setBlendingData
-
getInhabitedTime
public long getInhabitedTime() -
incrementInhabitedTime
public void incrementInhabitedTime(long p_187633_) -
setInhabitedTime
public void setInhabitedTime(long p_62099_) -
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 p_62100_) -
getMinBuildHeight
public int getMinBuildHeight()- Specified by:
getMinBuildHeight
in interfaceLevelHeightAccessor
-
getHeight
public int getHeight()- Specified by:
getHeight
in interfaceLevelHeightAccessor
-
getOrCreateNoiseChunk
-
carverBiome
Deprecated. -
getNoiseBiome
- 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
-
getExistingData
Description copied from interface:IAttachmentHolder
Returns an optional possibly containing a data attachment value of the given type.If there is no data attachment of the given type, an empty optional is returned.
- Specified by:
getExistingData
in interfaceIAttachmentHolder
- Returns:
- an optional possibly containing a data attachment value 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
ChunkSerializer
. -
readAttachmentsFromNBT
FOR INTERNAL USE ONLYOnly public for use in
ChunkSerializer
. -
getAttachmentHolder
-
getLevel
-