Fix light level detection for petrified creatures breaking out

This commit is contained in:
Electroblob
2018-06-05 14:12:33 +01:00
parent 669cd2892d
commit 05b905b988
2 changed files with 22 additions and 2 deletions
@@ -98,6 +98,26 @@ public final class WizardryUtilities {
// SECTION Block/Entity/World Utilities
// ===============================================================================================================
/**
* Returns the actual light level, taking natural light (skylight) and artificial light (block light) into account.
* This uses the same logic as mob spawning.
*
* @return The light level, from 0 (pitch darkness) to 15 (full daylight/at a torch).
*/
public static int getLightLevel(World world, BlockPos pos){
int i = world.getLightFromNeighbors(pos);
if(world.isThundering()){
int j = world.getSkylightSubtracted();
world.setSkylightSubtracted(10);
i = world.getLightFromNeighbors(pos);
world.setSkylightSubtracted(j);
}
return i;
}
/**
* Returns whether the block at the given coordinates can be replaced by another one (works as if a block is being
* placed by a player). True for air, liquids, vines, tall grass and snow layers but not for flowers, signs etc.