use of net.glowstone.util.nbt.NbtReadLimiter in project Glowstone by GlowstoneMC.
the class GlowBufUtils method readCompound.
private static CompoundTag readCompound(ByteBuf buf, boolean network) {
int idx = buf.readerIndex();
if (buf.readByte() == 0) {
return null;
}
buf.readerIndex(idx);
try (NBTInputStream str = new NBTInputStream(new ByteBufInputStream(buf), false)) {
return str.readCompound(network ? new NBTReadLimiter(2097152L) : NBTReadLimiter.UNLIMITED);
} catch (IOException e) {
return null;
}
}
Aggregations