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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AttachmentHolder.AsFieldprotected BlendingDataprotected final Map<BlockPos, BlockEntity> private 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 NoiseChunkprotected final Map<BlockPos, CompoundTag> protected final it.unimi.dsi.fastutil.shorts.ShortList[]protected final LevelChunkSection[]protected ChunkSkyLightSourcesprivate final Map<Structure, StructureStart> protected booleanprotected final UpgradeData -
Constructor Summary
ConstructorsConstructorDescriptionChunkAccess(ChunkPos pChunkPos, UpgradeData pUpgradeData, LevelHeightAccessor pLevelHeightAccessor, Registry<Biome> pBiomeRegistry, long pInhabitedTime, LevelChunkSection[] pSections, BlendingData pBlendingData) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidvoidaddPackedPostProcess(short pPackedPosition, int pIndex) voidaddReferenceForStructure(Structure pStructure, long pReference) carverBiome(Supplier<BiomeGenerationSettings> pCaverBiomeSettingsSupplier) Deprecated.voidfillBiomesFromNoise(BiomeResolver pResolver, Climate.Sampler pSampler) final voidfindBlockLightSources(BiConsumer<BlockPos, BlockState> pOutput) voidfindBlocks(BiPredicate<BlockState, BlockPos> p_285343_, BiConsumer<BlockPos, BlockState> p_285030_) Deprecated, for removal: This API element is subject to removal in a future version.voidfindBlocks(Predicate<BlockState> pPredicate, BiConsumer<BlockPos, BlockState> pOutput) voidfindBlocks(Predicate<BlockState> p_285343_, BiPredicate<BlockState, BlockPos> fineFilter, BiConsumer<BlockPos, BlockState> p_285030_) getBlockEntityNbt(BlockPos pPos) abstract CompoundTaggetBlockEntityNbtForSaving(BlockPos pPos, HolderLookup.Provider pRegistries) abstract TickContainerAccess<Block> <T> TgetData(AttachmentType<T> type) Returns the data attachment of the given type.<T> TgetExistingDataOrNull(AttachmentType<T> type) abstract TickContainerAccess<Fluid> intintgetHeight(Heightmap.Types pType, int pX, int pZ) intintDeprecated, for removal: This API element is subject to removal in a future version.longgetLevel()getListenerRegistry(int pSectionY) intgetNoiseBiome(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.ShortListgetOrCreateOffsetList(it.unimi.dsi.fastutil.shorts.ShortList[] pPackedPositions, int pIndex) abstract ChunkStatusgetPos()it.unimi.dsi.fastutil.shorts.ShortList[]it.unimi.dsi.fastutil.longs.LongSetgetReferencesForStructure(Structure pStructure) getSection(int pIndex) getStartForStructure(Structure pStructure) abstract ChunkAccess.TicksToSavebooleanbooleanReturnstrueif there is any data attachments,falseotherwise.booleanhasData(AttachmentType<?> type) Returnstrueif there is a data attachment of the give type,falseotherwise.booleanvoidincrementInhabitedTime(long pAmount) voidbooleanbooleanbooleanisSectionEmpty(int pY) booleanbooleanbooleanisYSpaceEmpty(int pStartY, int pEndY) voidfinal voidreadAttachmentsFromNBT(HolderLookup.Provider provider, CompoundTag tag) FOR INTERNAL USE ONLYabstract voidremoveBlockEntity(BlockPos pPos) <T> TremoveData(AttachmentType<T> type) Removes the data attachment of the given type.private static voidreplaceMissingSections(Registry<Biome> pBiomeRegistry, LevelChunkSection[] pSections) voidsetAllReferences(Map<Structure, it.unimi.dsi.fastutil.longs.LongSet> pStructureReferencesMap) voidsetAllStarts(Map<Structure, StructureStart> pStructureStarts) voidsetBlendingData(BlendingData pBlendingData) abstract voidsetBlockEntity(BlockEntity pBlockEntity) voidsetBlockEntityNbt(CompoundTag pTag) abstract BlockStatesetBlockState(BlockPos pPos, BlockState pState, boolean pIsMoving) <T> TsetData(AttachmentType<T> type, T data) Sets the data attachment of the given type.voidsetHeightmap(Heightmap.Types pType, long[] pData) voidsetInhabitedTime(long pInhabitedTime) voidsetLightCorrect(boolean pLightCorrect) voidsetStartForStructure(Structure pStructure, StructureStart pStructureStart) voidsetUnsaved(boolean pUnsaved) final CompoundTagwriteAttachmentsToNBT(HolderLookup.Provider provider) FOR INTERNAL USE ONLYMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.level.BlockGetter
clip, clipWithInteractionOverride, getBlockEntity, getBlockEntity, getBlockFloorHeight, getBlockFloorHeight, getBlockState, getBlockStates, getFluidState, getLightEmission, getMaxLightLevel, isBlockInLineMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncData, syncDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockGetterExtension
getAuxLightManager, getAuxLightManager, getModelDataMethods 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 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
@Nullable public abstract BlockState setBlockState(BlockPos pPos, BlockState pState, boolean pIsMoving) -
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
public void setAllReferences(Map<Structure, it.unimi.dsi.fastutil.longs.LongSet> pStructureReferencesMap) - Specified by:
setAllReferencesin interfaceStructureAccess
-
isYSpaceEmpty
public boolean isYSpaceEmpty(int pStartY, int pEndY) -
isSectionEmpty
public boolean isSectionEmpty(int pY) -
setUnsaved
public void setUnsaved(boolean pUnsaved) -
isUnsaved
public boolean isUnsaved() -
getPersistedStatus
-
getHighestGeneratedStatus
-
removeBlockEntity
-
markPosForPostprocessing
-
getPostProcessing
public it.unimi.dsi.fastutil.shorts.ShortList[] getPostProcessing() -
addPackedPostProcess
public void addPackedPostProcess(short pPackedPosition, int pIndex) -
setBlockEntityNbt
-
getBlockEntityNbt
-
getBlockEntityNbtForSaving
@Nullable public abstract CompoundTag getBlockEntityNbtForSaving(BlockPos pPos, HolderLookup.Provider pRegistries) -
findBlockLightSources
- Specified by:
findBlockLightSourcesin 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 pAmount) -
setInhabitedTime
public void setInhabitedTime(long pInhabitedTime) -
getOrCreateOffsetList
public static it.unimi.dsi.fastutil.shorts.ShortList getOrCreateOffsetList(it.unimi.dsi.fastutil.shorts.ShortList[] pPackedPositions, int pIndex) -
isLightCorrect
public boolean isLightCorrect() -
setLightCorrect
public void setLightCorrect(boolean pLightCorrect) -
getMinBuildHeight
public int getMinBuildHeight()- Specified by:
getMinBuildHeightin interfaceLevelHeightAccessor
-
getHeight
public int getHeight()- Specified by:
getHeightin 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:
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
ChunkSerializer. -
readAttachmentsFromNBT
FOR INTERNAL USE ONLYOnly public for use in
ChunkSerializer. -
getAttachmentHolder
-
getLevel
-