Class LightEngine<M extends DataLayerStorageMap<M>,S extends LayerLightSectionStorage<M>>
java.lang.Object
net.minecraft.world.level.lighting.LightEngine<M,S>
- All Implemented Interfaces:
LayerLightEventListener
,LightEventListener
- Direct Known Subclasses:
BlockLightEngine
,SkyLightEngine
public abstract class LightEngine<M extends DataLayerStorageMap<M>,S extends LayerLightSectionStorage<M>>
extends Object
implements LayerLightEventListener
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface net.minecraft.world.level.lighting.LayerLightEventListener
LayerLightEventListener.DummyLightLayerEventListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final it.unimi.dsi.fastutil.longs.LongOpenHashSet
private static final int
protected final LightChunkGetter
private final it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue
private final it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue
private final LightChunk[]
private final long[]
static final int
protected static final int
private static final int
private final BlockPos.MutableBlockPos
protected static final Direction[]
protected static final long
protected final S
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkBlock
(BlockPos pos) protected abstract void
checkNode
(long packedPos) private void
protected void
enqueueDecrease
(long packedPos1, long packedPos2) protected void
enqueueIncrease
(long packedPos1, long packedPos2) protected LightChunk
getChunk
(int x, int z) getDataLayerData
(SectionPos sectionPos) getDebugData
(long sectionPos) getDebugSectionType
(long sectionPos) static int
getLightBlockInto
(BlockGetter level, BlockState state1, BlockPos pos1, BlockState state2, BlockPos pos2, Direction direction, int defaultReturnValue) int
getLightValue
(BlockPos levelPos) protected VoxelShape
getOcclusionShape
(BlockState state, long pos, Direction direction) static VoxelShape
getOcclusionShape
(BlockGetter level, BlockPos pos, BlockState state, Direction direction) protected int
getOpacity
(BlockState state, BlockPos pos) protected BlockState
static boolean
hasDifferentLightProperties
(BlockGetter level, BlockPos pos, BlockState state1, BlockState state2) boolean
protected static boolean
isEmptyShape
(BlockState state) protected abstract void
propagateDecrease
(long packedPos, long lightLevel) private int
protected abstract void
propagateIncrease
(long packedPos, long queueEntry, int lightLevel) private int
void
queueSectionData
(long sectionPos, DataLayer data) void
retainData
(ChunkPos chunkPos, boolean retainData) int
void
setLightEnabled
(ChunkPos chunkPos, boolean lightEnabled) protected boolean
shapeOccludes
(long packedPos1, BlockState state1, long packedPos2, BlockState state2, Direction direction) void
updateSectionStatus
(SectionPos pos, boolean isQueueEmpty) Methods 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.lighting.LightEventListener
propagateLightSources, updateSectionStatus
-
Field Details
-
MAX_LEVEL
public static final int MAX_LEVEL- See Also:
-
MIN_OPACITY
protected static final int MIN_OPACITY- See Also:
-
PULL_LIGHT_IN_ENTRY
protected static final long PULL_LIGHT_IN_ENTRY -
MIN_QUEUE_SIZE
private static final int MIN_QUEUE_SIZE- See Also:
-
PROPAGATION_DIRECTIONS
-
chunkSource
-
storage
-
blockNodesToCheck
private final it.unimi.dsi.fastutil.longs.LongOpenHashSet blockNodesToCheck -
decreaseQueue
private final it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue decreaseQueue -
increaseQueue
private final it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue increaseQueue -
mutablePos
-
CACHE_SIZE
private static final int CACHE_SIZE- See Also:
-
lastChunkPos
private final long[] lastChunkPos -
lastChunk
-
-
Constructor Details
-
LightEngine
-
-
Method Details
-
hasDifferentLightProperties
public static boolean hasDifferentLightProperties(BlockGetter level, BlockPos pos, BlockState state1, BlockState state2) -
getLightBlockInto
public static int getLightBlockInto(BlockGetter level, BlockState state1, BlockPos pos1, BlockState state2, BlockPos pos2, Direction direction, int defaultReturnValue) -
getOcclusionShape
public static VoxelShape getOcclusionShape(BlockGetter level, BlockPos pos, BlockState state, Direction direction) -
isEmptyShape
-
getState
-
getOpacity
-
shapeOccludes
protected boolean shapeOccludes(long packedPos1, BlockState state1, long packedPos2, BlockState state2, Direction direction) -
getOcclusionShape
-
getChunk
-
clearChunkCache
private void clearChunkCache() -
checkBlock
- Specified by:
checkBlock
in interfaceLightEventListener
-
queueSectionData
-
retainData
-
updateSectionStatus
- Specified by:
updateSectionStatus
in interfaceLightEventListener
-
setLightEnabled
- Specified by:
setLightEnabled
in interfaceLightEventListener
-
runLightUpdates
public int runLightUpdates()- Specified by:
runLightUpdates
in interfaceLightEventListener
-
propagateIncreases
private int propagateIncreases() -
propagateDecreases
private int propagateDecreases() -
enqueueDecrease
protected void enqueueDecrease(long packedPos1, long packedPos2) -
enqueueIncrease
protected void enqueueIncrease(long packedPos1, long packedPos2) -
hasLightWork
public boolean hasLightWork()- Specified by:
hasLightWork
in interfaceLightEventListener
-
getDataLayerData
- Specified by:
getDataLayerData
in interfaceLayerLightEventListener
-
getLightValue
- Specified by:
getLightValue
in interfaceLayerLightEventListener
-
getDebugData
-
getDebugSectionType
-
checkNode
protected abstract void checkNode(long packedPos) -
propagateIncrease
protected abstract void propagateIncrease(long packedPos, long queueEntry, int lightLevel) -
propagateDecrease
protected abstract void propagateDecrease(long packedPos, long lightLevel)
-