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
  • 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

      protected static final Direction[] PROPAGATION_DIRECTIONS
    • chunkSource

      protected final LightChunkGetter chunkSource
    • storage

      protected final S extends LayerLightSectionStorage<M> 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
    • CACHE_SIZE

      private static final int CACHE_SIZE
      See Also:
    • lastChunkPos

      private final long[] lastChunkPos
    • lastChunk

      private final LightChunk[] lastChunk
  • Constructor Details

  • Method Details

    • hasDifferentLightProperties

      @Deprecated public static boolean hasDifferentLightProperties(BlockState oldState, BlockState newState)
      Deprecated.
      Neo: use overload with level context instead
    • hasDifferentLightProperties

      public static boolean hasDifferentLightProperties(BlockGetter level, BlockPos pos, BlockState oldState, BlockState newState)
    • getLightBlockInto

      public static int getLightBlockInto(BlockState fromState, BlockState toState, Direction direction, int simpleOpacity)
    • getOcclusionShape

      public static VoxelShape getOcclusionShape(BlockState state, Direction direction)
    • isEmptyShape

      protected static boolean isEmptyShape(BlockState state)
    • getState

      protected BlockState getState(BlockPos pos)
    • getOpacity

      protected int getOpacity(BlockState state)
    • shapeOccludes

      protected boolean shapeOccludes(BlockState fromState, BlockState toState, Direction direction)
    • getChunk

      protected @Nullable LightChunk getChunk(int chunkX, int chunkZ)
    • clearChunkCache

      private void clearChunkCache()
    • checkBlock

      public void checkBlock(BlockPos pos)
      Specified by:
      checkBlock in interface LightEventListener
    • queueSectionData

      public void queueSectionData(long pos, @Nullable DataLayer data)
    • retainData

      public void retainData(ChunkPos pos, boolean retain)
    • updateSectionStatus

      public void updateSectionStatus(SectionPos pos, boolean sectionEmpty)
      Specified by:
      updateSectionStatus in interface LightEventListener
    • setLightEnabled

      public void setLightEnabled(ChunkPos pos, boolean enable)
      Specified by:
      setLightEnabled in interface LightEventListener
    • runLightUpdates

      public int runLightUpdates()
      Specified by:
      runLightUpdates in interface LightEventListener
    • propagateIncreases

      private int propagateIncreases()
    • propagateDecreases

      private int propagateDecreases()
    • enqueueDecrease

      protected void enqueueDecrease(long fromNode, long decreaseData)
    • enqueueIncrease

      protected void enqueueIncrease(long fromNode, long increaseData)
    • hasLightWork

      public boolean hasLightWork()
      Specified by:
      hasLightWork in interface LightEventListener
    • getDataLayerData

      public @Nullable DataLayer getDataLayerData(SectionPos pos)
      Specified by:
      getDataLayerData in interface LayerLightEventListener
    • getLightValue

      public int getLightValue(BlockPos pos)
      Specified by:
      getLightValue in interface LayerLightEventListener
    • getDebugData

      public String getDebugData(long sectionNode)
    • getDebugSectionType

      public LayerLightSectionStorage.SectionType getDebugSectionType(long sectionNode)
    • checkNode

      protected abstract void checkNode(long blockNode)
    • propagateIncrease

      protected abstract void propagateIncrease(long fromNode, long increaseData, int fromLevel)
    • propagateDecrease

      protected abstract void propagateDecrease(long fromNode, long decreaseData)