Update dynamic lights
This commit is contained in:
parent
9e952ad73a
commit
b125383b56
|
@ -51,6 +51,10 @@ public class DynamicLight {
|
|||
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) {
|
||||
this.lastPosX = d6;
|
||||
this.lastPosY = d0;
|
||||
|
@ -60,7 +64,7 @@ public class DynamicLight {
|
|||
World world = p_update_1_.getWorld();
|
||||
|
||||
if (world != null) {
|
||||
this.blockPosMutable.func_181079_c(MathHelper.floor_double(d6), MathHelper.floor_double(d0), MathHelper.floor_double(d1));
|
||||
this.blockPosMutable.func_181079_c(i, i1, i2);
|
||||
IBlockState iblockstate = world.getBlockState(this.blockPosMutable);
|
||||
Block block = iblockstate.getBlock();
|
||||
this.underwater = block == Blocks.water;
|
||||
|
@ -69,9 +73,9 @@ public class DynamicLight {
|
|||
Set < BlockPos > set = new HashSet();
|
||||
|
||||
if (j > 0) {
|
||||
EnumFacing enumfacing2 = (MathHelper.floor_double(d6) & 15) >= 8 ? EnumFacing.EAST : EnumFacing.WEST;
|
||||
EnumFacing enumfacing = (MathHelper.floor_double(d0) & 15) >= 8 ? EnumFacing.UP : EnumFacing.DOWN;
|
||||
EnumFacing enumfacing1 = (MathHelper.floor_double(d1) & 15) >= 8 ? EnumFacing.SOUTH : EnumFacing.NORTH;
|
||||
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);
|
||||
|
|
|
@ -41,14 +41,12 @@ public class DynamicLights {
|
|||
public static void entityAdded(Entity p_entityAdded_0_, RenderGlobal p_entityAdded_1_) {}
|
||||
|
||||
public static void entityRemoved(Entity p_entityRemoved_0_, RenderGlobal p_entityRemoved_1_) {
|
||||
synchronized(mapDynamicLights) {
|
||||
DynamicLight dynamiclight = (DynamicLight) mapDynamicLights.remove(IntegerCache.func_181756_a(p_entityRemoved_0_.getEntityId()));
|
||||
|
||||
if (dynamiclight != null) {
|
||||
dynamiclight.updateLitChunks(p_entityRemoved_1_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void update(RenderGlobal p_update_0_) {
|
||||
long i = System.currentTimeMillis();
|
||||
|
@ -56,7 +54,6 @@ public class DynamicLights {
|
|||
if (i >= timeUpdateMs + 50L) {
|
||||
timeUpdateMs = i;
|
||||
|
||||
synchronized(mapDynamicLights) {
|
||||
updateMapDynamicLights(p_update_0_);
|
||||
|
||||
if (mapDynamicLights.size() > 0) {
|
||||
|
@ -66,7 +63,6 @@ public class DynamicLights {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateMapDynamicLights(RenderGlobal p_updateMapDynamicLights_0_) {
|
||||
World world = p_updateMapDynamicLights_0_.getWorld();
|
||||
|
@ -124,7 +120,6 @@ public class DynamicLights {
|
|||
public static double getLightLevel(BlockPos p_getLightLevel_0_) {
|
||||
double d0 = 0.0D;
|
||||
|
||||
synchronized(mapDynamicLights) {
|
||||
for (DynamicLight dynamiclight: mapDynamicLights.values()) {
|
||||
int i = dynamiclight.getLastLightLevel();
|
||||
|
||||
|
@ -153,7 +148,6 @@ public class DynamicLights {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double d11 = Config.limit(d0, 0.0D, 15.0D);
|
||||
return d11;
|
||||
|
@ -230,7 +224,6 @@ public class DynamicLights {
|
|||
}
|
||||
|
||||
public static void removeLights(RenderGlobal p_removeLights_0_) {
|
||||
synchronized(mapDynamicLights) {
|
||||
Collection < DynamicLight > collection = mapDynamicLights.values();
|
||||
Iterator iterator = collection.iterator();
|
||||
|
||||
|
@ -240,19 +233,14 @@ public class DynamicLights {
|
|||
dynamiclight.updateLitChunks(p_removeLights_0_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
synchronized(mapDynamicLights) {
|
||||
mapDynamicLights.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getCount() {
|
||||
synchronized(mapDynamicLights) {
|
||||
return mapDynamicLights.size();
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(EntityItem p_getItemStack_0_) {
|
||||
ItemStack itemstack = p_getItemStack_0_.getDataWatcher().getWatchableObjectItemStack(10);
|
||||
|
|
Loading…
Reference in New Issue
Block a user