/**
* Checks to make sure the light is not too bright where the mob is spawning
* Adapted from net.minecraft.entity.monster.EntityMob#isValidLightLevel
*
*/
private static boolean EntityMob_isValidLightLevel(EntityLivingBase entity)
{
BlockPos pos = new BlockPos(entity.posX, entity.getEntityBoundingBox().minY, entity.posZ);
if (entity.world.getLightFor(EnumSkyBlock.SKY, pos) > entity.world.rand.nextInt(32))
{
return false;
}
else
{
int i = entity.world.getLightFromNeighbors(pos);
if (entity.world.isThundering())
{
int j = entity.world.getSkylightSubtracted();
entity.world.setSkylightSubtracted(10);
i = entity.world.getLightFromNeighbors(pos);
entity.world.setSkylightSubtracted(j);
}
return i <= entity.world.rand.nextInt(8);
}
}
EntityUtils.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:Halloween
作者:
评论列表
文章目录