From 375c449470c18ace9e39367cfb31238b30c69662 Mon Sep 17 00:00:00 2001 From: PeytonPlayz595 <106421860+PeytonPlayz595@users.noreply.github.com> Date: Fri, 7 Jun 2024 18:11:55 -0400 Subject: [PATCH] Format Dynamic Light classes --- .../PeytonPlayz585/shadow/DynamicLight.java | 236 +++++------ .../PeytonPlayz585/shadow/DynamicLights.java | 388 +++++++++--------- 2 files changed, 312 insertions(+), 312 deletions(-) diff --git a/src/main/java/net/PeytonPlayz585/shadow/DynamicLight.java b/src/main/java/net/PeytonPlayz585/shadow/DynamicLight.java index e8bb1db..632a2e1 100644 --- a/src/main/java/net/PeytonPlayz585/shadow/DynamicLight.java +++ b/src/main/java/net/PeytonPlayz585/shadow/DynamicLight.java @@ -15,147 +15,147 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class DynamicLight { - private Entity entity = null; - private double offsetY = 0.0D; - private double lastPosX = -2.147483648E9D; - private double lastPosY = -2.147483648E9D; - private double lastPosZ = -2.147483648E9D; - private int lastLightLevel = 0; - private boolean underwater = false; - private long timeCheckMs = 0L; - private Set < BlockPos > setLitChunkPos = new HashSet(); - private BlockPos.MutableBlockPos blockPosMutable = new BlockPos.MutableBlockPos(); + private Entity entity = null; + private double offsetY = 0.0D; + private double lastPosX = -2.147483648E9D; + private double lastPosY = -2.147483648E9D; + private double lastPosZ = -2.147483648E9D; + private int lastLightLevel = 0; + private boolean underwater = false; + private long timeCheckMs = 0L; + private Set setLitChunkPos = new HashSet(); + private BlockPos.MutableBlockPos blockPosMutable = new BlockPos.MutableBlockPos(); - public DynamicLight(Entity p_i36_1_) { - this.entity = p_i36_1_; - this.offsetY = (double) p_i36_1_.getEyeHeight(); - } - - public void update(RenderGlobal p_update_1_) { - if (Config.isDynamicLightsFast()) { - long i = System.currentTimeMillis(); - - if (i < this.timeCheckMs + 500L) { - return; - } - - this.timeCheckMs = i; + public DynamicLight(Entity p_i36_1_) { + this.entity = p_i36_1_; + this.offsetY = (double) p_i36_1_.getEyeHeight(); } - double d6 = this.entity.posX - 0.5D; - double d0 = this.entity.posY - 0.5D + this.offsetY; - double d1 = this.entity.posZ - 0.5D; - int j = DynamicLights.getLightLevel(this.entity); - double d2 = d6 - this.lastPosX; - double d3 = d0 - this.lastPosY; - double d4 = d1 - this.lastPosZ; - double d5 = 0.1D; - - int i = MathHelper.floor_double(d6); - int i1 = MathHelper.floor_double(d0); - int i2 = MathHelper.floor_double(d1); + public void update(RenderGlobal p_update_1_) { + if (Config.isDynamicLightsFast()) { + long i = System.currentTimeMillis(); - if (Math.abs(d2) > d5 || Math.abs(d3) > d5 || Math.abs(d4) > d5 || this.lastLightLevel != j) { - this.lastPosX = d6; - this.lastPosY = d0; - this.lastPosZ = d1; - this.lastLightLevel = j; - this.underwater = false; - World world = p_update_1_.getWorld(); + if (i < this.timeCheckMs + 500L) { + return; + } - if (world != null) { - this.blockPosMutable.func_181079_c(i, i1, i2); - IBlockState iblockstate = world.getBlockState(this.blockPosMutable); - Block block = iblockstate.getBlock(); - this.underwater = block == Blocks.water; - } + this.timeCheckMs = i; + } - Set < BlockPos > set = new HashSet(); + double d6 = this.entity.posX - 0.5D; + double d0 = this.entity.posY - 0.5D + this.offsetY; + double d1 = this.entity.posZ - 0.5D; + int j = DynamicLights.getLightLevel(this.entity); + double d2 = d6 - this.lastPosX; + double d3 = d0 - this.lastPosY; + double d4 = d1 - this.lastPosZ; + double d5 = 0.1D; - if (j > 0) { - EnumFacing enumfacing2 = (i & 15) >= 8 ? EnumFacing.EAST : EnumFacing.WEST; - EnumFacing enumfacing = (i1 & 15) >= 8 ? EnumFacing.UP : EnumFacing.DOWN; - EnumFacing enumfacing1 = (i2 & 15) >= 8 ? EnumFacing.SOUTH : EnumFacing.NORTH; - BlockPos blockpos = new BlockPos(d6, d0, d1); - RenderChunk renderchunk = p_update_1_.getRenderChunk(blockpos); - RenderChunk renderchunk1 = p_update_1_.getRenderChunk(renderchunk, enumfacing2); - RenderChunk renderchunk2 = p_update_1_.getRenderChunk(renderchunk, enumfacing1); - RenderChunk renderchunk3 = p_update_1_.getRenderChunk(renderchunk1, enumfacing1); - RenderChunk renderchunk4 = p_update_1_.getRenderChunk(renderchunk, enumfacing); - RenderChunk renderchunk5 = p_update_1_.getRenderChunk(renderchunk4, enumfacing2); - RenderChunk renderchunk6 = p_update_1_.getRenderChunk(renderchunk4, enumfacing1); - RenderChunk renderchunk7 = p_update_1_.getRenderChunk(renderchunk5, enumfacing1); - this.updateChunkLight(renderchunk, this.setLitChunkPos, set); - this.updateChunkLight(renderchunk1, this.setLitChunkPos, set); - this.updateChunkLight(renderchunk2, this.setLitChunkPos, set); - this.updateChunkLight(renderchunk3, this.setLitChunkPos, set); - this.updateChunkLight(renderchunk4, this.setLitChunkPos, set); - this.updateChunkLight(renderchunk5, this.setLitChunkPos, set); - this.updateChunkLight(renderchunk6, this.setLitChunkPos, set); - this.updateChunkLight(renderchunk7, this.setLitChunkPos, set); - } + int i = MathHelper.floor_double(d6); + int i1 = MathHelper.floor_double(d0); + int i2 = MathHelper.floor_double(d1); - this.updateLitChunks(p_update_1_); - this.setLitChunkPos = set; + if (Math.abs(d2) > d5 || Math.abs(d3) > d5 || Math.abs(d4) > d5 || this.lastLightLevel != j) { + this.lastPosX = d6; + this.lastPosY = d0; + this.lastPosZ = d1; + this.lastLightLevel = j; + this.underwater = false; + World world = p_update_1_.getWorld(); + + if (world != null) { + this.blockPosMutable.func_181079_c(i, i1, i2); + IBlockState iblockstate = world.getBlockState(this.blockPosMutable); + Block block = iblockstate.getBlock(); + this.underwater = block == Blocks.water; + } + + Set set = new HashSet(); + + if (j > 0) { + EnumFacing enumfacing2 = (i & 15) >= 8 ? EnumFacing.EAST : EnumFacing.WEST; + EnumFacing enumfacing = (i1 & 15) >= 8 ? EnumFacing.UP : EnumFacing.DOWN; + EnumFacing enumfacing1 = (i2 & 15) >= 8 ? EnumFacing.SOUTH : EnumFacing.NORTH; + BlockPos blockpos = new BlockPos(d6, d0, d1); + RenderChunk renderchunk = p_update_1_.getRenderChunk(blockpos); + RenderChunk renderchunk1 = p_update_1_.getRenderChunk(renderchunk, enumfacing2); + RenderChunk renderchunk2 = p_update_1_.getRenderChunk(renderchunk, enumfacing1); + RenderChunk renderchunk3 = p_update_1_.getRenderChunk(renderchunk1, enumfacing1); + RenderChunk renderchunk4 = p_update_1_.getRenderChunk(renderchunk, enumfacing); + RenderChunk renderchunk5 = p_update_1_.getRenderChunk(renderchunk4, enumfacing2); + RenderChunk renderchunk6 = p_update_1_.getRenderChunk(renderchunk4, enumfacing1); + RenderChunk renderchunk7 = p_update_1_.getRenderChunk(renderchunk5, enumfacing1); + this.updateChunkLight(renderchunk, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk1, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk2, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk3, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk4, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk5, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk6, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk7, this.setLitChunkPos, set); + } + + this.updateLitChunks(p_update_1_); + this.setLitChunkPos = set; + } } - } - private void updateChunkLight(RenderChunk p_updateChunkLight_1_, Set < BlockPos > p_updateChunkLight_2_, Set < BlockPos > p_updateChunkLight_3_) { - if (p_updateChunkLight_1_ != null) { - CompiledChunk compiledchunk = p_updateChunkLight_1_.getCompiledChunk(); + private void updateChunkLight(RenderChunk p_updateChunkLight_1_, Set < BlockPos > p_updateChunkLight_2_, Set < BlockPos > p_updateChunkLight_3_) { + if (p_updateChunkLight_1_ != null) { + CompiledChunk compiledchunk = p_updateChunkLight_1_.getCompiledChunk(); - if (compiledchunk != null && !compiledchunk.isEmpty()) { - p_updateChunkLight_1_.setNeedsUpdate(true); - } + if (compiledchunk != null && !compiledchunk.isEmpty()) { + p_updateChunkLight_1_.setNeedsUpdate(true); + } - BlockPos blockpos = p_updateChunkLight_1_.getPosition(); + BlockPos blockpos = p_updateChunkLight_1_.getPosition(); - if (p_updateChunkLight_2_ != null) { - p_updateChunkLight_2_.remove(blockpos); - } + if (p_updateChunkLight_2_ != null) { + p_updateChunkLight_2_.remove(blockpos); + } - if (p_updateChunkLight_3_ != null) { - p_updateChunkLight_3_.add(blockpos); - } + if (p_updateChunkLight_3_ != null) { + p_updateChunkLight_3_.add(blockpos); + } + } } - } - public void updateLitChunks(RenderGlobal p_updateLitChunks_1_) { - for (BlockPos blockpos: this.setLitChunkPos) { - RenderChunk renderchunk = p_updateLitChunks_1_.getRenderChunk(blockpos); - this.updateChunkLight(renderchunk, (Set < BlockPos > ) null, (Set < BlockPos > ) null); + public void updateLitChunks(RenderGlobal p_updateLitChunks_1_) { + for (BlockPos blockpos: this.setLitChunkPos) { + RenderChunk renderchunk = p_updateLitChunks_1_.getRenderChunk(blockpos); + this.updateChunkLight(renderchunk, (Set ) null, (Set ) null); + } } - } - public Entity getEntity() { - return this.entity; - } + public Entity getEntity() { + return this.entity; + } - public double getLastPosX() { - return this.lastPosX; - } + public double getLastPosX() { + return this.lastPosX; + } - public double getLastPosY() { - return this.lastPosY; - } + public double getLastPosY() { + return this.lastPosY; + } - public double getLastPosZ() { - return this.lastPosZ; - } + public double getLastPosZ() { + return this.lastPosZ; + } - public int getLastLightLevel() { - return this.lastLightLevel; - } + public int getLastLightLevel() { + return this.lastLightLevel; + } - public boolean isUnderwater() { - return this.underwater; - } + public boolean isUnderwater() { + return this.underwater; + } - public double getOffsetY() { - return this.offsetY; - } + public double getOffsetY() { + return this.offsetY; + } - public String toString() { - return "Entity: " + this.entity + ", offsetY: " + this.offsetY; - } + public String toString() { + return "Entity: " + this.entity + ", offsetY: " + this.offsetY; + } } \ No newline at end of file diff --git a/src/main/java/net/PeytonPlayz585/shadow/DynamicLights.java b/src/main/java/net/PeytonPlayz585/shadow/DynamicLights.java index 97ea88c..f384ea4 100644 --- a/src/main/java/net/PeytonPlayz585/shadow/DynamicLights.java +++ b/src/main/java/net/PeytonPlayz585/shadow/DynamicLights.java @@ -26,224 +26,224 @@ import net.minecraft.util.IntegerCache; import net.minecraft.world.World; public class DynamicLights { - private static Map < Integer, DynamicLight > mapDynamicLights = new HashMap(); - private static long timeUpdateMs = 0L; - private static final double MAX_DIST = 7.5D; - private static final double MAX_DIST_SQ = 56.25D; - private static final int LIGHT_LEVEL_MAX = 15; - private static final int LIGHT_LEVEL_FIRE = 15; - private static final int LIGHT_LEVEL_BLAZE = 10; - private static final int LIGHT_LEVEL_MAGMA_CUBE = 8; - private static final int LIGHT_LEVEL_MAGMA_CUBE_CORE = 13; - private static final int LIGHT_LEVEL_GLOWSTONE_DUST = 8; - private static final int LIGHT_LEVEL_PRISMARINE_CRYSTALS = 8; + private static Map mapDynamicLights = new HashMap(); + private static long timeUpdateMs = 0L; + private static final double MAX_DIST = 7.5D; + private static final double MAX_DIST_SQ = 56.25D; + private static final int LIGHT_LEVEL_MAX = 15; + private static final int LIGHT_LEVEL_FIRE = 15; + private static final int LIGHT_LEVEL_BLAZE = 10; + private static final int LIGHT_LEVEL_MAGMA_CUBE = 8; + private static final int LIGHT_LEVEL_MAGMA_CUBE_CORE = 13; + private static final int LIGHT_LEVEL_GLOWSTONE_DUST = 8; + private static final int LIGHT_LEVEL_PRISMARINE_CRYSTALS = 8; - public static void entityAdded(Entity p_entityAdded_0_, RenderGlobal p_entityAdded_1_) {} + public static void entityAdded(Entity p_entityAdded_0_, RenderGlobal p_entityAdded_1_) {} - public static void entityRemoved(Entity p_entityRemoved_0_, RenderGlobal p_entityRemoved_1_) { - DynamicLight dynamiclight = (DynamicLight) mapDynamicLights.remove(IntegerCache.func_181756_a(p_entityRemoved_0_.getEntityId())); + public static void entityRemoved(Entity p_entityRemoved_0_, RenderGlobal p_entityRemoved_1_) { + DynamicLight dynamiclight = (DynamicLight) mapDynamicLights.remove(IntegerCache.func_181756_a(p_entityRemoved_0_.getEntityId())); - if (dynamiclight != null) { - dynamiclight.updateLitChunks(p_entityRemoved_1_); + if (dynamiclight != null) { + dynamiclight.updateLitChunks(p_entityRemoved_1_); + } } - } - public static void update(RenderGlobal p_update_0_) { - long i = System.currentTimeMillis(); + public static void update(RenderGlobal p_update_0_) { + long i = System.currentTimeMillis(); - if (i >= timeUpdateMs + 50L) { - timeUpdateMs = i; + if (i >= timeUpdateMs + 50L) { + timeUpdateMs = i; - updateMapDynamicLights(p_update_0_); + updateMapDynamicLights(p_update_0_); + + if (mapDynamicLights.size() > 0) { + for (DynamicLight dynamiclight: mapDynamicLights.values()) { + dynamiclight.update(p_update_0_); + } + } + } + } + + private static void updateMapDynamicLights(RenderGlobal p_updateMapDynamicLights_0_) { + World world = p_updateMapDynamicLights_0_.getWorld(); + + if (world != null) { + for (Entity entity: world.getLoadedEntityList()) { + int i = getLightLevel(entity); + + if (i > 0) { + Integer integer = IntegerCache.func_181756_a(entity.getEntityId()); + DynamicLight dynamiclight = (DynamicLight) mapDynamicLights.get(integer); + + if (dynamiclight == null) { + dynamiclight = new DynamicLight(entity); + mapDynamicLights.put(integer, dynamiclight); + } + } else { + Integer integer1 = IntegerCache.func_181756_a(entity.getEntityId()); + DynamicLight dynamiclight1 = (DynamicLight) mapDynamicLights.remove(integer1); + + if (dynamiclight1 != null) { + dynamiclight1.updateLitChunks(p_updateMapDynamicLights_0_); + } + } + } + } + } + + public static int getCombinedLight(BlockPos p_getCombinedLight_0_, int p_getCombinedLight_1_) { + double d0 = getLightLevel(p_getCombinedLight_0_); + p_getCombinedLight_1_ = getCombinedLight(d0, p_getCombinedLight_1_); + return p_getCombinedLight_1_; + } + + public static int getCombinedLight(Entity p_getCombinedLight_0_, int p_getCombinedLight_1_) { + double d0 = (double) getLightLevel(p_getCombinedLight_0_); + p_getCombinedLight_1_ = getCombinedLight(d0, p_getCombinedLight_1_); + return p_getCombinedLight_1_; + } + + public static int getCombinedLight(double p_getCombinedLight_0_, int p_getCombinedLight_2_) { + if (p_getCombinedLight_0_ > 0.0D) { + int i = (int)(p_getCombinedLight_0_ * 16.0D); + int j = p_getCombinedLight_2_ & 255; + + if (i > j) { + p_getCombinedLight_2_ = p_getCombinedLight_2_ & -256; + p_getCombinedLight_2_ = p_getCombinedLight_2_ | i; + } + } + + return p_getCombinedLight_2_; + } + + public static double getLightLevel(BlockPos p_getLightLevel_0_) { + double d0 = 0.0D; - if (mapDynamicLights.size() > 0) { for (DynamicLight dynamiclight: mapDynamicLights.values()) { - dynamiclight.update(p_update_0_); + int i = dynamiclight.getLastLightLevel(); + + if (i > 0) { + double d1 = dynamiclight.getLastPosX(); + double d2 = dynamiclight.getLastPosY(); + double d3 = dynamiclight.getLastPosZ(); + double d4 = (double) p_getLightLevel_0_.getX() - d1; + double d5 = (double) p_getLightLevel_0_.getY() - d2; + double d6 = (double) p_getLightLevel_0_.getZ() - d3; + double d7 = d4 * d4 + d5 * d5 + d6 * d6; + + if (dynamiclight.isUnderwater() && !Config.isClearWater()) { + i = Config.limit(i - 2, 0, 15); + d7 *= 2.0D; + } + + if (d7 <= 56.25D) { + double d8 = Math.sqrt(d7); + double d9 = 1.0D - d8 / 7.5D; + double d10 = d9 * (double) i; + + if (d10 > d0) { + d0 = d10; + } + } + } } - } + + double d11 = Config.limit(d0, 0.0D, 15.0D); + return d11; } - } - private static void updateMapDynamicLights(RenderGlobal p_updateMapDynamicLights_0_) { - World world = p_updateMapDynamicLights_0_.getWorld(); - - if (world != null) { - for (Entity entity: world.getLoadedEntityList()) { - int i = getLightLevel(entity); - - if (i > 0) { - Integer integer = IntegerCache.func_181756_a(entity.getEntityId()); - DynamicLight dynamiclight = (DynamicLight) mapDynamicLights.get(integer); - - if (dynamiclight == null) { - dynamiclight = new DynamicLight(entity); - mapDynamicLights.put(integer, dynamiclight); - } + public static int getLightLevel(ItemStack p_getLightLevel_0_) { + if (p_getLightLevel_0_ == null) { + return 0; } else { - Integer integer1 = IntegerCache.func_181756_a(entity.getEntityId()); - DynamicLight dynamiclight1 = (DynamicLight) mapDynamicLights.remove(integer1); + Item item = p_getLightLevel_0_.getItem(); - if (dynamiclight1 != null) { - dynamiclight1.updateLitChunks(p_updateMapDynamicLights_0_); - } + if (item instanceof ItemBlock) { + ItemBlock itemblock = (ItemBlock) item; + Block block = itemblock.getBlock(); + + if (block != null) { + return block.getLightValue(); + } + } + + return item == Items.lava_bucket ? Blocks.lava.getLightValue() : (item != Items.blaze_rod && item != Items.blaze_powder ? (item == Items.glowstone_dust ? 8 : (item == Items.prismarine_crystals ? 8 : (item == Items.magma_cream ? 8 : (item == Items.nether_star ? Blocks.beacon.getLightValue() / 2 : 0)))) : 10); } - } - } - } - - public static int getCombinedLight(BlockPos p_getCombinedLight_0_, int p_getCombinedLight_1_) { - double d0 = getLightLevel(p_getCombinedLight_0_); - p_getCombinedLight_1_ = getCombinedLight(d0, p_getCombinedLight_1_); - return p_getCombinedLight_1_; - } - - public static int getCombinedLight(Entity p_getCombinedLight_0_, int p_getCombinedLight_1_) { - double d0 = (double) getLightLevel(p_getCombinedLight_0_); - p_getCombinedLight_1_ = getCombinedLight(d0, p_getCombinedLight_1_); - return p_getCombinedLight_1_; - } - - public static int getCombinedLight(double p_getCombinedLight_0_, int p_getCombinedLight_2_) { - if (p_getCombinedLight_0_ > 0.0D) { - int i = (int)(p_getCombinedLight_0_ * 16.0D); - int j = p_getCombinedLight_2_ & 255; - - if (i > j) { - p_getCombinedLight_2_ = p_getCombinedLight_2_ & -256; - p_getCombinedLight_2_ = p_getCombinedLight_2_ | i; - } } - return p_getCombinedLight_2_; - } - - public static double getLightLevel(BlockPos p_getLightLevel_0_) { - double d0 = 0.0D; - - for (DynamicLight dynamiclight: mapDynamicLights.values()) { - int i = dynamiclight.getLastLightLevel(); - - if (i > 0) { - double d1 = dynamiclight.getLastPosX(); - double d2 = dynamiclight.getLastPosY(); - double d3 = dynamiclight.getLastPosZ(); - double d4 = (double) p_getLightLevel_0_.getX() - d1; - double d5 = (double) p_getLightLevel_0_.getY() - d2; - double d6 = (double) p_getLightLevel_0_.getZ() - d3; - double d7 = d4 * d4 + d5 * d5 + d6 * d6; - - if (dynamiclight.isUnderwater() && !Config.isClearWater()) { - i = Config.limit(i - 2, 0, 15); - d7 *= 2.0D; - } - - if (d7 <= 56.25D) { - double d8 = Math.sqrt(d7); - double d9 = 1.0D - d8 / 7.5D; - double d10 = d9 * (double) i; - - if (d10 > d0) { - d0 = d10; - } - } - } - } - - double d11 = Config.limit(d0, 0.0D, 15.0D); - return d11; - } - - public static int getLightLevel(ItemStack p_getLightLevel_0_) { - if (p_getLightLevel_0_ == null) { - return 0; - } else { - Item item = p_getLightLevel_0_.getItem(); - - if (item instanceof ItemBlock) { - ItemBlock itemblock = (ItemBlock) item; - Block block = itemblock.getBlock(); - - if (block != null) { - return block.getLightValue(); - } - } - - return item == Items.lava_bucket ? Blocks.lava.getLightValue() : (item != Items.blaze_rod && item != Items.blaze_powder ? (item == Items.glowstone_dust ? 8 : (item == Items.prismarine_crystals ? 8 : (item == Items.magma_cream ? 8 : (item == Items.nether_star ? Blocks.beacon.getLightValue() / 2 : 0)))) : 10); - } - } - - public static int getLightLevel(Entity p_getLightLevel_0_) { - if (p_getLightLevel_0_ == Minecraft.getMinecraft().getRenderViewEntity() && !Config.isDynamicHandLight()) { - return 0; - } else { - if (p_getLightLevel_0_ instanceof EntityPlayer) { - EntityPlayer entityplayer = (EntityPlayer) p_getLightLevel_0_; - - if (entityplayer.isSpectator()) { - return 0; - } - } - - if (p_getLightLevel_0_.isBurning()) { - return 15; - } else if (p_getLightLevel_0_ instanceof EntityFireball) { - return 15; - } else if (p_getLightLevel_0_ instanceof EntityTNTPrimed) { - return 15; - } else if (p_getLightLevel_0_ instanceof EntityBlaze) { - EntityBlaze entityblaze = (EntityBlaze) p_getLightLevel_0_; - return entityblaze.func_70845_n() ? 15 : 10; - } else if (p_getLightLevel_0_ instanceof EntityMagmaCube) { - EntityMagmaCube entitymagmacube = (EntityMagmaCube) p_getLightLevel_0_; - return (double) entitymagmacube.squishFactor > 0.6D ? 13 : 8; - } else { - if (p_getLightLevel_0_ instanceof EntityCreeper) { - EntityCreeper entitycreeper = (EntityCreeper) p_getLightLevel_0_; - - if ((double) entitycreeper.getCreeperFlashIntensity(0.0F) > 0.001D) { - return 15; - } - } - - if (p_getLightLevel_0_ instanceof EntityLivingBase) { - EntityLivingBase entitylivingbase = (EntityLivingBase) p_getLightLevel_0_; - ItemStack itemstack2 = entitylivingbase.getHeldItem(); - int i = getLightLevel(itemstack2); - ItemStack itemstack1 = entitylivingbase.getEquipmentInSlot(4); - int j = getLightLevel(itemstack1); - return Math.max(i, j); - } else if (p_getLightLevel_0_ instanceof EntityItem) { - EntityItem entityitem = (EntityItem) p_getLightLevel_0_; - ItemStack itemstack = getItemStack(entityitem); - return getLightLevel(itemstack); + public static int getLightLevel(Entity p_getLightLevel_0_) { + if (p_getLightLevel_0_ == Minecraft.getMinecraft().getRenderViewEntity() && !Config.isDynamicHandLight()) { + return 0; } else { - return 0; + if (p_getLightLevel_0_ instanceof EntityPlayer) { + EntityPlayer entityplayer = (EntityPlayer) p_getLightLevel_0_; + + if (entityplayer.isSpectator()) { + return 0; + } + } + + if (p_getLightLevel_0_.isBurning()) { + return 15; + } else if (p_getLightLevel_0_ instanceof EntityFireball) { + return 15; + } else if (p_getLightLevel_0_ instanceof EntityTNTPrimed) { + return 15; + } else if (p_getLightLevel_0_ instanceof EntityBlaze) { + EntityBlaze entityblaze = (EntityBlaze) p_getLightLevel_0_; + return entityblaze.func_70845_n() ? 15 : 10; + } else if (p_getLightLevel_0_ instanceof EntityMagmaCube) { + EntityMagmaCube entitymagmacube = (EntityMagmaCube) p_getLightLevel_0_; + return (double) entitymagmacube.squishFactor > 0.6D ? 13 : 8; + } else { + if (p_getLightLevel_0_ instanceof EntityCreeper) { + EntityCreeper entitycreeper = (EntityCreeper) p_getLightLevel_0_; + + if ((double) entitycreeper.getCreeperFlashIntensity(0.0F) > 0.001D) { + return 15; + } + } + + if (p_getLightLevel_0_ instanceof EntityLivingBase) { + EntityLivingBase entitylivingbase = (EntityLivingBase) p_getLightLevel_0_; + ItemStack itemstack2 = entitylivingbase.getHeldItem(); + int i = getLightLevel(itemstack2); + ItemStack itemstack1 = entitylivingbase.getEquipmentInSlot(4); + int j = getLightLevel(itemstack1); + return Math.max(i, j); + } else if (p_getLightLevel_0_ instanceof EntityItem) { + EntityItem entityitem = (EntityItem) p_getLightLevel_0_; + ItemStack itemstack = getItemStack(entityitem); + return getLightLevel(itemstack); + } else { + return 0; + } + } } - } } - } - public static void removeLights(RenderGlobal p_removeLights_0_) { - Collection < DynamicLight > collection = mapDynamicLights.values(); - Iterator iterator = collection.iterator(); + public static void removeLights(RenderGlobal p_removeLights_0_) { + Collection < DynamicLight > collection = mapDynamicLights.values(); + Iterator iterator = collection.iterator(); - while (iterator.hasNext()) { - DynamicLight dynamiclight = (DynamicLight) iterator.next(); - iterator.remove(); - dynamiclight.updateLitChunks(p_removeLights_0_); + while (iterator.hasNext()) { + DynamicLight dynamiclight = (DynamicLight) iterator.next(); + iterator.remove(); + dynamiclight.updateLitChunks(p_removeLights_0_); + } } - } - public static void clear() { - mapDynamicLights.clear(); - } + public static void clear() { + mapDynamicLights.clear(); + } - public static int getCount() { - return mapDynamicLights.size(); - } + public static int getCount() { + return mapDynamicLights.size(); + } - public static ItemStack getItemStack(EntityItem p_getItemStack_0_) { - ItemStack itemstack = p_getItemStack_0_.getDataWatcher().getWatchableObjectItemStack(10); - return itemstack; - } + public static ItemStack getItemStack(EntityItem p_getItemStack_0_) { + ItemStack itemstack = p_getItemStack_0_.getDataWatcher().getWatchableObjectItemStack(10); + return itemstack; + } } \ No newline at end of file