Package net.minecraft.world.chunk.light
Class LightStorage<M extends ChunkToNibbleArrayMap<M>>
java.lang.Object
net.minecraft.world.chunk.light.LevelPropagator
net.minecraft.world.SectionDistanceLevelPropagator
net.minecraft.world.chunk.light.LightStorage<M>
- Direct Known Subclasses:
BlockLightStorage,SkyLightStorage
public abstract class LightStorage<M extends ChunkToNibbleArrayMap<M>> extends SectionDistanceLevelPropagator
LightStorage handles the access, storage and propagation of a specific kind of light within the world.
For example, separate instances will be used to store block light as opposed to sky light.
The smallest unit within LightStorage is the section. Sections represent a cube of 16x16x16 blocks and their lighting data. In turn, 16 sections stacked on top of each other form a column, which are analogous to the standard 16x256x16 world chunks.
To avoid allocations, LightStorage packs all the coordinate arguments into single long values. Extra care should be taken to ensure that the relevant types are being used where appropriate.
- See Also:
SkyLightStorage,BlockLightStorage
-
Field Summary
Fields Modifier and Type Field Description private ChunkProviderchunkProviderprivate LongSetcolumnsToRetainprivate static Direction[]DIRECTIONSprotected LongSetdirtySectionsprotected static ChunkNibbleArrayEMPTYprotected booleanhasLightUpdatesprivate LightTypelightTypeprotected LongSetmarkedNotReadySectionsprotected LongSetmarkedReadySectionsprotected LongSetnotifySectionsprivate LongSetqueuedEdgeSectionsprotected Long2ObjectMap<ChunkNibbleArray>queuedSectionsprotected LongSetreadySectionsprivate LongSetsectionsToRemoveprotected Mstorageprotected MuncachedStorage -
Constructor Summary
Constructors Modifier Constructor Description protectedLightStorage(LightType lightType, ChunkProvider chunkProvider, M lightData) -
Method Summary
Modifier and Type Method Description protected ChunkNibbleArraycreateSection(long sectionPos)protected voidenqueueSectionData(long sectionPos, ChunkNibbleArray array, boolean bool)protected intget(long blockPos)protected intgetInitialLevel(long id)protected intgetLevel(long id)protected abstract intgetLight(long blockPos)ChunkNibbleArraygetLightSection(long sectionPos)protected ChunkNibbleArraygetLightSection(long sectionPos, boolean cached)protected ChunkNibbleArraygetLightSection(M storage, long sectionPos)protected booleanhasLightUpdates()protected booleanhasSection(long sectionPos)protected voidnotifyChanges()protected voidonLoadSection(long sectionPos)protected voidonUnloadSection(long sectionPos)protected voidremoveSection(ChunkLightProvider<?,?> storage, long sectionPos)protected voidset(long blockPos, int value)protected voidsetColumnEnabled(long columnPos, boolean enabled)protected voidsetLevel(long id, int level)voidsetRetainColumn(long sectionPos, boolean retain)protected voidsetSectionStatus(long sectionPos, boolean notReady)protected voidupdateAll()protected voidupdateLight(ChunkLightProvider<M,?> lightProvider, boolean doSkylight, boolean skipEdgeLightPropagation)private voidupdateSection(ChunkLightProvider<M,?> lightProvider, long sectionPos)Methods inherited from class net.minecraft.world.SectionDistanceLevelPropagator
getPropagatedLevel, isMarker, propagateLevel, recalculateLevel, updateMethods inherited from class net.minecraft.world.chunk.light.LevelPropagator
applyPendingUpdates, getPendingUpdateCount, hasPendingUpdates, propagateLevel, removePendingUpdate, removePendingUpdateIf, resetLevel, updateLevel
-
Field Details
-
EMPTY
-
DIRECTIONS
-
lightType
-
chunkProvider
-
readySections
-
markedNotReadySections
-
markedReadySections
-
uncachedStorage
-
storage
-
dirtySections
-
notifySections
-
queuedSections
-
queuedEdgeSections
-
columnsToRetain
-
sectionsToRemove
-
hasLightUpdates
protected volatile boolean hasLightUpdates
-
-
Constructor Details
-
LightStorage
-
-
Method Details
-
hasSection
protected boolean hasSection(long sectionPos) -
getLightSection
-
getLightSection
-
getLightSection
-
getLight
protected abstract int getLight(long blockPos) -
get
protected int get(long blockPos) -
set
protected void set(long blockPos, int value) -
getLevel
protected int getLevel(long id)- Specified by:
getLevelin classLevelPropagator
-
getInitialLevel
protected int getInitialLevel(long id)- Specified by:
getInitialLevelin classSectionDistanceLevelPropagator
-
setLevel
protected void setLevel(long id, int level)- Specified by:
setLevelin classLevelPropagator
-
createSection
-
removeSection
-
hasLightUpdates
protected boolean hasLightUpdates() -
updateLight
protected void updateLight(ChunkLightProvider<M,?> lightProvider, boolean doSkylight, boolean skipEdgeLightPropagation) -
updateSection
-
onLoadSection
protected void onLoadSection(long sectionPos) -
onUnloadSection
protected void onUnloadSection(long sectionPos) -
setColumnEnabled
protected void setColumnEnabled(long columnPos, boolean enabled) -
setRetainColumn
public void setRetainColumn(long sectionPos, boolean retain) -
enqueueSectionData
-
setSectionStatus
protected void setSectionStatus(long sectionPos, boolean notReady) -
updateAll
protected void updateAll() -
notifyChanges
protected void notifyChanges()
-