3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00

Don't send chunk packets with no chunks :)

Dieser Commit ist enthalten in:
Myles 2016-03-08 21:13:15 +00:00
Ursprung 126ee6e03f
Commit fc4a617da7
2 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -47,18 +47,21 @@ public class NetUtil {
// 2 = Get block light. // 2 = Get block light.
// 3 = Get sky light. // 3 = Get sky light.
Chunk[] chunks = new Chunk[16]; Chunk[] chunks = new Chunk[16];
int chunkCount = 0;
for (int pass = 0; pass < 4; pass++) { for (int pass = 0; pass < 4; pass++) {
if(pass == 1){
if(chunkCount == 0) return null;
}
for (int ind = 0; ind < 16; ind++) { for (int ind = 0; ind < 16; ind++) {
if ((bitmask & 1 << ind) != 0) { if ((bitmask & 1 << ind) != 0) {
if (pass == 0) { if (pass == 0) {
chunkCount++;
// Block length + Blocklight length // Block length + Blocklight length
expected += (4096 * 2) + 2048; expected += (4096 * 2) + 2048;
} }
if (pass == 1) { if (pass == 1) {
chunks[ind] = new Chunk(sky || hasSkyLight); chunks[ind] = new Chunk(sky || hasSkyLight);
buf.position(pos / 2); buf.position(pos / 2);
int buffPos = buf.position(); int buffPos = buf.position();
// convert short array to new one // convert short array to new one
@ -109,6 +112,7 @@ public class NetUtil {
} }
Column column = new Column(x, z, chunks, biomeData); Column column = new Column(x, z, chunks, biomeData);
System.out.println("Chunk " + x + " " + z + " count: " + chunkCount);
return column; return column;
} }
} }

Datei anzeigen

@ -770,6 +770,9 @@ public class OutgoingTransformer {
} }
} }
Column read = NetUtil.readOldChunkData(chunkX, chunkZ, groundUp, bitMask, data, true, sk); Column read = NetUtil.readOldChunkData(chunkX, chunkZ, groundUp, bitMask, data, true, sk);
if (read == null) {
throw new CancelException();
}
// Write chunk section array :(( // Write chunk section array :((
ByteBuf temp = output.alloc().buffer(); ByteBuf temp = output.alloc().buffer();
try { try {