remove more skylight
This commit is contained in:
parent
0873e0aab0
commit
ae0dc2e7cf
15 changed files with 128 additions and 300 deletions
|
@ -52,7 +52,7 @@ public class BlockIce extends Block {
|
|||
}
|
||||
|
||||
public void tick(AWorldServer world, BlockPos pos, State state, Random rand) {
|
||||
if(Vars.iceMelt && (world.getLightFor(LightType.BLOCK, pos) > 11 - this.getLightOpacity() || !world.canFreezeAt(pos))) {
|
||||
if(Vars.iceMelt && (world.getLightFor(pos) > 11 - this.getLightOpacity() || !world.canFreezeAt(pos))) {
|
||||
if(world.doesWaterVaporize(pos)) {
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class BlockSnow extends Block
|
|||
|
||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
if (Vars.snowMelt && (worldIn.getLightFor(LightType.BLOCK, pos) > 11 || !worldIn.canFreezeAt(pos)))
|
||||
if (Vars.snowMelt && (worldIn.getLightFor(pos) > 11 || !worldIn.canFreezeAt(pos)))
|
||||
{
|
||||
this.drop(worldIn, pos, worldIn.getState(pos), 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class BlockSnowBlock extends Block {
|
|||
}
|
||||
|
||||
public void tick(AWorldServer world, BlockPos pos, State state, Random rand) {
|
||||
if(Vars.snowFullMelt && (world.getLightFor(LightType.BLOCK, pos) > 11 || !world.canFreezeAt(pos))) {
|
||||
if(Vars.snowFullMelt && (world.getLightFor(pos) > 11 || !world.canFreezeAt(pos))) {
|
||||
this.drop(world, pos, world.getState(pos), 0);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
|
|
@ -3433,7 +3433,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
}
|
||||
tag.setList("items", list);
|
||||
if(this.isPlayer()) {
|
||||
tag.setInt("held", this.getSelectedIndex());
|
||||
tag.setInt("selected", this.getSelectedIndex());
|
||||
}
|
||||
else {
|
||||
TagObject item = new TagObject();
|
||||
|
|
|
@ -20,7 +20,6 @@ import common.util.BlockPos;
|
|||
import common.util.BoundingBox;
|
||||
import common.util.InheritanceMultiMap;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.IntHashMap;
|
||||
|
||||
public abstract class Chunk {
|
||||
|
@ -39,7 +38,6 @@ public abstract class Chunk {
|
|||
|
||||
protected boolean loaded;
|
||||
protected boolean populated;
|
||||
protected boolean lightInit;
|
||||
protected boolean updated;
|
||||
protected boolean modified;
|
||||
protected boolean hasEntity;
|
||||
|
@ -258,25 +256,15 @@ public abstract class Chunk {
|
|||
}
|
||||
}
|
||||
|
||||
public int getLight(LightType type, BlockPos pos) {
|
||||
public int getLight(BlockPos pos) {
|
||||
int x = pos.getX() & 15;
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
if(type == LightType.SKY) {
|
||||
int l = stor == null ? (this.canSeeSky(pos) ? type.defValue : 0) : (this.world.dimension.hasSkyLight() ? 15 : 0);
|
||||
if(y < 64) {
|
||||
int max = y < 0 ? 0 : y / 4;
|
||||
l = l > max ? max : l;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
if(stor == null)
|
||||
return this.canSeeSky(pos) ? type.defValue : 0;
|
||||
return type == LightType.BLOCK ? stor.getLight(x, y & 15, z) : type.defValue;
|
||||
return stor == null ? 0 : stor.getLight(x, y & 15, z);
|
||||
}
|
||||
|
||||
public void setLight(LightType type, BlockPos pos, int value) {
|
||||
public void setLight(BlockPos pos, int value) {
|
||||
int x = pos.getX() & 15;
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
|
@ -290,9 +278,7 @@ public abstract class Chunk {
|
|||
|
||||
this.modified = true;
|
||||
|
||||
if(type == LightType.BLOCK) {
|
||||
stor.setLight(x, y & 15, z, value);
|
||||
}
|
||||
stor.setLight(x, y & 15, z, value);
|
||||
}
|
||||
|
||||
public int getLightSub(BlockPos pos, int amount) {
|
||||
|
@ -300,11 +286,7 @@ public abstract class Chunk {
|
|||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
int l = stor == null ? LightType.SKY.defValue : (this.world.dimension.hasSkyLight() ? 15 : 0);
|
||||
if(y < 64) {
|
||||
int max = y < 0 ? 0 : y / 4;
|
||||
l = l > max ? max : l;
|
||||
}
|
||||
int l = this.world.dimension.hasSkyLight() ? World.getSkyLightFor(pos.getY()) : 0;
|
||||
if(stor == null)
|
||||
return this.world.dimension.hasSkyLight() && amount < l ? l - amount : 0;
|
||||
l = l - amount;
|
||||
|
@ -491,10 +473,6 @@ public abstract class Chunk {
|
|||
public void update(boolean noGaps) {
|
||||
this.updated = true;
|
||||
|
||||
if(!this.lightInit && this.populated) {
|
||||
this.checkLight();
|
||||
}
|
||||
|
||||
while(!this.tileQueue.isEmpty()) {
|
||||
BlockPos pos = (BlockPos)this.tileQueue.poll();
|
||||
|
||||
|
@ -507,97 +485,7 @@ public abstract class Chunk {
|
|||
}
|
||||
|
||||
public boolean isPopulated() {
|
||||
return this.updated && this.populated && this.lightInit;
|
||||
}
|
||||
|
||||
public void checkLight() {
|
||||
this.populated = true;
|
||||
this.lightInit = true;
|
||||
BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4);
|
||||
|
||||
if(this.world.dimension.hasSkyLight()) {
|
||||
if(this.world.isAreaLoaded(pos.add(-1, 0, -1), pos.add(16, this.world.getSeaLevel(), 16))) {
|
||||
label92:
|
||||
|
||||
for(int x = 0; x < 16; ++x) {
|
||||
for(int z = 0; z < 16; ++z) {
|
||||
if(!this.updateColumn(x, z)) {
|
||||
this.lightInit = false;
|
||||
break label92;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.lightInit) {
|
||||
for(Facing face : Facing.Plane.HORIZONTAL) {
|
||||
int d = face.getAxisDirection() == Facing.AxisDirection.POSITIVE ? 16 : 1;
|
||||
this.world.getChunk(pos.offset(face, d)).updateColumns(face.getOpposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.lightInit = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateColumns(Facing facing) {
|
||||
if(this.populated) {
|
||||
if(facing == Facing.EAST) {
|
||||
for(int z = 0; z < 16; ++z) {
|
||||
this.updateColumn(15, z);
|
||||
}
|
||||
}
|
||||
else if(facing == Facing.WEST) {
|
||||
for(int z = 0; z < 16; ++z) {
|
||||
this.updateColumn(0, z);
|
||||
}
|
||||
}
|
||||
else if(facing == Facing.SOUTH) {
|
||||
for(int x = 0; x < 16; ++x) {
|
||||
this.updateColumn(x, 15);
|
||||
}
|
||||
}
|
||||
else if(facing == Facing.NORTH) {
|
||||
for(int x = 0; x < 16; ++x) {
|
||||
this.updateColumn(x, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean updateColumn(int x, int z) {
|
||||
int top = this.top;
|
||||
int bottom = this.bottom < -64 ? -64 : this.bottom;
|
||||
boolean opaque = false;
|
||||
boolean below = false;
|
||||
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos((this.xPos << 4) + x, 0, (this.zPos << 4) + z);
|
||||
|
||||
for(int y = top + 16 - 1; y > this.world.getSeaLevel() || y > bottom && !below; --y) {
|
||||
pos.set(pos.getX(), y, pos.getZ());
|
||||
int o = this.getOpacity(pos);
|
||||
|
||||
if(o == 255 && pos.getY() < this.world.getSeaLevel()) {
|
||||
below = true;
|
||||
}
|
||||
|
||||
if(!opaque && o > 0) {
|
||||
opaque = true;
|
||||
}
|
||||
else if(opaque && o == 0 && !this.world.checkLight(pos)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(int y = pos.getY(); y > bottom; --y) {
|
||||
pos.set(pos.getX(), y, pos.getZ());
|
||||
|
||||
if(this.getBlock(pos).getLight() > 0) {
|
||||
this.world.checkLight(pos);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return this.updated && this.populated;
|
||||
}
|
||||
|
||||
public boolean isLoaded() {
|
||||
|
|
|
@ -182,7 +182,7 @@ public abstract class World implements IWorldAccess {
|
|||
return false;
|
||||
Block block1 = iblockstate.getBlock();
|
||||
if(block.getLightOpacity() != block1.getLightOpacity() || block.getLight() != block1.getLight())
|
||||
this.checkLight(pos);
|
||||
this.checkBlockLight(pos);
|
||||
if((flags & 2) != 0 && (flags & 4) == 0 && chunk.isPopulated())
|
||||
this.markBlockForUpdate(pos);
|
||||
return true;
|
||||
|
@ -221,12 +221,6 @@ public abstract class World implements IWorldAccess {
|
|||
x2 = i;
|
||||
}
|
||||
|
||||
if(this.dimension.hasSkyLight()) {
|
||||
for(int j = x2; j <= z2; ++j) {
|
||||
this.checkLightFor(LightType.SKY, new BlockPos(x1, j, z1));
|
||||
}
|
||||
}
|
||||
|
||||
this.clientRenderUpdate(x1, x2, z1, x1, z2, z1);
|
||||
}
|
||||
|
||||
|
@ -317,90 +311,70 @@ public abstract class World implements IWorldAccess {
|
|||
return new BlockPos(pos.getX(), i, pos.getZ());
|
||||
}
|
||||
|
||||
public int getChunksLowestHorizon(int x, int z) {
|
||||
if(x >= -MAX_SIZE && z >= -MAX_SIZE && x < MAX_SIZE && z < MAX_SIZE) {
|
||||
if(!this.isLoaded(x >> 4, z >> 4, true)) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
Chunk chunk = this.getChunk(x >> 4, z >> 4);
|
||||
return chunk.getLowest();
|
||||
}
|
||||
}
|
||||
else {
|
||||
return this.getSeaLevel() + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int getLightFromNeighborsFor(LightType type, BlockPos pos) {
|
||||
if(!this.dimension.hasSkyLight() && type == LightType.SKY) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if(pos.getY() < -MAX_SIZE_Y) {
|
||||
pos = new BlockPos(pos.getX(), -MAX_SIZE_Y, pos.getZ());
|
||||
}
|
||||
|
||||
if(!isValid(pos)) {
|
||||
return type.defValue;
|
||||
}
|
||||
else if(!this.isBlockLoaded(pos)) {
|
||||
return type.defValue;
|
||||
}
|
||||
else if(this.getState(pos).getBlock().getSumBrightness()) {
|
||||
int i1 = this.getLightFor(type, pos.up());
|
||||
int i = this.getLightFor(type, pos.east());
|
||||
int j = this.getLightFor(type, pos.west());
|
||||
int k = this.getLightFor(type, pos.south());
|
||||
int l = this.getLightFor(type, pos.north());
|
||||
|
||||
if(i > i1) {
|
||||
i1 = i;
|
||||
}
|
||||
|
||||
if(j > i1) {
|
||||
i1 = j;
|
||||
}
|
||||
|
||||
if(k > i1) {
|
||||
i1 = k;
|
||||
}
|
||||
|
||||
if(l > i1) {
|
||||
i1 = l;
|
||||
}
|
||||
|
||||
return i1;
|
||||
}
|
||||
else {
|
||||
Chunk chunk = this.getChunk(pos);
|
||||
return chunk.getLight(type, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getLightFor(LightType type, BlockPos pos) {
|
||||
public int getBlockLightSum(BlockPos pos) {
|
||||
if(pos.getY() < -MAX_SIZE_Y) {
|
||||
pos = new BlockPos(pos.getX(), -MAX_SIZE_Y, pos.getZ());
|
||||
}
|
||||
|
||||
if(!isValid(pos)) {
|
||||
return type.defValue;
|
||||
return 0;
|
||||
}
|
||||
else if(!this.isBlockLoaded(pos)) {
|
||||
return type.defValue;
|
||||
return 0;
|
||||
}
|
||||
else if(this.getState(pos).getBlock().getSumBrightness()) {
|
||||
int i1 = this.getLightFor(pos.up());
|
||||
int i = this.getLightFor(pos.east());
|
||||
int j = this.getLightFor(pos.west());
|
||||
int k = this.getLightFor(pos.south());
|
||||
int l = this.getLightFor(pos.north());
|
||||
|
||||
if(i > i1) {
|
||||
i1 = i;
|
||||
}
|
||||
|
||||
if(j > i1) {
|
||||
i1 = j;
|
||||
}
|
||||
|
||||
if(k > i1) {
|
||||
i1 = k;
|
||||
}
|
||||
|
||||
if(l > i1) {
|
||||
i1 = l;
|
||||
}
|
||||
|
||||
return i1;
|
||||
}
|
||||
else {
|
||||
Chunk chunk = this.getChunk(pos);
|
||||
return chunk.getLight(type, pos);
|
||||
return chunk.getLight(pos);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLightFor(LightType type, BlockPos pos, int lightValue) {
|
||||
public int getLightFor(BlockPos pos) {
|
||||
if(pos.getY() < -MAX_SIZE_Y) {
|
||||
pos = new BlockPos(pos.getX(), -MAX_SIZE_Y, pos.getZ());
|
||||
}
|
||||
|
||||
if(!isValid(pos)) {
|
||||
return 0;
|
||||
}
|
||||
else if(!this.isBlockLoaded(pos)) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
Chunk chunk = this.getChunk(pos);
|
||||
return chunk.getLight(pos);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlockLight(BlockPos pos, int lightValue) {
|
||||
if(isValid(pos)) {
|
||||
if(this.isBlockLoaded(pos)) {
|
||||
Chunk chunk = this.getChunk(pos);
|
||||
chunk.setLight(type, pos, lightValue);
|
||||
chunk.setLight(pos, lightValue);
|
||||
this.clientNotifyLight(pos);
|
||||
}
|
||||
}
|
||||
|
@ -408,8 +382,8 @@ public abstract class World implements IWorldAccess {
|
|||
|
||||
@Clientside
|
||||
public int getCombinedLight(BlockPos pos, int lightValue) {
|
||||
int i = this.getLightFromNeighborsFor(LightType.SKY, pos);
|
||||
int j = this.getLightFromNeighborsFor(LightType.BLOCK, pos);
|
||||
int i = this.dimension.hasSkyLight() ? getSkyLightFor(pos.getY()) : 0;
|
||||
int j = this.getBlockLightSum(pos);
|
||||
|
||||
if(j < lightValue) {
|
||||
j = lightValue;
|
||||
|
@ -1414,7 +1388,7 @@ public abstract class World implements IWorldAccess {
|
|||
int l1 = ExtMath.floord(entityplayer1.posX) + this.rand.zrange(11) - 5;
|
||||
int i2 = ExtMath.floord(entityplayer1.posY) + this.rand.zrange(11) - 5;
|
||||
int j2 = ExtMath.floord(entityplayer1.posZ) + this.rand.zrange(11) - 5;
|
||||
this.checkLight(new BlockPos(l1, i2, j2));
|
||||
this.checkBlockLight(new BlockPos(l1, i2, j2));
|
||||
}
|
||||
|
||||
return this.active;
|
||||
|
@ -1469,7 +1443,7 @@ public abstract class World implements IWorldAccess {
|
|||
return true;
|
||||
}
|
||||
else {
|
||||
if(pos.getY() >= -MAX_SIZE_Y && pos.getY() < MAX_SIZE_Y && this.getLightFor(LightType.BLOCK, pos) < 10) {
|
||||
if(pos.getY() >= -MAX_SIZE_Y && pos.getY() < MAX_SIZE_Y && this.getLightFor(pos) < 10) {
|
||||
Block block = this.getState(pos).getBlock();
|
||||
|
||||
if((block == Blocks.air || (allowLayers && block == Blocks.snow_layer))
|
||||
|
@ -1482,66 +1456,50 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean checkLight(BlockPos pos) {
|
||||
boolean flag = false;
|
||||
private int getRawBlockLight(BlockPos pos) {
|
||||
Block block = this.getState(pos).getBlock();
|
||||
int i = block.getLight();
|
||||
int j = block.getLightOpacity();
|
||||
|
||||
if(this.dimension.hasSkyLight()) {
|
||||
flag |= this.checkLightFor(LightType.SKY, pos);
|
||||
if(j >= 15 && block.getLight() > 0) {
|
||||
j = 1;
|
||||
}
|
||||
|
||||
flag = flag | this.checkLightFor(LightType.BLOCK, pos);
|
||||
return flag;
|
||||
}
|
||||
if(j < 1) {
|
||||
j = 1;
|
||||
}
|
||||
|
||||
private int getRawLight(BlockPos pos, LightType lightType) {
|
||||
if(lightType == LightType.SKY && this.canSeeSky(pos)) {
|
||||
return pos.getY() < 64 ? (pos.getY() < 0 ? 0 : pos.getY() / 4) : 15;
|
||||
if(j >= 15) {
|
||||
return 0;
|
||||
}
|
||||
else if(i >= 14) {
|
||||
return i;
|
||||
}
|
||||
else {
|
||||
Block block = this.getState(pos).getBlock();
|
||||
int i = lightType == LightType.SKY ? 0 : block.getLight();
|
||||
int j = block.getLightOpacity();
|
||||
for(Facing enumfacing : Facing.values()) {
|
||||
BlockPos blockpos = pos.offset(enumfacing);
|
||||
int k = this.getLightFor(blockpos) - j;
|
||||
|
||||
if(j >= 15 && block.getLight() > 0) {
|
||||
j = 1;
|
||||
}
|
||||
|
||||
if(j < 1) {
|
||||
j = 1;
|
||||
}
|
||||
|
||||
if(j >= 15) {
|
||||
return 0;
|
||||
}
|
||||
else if(i >= 14) {
|
||||
return i;
|
||||
}
|
||||
else {
|
||||
for(Facing enumfacing : Facing.values()) {
|
||||
BlockPos blockpos = pos.offset(enumfacing);
|
||||
int k = this.getLightFor(lightType, blockpos) - j;
|
||||
|
||||
if(k > i) {
|
||||
i = k;
|
||||
}
|
||||
|
||||
if(i >= 14) {
|
||||
return i;
|
||||
}
|
||||
if(k > i) {
|
||||
i = k;
|
||||
}
|
||||
|
||||
return i;
|
||||
if(i >= 14) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkLightFor(LightType type, BlockPos pos) {
|
||||
public boolean checkBlockLight(BlockPos pos) {
|
||||
if(!this.isAreaLoaded(pos, 17, false))
|
||||
return false;
|
||||
int done = 0;
|
||||
int cnt = 0;
|
||||
int light = this.getLightFor(type, pos);
|
||||
int raw = this.getRawLight(pos, type);
|
||||
int light = this.getLightFor(pos);
|
||||
int raw = this.getRawBlockLight(pos);
|
||||
int bx = pos.getX();
|
||||
int by = pos.getY();
|
||||
int bz = pos.getZ();
|
||||
|
@ -1559,10 +1517,10 @@ public abstract class World implements IWorldAccess {
|
|||
int z = (p >> 12 & 63) - 32 + bz;
|
||||
int s = p >> 18 & 15;
|
||||
BlockPos blk = new BlockPos(x, y, z);
|
||||
int l = this.getLightFor(type, blk);
|
||||
int l = this.getLightFor(blk);
|
||||
|
||||
if(l == s) {
|
||||
this.setLightFor(type, blk, 0);
|
||||
this.setBlockLight(blk, 0);
|
||||
|
||||
if(s > 0) {
|
||||
int dx = ExtMath.absi(x - bx);
|
||||
|
@ -1578,7 +1536,7 @@ public abstract class World implements IWorldAccess {
|
|||
int oz = z + dir.getFrontOffsetZ();
|
||||
bpos.set(ox, oy, oz);
|
||||
int op = Math.max(1, this.getState(bpos).getBlock().getLightOpacity());
|
||||
l = this.getLightFor(type, bpos);
|
||||
l = this.getLightFor(bpos);
|
||||
|
||||
if(l == s - op && cnt < this.lightUpdate.length) {
|
||||
this.lightUpdate[cnt++] = ox - bx + 32 | oy - by + 32 << 6 | oz - bz + 32 << 12 | s - op << 18;
|
||||
|
@ -1598,11 +1556,11 @@ public abstract class World implements IWorldAccess {
|
|||
int y = (p >> 6 & 63) - 32 + by;
|
||||
int z = (p >> 12 & 63) - 32 + bz;
|
||||
BlockPos blk = new BlockPos(x, y, z);
|
||||
int l = this.getLightFor(type, blk);
|
||||
int r = this.getRawLight(blk, type);
|
||||
int l = this.getLightFor(blk);
|
||||
int r = this.getRawBlockLight(blk);
|
||||
|
||||
if(r != l) {
|
||||
this.setLightFor(type, blk, r);
|
||||
this.setBlockLight(blk, r);
|
||||
|
||||
if(r > l) {
|
||||
int k6 = Math.abs(x - bx);
|
||||
|
@ -1611,27 +1569,27 @@ public abstract class World implements IWorldAccess {
|
|||
boolean flag = cnt < this.lightUpdate.length - 6;
|
||||
|
||||
if(k6 + l6 + i7 < 17 && flag) {
|
||||
if(this.getLightFor(type, blk.west()) < r) {
|
||||
if(this.getLightFor(blk.west()) < r) {
|
||||
this.lightUpdate[cnt++] = x - 1 - bx + 32 + (y - by + 32 << 6) + (z - bz + 32 << 12);
|
||||
}
|
||||
|
||||
if(this.getLightFor(type, blk.east()) < r) {
|
||||
if(this.getLightFor(blk.east()) < r) {
|
||||
this.lightUpdate[cnt++] = x + 1 - bx + 32 + (y - by + 32 << 6) + (z - bz + 32 << 12);
|
||||
}
|
||||
|
||||
if(this.getLightFor(type, blk.down()) < r) {
|
||||
if(this.getLightFor(blk.down()) < r) {
|
||||
this.lightUpdate[cnt++] = x - bx + 32 + (y - 1 - by + 32 << 6) + (z - bz + 32 << 12);
|
||||
}
|
||||
|
||||
if(this.getLightFor(type, blk.up()) < r) {
|
||||
if(this.getLightFor(blk.up()) < r) {
|
||||
this.lightUpdate[cnt++] = x - bx + 32 + (y + 1 - by + 32 << 6) + (z - bz + 32 << 12);
|
||||
}
|
||||
|
||||
if(this.getLightFor(type, blk.north()) < r) {
|
||||
if(this.getLightFor(blk.north()) < r) {
|
||||
this.lightUpdate[cnt++] = x - bx + 32 + (y - by + 32 << 6) + (z - 1 - bz + 32 << 12);
|
||||
}
|
||||
|
||||
if(this.getLightFor(type, blk.south()) < r) {
|
||||
if(this.getLightFor(blk.south()) < r) {
|
||||
this.lightUpdate[cnt++] = x - bx + 32 + (y - by + 32 << 6) + (z + 1 - bz + 32 << 12);
|
||||
}
|
||||
}
|
||||
|
@ -1864,6 +1822,11 @@ public abstract class World implements IWorldAccess {
|
|||
double zm = (Math.abs(z) - r) / 16384.0;
|
||||
return ExtMath.clampd(Math.max(Math.max(xm, zm), ym), 0.0, 1.0);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public static int getSkyLightFor(int y) {
|
||||
return y < 0 ? 0 : (y < 64 ? y / 4 : 15);
|
||||
}
|
||||
|
||||
public double getGravity(double x, double y, double z) {
|
||||
double gravity = this.gravity * (1.0 - this.getSpaceFactor(x, y, z));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue