remove skylight
This commit is contained in:
parent
375a67d10f
commit
259bcab1fd
12 changed files with 38 additions and 325 deletions
|
@ -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<BlockArray> 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<ChunkServer> chunks, boolean sky)
|
||||
private static SPacketMapChunkBulk getPacket(WorldServer world, List<ChunkServer> 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)
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -490,12 +490,11 @@ public class Region {
|
|||
chunk.setInhabited(tag.getLong("I"));
|
||||
List<TagObject> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TileEntity> list = WorldServer.this.getTileEntitiesIn(x, Integer.MIN_VALUE, z, x + 16, Integer.MAX_VALUE, z + 16);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue