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 ChunkProvider
chunkProvider
private LongSet
columnsToRetain
private static Direction[]
DIRECTIONS
protected LongSet
dirtySections
protected static ChunkNibbleArray
EMPTY
protected boolean
hasLightUpdates
private LightType
lightType
protected LongSet
markedNotReadySections
protected LongSet
markedReadySections
protected LongSet
notifySections
private LongSet
queuedEdgeSections
protected Long2ObjectMap<ChunkNibbleArray>
queuedSections
protected LongSet
readySections
private LongSet
sectionsToRemove
protected M
storage
protected M
uncachedStorage
-
Constructor Summary
Constructors Modifier Constructor Description protected
LightStorage(LightType lightType, ChunkProvider chunkProvider, M lightData)
-
Method Summary
Modifier and Type Method Description protected ChunkNibbleArray
createSection(long sectionPos)
protected void
enqueueSectionData(long sectionPos, ChunkNibbleArray array, boolean bool)
protected int
get(long blockPos)
protected int
getInitialLevel(long id)
protected int
getLevel(long id)
protected abstract int
getLight(long blockPos)
ChunkNibbleArray
getLightSection(long sectionPos)
protected ChunkNibbleArray
getLightSection(long sectionPos, boolean cached)
protected ChunkNibbleArray
getLightSection(M storage, long sectionPos)
protected boolean
hasLightUpdates()
protected boolean
hasSection(long sectionPos)
protected void
notifyChanges()
protected void
onLoadSection(long sectionPos)
protected void
onUnloadSection(long sectionPos)
protected void
removeSection(ChunkLightProvider<?,?> storage, long sectionPos)
protected void
set(long blockPos, int value)
protected void
setColumnEnabled(long columnPos, boolean enabled)
protected void
setLevel(long id, int level)
void
setRetainColumn(long sectionPos, boolean retain)
protected void
setSectionStatus(long sectionPos, boolean notReady)
protected void
updateAll()
protected void
updateLight(ChunkLightProvider<M,?> lightProvider, boolean doSkylight, boolean skipEdgeLightPropagation)
private void
updateSection(ChunkLightProvider<M,?> lightProvider, long sectionPos)
Methods inherited from class net.minecraft.world.SectionDistanceLevelPropagator
getPropagatedLevel, isMarker, propagateLevel, recalculateLevel, update
Methods 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:
getLevel
in classLevelPropagator
-
getInitialLevel
protected int getInitialLevel(long id)- Specified by:
getInitialLevel
in classSectionDistanceLevelPropagator
-
setLevel
protected void setLevel(long id, int level)- Specified by:
setLevel
in 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()
-