public abstract class LightStorage<M extends ChunkToNibbleArrayMap<M>> extends SectionDistanceLevelPropagator
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.
SkyLightStorage
,
BlockLightStorage
Modifier and Type | Field and Description |
---|---|
private ChunkProvider |
chunkProvider |
private it.unimi.dsi.fastutil.longs.LongSet |
columnsToRetain |
private static Direction[] |
DIRECTIONS |
protected it.unimi.dsi.fastutil.longs.LongSet |
dirtySections |
protected static ChunkNibbleArray |
EMPTY |
protected boolean |
hasLightUpdates |
private LightType |
lightType |
protected it.unimi.dsi.fastutil.longs.LongSet |
markedNotReadySections |
protected it.unimi.dsi.fastutil.longs.LongSet |
markedReadySections |
protected it.unimi.dsi.fastutil.longs.LongSet |
notifySections |
private it.unimi.dsi.fastutil.longs.LongSet |
queuedEdgeSections |
protected it.unimi.dsi.fastutil.longs.Long2ObjectMap<ChunkNibbleArray> |
queuedSections |
protected it.unimi.dsi.fastutil.longs.LongSet |
readySections |
private it.unimi.dsi.fastutil.longs.LongSet |
sectionsToRemove |
protected M |
storage |
protected M |
uncachedStorage |
Modifier | Constructor and Description |
---|---|
protected |
LightStorage(LightType lightType,
ChunkProvider chunkProvider,
M lightData) |
Modifier and Type | Method and 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) |
getPropagatedLevel, isMarker, propagateLevel, recalculateLevel, update
applyPendingUpdates, getPendingUpdateCount, hasPendingUpdates, propagateLevel, removePendingUpdate, removePendingUpdateIf, resetLevel, updateLevel
protected static final ChunkNibbleArray EMPTY
private static final Direction[] DIRECTIONS
private final LightType lightType
private final ChunkProvider chunkProvider
protected final it.unimi.dsi.fastutil.longs.LongSet readySections
protected final it.unimi.dsi.fastutil.longs.LongSet markedNotReadySections
protected final it.unimi.dsi.fastutil.longs.LongSet markedReadySections
protected volatile M extends ChunkToNibbleArrayMap<M> uncachedStorage
protected final M extends ChunkToNibbleArrayMap<M> storage
protected final it.unimi.dsi.fastutil.longs.LongSet dirtySections
protected final it.unimi.dsi.fastutil.longs.LongSet notifySections
protected final it.unimi.dsi.fastutil.longs.Long2ObjectMap<ChunkNibbleArray> queuedSections
private final it.unimi.dsi.fastutil.longs.LongSet queuedEdgeSections
private final it.unimi.dsi.fastutil.longs.LongSet columnsToRetain
private final it.unimi.dsi.fastutil.longs.LongSet sectionsToRemove
protected volatile boolean hasLightUpdates
protected LightStorage(LightType lightType, ChunkProvider chunkProvider, M lightData)
protected boolean hasSection(long sectionPos)
@Nullable protected ChunkNibbleArray getLightSection(long sectionPos, boolean cached)
@Nullable protected ChunkNibbleArray getLightSection(M storage, long sectionPos)
@Nullable public ChunkNibbleArray getLightSection(long sectionPos)
protected abstract int getLight(long blockPos)
protected int get(long blockPos)
protected void set(long blockPos, int value)
protected int getLevel(long id)
getLevel
in class LevelPropagator
protected int getInitialLevel(long id)
getInitialLevel
in class SectionDistanceLevelPropagator
protected void setLevel(long id, int level)
setLevel
in class LevelPropagator
protected ChunkNibbleArray createSection(long sectionPos)
protected void removeSection(ChunkLightProvider<?,?> storage, long sectionPos)
protected boolean hasLightUpdates()
protected void updateLight(ChunkLightProvider<M,?> lightProvider, boolean doSkylight, boolean skipEdgeLightPropagation)
private void updateSection(ChunkLightProvider<M,?> lightProvider, long sectionPos)
protected void onLoadSection(long sectionPos)
protected void onUnloadSection(long sectionPos)
protected void setColumnEnabled(long columnPos, boolean enabled)
public void setRetainColumn(long sectionPos, boolean retain)
protected void enqueueSectionData(long sectionPos, @Nullable ChunkNibbleArray array, boolean bool)
protected void setSectionStatus(long sectionPos, boolean notReady)
protected void updateAll()
protected void notifyChanges()