From 259bcab1fd35dd63f5feb222960c19b9fe336daa Mon Sep 17 00:00:00 2001 From: Sen Date: Wed, 27 Aug 2025 21:11:45 +0200 Subject: [PATCH] remove skylight --- client/src/main/java/client/Client.java | 1 - .../java/client/network/ClientPlayer.java | 10 - .../main/java/client/world/ChunkClient.java | 14 +- .../java/common/packet/SPacketChunkData.java | 5 +- .../common/packet/SPacketMapChunkBulk.java | 8 +- .../main/java/common/world/BlockArray.java | 21 +- common/src/main/java/common/world/Chunk.java | 240 +----------------- common/src/main/java/common/world/World.java | 2 +- .../src/main/java/server/network/Player.java | 26 +- .../main/java/server/world/ChunkServer.java | 15 +- server/src/main/java/server/world/Region.java | 14 +- .../main/java/server/world/WorldServer.java | 7 +- 12 files changed, 38 insertions(+), 325 deletions(-) diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index ba9232ff..cacef781 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -3616,7 +3616,6 @@ public class Client implements IThreadListener { int j = chunkcoordintpair.x * 16; int k = chunkcoordintpair.z * 16; ChunkClient chunk = this.getChunk(chunkcoordintpair.x, chunkcoordintpair.z); - chunk.enqueueRelight(); this.previousActive.add(chunkcoordintpair); ++i; diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index a59e1f37..ecbca6fc 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -743,11 +743,6 @@ public class ClientPlayer implements IClientPlayer ChunkClient chunk = this.gm.getChunk(packetIn.getChunkX(), packetIn.getChunkZ()); chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedExtend(), packetIn.hasBiomes()); this.gm.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, -World.MAX_SIZE_Y, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, World.MAX_SIZE_Y, (packetIn.getChunkZ() << 4) + 15); - - if (!packetIn.hasBiomes() || !this.world.dimension.hasSkyLight()) // TODO: check - { - chunk.resetRelight(); - } } /** @@ -1342,11 +1337,6 @@ public class ClientPlayer implements IClientPlayer ChunkClient chunk = this.gm.getChunk(j, k); chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkExtend(i), true); this.gm.markBlockRangeForRenderUpdate(j << 4, -World.MAX_SIZE_Y, k << 4, (j << 4) + 15, World.MAX_SIZE_Y, (k << 4) + 15); - - if (!this.world.dimension.hasSkyLight()) // TODO: check - { - chunk.resetRelight(); - } } } diff --git a/client/src/main/java/client/world/ChunkClient.java b/client/src/main/java/client/world/ChunkClient.java index 1221620f..2bfb5af9 100644 --- a/client/src/main/java/client/world/ChunkClient.java +++ b/client/src/main/java/client/world/ChunkClient.java @@ -66,7 +66,6 @@ public class ChunkClient extends Chunk { public void setData(byte[] data, int[] extend, boolean biomes) { int pos = 0; - boolean sky = this.world.dimension.hasSkyLight(); if(biomes) { this.clearArrays(); @@ -74,7 +73,7 @@ public class ChunkClient extends Chunk { for(int cy : extend) { BlockArray arr = this.getArray(cy); if(arr == null) { - arr = new BlockArray(cy << 4, sky, null); + arr = new BlockArray(cy << 4, null); this.setArray(arr); } @@ -95,17 +94,6 @@ public class ChunkClient extends Chunk { } } - if(sky) { - for(int cy : extend) { - BlockArray arr = this.getArray(cy); - if(arr != null) { - NibbleArray slight = arr.getSkylight(); - System.arraycopy(data, pos, slight.getData(), 0, slight.getData().length); - pos += slight.getData().length; - } - } - } - if(biomes) { for(int k = 0; k < this.temperatures.length; ++k) { this.temperatures[k] = Float.intBitsToFloat((int)((data[pos + 3] & 255) << 24 | (data[pos + 2] & 255) << 16 | (data[pos + 1] & 255) << 8 | data[pos] & 255)); diff --git a/common/src/main/java/common/packet/SPacketChunkData.java b/common/src/main/java/common/packet/SPacketChunkData.java index 69ddf527..381b6f84 100755 --- a/common/src/main/java/common/packet/SPacketChunkData.java +++ b/common/src/main/java/common/packet/SPacketChunkData.java @@ -68,13 +68,12 @@ public class SPacketChunkData implements Packet return this.extractedData.data; } - public static int getSize(int segments, boolean overworld, boolean biomes) + public 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 * 8 : 0; - return i + j + k + l; + return i + j + l; } public int getChunkX() diff --git a/common/src/main/java/common/packet/SPacketMapChunkBulk.java b/common/src/main/java/common/packet/SPacketMapChunkBulk.java index 8adceef9..0f2edd8e 100755 --- a/common/src/main/java/common/packet/SPacketMapChunkBulk.java +++ b/common/src/main/java/common/packet/SPacketMapChunkBulk.java @@ -10,18 +10,16 @@ public class SPacketMapChunkBulk implements Packet private int[] xPositions; private int[] zPositions; private SPacketChunkData.Extracted[] chunksData; - private boolean sky; public SPacketMapChunkBulk() { } - public SPacketMapChunkBulk(int[] x, int[] z, SPacketChunkData.Extracted[] chunks, boolean sky) + public SPacketMapChunkBulk(int[] x, int[] z, SPacketChunkData.Extracted[] chunks) { this.xPositions = x; this.zPositions = z; this.chunksData = chunks; - this.sky = sky; } /** @@ -29,7 +27,6 @@ public class SPacketMapChunkBulk implements Packet */ public void readPacketData(PacketBuffer buf) throws IOException { - this.sky = buf.readBoolean(); int i = buf.readVarInt(); this.xPositions = new int[i]; this.zPositions = new int[i]; @@ -44,7 +41,7 @@ public class SPacketMapChunkBulk implements Packet for(int z = 0; z < this.chunksData[j].extend.length; z++) { this.chunksData[j].extend[z] = buf.readVarInt(); } - this.chunksData[j].data = new byte[SPacketChunkData.getSize(this.chunksData[j].extend.length, this.sky, true)]; + this.chunksData[j].data = new byte[SPacketChunkData.getSize(this.chunksData[j].extend.length, true)]; } for (int k = 0; k < i; ++k) @@ -58,7 +55,6 @@ public class SPacketMapChunkBulk implements Packet */ public void writePacketData(PacketBuffer buf) throws IOException { - buf.writeBoolean(this.sky); buf.writeVarInt(this.chunksData.length); for (int i = 0; i < this.xPositions.length; ++i) diff --git a/common/src/main/java/common/world/BlockArray.java b/common/src/main/java/common/world/BlockArray.java index 584b1a4f..abff814b 100755 --- a/common/src/main/java/common/world/BlockArray.java +++ b/common/src/main/java/common/world/BlockArray.java @@ -16,15 +16,12 @@ public class BlockArray { private int filled; private char[] data; private NibbleArray blocklight; - private NibbleArray skylight; - public BlockArray(int y, boolean sky, State filler) { + public BlockArray(int y, State filler) { this.yBase = y; this.filler = filler; this.data = new char[4096]; this.blocklight = new NibbleArray(); - if(sky) - this.skylight = new NibbleArray(); if(filler != null && filler.getBlock() != Blocks.air) { Arrays.fill(this.data, (char)BlockRegistry.getId(filler)); this.blocks = this.data.length; @@ -78,14 +75,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); } @@ -123,10 +112,6 @@ public class BlockArray { return this.blocklight; } - public NibbleArray getSkylight() { - return this.skylight; - } - public void setData(char[] data) { this.data = data; } @@ -134,10 +119,6 @@ public class BlockArray { public void setBlocklight(NibbleArray data) { this.blocklight = data; } - - public void setSkylight(NibbleArray data) { - this.skylight = data; - } public int hashCode() { return this.yBase >> 4; diff --git a/common/src/main/java/common/world/Chunk.java b/common/src/main/java/common/world/Chunk.java index 9d1a0d44..7696bd69 100755 --- a/common/src/main/java/common/world/Chunk.java +++ b/common/src/main/java/common/world/Chunk.java @@ -32,21 +32,18 @@ public abstract class Chunk { protected final IntHashMap blocks = new IntHashMap(); protected final Set blockList = Sets.newHashSet(); protected final int[] precHeight = new int[256]; - protected final boolean[] updateSky = new boolean[256]; protected final int[] height = new int[256]; protected final Map tiles = Maps.newHashMap(); protected final InheritanceMultiMap[] entities = new InheritanceMultiMap[32]; protected final ConcurrentLinkedQueue tileQueue = new ConcurrentLinkedQueue(); protected boolean loaded; - protected boolean gapUpdate; protected boolean populated; protected boolean lightInit; protected boolean updated; protected boolean modified; protected boolean hasEntity; protected int minHeight; - protected int lightChecks = Integer.MAX_VALUE; protected int bottom = Integer.MAX_VALUE; protected int top = Integer.MIN_VALUE; @@ -80,7 +77,7 @@ public abstract class Chunk { this.top = y > this.top ? y : this.top; } - public void genSkyLight() { + public void genSky() { int top = this.top; int bottom = this.bottom < -64 ? -64 : this.bottom; this.minHeight = Integer.MAX_VALUE; @@ -100,101 +97,12 @@ public abstract class Chunk { break; } } - - if(this.world.dimension.hasSkyLight() && top != Integer.MIN_VALUE) { - int l = 15; - int y = top + 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.getArray(y >> 4); - - if(stor != null) { - stor.setSky(x, y & 15, z, l); - this.world.clientNotifyLight(new BlockPos((this.xPos << 4) + x, y, (this.zPos << 4) + z)); - } - } - - --y; - - if(y <= bottom || 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) { - 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) { - return; - } - } - } - } - - this.gapUpdate = false; - } - } - - 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]; int min = this.bottom < -64 ? -64 : this.bottom; @@ -214,52 +122,6 @@ public abstract class Chunk { int cx = this.xPos * 16 + x; int cz = this.zPos * 16 + z; - if(this.world.dimension.hasSkyLight()) { - if(cy < h) { - for(int n = cy; n < h; ++n) { - BlockArray stor = this.getArray(n >> 4); - - if(stor != null) { - stor.setSky(x, n & 15, z, 15); - this.world.clientNotifyLight(new BlockPos((this.xPos << 4) + x, n, (this.zPos << 4) + z)); - } - } - } - else { - for(int n = h; n < cy; ++n) { - BlockArray stor = this.getArray(n >> 4); - - if(stor != null) { - stor.setSky(x, n & 15, z, 0); - this.world.clientNotifyLight(new BlockPos((this.xPos << 4) + x, n, (this.zPos << 4) + z)); - } - } - } - - int l = 15; - - while(cy > min && 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.getArray(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; @@ -273,14 +135,6 @@ public abstract class Chunk { this.minHeight = sh; } - if(this.world.dimension.hasSkyLight()) { - 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; } } @@ -334,7 +188,7 @@ public abstract class Chunk { return null; } - stor = new BlockArray(y >> 4 << 4, this.world.dimension.hasSkyLight(), y < 0 ? this.filler : null); + stor = new BlockArray(y >> 4 << 4, y < 0 ? this.filler : null); this.setArray(stor); up = y >= h; } @@ -356,7 +210,7 @@ public abstract class Chunk { else { if(updateLight) { if(up) { - this.genSkyLight(); + this.genSky(); } else { int b = block.getLightOpacity(); @@ -370,10 +224,6 @@ public abstract class Chunk { 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); - } } } @@ -414,9 +264,9 @@ public abstract class Chunk { 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() ? stor.getSky(x, y & 15, z) : 0); - if(y < 0) { - int max = y < -64 ? 0 : (y + 64) / 4; + 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; @@ -433,19 +283,14 @@ public abstract class Chunk { BlockArray stor = this.getArray(y >> 4); if(stor == null) { - stor = new BlockArray(y >> 4 << 4, this.world.dimension.hasSkyLight(), y < 0 ? this.filler : null); + stor = new BlockArray(y >> 4 << 4, y < 0 ? this.filler : null); this.setArray(stor); - this.genSkyLight(); + this.genSky(); } this.modified = true; - if(type == LightType.SKY) { - if(this.world.dimension.hasSkyLight()) { - stor.setSky(x, y & 15, z, value); - } - } - else if(type == LightType.BLOCK) { + if(type == LightType.BLOCK) { stor.setLight(x, y & 15, z, value); } } @@ -455,9 +300,9 @@ 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() ? stor.getSky(x, y & 15, z) : 0); - if(y < 0) { - int max = y < -64 ? 0 : (y + 64) / 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; } if(stor == null) @@ -644,10 +489,6 @@ public abstract class Chunk { } public void update(boolean noGaps) { - if(this.gapUpdate && this.world.dimension.hasSkyLight() && !noGaps) { - this.recheckGaps(this.world.client); - } - this.updated = true; if(!this.lightInit && this.populated) { @@ -669,53 +510,6 @@ public abstract class Chunk { return this.updated && this.populated && this.lightInit; } - public void resetRelight() { - this.lightChecks = 0; - } - - /** - * Called once-per-chunk-per-tick, and advances the round-robin relight check - * index by up to 8 blocks at a time. In a worst-case scenario, can potentially - * take up to 51.2 seconds, calculated via (8192/8)/20, to re-check all blocks - * in a chunk, which may explain lagging light updates on initial world - * generation. - */ - public void enqueueRelight() { - BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4); - - for(int n = 0; n < 8; ++n) { - if(this.top == Integer.MIN_VALUE) - return; - int h = 1 + (this.top >> 4) - (this.bottom >> 4); - if(this.lightChecks >= 256 * h) - return; - - int s = (this.lightChecks % h) + (this.bottom >> 4); - int x = this.lightChecks / h % 16; - int z = this.lightChecks / 512; - ++this.lightChecks; - - for(int y = 0; y < 16; ++y) { - BlockPos block = pos.add(x, (s << 4) + y, z); - boolean edge = y == 0 || y == 15 || x == 0 || x == 15 || z == 0 || z == 15; - - BlockArray arr = this.getArray(s); - if(arr == null && edge || arr != null - && arr.getBlock(x, y, z) == Blocks.air) { - for(Facing face : Facing.values()) { - BlockPos side = block.offset(face); - - if(this.world.getState(side).getBlock().getLight() > 0) { - this.world.checkLight(side); - } - } - - this.world.checkLight(block); - } - } - } - } - public void checkLight() { this.populated = true; this.lightInit = true; @@ -739,8 +533,6 @@ public abstract class Chunk { int d = face.getAxisDirection() == Facing.AxisDirection.POSITIVE ? 16 : 1; this.world.getChunk(pos.offset(face, d)).updateColumns(face.getOpposite()); } - - this.setSkyDirty(); } } else { @@ -749,14 +541,6 @@ public abstract class Chunk { } } - 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) { diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index c0823e2f..fa2f6a51 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -1495,7 +1495,7 @@ public abstract class World implements IWorldAccess { private int getRawLight(BlockPos pos, LightType lightType) { if(lightType == LightType.SKY && this.canSeeSky(pos)) { - return pos.getY() < 0 ? (pos.getY() < -64 ? 0 : (pos.getY() + 64) / 4) : 15; + return pos.getY() < 64 ? (pos.getY() < 0 ? 0 : pos.getY() / 4) : 15; } else { Block block = this.getState(pos).getBlock(); diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index ef37d5a4..5cc3eeee 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -859,7 +859,7 @@ public class Player extends User implements Executor, IPlayer - public static SPacketChunkData.Extracted getExtractedData(WorldServer world, ChunkServer chunk, boolean biomes, boolean overworld, int[] extend) + public static SPacketChunkData.Extracted getExtractedData(WorldServer world, ChunkServer chunk, boolean biomes, int[] extend) { Set aextendedblockstorage = chunk.getStorage(); SPacketChunkData.Extracted dataset = new SPacketChunkData.Extracted(); @@ -884,7 +884,7 @@ public class Player extends User implements Executor, IPlayer } dataset.extend = extend; - dataset.data = new byte[SPacketChunkData.getSize(extend.length, overworld, biomes)]; + dataset.data = new byte[SPacketChunkData.getSize(extend.length, biomes)]; int j = 0; for (BlockArray extendedblockstorage1 : list) @@ -903,14 +903,6 @@ public class Player extends User implements Executor, IPlayer j = copyTo(extendedblockstorage2.getBlocklight().getData(), dataset.data, j); } - if (overworld) - { - for (BlockArray extendedblockstorage3 : list) - { - j = copyTo(extendedblockstorage3.getSkylight().getData(), dataset.data, j); - } - } - if (biomes) { BiomeGenerator gen = world.getBiomeGenerator(); @@ -940,12 +932,12 @@ public class Player extends User implements Executor, IPlayer return offset + src.length; } - public static SPacketChunkData getPacket(WorldServer world, ChunkServer chunkIn, boolean biomes, int[] extend, boolean sky) + public static SPacketChunkData getPacket(WorldServer world, ChunkServer chunkIn, boolean biomes, int[] extend) { - return new SPacketChunkData(chunkIn.xPos, chunkIn.zPos, biomes, getExtractedData(world, chunkIn, biomes, sky, extend)); + return new SPacketChunkData(chunkIn.xPos, chunkIn.zPos, biomes, getExtractedData(world, chunkIn, biomes, extend)); } - private static SPacketMapChunkBulk getPacket(WorldServer world, List chunks, boolean sky) + private static SPacketMapChunkBulk getPacket(WorldServer world, List chunks) { int i = chunks.size(); int[] xPositions = new int[i]; @@ -955,13 +947,13 @@ public class Player extends User implements Executor, IPlayer for (int j = 0; j < i; ++j) { ChunkServer chunk = chunks.get(j); - SPacketChunkData.Extracted s21packetchunkdata$extracted = getExtractedData(world, chunk, true, sky, null); + SPacketChunkData.Extracted s21packetchunkdata$extracted = getExtractedData(world, chunk, true, null); xPositions[j] = chunk.xPos; zPositions[j] = chunk.zPos; chunksData[j] = s21packetchunkdata$extracted; } - return new SPacketMapChunkBulk(xPositions, zPositions, chunksData, sky); + return new SPacketMapChunkBulk(xPositions, zPositions, chunksData); } @@ -1052,11 +1044,11 @@ public class Player extends User implements Executor, IPlayer { if (list.size() == 1) { - this.sendPacket(getPacket(world, list.get(0), true, null, this.entity.worldObj.dimension.hasSkyLight())); + this.sendPacket(getPacket(world, list.get(0), true, null)); } else { - this.sendPacket(getPacket(world, list, this.entity.worldObj.dimension.hasSkyLight())); + this.sendPacket(getPacket(world, list)); } for (TileEntity tileentity : list1) diff --git a/server/src/main/java/server/world/ChunkServer.java b/server/src/main/java/server/world/ChunkServer.java index ce2e93fc..4e8af3c9 100644 --- a/server/src/main/java/server/world/ChunkServer.java +++ b/server/src/main/java/server/world/ChunkServer.java @@ -24,7 +24,6 @@ public class ChunkServer extends Chunk { public ChunkServer(WorldServer world, char[] data, int height, boolean base, boolean ceil, Random rand, int x, int z) { this(world, x, z); - boolean sky = world.dimension.hasSkyLight(); for(int bx = 0; bx < 16; ++bx) { for(int bz = 0; bz < 16; ++bz) { for(int by = 0; by < height; ++by) { @@ -33,7 +32,7 @@ public class ChunkServer extends Chunk { int y = by >> 4; BlockArray arr = this.getArray(y); if(arr == null) { - arr = new BlockArray(y << 4, sky, null); + arr = new BlockArray(y << 4, null); this.setArray(arr); } arr.set(bx, by & 15, bz, state); @@ -44,7 +43,7 @@ public class ChunkServer extends Chunk { if(base) { BlockArray arr = this.getArray(0); if(arr == null) { - arr = new BlockArray(0, sky, null); + arr = new BlockArray(0, null); this.setArray(arr); } for(int bx = 0; bx < 16; ++bx) { @@ -63,13 +62,13 @@ public class ChunkServer extends Chunk { int y = (height - 1) >> 4; BlockArray arr = this.getArray(y); if(arr == null) { - arr = new BlockArray(y << 4, sky, null); + arr = new BlockArray(y << 4, null); this.setArray(arr); } y = (height - 5) >> 4; arr = this.getArray(y); if(arr == null) { - arr = new BlockArray(y << 4, sky, null); + arr = new BlockArray(y << 4, null); this.setArray(arr); } for(int bx = 0; bx < 16; ++bx) { @@ -81,10 +80,8 @@ public class ChunkServer extends Chunk { } } } - if(ceil) - this.resetRelight(); - else - this.genSkyLight(); + if(!ceil) + this.genSky(); } public int getTopSegment() { diff --git a/server/src/main/java/server/world/Region.java b/server/src/main/java/server/world/Region.java index 4f0657e8..4f3208e0 100755 --- a/server/src/main/java/server/world/Region.java +++ b/server/src/main/java/server/world/Region.java @@ -490,12 +490,11 @@ public class Region { chunk.setInhabited(tag.getLong("I")); List sects = tag.getList("S"); BlockArray[] sections = new BlockArray[sects.size()]; - boolean light = world.dimension.hasSkyLight(); for(int n = 0; n < sects.size(); ++n) { TagObject sect = sects.get(n); int y = sect.getInt("Y"); - BlockArray storage = new BlockArray(y << 4, light, y < 0 ? world.dimension.getFiller() : null); + BlockArray storage = new BlockArray(y << 4, y < 0 ? world.dimension.getFiller() : null); byte[] blocks = sect.getByteArray("D"); char[] seg = new char[blocks.length >> 1]; @@ -506,10 +505,6 @@ public class Region { storage.setData(seg); storage.setBlocklight(new NibbleArray(sect.getByteArray("B"))); - if(light) { - storage.setSkylight(new NibbleArray(sect.getByteArray("S"))); - } - storage.update(); sections[n] = storage; } @@ -614,13 +609,6 @@ public class Region { sect.setByteArray("B", storage.getBlocklight().getData()); - if(light) { - sect.setByteArray("S", storage.getSkylight().getData()); - } - else { - sect.setByteArray("S", new byte[storage.getBlocklight().getData().length]); - } - sects.add(sect); } } diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index dc0f56f4..e3775f64 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -465,7 +465,6 @@ public final class WorldServer extends AWorldServer { // this.profiler.next("moodSound"); // this.playMoodSound(k, l, chunk); // this.profiler.next("checkLight"); - chunk.enqueueRelight(); // this.profiler.next("tickChunk"); chunk.update(false); // this.profiler.next("thunder"); @@ -1476,7 +1475,7 @@ public final class WorldServer extends AWorldServer { private ChunkServer generate(int x, int z) { if(x < -this.size || z < -this.size || x >= this.size || z >= this.size) { ChunkServer chunk = new ChunkServer(this, x, z); - chunk.genSkyLight(); + chunk.genSky(); return chunk; } this.grng.setSeed((long)x * 341873128712L + (long)z * 132897987541L); @@ -2899,7 +2898,7 @@ public final class WorldServer extends AWorldServer { ChunkServer chunk = WorldServer.this.getChunk(this.position.x, this.position.z); if(chunk.isPopulated()) { - player.connection.sendPacket(Player.getPacket(WorldServer.this, chunk, true, new int[0], WorldServer.this.dimension.hasSkyLight())); + player.connection.sendPacket(Player.getPacket(WorldServer.this, chunk, true, new int[0])); } this.watching.remove(player); @@ -2991,7 +2990,7 @@ public final class WorldServer extends AWorldServer { } } this.sendToAllPlayersWatchingChunk(Player.getPacket(WorldServer.this, WorldServer.this.getChunk(this.position.x, this.position.z), - this.biomes, extend, WorldServer.this.dimension.hasSkyLight())); + this.biomes, extend)); if(this.biomes) { List list = WorldServer.this.getTileEntitiesIn(x, Integer.MIN_VALUE, z, x + 16, Integer.MAX_VALUE, z + 16);