3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 00:22:53 +01:00

Patch for LibsDisguises, they are sending too big chunks. :'( Fix #3

Dieser Commit ist enthalten in:
Matsv 2016-09-17 11:32:35 +02:00
Ursprung 7418492ef1
Commit fc993809d6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 97CEC2A2EA31350F

Datei anzeigen

@ -22,6 +22,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import org.apache.commons.lang.IllegalClassException; import org.apache.commons.lang.IllegalClassException;
import org.bukkit.World; import org.bukkit.World;
import us.myles.ViaVersion.api.ViaVersion;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk; import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection; import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
import us.myles.ViaVersion.api.type.PartialType; import us.myles.ViaVersion.api.type.PartialType;
@ -77,6 +78,14 @@ public class Chunk1_10Type extends PartialType<Chunk, ClientWorld> {
List<CompoundTag> nbtData = Arrays.asList(Type.NBT_ARRAY.read(input)); List<CompoundTag> nbtData = Arrays.asList(Type.NBT_ARRAY.read(input));
// Temp patch for plugins that sent wrong too big chunks TODO find the issue in LibsDisguise and PR it.
if (input.readableBytes() > 0) {
byte[] array = new byte[input.readableBytes()];
input.readBytes(array);
if (ViaVersion.getInstance().isDebug())
System.out.println("Found " + array.length + " more bytes than expected while reading the chunk");
}
return new Chunk1_10(chunkX, chunkZ, groundUp, primaryBitmask, sections, biomeData, nbtData); return new Chunk1_10(chunkX, chunkZ, groundUp, primaryBitmask, sections, biomeData, nbtData);
} }