Re-implement missing level-sensitive block light hook in ChunkAccess (#9536)

This commit is contained in:
Dennis C authored and GitHub committed 2023-06-10 09:13:29 +01:00
1 parent 622c47c075
commit ce84ba86f0
8 files changed
+252

No files matched your search

@@ -87,7 +87,27 @@ public interface IForgeBlock
/**
* Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15
*
* @param state The state of this block
* @param level The level this block is in
* @param pos The position of this block in the level, will be {@link BlockPos#ZERO} when the chunk being loaded or
* generated calls this to check whether it contains any light sources
* @return The light value
* @implNote <ul>
* <li>
* If the given state of this block may emit light but requires position context to determine the light
* value, then it must return a non-zero light value if {@code (pos == BlockPos.ZERO)} in order for the
* chunk calling this to be considered as containing light sources.
* </li>
* <li>
* The given {@link BlockGetter} may be a chunk. Block, fluid or block entity accesses outside of its bounds
* will cause issues such as wrapping coordinates returning values from the opposing chunk edge
* </li>
* <li>
* This method may be called on a worker thread and must therefore use
* {@link IForgeBlockGetter#getExistingBlockEntity(BlockPos)} to retrieve the {@link BlockEntity}
* at the given position
* </li>
* </ul>
*/
default int getLightEmission(BlockState state, BlockGetter level, BlockPos pos)
{