From aa772848ed82fec6a9715de912356a9dfe910edc Mon Sep 17 00:00:00 2001 From: Sen Date: Mon, 19 May 2025 15:52:19 +0200 Subject: [PATCH] remove sky light --- client/src/client/Client.java | 5 +- .../client/renderer/RegionRenderCache.java | 26 +- client/src/client/world/EmptyChunk.java | 10 +- client/src/client/world/WorldClient.java | 2 +- .../common/block/BlockDaylightDetector.java | 3 +- common/src/common/block/BlockIce.java | 3 +- common/src/common/block/BlockSnow.java | 3 +- common/src/common/block/BlockSnowBlock.java | 3 +- .../src/common/packet/SPacketChunkData.java | 19 +- .../common/packet/SPacketMapChunkBulk.java | 8 +- common/src/common/world/BlockArray.java | 21 +- common/src/common/world/Chunk.java | 414 +----------------- common/src/common/world/LightType.java | 11 - common/src/common/world/World.java | 216 ++++----- server/src/server/world/Region.java | 22 +- server/src/server/world/WorldServer.java | 13 +- server/src/server/worldgen/FeatureLakes.java | 3 +- 17 files changed, 155 insertions(+), 627 deletions(-) delete mode 100755 common/src/common/world/LightType.java diff --git a/client/src/client/Client.java b/client/src/client/Client.java index 733137d..ba5d0d2 100755 --- a/client/src/client/Client.java +++ b/client/src/client/Client.java @@ -157,7 +157,6 @@ import common.util.LazyLoadBase; import common.util.Util; import common.util.HitPosition.ObjectType; import common.world.Chunk; -import common.world.LightType; import common.world.State; import common.world.World; import io.netty.bootstrap.Bootstrap; @@ -1739,8 +1738,8 @@ public class Client implements IThreadListener { bline = "Biom: " + biome.display + " (" + biome.id + ")" + /* (this.debugHideInfo ? "" : */ (", D: " + TextColor.stripCodes(this.world.dimension.getFormattedName(false)) + " (" + this.world.dimension.getDimensionId() + ")"); - lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + chunk.getLight(LightType.SKY, blockpos) + " Himmel, " - + chunk.getLight(LightType.BLOCK, blockpos) + " Blöcke, " + String.format( + lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + + chunk.getLight(blockpos) + " Blöcke, " + String.format( "%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: " + String.format("%.3f", this.world.getCelestialAngle(1.0f)); } diff --git a/client/src/client/renderer/RegionRenderCache.java b/client/src/client/renderer/RegionRenderCache.java index 635a77a..12fab08 100755 --- a/client/src/client/renderer/RegionRenderCache.java +++ b/client/src/client/renderer/RegionRenderCache.java @@ -11,7 +11,6 @@ import common.util.Vec3i; import common.world.Chunk; import common.world.ChunkCache; import common.world.IWorldAccess; -import common.world.LightType; import common.world.State; import common.world.World; @@ -114,15 +113,14 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess public int getLight(BlockPos pos, int lightValue) { - int i = this.getLightForExt(LightType.SKY, pos); - int j = this.getLightForExt(LightType.BLOCK, pos); + int j = this.getLightForExt(pos); if (j < lightValue) { j = lightValue; } - return i << 20 | j << 4; + return 15 << 20 | j << 4; } public Biome getBiomeGenForCoords(BlockPos pos) @@ -130,13 +128,9 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess return this.worldObj.getBiomeGenForCoords(pos); } - private int getLightForExt(LightType p_175629_1_, BlockPos pos) + private int getLightForExt(BlockPos pos) { - if (p_175629_1_ == LightType.SKY && this.worldObj.dimension.hasNoLight()) - { - return 0; - } - else if (pos.getY() >= 0 && pos.getY() < 512) + if (pos.getY() >= 0 && pos.getY() < 512) { if (this.getState(pos).getBlock().getSumBrightness()) { @@ -144,7 +138,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess for (Facing enumfacing : Facing.values()) { - int k = this.getLightFor(p_175629_1_, pos.offset(enumfacing)); + int k = this.getLightFor(pos.offset(enumfacing)); if (k > l) { @@ -163,12 +157,12 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess { int i = (pos.getX() >> 4) - this.chunkX; int j = (pos.getZ() >> 4) - this.chunkZ; - return this.chunkArray[i][j].getLight(p_175629_1_, pos); + return this.chunkArray[i][j].getLight(pos); } } else { - return p_175629_1_.defValue; + return 0; } } @@ -181,17 +175,17 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess // return this.getBlockState(pos).getBlock().getMaterial() == Material.air; // } - public int getLightFor(LightType p_175628_1_, BlockPos pos) + public int getLightFor(BlockPos pos) { if (pos.getY() >= 0 && pos.getY() < 512) { int i = (pos.getX() >> 4) - this.chunkX; int j = (pos.getZ() >> 4) - this.chunkZ; - return this.chunkArray[i][j].getLight(p_175628_1_, pos); + return this.chunkArray[i][j].getLight(pos); } else { - return p_175628_1_.defValue; + return 0; } } diff --git a/client/src/client/world/EmptyChunk.java b/client/src/client/world/EmptyChunk.java index 190c2d7..63c8b56 100755 --- a/client/src/client/world/EmptyChunk.java +++ b/client/src/client/world/EmptyChunk.java @@ -10,7 +10,6 @@ import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.BoundingBox; import common.world.Chunk; -import common.world.LightType; public class EmptyChunk extends Chunk { public EmptyChunk(WorldClient world) { @@ -24,9 +23,6 @@ public class EmptyChunk extends Chunk { public void genHeights() { } - public void genSkyLight() { - } - public Block getBlock(BlockPos pos) { return Blocks.air; } @@ -39,11 +35,11 @@ public class EmptyChunk extends Chunk { return 0; } - public int getLight(LightType type, BlockPos pos) { - return type.defValue; + public int getLight(BlockPos pos) { + return 0; } - public void setLight(LightType type, BlockPos pos, int value) { + public void setLight(BlockPos pos, int value) { } public int getLightSub(BlockPos pos, int amount) { diff --git a/client/src/client/world/WorldClient.java b/client/src/client/world/WorldClient.java index 7e8f142..5986b9b 100755 --- a/client/src/client/world/WorldClient.java +++ b/client/src/client/world/WorldClient.java @@ -85,7 +85,7 @@ public class WorldClient extends AWorldClient long time = System.currentTimeMillis(); for (Chunk chunk : this.chunkListing) { - chunk.update(System.currentTimeMillis() - time > 5L); + chunk.update(); } if (System.currentTimeMillis() - time > 100L) { diff --git a/common/src/common/block/BlockDaylightDetector.java b/common/src/common/block/BlockDaylightDetector.java index f213c1f..735a4bb 100755 --- a/common/src/common/block/BlockDaylightDetector.java +++ b/common/src/common/block/BlockDaylightDetector.java @@ -21,7 +21,6 @@ import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; import common.world.IWorldAccess; -import common.world.LightType; import common.world.State; import common.world.World; import common.world.AWorldServer; @@ -58,7 +57,7 @@ public class BlockDaylightDetector extends BlockContainer if (!worldIn.dimension.hasNoLight()) { State iblockstate = worldIn.getState(pos); - int i = worldIn.getLightFor(LightType.SKY, pos) - worldIn.getSkylightSubtracted(); + int i = 15 - worldIn.getSkylightSubtracted(); float f = worldIn.getCelestialAngleRadians(1.0F); float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F); f = f + (f1 - f) * 0.2F; diff --git a/common/src/common/block/BlockIce.java b/common/src/common/block/BlockIce.java index a1e5981..aa42cc3 100755 --- a/common/src/common/block/BlockIce.java +++ b/common/src/common/block/BlockIce.java @@ -11,7 +11,6 @@ import common.model.BlockLayer; import common.rng.Random; import common.tileentity.TileEntity; import common.util.BlockPos; -import common.world.LightType; import common.world.State; import common.world.World; import common.world.AWorldServer; @@ -73,7 +72,7 @@ public class BlockIce extends BlockBreakable public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - if (Config.iceMelt && ((worldIn.getLightFor(LightType.BLOCK, pos) > 11 - this.getLightOpacity()) || !worldIn.canFreezeAt(pos))) + if (Config.iceMelt && ((worldIn.getLightFor(pos) > 11 - this.getLightOpacity()) || !worldIn.canFreezeAt(pos))) { if (worldIn.doesWaterVaporize(pos)) { diff --git a/common/src/common/block/BlockSnow.java b/common/src/common/block/BlockSnow.java index 3647804..02c193a 100755 --- a/common/src/common/block/BlockSnow.java +++ b/common/src/common/block/BlockSnow.java @@ -20,7 +20,6 @@ import common.util.BoundingBox; import common.util.Facing; import common.world.IBlockAccess; import common.world.IWorldAccess; -import common.world.LightType; import common.world.State; import common.world.World; import common.world.AWorldServer; @@ -137,7 +136,7 @@ public class BlockSnow extends Block public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - if (Config.snowMelt && ((worldIn.getLightFor(LightType.BLOCK, pos) > 11) || !worldIn.canFreezeAt(pos))) + if (Config.snowMelt && ((worldIn.getLightFor(pos) > 11) || !worldIn.canFreezeAt(pos))) { this.dropBlockAsItem(worldIn, pos, worldIn.getState(pos), 0); worldIn.setBlockToAir(pos); diff --git a/common/src/common/block/BlockSnowBlock.java b/common/src/common/block/BlockSnowBlock.java index 0e4a60e..da6fd2f 100755 --- a/common/src/common/block/BlockSnowBlock.java +++ b/common/src/common/block/BlockSnowBlock.java @@ -7,7 +7,6 @@ import common.item.Item; import common.material.Material; import common.rng.Random; import common.util.BlockPos; -import common.world.LightType; import common.world.State; import common.world.AWorldServer; @@ -38,7 +37,7 @@ public class BlockSnowBlock extends Block public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - if (Config.snowFullMelt && worldIn.getLightFor(LightType.BLOCK, pos) > 11) + if (Config.snowFullMelt && worldIn.getLightFor(pos) > 11) { this.dropBlockAsItem(worldIn, pos, worldIn.getState(pos), 0); worldIn.setBlockToAir(pos); diff --git a/common/src/common/packet/SPacketChunkData.java b/common/src/common/packet/SPacketChunkData.java index 1996522..6332281 100755 --- a/common/src/common/packet/SPacketChunkData.java +++ b/common/src/common/packet/SPacketChunkData.java @@ -26,7 +26,7 @@ public class SPacketChunkData implements Packet this.chunkX = chunkIn.xPos; this.chunkZ = chunkIn.zPos; this.biomes = biomes; - this.extractedData = getExtractedData(chunkIn, biomes, !chunkIn.getWorld().dimension.hasNoLight(), segUpdate); + this.extractedData = getExtractedData(chunkIn, biomes, segUpdate); } /** @@ -67,16 +67,15 @@ public class SPacketChunkData implements Packet return this.extractedData.data; } - protected static int getSize(int segments, boolean overworld, boolean biomes) + protected static int getSize(int segments, boolean biomes) { int i = segments * 2 * 16 * 16 * 16; int j = segments * 16 * 16 * 16 / 2; - int k = overworld ? segments * 16 * 16 * 16 / 2 : 0; int l = biomes ? 256 : 0; - return i + j + k + l; + return i + j + l; } - public static SPacketChunkData.Extracted getExtractedData(Chunk chunk, boolean biomes, boolean overworld, int segUpdate) + public static SPacketChunkData.Extracted getExtractedData(Chunk chunk, boolean biomes, int segUpdate) { BlockArray[] aextendedblockstorage = chunk.getStorage(); SPacketChunkData.Extracted s21packetchunkdata$extracted = new SPacketChunkData.Extracted(); @@ -93,7 +92,7 @@ public class SPacketChunkData implements Packet } } - s21packetchunkdata$extracted.data = new byte[getSize(Integer.bitCount(s21packetchunkdata$extracted.dataSize), overworld, biomes)]; + s21packetchunkdata$extracted.data = new byte[getSize(Integer.bitCount(s21packetchunkdata$extracted.dataSize), biomes)]; int j = 0; for (BlockArray extendedblockstorage1 : list) @@ -112,14 +111,6 @@ public class SPacketChunkData implements Packet j = copyTo(extendedblockstorage2.getBlocklight().getData(), s21packetchunkdata$extracted.data, j); } - if (overworld) - { - for (BlockArray extendedblockstorage3 : list) - { - j = copyTo(extendedblockstorage3.getSkylight().getData(), s21packetchunkdata$extracted.data, j); - } - } - if (biomes) { copyTo(chunk.getBiomes(), s21packetchunkdata$extracted.data, j); diff --git a/common/src/common/packet/SPacketMapChunkBulk.java b/common/src/common/packet/SPacketMapChunkBulk.java index aebfac5..09172e0 100755 --- a/common/src/common/packet/SPacketMapChunkBulk.java +++ b/common/src/common/packet/SPacketMapChunkBulk.java @@ -13,7 +13,6 @@ public class SPacketMapChunkBulk implements Packet private int[] xPositions; private int[] zPositions; private SPacketChunkData.Extracted[] chunksData; - private boolean isOverworld; public SPacketMapChunkBulk() { @@ -25,12 +24,11 @@ public class SPacketMapChunkBulk implements Packet this.xPositions = new int[i]; this.zPositions = new int[i]; this.chunksData = new SPacketChunkData.Extracted[i]; - this.isOverworld = !((Chunk)chunks.get(0)).getWorld().dimension.hasNoLight(); for (int j = 0; j < i; ++j) { Chunk chunk = (Chunk)chunks.get(j); - SPacketChunkData.Extracted s21packetchunkdata$extracted = SPacketChunkData.getExtractedData(chunk, true, this.isOverworld, 0xffffffff); + SPacketChunkData.Extracted s21packetchunkdata$extracted = SPacketChunkData.getExtractedData(chunk, true, 0xffffffff); this.xPositions[j] = chunk.xPos; this.zPositions[j] = chunk.zPos; this.chunksData[j] = s21packetchunkdata$extracted; @@ -42,7 +40,6 @@ public class SPacketMapChunkBulk implements Packet */ public void readPacketData(PacketBuffer buf) throws IOException { - this.isOverworld = buf.readBoolean(); int i = buf.readVarIntFromBuffer(); this.xPositions = new int[i]; this.zPositions = new int[i]; @@ -54,7 +51,7 @@ public class SPacketMapChunkBulk implements Packet this.zPositions[j] = buf.readInt(); this.chunksData[j] = new SPacketChunkData.Extracted(); this.chunksData[j].dataSize = buf.readInt(); - this.chunksData[j].data = new byte[SPacketChunkData.getSize(Integer.bitCount(this.chunksData[j].dataSize), this.isOverworld, true)]; + this.chunksData[j].data = new byte[SPacketChunkData.getSize(Integer.bitCount(this.chunksData[j].dataSize), true)]; } for (int k = 0; k < i; ++k) @@ -68,7 +65,6 @@ public class SPacketMapChunkBulk implements Packet */ public void writePacketData(PacketBuffer buf) throws IOException { - buf.writeBoolean(this.isOverworld); buf.writeVarIntToBuffer(this.chunksData.length); for (int i = 0; i < this.xPositions.length; ++i) diff --git a/common/src/common/world/BlockArray.java b/common/src/common/world/BlockArray.java index 44fba70..557e89d 100755 --- a/common/src/common/world/BlockArray.java +++ b/common/src/common/world/BlockArray.java @@ -11,14 +11,11 @@ public class BlockArray { private int ticked; private char[] data; private NibbleArray blocklight; - private NibbleArray skylight; - public BlockArray(int y, boolean sky) { + public BlockArray(int y) { this.yBase = y; this.data = new char[4096]; this.blocklight = new NibbleArray(); - if(sky) - this.skylight = new NibbleArray(); } public State get(int x, int y, int z) { @@ -64,14 +61,6 @@ public class BlockArray { return this.yBase; } - public void setSky(int x, int y, int z, int value) { - this.skylight.set(x, y, z, value); - } - - public int getSky(int x, int y, int z) { - return this.skylight.get(x, y, z); - } - public void setLight(int x, int y, int z, int value) { this.blocklight.set(x, y, z, value); } @@ -105,10 +94,6 @@ public class BlockArray { return this.blocklight; } - public NibbleArray getSkylight() { - return this.skylight; - } - public void setData(char[] data) { this.data = data; } @@ -116,8 +101,4 @@ public class BlockArray { public void setBlocklight(NibbleArray data) { this.blocklight = data; } - - public void setSkylight(NibbleArray data) { - this.skylight = data; - } } diff --git a/common/src/common/world/Chunk.java b/common/src/common/world/Chunk.java index 6a5fdf7..8bd4b7e 100755 --- a/common/src/common/world/Chunk.java +++ b/common/src/common/world/Chunk.java @@ -34,16 +34,13 @@ public class Chunk { private final BlockArray[] blocks = new BlockArray[32]; private final byte[] biomes = new byte[256]; private final int[] precHeight = new int[256]; - private final boolean[] updateSky = new boolean[256]; private final int[] height = new int[256]; private final Map tiles = Maps.newHashMap(); private final ClassInheritanceMultiMap[] entities = new ClassInheritanceMultiMap[32]; private final ConcurrentLinkedQueue tileQueue = new ConcurrentLinkedQueue(); private boolean loaded; - private boolean gapUpdate; private boolean populated; - private boolean lightInit; private boolean updated; private boolean modified; private boolean hasEntity; @@ -65,7 +62,6 @@ public class Chunk { public Chunk(World world, short[] data, int height, State base, State ceil, Random rand, Biome[] biomes, int x, int z) { this(world, x, z); - boolean sky = !world.dimension.hasNoLight(); for(int bx = 0; bx < 16; ++bx) { for(int bz = 0; bz < 16; ++bz) { for(int by = 0; by < height; ++by) { @@ -73,7 +69,7 @@ public class Chunk { if(state != null && state.getBlock().getMaterial() != Material.air) { int y = by >> 4; if(this.blocks[y] == null) - this.blocks[y] = new BlockArray(y << 4, sky); + this.blocks[y] = new BlockArray(y << 4); this.blocks[y].set(bx, by & 15, bz, state); } } @@ -81,7 +77,7 @@ public class Chunk { } if(base != null) { if(this.blocks[0] == null) - this.blocks[0] = new BlockArray(0, sky); + this.blocks[0] = new BlockArray(0); for(int bx = 0; bx < 16; ++bx) { for(int bz = 0; bz < 16; ++bz) { for(int by = 0; by < 5; ++by) { @@ -94,10 +90,10 @@ public class Chunk { if(ceil != null) { int y = (height - 1) >> 4; if(this.blocks[y] == null) - this.blocks[y] = new BlockArray(y << 4, sky); + this.blocks[y] = new BlockArray(y << 4); y = (height - 5) >> 4; if(this.blocks[y] == null) - this.blocks[y] = new BlockArray(y << 4, sky); + this.blocks[y] = new BlockArray(y << 4); for(int bx = 0; bx < 16; ++bx) { for(int bz = 0; bz < 16; ++bz) { for(int by = height - 1; by >= height - 5; --by) { @@ -110,9 +106,7 @@ public class Chunk { for(int n = 0; n < this.biomes.length; ++n) { this.biomes[n] = (byte)biomes[n].id; } - if(ceil == null) - this.genSkyLight(); - else + if(ceil != null) this.resetRelight(); } @@ -164,215 +158,7 @@ public class Chunk { this.modified = true; } - - public void genSkyLight() { - int h = this.getTopSegment(); - this.minHeight = Integer.MAX_VALUE; - - for(int x = 0; x < 16; ++x) { - for(int z = 0; z < 16; ++z) { - this.precHeight[x + (z << 4)] = -999; - - for(int y = h + 16; y > 0; --y) { - if(this.getOpacity(x, y - 1, z) != 0) { - this.height[z << 4 | x] = y; - - if(y < this.minHeight) { - this.minHeight = y; - } - - break; - } - } - - if(!this.world.dimension.hasNoLight()) { - int l = 15; - int y = h + 16 - 1; - - while(true) { - int b = this.getOpacity(x, y, z); - - if(b == 0 && l != 15) { - b = 1; - } - - l -= b; - - if(l > 0) { - BlockArray stor = this.blocks[y >> 4]; - - if(stor != null) { - stor.setSky(x, y & 15, z, l); - this.world.notifyLightSet(new BlockPos((this.xPos << 4) + x, y, (this.zPos << 4) + z)); - } - } - - --y; - - if(y <= 0 || l <= 0) { - break; - } - } - } - } - } - - this.modified = true; - } - - private void propagateOcclusion(int x, int z) { - this.updateSky[x + z * 16] = true; - this.gapUpdate = true; - } - - private void recheckGaps(boolean single) { -// this.world.profiler.start("recheckGaps"); - - if(this.world.isAreaLoaded(new BlockPos(this.xPos * 16 + 8, 0, this.zPos * 16 + 8), 16)) { - for(int x = 0; x < 16; ++x) { - for(int z = 0; z < 16; ++z) { - if(this.updateSky[x + z * 16]) { - this.updateSky[x + z * 16] = false; - int h = this.getHeight(x, z); - int cx = this.xPos * 16 + x; - int cz = this.zPos * 16 + z; - int max = Integer.MAX_VALUE; - - for(Facing face : Facing.Plane.HORIZONTAL) { - max = Math.min(max, this.world.getChunksLowestHorizon(cx + face.getFrontOffsetX(), - cz + face.getFrontOffsetZ())); - } - - this.checkNeighbor(cx, cz, max); - - for(Facing face : Facing.Plane.HORIZONTAL) { - this.checkNeighbor(cx + face.getFrontOffsetX(), cz + face.getFrontOffsetZ(), h); - } - - if(single) { -// this.world.profiler.end(); - return; - } - } - } - } - - this.gapUpdate = false; - } - -// this.world.profiler.end(); - } - - private void checkNeighbor(int x, int z, int max) { - int h = this.world.getHeight(new BlockPos(x, 0, z)).getY(); - - if(h > max) { - this.updateNeighbor(x, z, max, h + 1); - } - else if(h < max) { - this.updateNeighbor(x, z, h, max + 1); - } - } - - private void updateNeighbor(int x, int z, int bottom, int top) { - if(top > bottom && this.world.isAreaLoaded(new BlockPos(x, 0, z), 16)) { - for(int y = bottom; y < top; ++y) { - this.world.checkLightFor(LightType.SKY, new BlockPos(x, y, z)); - } - - this.modified = true; - } - } - - private void relightBlock(int x, int y, int z) { - int h = this.height[z << 4 | x] & 511; - int cy = h; - - if(y > h) { - cy = y; - } - - while(cy > 0 && this.getOpacity(x, cy - 1, z) == 0) { - --cy; - } - - if(cy != h) { - this.world.markBlocksDirtyVertical(x + this.xPos * 16, z + this.zPos * 16, cy, h); - this.height[z << 4 | x] = cy; - int cx = this.xPos * 16 + x; - int cz = this.zPos * 16 + z; - - if(!this.world.dimension.hasNoLight()) { - if(cy < h) { - for(int n = cy; n < h; ++n) { - BlockArray stor = this.blocks[n >> 4]; - - if(stor != null) { - stor.setSky(x, n & 15, z, 15); - this.world.notifyLightSet(new BlockPos((this.xPos << 4) + x, n, (this.zPos << 4) + z)); - } - } - } - else { - for(int n = h; n < cy; ++n) { - BlockArray stor = this.blocks[n >> 4]; - - if(stor != null) { - stor.setSky(x, n & 15, z, 0); - this.world.notifyLightSet(new BlockPos((this.xPos << 4) + x, n, (this.zPos << 4) + z)); - } - } - } - - int l = 15; - - while(cy > 0 && l > 0) { - --cy; - int b = this.getOpacity(x, cy, z); - - if(b == 0) { - b = 1; - } - - l -= b; - - if(l < 0) { - l = 0; - } - - BlockArray stor = this.blocks[cy >> 4]; - - if(stor != null) { - stor.setSky(x, cy & 15, z, l); - } - } - } - - int sh = this.height[z << 4 | x]; - int sy = h; - int ey = sh; - - if(sh < h) { - sy = sh; - ey = h; - } - - if(sh < this.minHeight) { - this.minHeight = sh; - } - - if(!this.world.dimension.hasNoLight()) { - for(Facing face : Facing.Plane.HORIZONTAL) { - this.updateNeighbor(cx + face.getFrontOffsetX(), cz + face.getFrontOffsetZ(), sy, ey); - } - - this.updateNeighbor(cx, cz, sy, ey); - } - - this.modified = true; - } - } - + public int getOpacity(BlockPos pos) { return this.getBlock(pos).getLightOpacity(); } @@ -467,15 +253,13 @@ public class Chunk { Block block = state.getBlock(); Block oldb = old.getBlock(); BlockArray stor = this.blocks[y >> 4]; - boolean up = false; if(stor == null) { if(block == Blocks.air) { return null; } - stor = this.blocks[y >> 4] = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight()); - up = y >= h; + stor = this.blocks[y >> 4] = new BlockArray(y >> 4 << 4); } stor.set(x, y & 15, z, state); @@ -493,27 +277,6 @@ public class Chunk { return null; } else { - if(up) { - this.genSkyLight(); - } - else { - int b = block.getLightOpacity(); - int ob = oldb.getLightOpacity(); - - if(b > 0) { - if(y >= h) { - this.relightBlock(x, y + 1, z); - } - } - else if(y == h - 1) { - this.relightBlock(x, y, z); - } - - if(b != ob && (b < ob || this.getLight(LightType.SKY, pos) > 0 || this.getLight(LightType.BLOCK, pos) > 0)) { - this.propagateOcclusion(x, z); - } - } - if(oldb instanceof ITileEntityProvider) { TileEntity tile = this.getTileEntity(pos, TileEntity.EnumCreateEntityType.CHECK); @@ -545,37 +308,27 @@ public 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.blocks[y >> 4]; - return stor == null ? (this.canSeeSky(pos) ? type.defValue : 0) - : (type == LightType.SKY ? (this.world.dimension.hasNoLight() ? 0 : stor.getSky(x, y & 15, z)) - : (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; BlockArray stor = this.blocks[y >> 4]; if(stor == null) { - stor = this.blocks[y >> 4] = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight()); - this.genSkyLight(); + stor = this.blocks[y >> 4] = new BlockArray(y >> 4 << 4); } this.modified = true; - if(type == LightType.SKY) { - if(!this.world.dimension.hasNoLight()) { - stor.setSky(x, y & 15, z, value); - } - } - else 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) { @@ -585,11 +338,11 @@ public class Chunk { BlockArray stor = this.blocks[y >> 4]; if(stor == null) { - return !this.world.dimension.hasNoLight() && amount < LightType.SKY.defValue - ? LightType.SKY.defValue - amount : 0; + return !this.world.dimension.hasNoLight() && amount < 15 + ? 15 - amount : 0; } else { - int l = this.world.dimension.hasNoLight() ? 0 : stor.getSky(x, y & 15, z); + int l = this.world.dimension.hasNoLight() ? 0 : 15; l = l - amount; int b = stor.getLight(x, y & 15, z); @@ -834,17 +587,9 @@ public class Chunk { return new BlockPos(pos.getX(), this.precHeight[o], pos.getZ()); } - public void update(boolean noGaps) { - if(this.gapUpdate && !this.world.dimension.hasNoLight() && !noGaps) { - this.recheckGaps(this.world.client); - } - + public void update() { this.updated = true; - - if(!this.lightInit && this.populated) { - this.checkLight(); - } - + while(!this.tileQueue.isEmpty()) { BlockPos pos = (BlockPos)this.tileQueue.poll(); @@ -857,7 +602,7 @@ public class Chunk { } public boolean isPopulated() { - return this.updated && this.populated && this.lightInit; + return this.updated && this.populated; } public ChunkPos getPos() { @@ -898,12 +643,11 @@ public class Chunk { public void setData(byte[] data, int update, boolean biomes) { int pos = 0; - boolean sky = !this.world.dimension.hasNoLight(); for(int n = 0; n < this.blocks.length; ++n) { if((update & 1 << n) != 0) { if(this.blocks[n] == null) { - this.blocks[n] = new BlockArray(n << 4, sky); + this.blocks[n] = new BlockArray(n << 4); } char[] blocks = this.blocks[n].getData(); @@ -926,16 +670,6 @@ public class Chunk { } } - if(sky) { - for(int n = 0; n < this.blocks.length; ++n) { - if((update & 1 << n) != 0 && this.blocks[n] != null) { - NibbleArray slight = this.blocks[n].getSkylight(); - System.arraycopy(data, pos, slight.getData(), 0, slight.getData().length); - pos += slight.getData().length; - } - } - } - if(biomes) { System.arraycopy(data, pos, this.biomes, 0, this.biomes.length); // int unk = pos + this.biomes.length; @@ -947,7 +681,6 @@ public class Chunk { } } - this.lightInit = true; this.populated = true; this.genHeights(); @@ -1027,106 +760,7 @@ public class Chunk { } } } - - public void checkLight() { - this.populated = true; - this.lightInit = true; - BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4); - - if(!this.world.dimension.hasNoLight()) { - 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()); - } - - this.setSkyDirty(); - } - } - else { - this.lightInit = false; - } - } - } - - private void setSkyDirty() { - for(int n = 0; n < this.updateSky.length; ++n) { - this.updateSky[n] = true; - } - - this.recheckGaps(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.getTopSegment(); - 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 > 0 && !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 > 0; --y) { - pos.set(pos.getX(), y, pos.getZ()); - - if(this.getBlock(pos).getLightValue() > 0) { - this.world.checkLight(pos); - } - } - - return true; - } - + public boolean isLoaded() { return this.loaded; } @@ -1170,14 +804,6 @@ public class Chunk { this.populated = populated; } - public boolean isLightPopulated() { - return this.lightInit; - } - - public void setLightPopulated(boolean populated) { - this.lightInit = populated; - } - public void setModified(boolean modified) { this.modified = modified; } diff --git a/common/src/common/world/LightType.java b/common/src/common/world/LightType.java deleted file mode 100755 index e1bfdbb..0000000 --- a/common/src/common/world/LightType.java +++ /dev/null @@ -1,11 +0,0 @@ -package common.world; - -public enum LightType { - SKY(15), BLOCK(0); - - public final int defValue; - - private LightType(int def) { - this.defValue = def; - } -} diff --git a/common/src/common/world/World.java b/common/src/common/world/World.java index 519dc36..619868a 100755 --- a/common/src/common/world/World.java +++ b/common/src/common/world/World.java @@ -282,13 +282,7 @@ public abstract class World implements IWorldAccess { z2 = x2; x2 = i; } - - if(!this.dimension.hasNoLight()) { - for(int j = x2; j <= z2; ++j) { - this.checkLightFor(LightType.SKY, new BlockPos(x1, j, z1)); - } - } - + this.markBlockRangeForRenderUpdate(x1, x2, z1, x1, z2, z1); } @@ -437,89 +431,83 @@ public abstract class World implements IWorldAccess { } } - public int getLightFromNeighborsFor(LightType type, BlockPos pos) { - if(this.dimension.hasNoLight() && type == LightType.SKY) { - return 0; - } - else { - if(pos.getY() < 0) { - pos = new BlockPos(pos.getX(), 0, 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 getLightFromNeighborsFor(BlockPos pos) { if(pos.getY() < 0) { pos = new BlockPos(pos.getX(), 0, 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() < 0) { + pos = new BlockPos(pos.getX(), 0, 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 setLightFor(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.notifyLightSet(pos); } } } public int getCombinedLight(BlockPos pos, int lightValue) { - int i = this.getLightFromNeighborsFor(LightType.SKY, pos); - int j = this.getLightFromNeighborsFor(LightType.BLOCK, pos); + int j = this.getLightFromNeighborsFor(pos); if(j < lightValue) { j = lightValue; } - return i << 20 | j << 4; + return 15 << 20 | j << 4; } public float getLightBrightness(BlockPos pos) { @@ -1593,7 +1581,7 @@ public abstract class World implements IWorldAccess { return true; } else { - if(pos.getY() >= 0 && pos.getY() < 512 && this.getLightFor(LightType.BLOCK, pos) < 10) { + if(pos.getY() >= 0 && pos.getY() < 512 && this.getLightFor(pos) < 10) { Block block = this.getState(pos).getBlock(); if((block.getMaterial() == Material.air || (allowLayers && block == Blocks.snow_layer)) @@ -1607,59 +1595,47 @@ public abstract class World implements IWorldAccess { } public boolean checkLight(BlockPos pos) { - boolean flag = false; - - if(!this.dimension.hasNoLight()) { - flag |= this.checkLightFor(LightType.SKY, pos); - } - - flag = flag | this.checkLightFor(LightType.BLOCK, pos); - return flag; + return this.checkLightFor(pos); } - private int getRawLight(BlockPos pos, LightType lightType) { - if(lightType == LightType.SKY && this.canSeeSky(pos)) { - return 15; + private int getRawLight(BlockPos pos) { + Block block = this.getState(pos).getBlock(); + int i = block.getLightValue(); + int j = block.getLightOpacity(); + + if(j >= 15 && block.getLightValue() > 0) { + j = 1; + } + + if(j < 1) { + j = 1; + } + + 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.getLightValue(); - int j = block.getLightOpacity(); + for(Facing enumfacing : Facing.values()) { + BlockPos blockpos = pos.offset(enumfacing); + int k = this.getLightFor(blockpos) - j; - if(j >= 15 && block.getLightValue() > 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 lightType, BlockPos pos) { + public boolean checkLightFor(BlockPos pos) { if(!this.isAreaLoaded(pos, 17, false)) { return false; } @@ -1667,8 +1643,8 @@ public abstract class World implements IWorldAccess { int i = 0; int j = 0; // this.profiler.start("getBrightness"); - int k = this.getLightFor(lightType, pos); - int l = this.getRawLight(pos, lightType); + int k = this.getLightFor(pos); + int l = this.getRawLight(pos); int i1 = pos.getX(); int j1 = pos.getY(); int k1 = pos.getZ(); @@ -1686,10 +1662,10 @@ public abstract class World implements IWorldAccess { int k2 = (l1 >> 12 & 63) - 32 + k1; int l2 = l1 >> 18 & 15; BlockPos blockpos = new BlockPos(i2, j2, k2); - int i3 = this.getLightFor(lightType, blockpos); + int i3 = this.getLightFor(blockpos); if(i3 == l2) { - this.setLightFor(lightType, blockpos, 0); + this.setLightFor(blockpos, 0); if(l2 > 0) { int j3 = ExtMath.absi(i2 - i1); @@ -1705,7 +1681,7 @@ public abstract class World implements IWorldAccess { int k4 = k2 + enumfacing.getFrontOffsetZ(); blockpos$mutableblockpos.set(i4, j4, k4); int l4 = Math.max(1, this.getState(blockpos$mutableblockpos).getBlock().getLightOpacity()); - i3 = this.getLightFor(lightType, blockpos$mutableblockpos); + i3 = this.getLightFor(blockpos$mutableblockpos); if(i3 == l2 - l4 && j < this.lightUpdate.length) { this.lightUpdate[j++] = i4 - i1 + 32 | j4 - j1 + 32 << 6 | k4 - k1 + 32 << 12 | l2 - l4 << 18; @@ -1728,11 +1704,11 @@ public abstract class World implements IWorldAccess { int k5 = (i5 >> 6 & 63) - 32 + j1; int l5 = (i5 >> 12 & 63) - 32 + k1; BlockPos blockpos1 = new BlockPos(j5, k5, l5); - int i6 = this.getLightFor(lightType, blockpos1); - int j6 = this.getRawLight(blockpos1, lightType); + int i6 = this.getLightFor(blockpos1); + int j6 = this.getRawLight(blockpos1); if(j6 != i6) { - this.setLightFor(lightType, blockpos1, j6); + this.setLightFor(blockpos1, j6); if(j6 > i6) { int k6 = Math.abs(j5 - i1); @@ -1741,27 +1717,27 @@ public abstract class World implements IWorldAccess { boolean flag = j < this.lightUpdate.length - 6; if(k6 + l6 + i7 < 17 && flag) { - if(this.getLightFor(lightType, blockpos1.west()) < j6) { + if(this.getLightFor(blockpos1.west()) < j6) { this.lightUpdate[j++] = j5 - 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); } - if(this.getLightFor(lightType, blockpos1.east()) < j6) { + if(this.getLightFor(blockpos1.east()) < j6) { this.lightUpdate[j++] = j5 + 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); } - if(this.getLightFor(lightType, blockpos1.down()) < j6) { + if(this.getLightFor(blockpos1.down()) < j6) { this.lightUpdate[j++] = j5 - i1 + 32 + (k5 - 1 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); } - if(this.getLightFor(lightType, blockpos1.up()) < j6) { + if(this.getLightFor(blockpos1.up()) < j6) { this.lightUpdate[j++] = j5 - i1 + 32 + (k5 + 1 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); } - if(this.getLightFor(lightType, blockpos1.north()) < j6) { + if(this.getLightFor(blockpos1.north()) < j6) { this.lightUpdate[j++] = j5 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - 1 - k1 + 32 << 12); } - if(this.getLightFor(lightType, blockpos1.south()) < j6) { + if(this.getLightFor(blockpos1.south()) < j6) { this.lightUpdate[j++] = j5 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 + 1 - k1 + 32 << 12); } } diff --git a/server/src/server/world/Region.java b/server/src/server/world/Region.java index fcf1367..b74566d 100755 --- a/server/src/server/world/Region.java +++ b/server/src/server/world/Region.java @@ -372,17 +372,15 @@ public class Region { Chunk chunk = new Chunk(world, x, z); chunk.setHeights(tag.getIntArray("HeightMap")); chunk.setTerrainPopulated(tag.getBoolean("TerrainPopulated")); - chunk.setLightPopulated(tag.getBoolean("LightPopulated")); chunk.setInhabited(tag.getLong("InhabitedTime")); NBTTagList sects = tag.getTagList("Sections", 10); int stor = 32; BlockArray[] sections = new BlockArray[stor]; - boolean light = !world.dimension.hasNoLight(); - + for(int n = 0; n < sects.tagCount(); ++n) { NBTTagCompound sect = sects.getCompoundTagAt(n); int y = sect.getByte("Y"); - BlockArray storage = new BlockArray(y << 4, light); + BlockArray storage = new BlockArray(y << 4); byte[] blocks = sect.getByteArray("Blocks"); NibbleArray data = new NibbleArray(sect.getByteArray("Data")); NibbleArray adddata = sect.hasKey("Add", 7) ? new NibbleArray(sect.getByteArray("Add")) : null; @@ -398,11 +396,7 @@ public class Region { storage.setData(seg); storage.setBlocklight(new NibbleArray(sect.getByteArray("BlockLight"))); - - if(light) { - storage.setSkylight(new NibbleArray(sect.getByteArray("SkyLight"))); - } - + storage.update(); sections[y] = storage; } @@ -492,7 +486,6 @@ public class Region { tag.setLong("LastUpdate", world.getTime()); tag.setIntArray("HeightMap", chunk.getHeights()); tag.setBoolean("TerrainPopulated", chunk.isTerrainPopulated()); - tag.setBoolean("LightPopulated", chunk.isLightPopulated()); tag.setLong("InhabitedTime", chunk.getInhabited()); BlockArray[] sections = chunk.getStorage(); NBTTagList sects = new NBTTagList(); @@ -532,14 +525,7 @@ public class Region { } sect.setByteArray("BlockLight", storage.getBlocklight().getData()); - - if(light) { - sect.setByteArray("SkyLight", storage.getSkylight().getData()); - } - else { - sect.setByteArray("SkyLight", new byte[storage.getBlocklight().getData().length]); - } - + sects.appendTag(sect); } } diff --git a/server/src/server/world/WorldServer.java b/server/src/server/world/WorldServer.java index 84c1cf1..73d7743 100755 --- a/server/src/server/world/WorldServer.java +++ b/server/src/server/world/WorldServer.java @@ -76,7 +76,6 @@ import common.world.BlockArray; import common.world.Chunk; import common.world.Explosion; import common.world.AWorldServer; -import common.world.LightType; import common.world.State; import common.world.Weather; import common.world.World; @@ -644,7 +643,7 @@ public final class WorldServer extends AWorldServer { if(this.debug) { for(ChunkPos chunkcoordintpair1 : this.active) { - this.getChunk(chunkcoordintpair1.x, chunkcoordintpair1.z).update(false); + this.getChunk(chunkcoordintpair1.x, chunkcoordintpair1.z).update(); } } else { @@ -661,7 +660,7 @@ public final class WorldServer extends AWorldServer { // this.profiler.next("checkLight"); chunk.enqueueRelight(); // this.profiler.next("tickChunk"); - chunk.update(false); + chunk.update(); // this.profiler.next("thunder"); int l2 = Config.boltChance; @@ -1532,7 +1531,7 @@ public final class WorldServer extends AWorldServer { private void populate(int x, int z) { Chunk chunk = this.getChunk(x, z); if(!chunk.isTerrainPopulated()) { - chunk.checkLight(); + chunk.setTerrainPopulated(true); BlockFalling.fallInstantly = true; int bx = x * 16; int bz = z * 16; @@ -1689,11 +1688,11 @@ public final class WorldServer extends AWorldServer { this.chunks.add(pos, chunk); this.loaded.add(chunk); chunk.onChunkLoad(); - chunk.checkLight(); + chunk.setTerrainPopulated(true); chunk.setModified(); } for(Chunk chunk : this.loaded) { - chunk.update(false); + chunk.update(); } this.entities.removeAll(this.unloaded); for(int l = 0; l < this.unloaded.size(); ++l) { @@ -2380,7 +2379,7 @@ public final class WorldServer extends AWorldServer { return false; } else { - if(pos.getY() >= 0 && pos.getY() < 512 && this.getLightFor(LightType.BLOCK, pos) < 10) { + if(pos.getY() >= 0 && pos.getY() < 512 && this.getLightFor(pos) < 10) { State iblockstate = this.getState(pos); Block block = iblockstate.getBlock(); diff --git a/server/src/server/worldgen/FeatureLakes.java b/server/src/server/worldgen/FeatureLakes.java index 98fe8bd..1f4e2c1 100755 --- a/server/src/server/worldgen/FeatureLakes.java +++ b/server/src/server/worldgen/FeatureLakes.java @@ -5,7 +5,6 @@ import common.init.Blocks; import common.material.Material; import common.rng.Random; import common.util.BlockPos; -import common.world.LightType; import common.world.State; import server.biome.GenBiome; import server.world.WorldServer; @@ -161,7 +160,7 @@ public class FeatureLakes { BlockPos blockpos = position.add(i2, j4 - 1, j3); - if (worldIn.getState(blockpos).getBlock() == replace && worldIn.getLightFor(LightType.SKY, position.add(i2, j4, j3)) > 0) + if (worldIn.getState(blockpos).getBlock() == replace && worldIn.isAirBlock(position.add(i2, j4, j3))) { GenBiome biomegenbase = GenBiome.BIOMES[worldIn.getBiomeGenForCoords(blockpos).id];