Format Dynamic Light classes

This commit is contained in:
PeytonPlayz595 2024-06-07 18:11:55 -04:00
parent b125383b56
commit 375c449470
2 changed files with 312 additions and 312 deletions

View File

@ -15,147 +15,147 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
public class DynamicLight { public class DynamicLight {
private Entity entity = null; private Entity entity = null;
private double offsetY = 0.0D; private double offsetY = 0.0D;
private double lastPosX = -2.147483648E9D; private double lastPosX = -2.147483648E9D;
private double lastPosY = -2.147483648E9D; private double lastPosY = -2.147483648E9D;
private double lastPosZ = -2.147483648E9D; private double lastPosZ = -2.147483648E9D;
private int lastLightLevel = 0; private int lastLightLevel = 0;
private boolean underwater = false; private boolean underwater = false;
private long timeCheckMs = 0L; private long timeCheckMs = 0L;
private Set < BlockPos > setLitChunkPos = new HashSet(); private Set <BlockPos> setLitChunkPos = new HashSet();
private BlockPos.MutableBlockPos blockPosMutable = new BlockPos.MutableBlockPos(); private BlockPos.MutableBlockPos blockPosMutable = new BlockPos.MutableBlockPos();
public DynamicLight(Entity p_i36_1_) { public DynamicLight(Entity p_i36_1_) {
this.entity = p_i36_1_; this.entity = p_i36_1_;
this.offsetY = (double) p_i36_1_.getEyeHeight(); 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;
} }
double d6 = this.entity.posX - 0.5D; public void update(RenderGlobal p_update_1_) {
double d0 = this.entity.posY - 0.5D + this.offsetY; if (Config.isDynamicLightsFast()) {
double d1 = this.entity.posZ - 0.5D; long i = System.currentTimeMillis();
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);
if (Math.abs(d2) > d5 || Math.abs(d3) > d5 || Math.abs(d4) > d5 || this.lastLightLevel != j) { if (i < this.timeCheckMs + 500L) {
this.lastPosX = d6; return;
this.lastPosY = d0; }
this.lastPosZ = d1;
this.lastLightLevel = j;
this.underwater = false;
World world = p_update_1_.getWorld();
if (world != null) { this.timeCheckMs = i;
this.blockPosMutable.func_181079_c(i, i1, i2); }
IBlockState iblockstate = world.getBlockState(this.blockPosMutable);
Block block = iblockstate.getBlock();
this.underwater = block == Blocks.water;
}
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) { int i = MathHelper.floor_double(d6);
EnumFacing enumfacing2 = (i & 15) >= 8 ? EnumFacing.EAST : EnumFacing.WEST; int i1 = MathHelper.floor_double(d0);
EnumFacing enumfacing = (i1 & 15) >= 8 ? EnumFacing.UP : EnumFacing.DOWN; int i2 = MathHelper.floor_double(d1);
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_); if (Math.abs(d2) > d5 || Math.abs(d3) > d5 || Math.abs(d4) > d5 || this.lastLightLevel != j) {
this.setLitChunkPos = set; 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 <BlockPos> 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_) { private void updateChunkLight(RenderChunk p_updateChunkLight_1_, Set < BlockPos > p_updateChunkLight_2_, Set < BlockPos > p_updateChunkLight_3_) {
if (p_updateChunkLight_1_ != null) { if (p_updateChunkLight_1_ != null) {
CompiledChunk compiledchunk = p_updateChunkLight_1_.getCompiledChunk(); CompiledChunk compiledchunk = p_updateChunkLight_1_.getCompiledChunk();
if (compiledchunk != null && !compiledchunk.isEmpty()) { if (compiledchunk != null && !compiledchunk.isEmpty()) {
p_updateChunkLight_1_.setNeedsUpdate(true); p_updateChunkLight_1_.setNeedsUpdate(true);
} }
BlockPos blockpos = p_updateChunkLight_1_.getPosition(); BlockPos blockpos = p_updateChunkLight_1_.getPosition();
if (p_updateChunkLight_2_ != null) { if (p_updateChunkLight_2_ != null) {
p_updateChunkLight_2_.remove(blockpos); p_updateChunkLight_2_.remove(blockpos);
} }
if (p_updateChunkLight_3_ != null) { if (p_updateChunkLight_3_ != null) {
p_updateChunkLight_3_.add(blockpos); p_updateChunkLight_3_.add(blockpos);
} }
}
} }
}
public void updateLitChunks(RenderGlobal p_updateLitChunks_1_) { public void updateLitChunks(RenderGlobal p_updateLitChunks_1_) {
for (BlockPos blockpos: this.setLitChunkPos) { for (BlockPos blockpos: this.setLitChunkPos) {
RenderChunk renderchunk = p_updateLitChunks_1_.getRenderChunk(blockpos); RenderChunk renderchunk = p_updateLitChunks_1_.getRenderChunk(blockpos);
this.updateChunkLight(renderchunk, (Set < BlockPos > ) null, (Set < BlockPos > ) null); this.updateChunkLight(renderchunk, (Set <BlockPos> ) null, (Set <BlockPos> ) null);
}
} }
}
public Entity getEntity() { public Entity getEntity() {
return this.entity; return this.entity;
} }
public double getLastPosX() { public double getLastPosX() {
return this.lastPosX; return this.lastPosX;
} }
public double getLastPosY() { public double getLastPosY() {
return this.lastPosY; return this.lastPosY;
} }
public double getLastPosZ() { public double getLastPosZ() {
return this.lastPosZ; return this.lastPosZ;
} }
public int getLastLightLevel() { public int getLastLightLevel() {
return this.lastLightLevel; return this.lastLightLevel;
} }
public boolean isUnderwater() { public boolean isUnderwater() {
return this.underwater; return this.underwater;
} }
public double getOffsetY() { public double getOffsetY() {
return this.offsetY; return this.offsetY;
} }
public String toString() { public String toString() {
return "Entity: " + this.entity + ", offsetY: " + this.offsetY; return "Entity: " + this.entity + ", offsetY: " + this.offsetY;
} }
} }

View File

@ -26,224 +26,224 @@ import net.minecraft.util.IntegerCache;
import net.minecraft.world.World; import net.minecraft.world.World;
public class DynamicLights { public class DynamicLights {
private static Map < Integer, DynamicLight > mapDynamicLights = new HashMap(); private static Map <Integer, DynamicLight> mapDynamicLights = new HashMap();
private static long timeUpdateMs = 0L; private static long timeUpdateMs = 0L;
private static final double MAX_DIST = 7.5D; private static final double MAX_DIST = 7.5D;
private static final double MAX_DIST_SQ = 56.25D; private static final double MAX_DIST_SQ = 56.25D;
private static final int LIGHT_LEVEL_MAX = 15; private static final int LIGHT_LEVEL_MAX = 15;
private static final int LIGHT_LEVEL_FIRE = 15; private static final int LIGHT_LEVEL_FIRE = 15;
private static final int LIGHT_LEVEL_BLAZE = 10; 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 = 8;
private static final int LIGHT_LEVEL_MAGMA_CUBE_CORE = 13; 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_GLOWSTONE_DUST = 8;
private static final int LIGHT_LEVEL_PRISMARINE_CRYSTALS = 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_) { 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())); DynamicLight dynamiclight = (DynamicLight) mapDynamicLights.remove(IntegerCache.func_181756_a(p_entityRemoved_0_.getEntityId()));
if (dynamiclight != null) { if (dynamiclight != null) {
dynamiclight.updateLitChunks(p_entityRemoved_1_); dynamiclight.updateLitChunks(p_entityRemoved_1_);
}
} }
}
public static void update(RenderGlobal p_update_0_) { public static void update(RenderGlobal p_update_0_) {
long i = System.currentTimeMillis(); long i = System.currentTimeMillis();
if (i >= timeUpdateMs + 50L) { if (i >= timeUpdateMs + 50L) {
timeUpdateMs = i; 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()) { 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_) { public static int getLightLevel(ItemStack p_getLightLevel_0_) {
World world = p_updateMapDynamicLights_0_.getWorld(); if (p_getLightLevel_0_ == null) {
return 0;
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 { } else {
Integer integer1 = IntegerCache.func_181756_a(entity.getEntityId()); Item item = p_getLightLevel_0_.getItem();
DynamicLight dynamiclight1 = (DynamicLight) mapDynamicLights.remove(integer1);
if (dynamiclight1 != null) { if (item instanceof ItemBlock) {
dynamiclight1.updateLitChunks(p_updateMapDynamicLights_0_); 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 int getLightLevel(Entity p_getLightLevel_0_) {
} if (p_getLightLevel_0_ == Minecraft.getMinecraft().getRenderViewEntity() && !Config.isDynamicHandLight()) {
return 0;
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);
} else { } 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_) { public static void removeLights(RenderGlobal p_removeLights_0_) {
Collection < DynamicLight > collection = mapDynamicLights.values(); Collection < DynamicLight > collection = mapDynamicLights.values();
Iterator iterator = collection.iterator(); Iterator iterator = collection.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
DynamicLight dynamiclight = (DynamicLight) iterator.next(); DynamicLight dynamiclight = (DynamicLight) iterator.next();
iterator.remove(); iterator.remove();
dynamiclight.updateLitChunks(p_removeLights_0_); dynamiclight.updateLitChunks(p_removeLights_0_);
}
} }
}
public static void clear() { public static void clear() {
mapDynamicLights.clear(); mapDynamicLights.clear();
} }
public static int getCount() { public static int getCount() {
return mapDynamicLights.size(); return mapDynamicLights.size();
} }
public static ItemStack getItemStack(EntityItem p_getItemStack_0_) { public static ItemStack getItemStack(EntityItem p_getItemStack_0_) {
ItemStack itemstack = p_getItemStack_0_.getDataWatcher().getWatchableObjectItemStack(10); ItemStack itemstack = p_getItemStack_0_.getDataWatcher().getWatchableObjectItemStack(10);
return itemstack; return itemstack;
} }
} }