--- a/net/minecraft/network/FriendlyByteBuf.java
+++ b/net/minecraft/network/FriendlyByteBuf.java
@@ -33,6 +33,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.EnumSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -68,9 +69,11 @@
 import org.joml.Vector3f;
 
 public class FriendlyByteBuf extends ByteBuf {
+
     public static final int DEFAULT_NBT_QUOTA = 2097152;
     private final ByteBuf source;
-    public static final short MAX_STRING_LENGTH = 32767;
+    @Nullable public final java.util.Locale adventure$locale; // Paper - track player's locale for server-side translations
+    public static final short MAX_STRING_LENGTH = Short.MAX_VALUE;
     public static final int MAX_COMPONENT_STRING_LENGTH = 262144;
     private static final int PUBLIC_KEY_SIZE = 256;
     private static final int MAX_PUBLIC_KEY_HEADER_SIZE = 256;
@@ -78,100 +81,124 @@
     private static final Gson GSON = new Gson();
 
     public FriendlyByteBuf(ByteBuf parent) {
+        this.adventure$locale = PacketEncoder.ADVENTURE_LOCALE.get(); // Paper - track player's locale for server-side translations
         this.source = parent;
     }
 
+    /** @deprecated */
     @Deprecated
     public <T> T readWithCodecTrusted(DynamicOps<Tag> ops, Codec<T> codec) {
         return this.readWithCodec(ops, codec, NbtAccounter.unlimitedHeap());
     }
 
+    /** @deprecated */
     @Deprecated
     public <T> T readWithCodec(DynamicOps<Tag> ops, Codec<T> codec, NbtAccounter sizeTracker) {
-        Tag tag = this.readNbt(sizeTracker);
-        return codec.parse(ops, tag).getOrThrow(error -> new DecoderException("Failed to decode: " + error + " " + tag));
+        Tag nbtbase = this.readNbt(sizeTracker);
+
+        return codec.parse(ops, nbtbase).getOrThrow((s) -> {
+            return new DecoderException("Failed to decode: " + s + " " + String.valueOf(nbtbase));
+        });
     }
 
+    /** @deprecated */
     @Deprecated
     public <T> FriendlyByteBuf writeWithCodec(DynamicOps<Tag> ops, Codec<T> codec, T value) {
-        Tag tag = codec.encodeStart(ops, value).getOrThrow(error -> new EncoderException("Failed to encode: " + error + " " + value));
-        this.writeNbt(tag);
+        Tag nbtbase = (Tag) codec.encodeStart(ops, value).getOrThrow((s) -> {
+            return new EncoderException("Failed to encode: " + s + " " + String.valueOf(value));
+        });
+
+        this.writeNbt(nbtbase);
         return this;
     }
 
     public <T> T readJsonWithCodec(Codec<T> codec) {
-        JsonElement jsonElement = GsonHelper.fromJson(GSON, this.readUtf(), JsonElement.class);
-        DataResult<T> dataResult = codec.parse(JsonOps.INSTANCE, jsonElement);
-        return dataResult.getOrThrow(error -> new DecoderException("Failed to decode json: " + error));
+        JsonElement jsonelement = (JsonElement) GsonHelper.fromJson(FriendlyByteBuf.GSON, this.readUtf(), JsonElement.class);
+        DataResult<T> dataresult = codec.parse(JsonOps.INSTANCE, jsonelement);
+
+        return dataresult.getOrThrow((s) -> {
+            return new DecoderException("Failed to decode json: " + s);
+        });
     }
 
     public <T> void writeJsonWithCodec(Codec<T> codec, T value) {
-        DataResult<JsonElement> dataResult = codec.encodeStart(JsonOps.INSTANCE, value);
-        this.writeUtf(GSON.toJson(dataResult.getOrThrow(error -> new EncoderException("Failed to encode: " + error + " " + value))));
+        // Paper start - Adventure; add max length parameter
+        this.writeJsonWithCodec(codec, value, MAX_STRING_LENGTH);
+    }
+    public <T> void writeJsonWithCodec(Codec<T> codec, T value, int maxLength) {
+        // Paper end - Adventure; add max length parameter
+        DataResult<JsonElement> dataresult = codec.encodeStart(JsonOps.INSTANCE, value);
+
+        this.writeUtf(FriendlyByteBuf.GSON.toJson((JsonElement) dataresult.getOrThrow((s) -> {
+            return new EncoderException("Failed to encode: " + s + " " + String.valueOf(value));
+        })), maxLength); // Paper - Adventure; add max length parameter
     }
 
     public static <T> IntFunction<T> limitValue(IntFunction<T> applier, int max) {
-        return value -> {
-            if (value > max) {
-                throw new DecoderException("Value " + value + " is larger than limit " + max);
+        return (j) -> {
+            if (j > max) {
+                throw new DecoderException("Value " + j + " is larger than limit " + max);
             } else {
-                return applier.apply(value);
+                return applier.apply(j);
             }
         };
     }
 
     public <T, C extends Collection<T>> C readCollection(IntFunction<C> collectionFactory, StreamDecoder<? super FriendlyByteBuf, T> reader) {
         int i = this.readVarInt();
-        C collection = (C)collectionFactory.apply(i);
+        C c0 = collectionFactory.apply(i); // CraftBukkit - decompile error
 
-        for (int j = 0; j < i; j++) {
-            collection.add(reader.decode(this));
+        for (int j = 0; j < i; ++j) {
+            c0.add(reader.decode(this));
         }
 
-        return collection;
+        return c0;
     }
 
     public <T> void writeCollection(Collection<T> collection, StreamEncoder<? super FriendlyByteBuf, T> writer) {
         this.writeVarInt(collection.size());
+        Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
 
-        for (T object : collection) {
-            writer.encode(this, object);
+        while (iterator.hasNext()) {
+            T t0 = iterator.next();
+
+            writer.encode(this, t0);
         }
+
     }
 
     public <T> List<T> readList(StreamDecoder<? super FriendlyByteBuf, T> reader) {
-        return this.readCollection(Lists::newArrayListWithCapacity, reader);
+        return (List) this.readCollection(Lists::newArrayListWithCapacity, reader);
     }
 
     public IntList readIntIdList() {
         int i = this.readVarInt();
-        IntList intList = new IntArrayList();
+        IntArrayList intarraylist = new IntArrayList();
 
-        for (int j = 0; j < i; j++) {
-            intList.add(this.readVarInt());
+        for (int j = 0; j < i; ++j) {
+            intarraylist.add(this.readVarInt());
         }
 
-        return intList;
+        return intarraylist;
     }
 
     public void writeIntIdList(IntList list) {
         this.writeVarInt(list.size());
-        list.forEach(this::writeVarInt);
+        list.forEach((java.util.function.IntConsumer) this::writeVarInt); // CraftBukkit - decompile error
     }
 
-    public <K, V, M extends Map<K, V>> M readMap(
-        IntFunction<M> mapFactory, StreamDecoder<? super FriendlyByteBuf, K> keyReader, StreamDecoder<? super FriendlyByteBuf, V> valueReader
-    ) {
+    public <K, V, M extends Map<K, V>> M readMap(IntFunction<M> mapFactory, StreamDecoder<? super FriendlyByteBuf, K> keyReader, StreamDecoder<? super FriendlyByteBuf, V> valueReader) {
         int i = this.readVarInt();
-        M map = (M)mapFactory.apply(i);
+        M m0 = mapFactory.apply(i); // CraftBukkit - decompile error
 
-        for (int j = 0; j < i; j++) {
-            K object = keyReader.decode(this);
-            V object2 = valueReader.decode(this);
-            map.put(object, object2);
+        for (int j = 0; j < i; ++j) {
+            K k0 = keyReader.decode(this);
+            V v0 = valueReader.decode(this);
+
+            m0.put(k0, v0);
         }
 
-        return map;
+        return m0;
     }
 
     public <K, V> Map<K, V> readMap(StreamDecoder<? super FriendlyByteBuf, K> keyReader, StreamDecoder<? super FriendlyByteBuf, V> valueReader) {
@@ -180,43 +207,44 @@
 
     public <K, V> void writeMap(Map<K, V> map, StreamEncoder<? super FriendlyByteBuf, K> keyWriter, StreamEncoder<? super FriendlyByteBuf, V> valueWriter) {
         this.writeVarInt(map.size());
-        map.forEach((key, value) -> {
-            keyWriter.encode(this, (K)key);
-            valueWriter.encode(this, (V)value);
+        map.forEach((object, object1) -> {
+            keyWriter.encode(this, object);
+            valueWriter.encode(this, object1);
         });
     }
 
     public void readWithCount(Consumer<FriendlyByteBuf> consumer) {
         int i = this.readVarInt();
 
-        for (int j = 0; j < i; j++) {
+        for (int j = 0; j < i; ++j) {
             consumer.accept(this);
         }
+
     }
 
     public <E extends Enum<E>> void writeEnumSet(EnumSet<E> enumSet, Class<E> type) {
-        E[] enums = (E[])type.getEnumConstants();
-        BitSet bitSet = new BitSet(enums.length);
+        E[] ae = type.getEnumConstants(); // CraftBukkit - decompile error
+        BitSet bitset = new BitSet(ae.length);
 
-        for (int i = 0; i < enums.length; i++) {
-            bitSet.set(i, enumSet.contains(enums[i]));
+        for (int i = 0; i < ae.length; ++i) {
+            bitset.set(i, enumSet.contains(ae[i]));
         }
 
-        this.writeFixedBitSet(bitSet, enums.length);
+        this.writeFixedBitSet(bitset, ae.length);
     }
 
     public <E extends Enum<E>> EnumSet<E> readEnumSet(Class<E> type) {
-        E[] enums = (E[])type.getEnumConstants();
-        BitSet bitSet = this.readFixedBitSet(enums.length);
-        EnumSet<E> enumSet = EnumSet.noneOf(type);
+        E[] ae = type.getEnumConstants(); // CraftBukkit - decompile error
+        BitSet bitset = this.readFixedBitSet(ae.length);
+        EnumSet<E> enumset = EnumSet.noneOf(type);
 
-        for (int i = 0; i < enums.length; i++) {
-            if (bitSet.get(i)) {
-                enumSet.add(enums[i]);
+        for (int i = 0; i < ae.length; ++i) {
+            if (bitset.get(i)) {
+                enumset.add(ae[i]);
             }
         }
 
-        return enumSet;
+        return enumset;
     }
 
     public <T> void writeOptional(Optional<T> value, StreamEncoder<? super FriendlyByteBuf, T> writer) {
@@ -226,6 +254,7 @@
         } else {
             this.writeBoolean(false);
         }
+
     }
 
     public <T> Optional<T> readOptional(StreamDecoder<? super FriendlyByteBuf, T> reader) {
@@ -234,7 +263,7 @@
 
     @Nullable
     public <T> T readNullable(StreamDecoder<? super FriendlyByteBuf, T> reader) {
-        return readNullable(this, reader);
+        return FriendlyByteBuf.readNullable(this, reader);
     }
 
     @Nullable
@@ -243,7 +272,7 @@
     }
 
     public <T> void writeNullable(@Nullable T value, StreamEncoder<? super FriendlyByteBuf, T> writer) {
-        writeNullable(this, value, writer);
+        FriendlyByteBuf.writeNullable(this, value, writer);
     }
 
     public static <T, B extends ByteBuf> void writeNullable(B buf, @Nullable T value, StreamEncoder<? super B, T> writer) {
@@ -253,18 +282,19 @@
         } else {
             buf.writeBoolean(false);
         }
+
     }
 
     public byte[] readByteArray() {
-        return readByteArray(this);
+        return FriendlyByteBuf.readByteArray(this);
     }
 
     public static byte[] readByteArray(ByteBuf buf) {
-        return readByteArray(buf, buf.readableBytes());
+        return FriendlyByteBuf.readByteArray(buf, buf.readableBytes());
     }
 
     public FriendlyByteBuf writeByteArray(byte[] array) {
-        writeByteArray(this, array);
+        FriendlyByteBuf.writeByteArray(this, array);
         return this;
     }
 
@@ -274,25 +304,31 @@
     }
 
     public byte[] readByteArray(int maxSize) {
-        return readByteArray(this, maxSize);
+        return FriendlyByteBuf.readByteArray(this, maxSize);
     }
 
     public static byte[] readByteArray(ByteBuf buf, int maxSize) {
-        int i = VarInt.read(buf);
-        if (i > maxSize) {
-            throw new DecoderException("ByteArray with size " + i + " is bigger than allowed " + maxSize);
+        int j = VarInt.read(buf);
+
+        if (j > maxSize) {
+            throw new DecoderException("ByteArray with size " + j + " is bigger than allowed " + maxSize);
         } else {
-            byte[] bs = new byte[i];
-            buf.readBytes(bs);
-            return bs;
+            byte[] abyte = new byte[j];
+
+            buf.readBytes(abyte);
+            return abyte;
         }
     }
 
     public FriendlyByteBuf writeVarIntArray(int[] array) {
         this.writeVarInt(array.length);
+        int[] aint1 = array;
+        int i = array.length;
 
-        for (int i : array) {
-            this.writeVarInt(i);
+        for (int j = 0; j < i; ++j) {
+            int k = aint1[j];
+
+            this.writeVarInt(k);
         }
 
         return this;
@@ -303,32 +339,37 @@
     }
 
     public int[] readVarIntArray(int maxSize) {
-        int i = this.readVarInt();
-        if (i > maxSize) {
-            throw new DecoderException("VarIntArray with size " + i + " is bigger than allowed " + maxSize);
+        int j = this.readVarInt();
+
+        if (j > maxSize) {
+            throw new DecoderException("VarIntArray with size " + j + " is bigger than allowed " + maxSize);
         } else {
-            int[] is = new int[i];
+            int[] aint = new int[j];
 
-            for (int j = 0; j < is.length; j++) {
-                is[j] = this.readVarInt();
+            for (int k = 0; k < aint.length; ++k) {
+                aint[k] = this.readVarInt();
             }
 
-            return is;
+            return aint;
         }
     }
 
     public FriendlyByteBuf writeLongArray(long[] array) {
         this.writeVarInt(array.length);
+        long[] along1 = array;
+        int i = array.length;
 
-        for (long l : array) {
-            this.writeLong(l);
+        for (int j = 0; j < i; ++j) {
+            long k = along1[j];
+
+            this.writeLong(k);
         }
 
         return this;
     }
 
     public long[] readLongArray() {
-        return this.readLongArray(null);
+        return this.readLongArray((long[]) null);
     }
 
     public long[] readLongArray(@Nullable long[] toArray) {
@@ -336,24 +377,25 @@
     }
 
     public long[] readLongArray(@Nullable long[] toArray, int maxSize) {
-        int i = this.readVarInt();
-        if (toArray == null || toArray.length != i) {
-            if (i > maxSize) {
-                throw new DecoderException("LongArray with size " + i + " is bigger than allowed " + maxSize);
+        int j = this.readVarInt();
+
+        if (toArray == null || toArray.length != j) {
+            if (j > maxSize) {
+                throw new DecoderException("LongArray with size " + j + " is bigger than allowed " + maxSize);
             }
 
-            toArray = new long[i];
+            toArray = new long[j];
         }
 
-        for (int j = 0; j < toArray.length; j++) {
-            toArray[j] = this.readLong();
+        for (int k = 0; k < toArray.length; ++k) {
+            toArray[k] = this.readLong();
         }
 
         return toArray;
     }
 
     public BlockPos readBlockPos() {
-        return readBlockPos(this);
+        return FriendlyByteBuf.readBlockPos(this);
     }
 
     public static BlockPos readBlockPos(ByteBuf buf) {
@@ -361,7 +403,7 @@
     }
 
     public FriendlyByteBuf writeBlockPos(BlockPos pos) {
-        writeBlockPos(this, pos);
+        FriendlyByteBuf.writeBlockPos(this, pos);
         return this;
     }
 
@@ -388,9 +430,10 @@
     }
 
     public GlobalPos readGlobalPos() {
-        ResourceKey<Level> resourceKey = this.readResourceKey(Registries.DIMENSION);
-        BlockPos blockPos = this.readBlockPos();
-        return GlobalPos.of(resourceKey, blockPos);
+        ResourceKey<Level> resourcekey = this.readResourceKey(Registries.DIMENSION);
+        BlockPos blockposition = this.readBlockPos();
+
+        return GlobalPos.of(resourcekey, blockposition);
     }
 
     public void writeGlobalPos(GlobalPos pos) {
@@ -399,7 +442,7 @@
     }
 
     public Vector3f readVector3f() {
-        return readVector3f(this);
+        return FriendlyByteBuf.readVector3f(this);
     }
 
     public static Vector3f readVector3f(ByteBuf buf) {
@@ -407,7 +450,7 @@
     }
 
     public void writeVector3f(Vector3f vector3f) {
-        writeVector3f(this, vector3f);
+        FriendlyByteBuf.writeVector3f(this, vector3f);
     }
 
     public static void writeVector3f(ByteBuf buf, Vector3f vector) {
@@ -417,7 +460,7 @@
     }
 
     public Quaternionf readQuaternion() {
-        return readQuaternion(this);
+        return FriendlyByteBuf.readQuaternion(this);
     }
 
     public static Quaternionf readQuaternion(ByteBuf buf) {
@@ -425,7 +468,7 @@
     }
 
     public void writeQuaternion(Quaternionf quaternionf) {
-        writeQuaternion(this, quaternionf);
+        FriendlyByteBuf.writeQuaternion(this, quaternionf);
     }
 
     public static void writeQuaternion(ByteBuf buf, Quaternionf quaternion) {
@@ -446,7 +489,7 @@
     }
 
     public <T extends Enum<T>> T readEnum(Class<T> enumClass) {
-        return enumClass.getEnumConstants()[this.readVarInt()];
+        return ((T[]) enumClass.getEnumConstants())[this.readVarInt()]; // CraftBukkit - fix decompile error
     }
 
     public FriendlyByteBuf writeEnum(Enum<?> instance) {
@@ -455,11 +498,13 @@
 
     public <T> T readById(IntFunction<T> idToValue) {
         int i = this.readVarInt();
+
         return idToValue.apply(i);
     }
 
     public <T> FriendlyByteBuf writeById(ToIntFunction<T> valueToId, T value) {
         int i = valueToId.applyAsInt(value);
+
         return this.writeVarInt(i);
     }
 
@@ -472,7 +517,7 @@
     }
 
     public FriendlyByteBuf writeUUID(UUID uuid) {
-        writeUUID(this, uuid);
+        FriendlyByteBuf.writeUUID(this, uuid);
         return this;
     }
 
@@ -482,7 +527,7 @@
     }
 
     public UUID readUUID() {
-        return readUUID(this);
+        return FriendlyByteBuf.readUUID(this);
     }
 
     public static UUID readUUID(ByteBuf buf) {
@@ -500,7 +545,7 @@
     }
 
     public FriendlyByteBuf writeNbt(@Nullable Tag nbt) {
-        writeNbt(this, nbt);
+        FriendlyByteBuf.writeNbt(this, nbt);
         return this;
     }
 
@@ -510,40 +555,42 @@
         }
 
         try {
-            NbtIo.writeAnyTag(nbt, new ByteBufOutputStream(buf));
-        } catch (IOException var3) {
-            throw new EncoderException(var3);
+            NbtIo.writeAnyTag((Tag) nbt, new ByteBufOutputStream(buf));
+        } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
+            throw new EncoderException(ioexception);
         }
     }
 
     @Nullable
     public CompoundTag readNbt() {
-        return readNbt(this);
+        return FriendlyByteBuf.readNbt((ByteBuf) this);
     }
 
     @Nullable
     public static CompoundTag readNbt(ByteBuf buf) {
-        Tag tag = readNbt(buf, NbtAccounter.create(2097152L));
-        if (tag != null && !(tag instanceof CompoundTag)) {
-            throw new DecoderException("Not a compound tag: " + tag);
+        Tag nbtbase = FriendlyByteBuf.readNbt(buf, NbtAccounter.create(2097152L));
+
+        if (nbtbase != null && !(nbtbase instanceof CompoundTag)) {
+            throw new DecoderException("Not a compound tag: " + String.valueOf(nbtbase));
         } else {
-            return (CompoundTag)tag;
+            return (CompoundTag) nbtbase;
         }
     }
 
     @Nullable
     public static Tag readNbt(ByteBuf buf, NbtAccounter sizeTracker) {
         try {
-            Tag tag = NbtIo.readAnyTag(new ByteBufInputStream(buf), sizeTracker);
-            return tag.getId() == 0 ? null : tag;
-        } catch (IOException var3) {
-            throw new EncoderException(var3);
+            Tag nbtbase = NbtIo.readAnyTag(new ByteBufInputStream(buf), sizeTracker);
+
+            return nbtbase.getId() == 0 ? null : nbtbase;
+        } catch (IOException ioexception) {
+            throw new EncoderException(ioexception);
         }
     }
 
     @Nullable
     public Tag readNbt(NbtAccounter sizeTracker) {
-        return readNbt(this, sizeTracker);
+        return FriendlyByteBuf.readNbt(this, sizeTracker);
     }
 
     public String readUtf() {
@@ -573,8 +620,9 @@
     }
 
     public <T> ResourceKey<T> readResourceKey(ResourceKey<? extends Registry<T>> registryRef) {
-        ResourceLocation resourceLocation = this.readResourceLocation();
-        return ResourceKey.create(registryRef, resourceLocation);
+        ResourceLocation minecraftkey = this.readResourceLocation();
+
+        return ResourceKey.create(registryRef, minecraftkey);
     }
 
     public void writeResourceKey(ResourceKey<?> key) {
@@ -582,8 +630,9 @@
     }
 
     public <T> ResourceKey<? extends Registry<T>> readRegistryKey() {
-        ResourceLocation resourceLocation = this.readResourceLocation();
-        return ResourceKey.createRegistryKey(resourceLocation);
+        ResourceLocation minecraftkey = this.readResourceLocation();
+
+        return ResourceKey.createRegistryKey(minecraftkey);
     }
 
     public Date readDate() {
@@ -606,8 +655,8 @@
     public PublicKey readPublicKey() {
         try {
             return Crypt.byteToPublicKey(this.readByteArray(512));
-        } catch (CryptException var2) {
-            throw new DecoderException("Malformed public key bytes", var2);
+        } catch (CryptException cryptographyexception) {
+            throw new DecoderException("Malformed public key bytes", cryptographyexception);
         }
     }
 
@@ -617,25 +666,26 @@
     }
 
     public BlockHitResult readBlockHitResult() {
-        BlockPos blockPos = this.readBlockPos();
-        Direction direction = this.readEnum(Direction.class);
+        BlockPos blockposition = this.readBlockPos();
+        Direction enumdirection = (Direction) this.readEnum(Direction.class);
         float f = this.readFloat();
-        float g = this.readFloat();
-        float h = this.readFloat();
-        boolean bl = this.readBoolean();
-        return new BlockHitResult(
-            new Vec3((double)blockPos.getX() + (double)f, (double)blockPos.getY() + (double)g, (double)blockPos.getZ() + (double)h), direction, blockPos, bl
-        );
+        float f1 = this.readFloat();
+        float f2 = this.readFloat();
+        boolean flag = this.readBoolean();
+
+        return new BlockHitResult(new Vec3((double) blockposition.getX() + (double) f, (double) blockposition.getY() + (double) f1, (double) blockposition.getZ() + (double) f2), enumdirection, blockposition, flag);
     }
 
     public void writeBlockHitResult(BlockHitResult hitResult) {
-        BlockPos blockPos = hitResult.getBlockPos();
-        this.writeBlockPos(blockPos);
+        BlockPos blockposition = hitResult.getBlockPos();
+
+        this.writeBlockPos(blockposition);
         this.writeEnum(hitResult.getDirection());
-        Vec3 vec3 = hitResult.getLocation();
-        this.writeFloat((float)(vec3.x - (double)blockPos.getX()));
-        this.writeFloat((float)(vec3.y - (double)blockPos.getY()));
-        this.writeFloat((float)(vec3.z - (double)blockPos.getZ()));
+        Vec3 vec3d = hitResult.getLocation();
+
+        this.writeFloat((float) (vec3d.x - (double) blockposition.getX()));
+        this.writeFloat((float) (vec3d.y - (double) blockposition.getY()));
+        this.writeFloat((float) (vec3d.z - (double) blockposition.getZ()));
         this.writeBoolean(hitResult.isInside());
     }
 
@@ -648,17 +698,21 @@
     }
 
     public BitSet readFixedBitSet(int size) {
-        byte[] bs = new byte[Mth.positiveCeilDiv(size, 8)];
-        this.readBytes(bs);
-        return BitSet.valueOf(bs);
+        byte[] abyte = new byte[Mth.positiveCeilDiv(size, 8)];
+
+        this.readBytes(abyte);
+        return BitSet.valueOf(abyte);
     }
 
     public void writeFixedBitSet(BitSet bitSet, int size) {
         if (bitSet.length() > size) {
-            throw new EncoderException("BitSet is larger than expected size (" + bitSet.length() + ">" + size + ")");
+            int j = bitSet.length();
+
+            throw new EncoderException("BitSet is larger than expected size (" + j + ">" + size + ")");
         } else {
-            byte[] bs = bitSet.toByteArray();
-            this.writeBytes(Arrays.copyOf(bs, Mth.positiveCeilDiv(size, 8)));
+            byte[] abyte = bitSet.toByteArray();
+
+            this.writeBytes(Arrays.copyOf(abyte, Mth.positiveCeilDiv(size, 8)));
         }
     }
 
@@ -691,8 +745,8 @@
         return this.source.order();
     }
 
-    public ByteBuf order(ByteOrder byteOrder) {
-        return this.source.order(byteOrder);
+    public ByteBuf order(ByteOrder byteorder) {
+        return this.source.order(byteorder);
     }
 
     public ByteBuf unwrap() {
@@ -802,8 +856,8 @@
         return this;
     }
 
-    public int ensureWritable(int i, boolean bl) {
-        return this.source.ensureWritable(i, bl);
+    public int ensureWritable(int i, boolean flag) {
+        return this.source.ensureWritable(i, flag);
     }
 
     public boolean getBoolean(int i) {
@@ -886,55 +940,55 @@
         return this.source.getDouble(i);
     }
 
-    public FriendlyByteBuf getBytes(int i, ByteBuf byteBuf) {
-        this.source.getBytes(i, byteBuf);
+    public FriendlyByteBuf getBytes(int i, ByteBuf bytebuf) {
+        this.source.getBytes(i, bytebuf);
         return this;
     }
 
-    public FriendlyByteBuf getBytes(int i, ByteBuf byteBuf, int j) {
-        this.source.getBytes(i, byteBuf, j);
+    public FriendlyByteBuf getBytes(int i, ByteBuf bytebuf, int j) {
+        this.source.getBytes(i, bytebuf, j);
         return this;
     }
 
-    public FriendlyByteBuf getBytes(int i, ByteBuf byteBuf, int j, int k) {
-        this.source.getBytes(i, byteBuf, j, k);
+    public FriendlyByteBuf getBytes(int i, ByteBuf bytebuf, int j, int k) {
+        this.source.getBytes(i, bytebuf, j, k);
         return this;
     }
 
-    public FriendlyByteBuf getBytes(int i, byte[] bs) {
-        this.source.getBytes(i, bs);
+    public FriendlyByteBuf getBytes(int i, byte[] abyte) {
+        this.source.getBytes(i, abyte);
         return this;
     }
 
-    public FriendlyByteBuf getBytes(int i, byte[] bs, int j, int k) {
-        this.source.getBytes(i, bs, j, k);
+    public FriendlyByteBuf getBytes(int i, byte[] abyte, int j, int k) {
+        this.source.getBytes(i, abyte, j, k);
         return this;
     }
 
-    public FriendlyByteBuf getBytes(int i, ByteBuffer byteBuffer) {
-        this.source.getBytes(i, byteBuffer);
+    public FriendlyByteBuf getBytes(int i, ByteBuffer bytebuffer) {
+        this.source.getBytes(i, bytebuffer);
         return this;
     }
 
-    public FriendlyByteBuf getBytes(int i, OutputStream outputStream, int j) throws IOException {
-        this.source.getBytes(i, outputStream, j);
+    public FriendlyByteBuf getBytes(int i, OutputStream outputstream, int j) throws IOException {
+        this.source.getBytes(i, outputstream, j);
         return this;
     }
 
-    public int getBytes(int i, GatheringByteChannel gatheringByteChannel, int j) throws IOException {
-        return this.source.getBytes(i, gatheringByteChannel, j);
+    public int getBytes(int i, GatheringByteChannel gatheringbytechannel, int j) throws IOException {
+        return this.source.getBytes(i, gatheringbytechannel, j);
     }
 
-    public int getBytes(int i, FileChannel fileChannel, long l, int j) throws IOException {
-        return this.source.getBytes(i, fileChannel, l, j);
+    public int getBytes(int i, FileChannel filechannel, long j, int k) throws IOException {
+        return this.source.getBytes(i, filechannel, j, k);
     }
 
     public CharSequence getCharSequence(int i, int j, Charset charset) {
         return this.source.getCharSequence(i, j, charset);
     }
 
-    public FriendlyByteBuf setBoolean(int i, boolean bl) {
-        this.source.setBoolean(i, bl);
+    public FriendlyByteBuf setBoolean(int i, boolean flag) {
+        this.source.setBoolean(i, flag);
         return this;
     }
 
@@ -973,13 +1027,13 @@
         return this;
     }
 
-    public FriendlyByteBuf setLong(int i, long l) {
-        this.source.setLong(i, l);
+    public FriendlyByteBuf setLong(int i, long j) {
+        this.source.setLong(i, j);
         return this;
     }
 
-    public FriendlyByteBuf setLongLE(int i, long l) {
-        this.source.setLongLE(i, l);
+    public FriendlyByteBuf setLongLE(int i, long j) {
+        this.source.setLongLE(i, j);
         return this;
     }
 
@@ -993,51 +1047,51 @@
         return this;
     }
 
-    public FriendlyByteBuf setDouble(int i, double d) {
-        this.source.setDouble(i, d);
+    public FriendlyByteBuf setDouble(int i, double d0) {
+        this.source.setDouble(i, d0);
         return this;
     }
 
-    public FriendlyByteBuf setBytes(int i, ByteBuf byteBuf) {
-        this.source.setBytes(i, byteBuf);
+    public FriendlyByteBuf setBytes(int i, ByteBuf bytebuf) {
+        this.source.setBytes(i, bytebuf);
         return this;
     }
 
-    public FriendlyByteBuf setBytes(int i, ByteBuf byteBuf, int j) {
-        this.source.setBytes(i, byteBuf, j);
+    public FriendlyByteBuf setBytes(int i, ByteBuf bytebuf, int j) {
+        this.source.setBytes(i, bytebuf, j);
         return this;
     }
 
-    public FriendlyByteBuf setBytes(int i, ByteBuf byteBuf, int j, int k) {
-        this.source.setBytes(i, byteBuf, j, k);
+    public FriendlyByteBuf setBytes(int i, ByteBuf bytebuf, int j, int k) {
+        this.source.setBytes(i, bytebuf, j, k);
         return this;
     }
 
-    public FriendlyByteBuf setBytes(int i, byte[] bs) {
-        this.source.setBytes(i, bs);
+    public FriendlyByteBuf setBytes(int i, byte[] abyte) {
+        this.source.setBytes(i, abyte);
         return this;
     }
 
-    public FriendlyByteBuf setBytes(int i, byte[] bs, int j, int k) {
-        this.source.setBytes(i, bs, j, k);
+    public FriendlyByteBuf setBytes(int i, byte[] abyte, int j, int k) {
+        this.source.setBytes(i, abyte, j, k);
         return this;
     }
 
-    public FriendlyByteBuf setBytes(int i, ByteBuffer byteBuffer) {
-        this.source.setBytes(i, byteBuffer);
+    public FriendlyByteBuf setBytes(int i, ByteBuffer bytebuffer) {
+        this.source.setBytes(i, bytebuffer);
         return this;
     }
 
-    public int setBytes(int i, InputStream inputStream, int j) throws IOException {
-        return this.source.setBytes(i, inputStream, j);
+    public int setBytes(int i, InputStream inputstream, int j) throws IOException {
+        return this.source.setBytes(i, inputstream, j);
     }
 
-    public int setBytes(int i, ScatteringByteChannel scatteringByteChannel, int j) throws IOException {
-        return this.source.setBytes(i, scatteringByteChannel, j);
+    public int setBytes(int i, ScatteringByteChannel scatteringbytechannel, int j) throws IOException {
+        return this.source.setBytes(i, scatteringbytechannel, j);
     }
 
-    public int setBytes(int i, FileChannel fileChannel, long l, int j) throws IOException {
-        return this.source.setBytes(i, fileChannel, l, j);
+    public int setBytes(int i, FileChannel filechannel, long j, int k) throws IOException {
+        return this.source.setBytes(i, filechannel, j, k);
     }
 
     public FriendlyByteBuf setZero(int i, int j) {
@@ -1045,8 +1099,8 @@
         return this;
     }
 
-    public int setCharSequence(int i, CharSequence charSequence, Charset charset) {
-        return this.source.setCharSequence(i, charSequence, charset);
+    public int setCharSequence(int i, CharSequence charsequence, Charset charset) {
+        return this.source.setCharSequence(i, charsequence, charset);
     }
 
     public boolean readBoolean() {
@@ -1141,51 +1195,51 @@
         return this.source.readRetainedSlice(i);
     }
 
-    public FriendlyByteBuf readBytes(ByteBuf byteBuf) {
-        this.source.readBytes(byteBuf);
+    public FriendlyByteBuf readBytes(ByteBuf bytebuf) {
+        this.source.readBytes(bytebuf);
         return this;
     }
 
-    public FriendlyByteBuf readBytes(ByteBuf byteBuf, int i) {
-        this.source.readBytes(byteBuf, i);
+    public FriendlyByteBuf readBytes(ByteBuf bytebuf, int i) {
+        this.source.readBytes(bytebuf, i);
         return this;
     }
 
-    public FriendlyByteBuf readBytes(ByteBuf byteBuf, int i, int j) {
-        this.source.readBytes(byteBuf, i, j);
+    public FriendlyByteBuf readBytes(ByteBuf bytebuf, int i, int j) {
+        this.source.readBytes(bytebuf, i, j);
         return this;
     }
 
-    public FriendlyByteBuf readBytes(byte[] bs) {
-        this.source.readBytes(bs);
+    public FriendlyByteBuf readBytes(byte[] abyte) {
+        this.source.readBytes(abyte);
         return this;
     }
 
-    public FriendlyByteBuf readBytes(byte[] bs, int i, int j) {
-        this.source.readBytes(bs, i, j);
+    public FriendlyByteBuf readBytes(byte[] abyte, int i, int j) {
+        this.source.readBytes(abyte, i, j);
         return this;
     }
 
-    public FriendlyByteBuf readBytes(ByteBuffer byteBuffer) {
-        this.source.readBytes(byteBuffer);
+    public FriendlyByteBuf readBytes(ByteBuffer bytebuffer) {
+        this.source.readBytes(bytebuffer);
         return this;
     }
 
-    public FriendlyByteBuf readBytes(OutputStream outputStream, int i) throws IOException {
-        this.source.readBytes(outputStream, i);
+    public FriendlyByteBuf readBytes(OutputStream outputstream, int i) throws IOException {
+        this.source.readBytes(outputstream, i);
         return this;
     }
 
-    public int readBytes(GatheringByteChannel gatheringByteChannel, int i) throws IOException {
-        return this.source.readBytes(gatheringByteChannel, i);
+    public int readBytes(GatheringByteChannel gatheringbytechannel, int i) throws IOException {
+        return this.source.readBytes(gatheringbytechannel, i);
     }
 
     public CharSequence readCharSequence(int i, Charset charset) {
         return this.source.readCharSequence(i, charset);
     }
 
-    public int readBytes(FileChannel fileChannel, long l, int i) throws IOException {
-        return this.source.readBytes(fileChannel, l, i);
+    public int readBytes(FileChannel filechannel, long i, int j) throws IOException {
+        return this.source.readBytes(filechannel, i, j);
     }
 
     public FriendlyByteBuf skipBytes(int i) {
@@ -1193,8 +1247,8 @@
         return this;
     }
 
-    public FriendlyByteBuf writeBoolean(boolean bl) {
-        this.source.writeBoolean(bl);
+    public FriendlyByteBuf writeBoolean(boolean flag) {
+        this.source.writeBoolean(flag);
         return this;
     }
 
@@ -1233,13 +1287,13 @@
         return this;
     }
 
-    public FriendlyByteBuf writeLong(long l) {
-        this.source.writeLong(l);
+    public FriendlyByteBuf writeLong(long i) {
+        this.source.writeLong(i);
         return this;
     }
 
-    public FriendlyByteBuf writeLongLE(long l) {
-        this.source.writeLongLE(l);
+    public FriendlyByteBuf writeLongLE(long i) {
+        this.source.writeLongLE(i);
         return this;
     }
 
@@ -1253,51 +1307,51 @@
         return this;
     }
 
-    public FriendlyByteBuf writeDouble(double d) {
-        this.source.writeDouble(d);
+    public FriendlyByteBuf writeDouble(double d0) {
+        this.source.writeDouble(d0);
         return this;
     }
 
-    public FriendlyByteBuf writeBytes(ByteBuf byteBuf) {
-        this.source.writeBytes(byteBuf);
+    public FriendlyByteBuf writeBytes(ByteBuf bytebuf) {
+        this.source.writeBytes(bytebuf);
         return this;
     }
 
-    public FriendlyByteBuf writeBytes(ByteBuf byteBuf, int i) {
-        this.source.writeBytes(byteBuf, i);
+    public FriendlyByteBuf writeBytes(ByteBuf bytebuf, int i) {
+        this.source.writeBytes(bytebuf, i);
         return this;
     }
 
-    public FriendlyByteBuf writeBytes(ByteBuf byteBuf, int i, int j) {
-        this.source.writeBytes(byteBuf, i, j);
+    public FriendlyByteBuf writeBytes(ByteBuf bytebuf, int i, int j) {
+        this.source.writeBytes(bytebuf, i, j);
         return this;
     }
 
-    public FriendlyByteBuf writeBytes(byte[] bs) {
-        this.source.writeBytes(bs);
+    public FriendlyByteBuf writeBytes(byte[] abyte) {
+        this.source.writeBytes(abyte);
         return this;
     }
 
-    public FriendlyByteBuf writeBytes(byte[] bs, int i, int j) {
-        this.source.writeBytes(bs, i, j);
+    public FriendlyByteBuf writeBytes(byte[] abyte, int i, int j) {
+        this.source.writeBytes(abyte, i, j);
         return this;
     }
 
-    public FriendlyByteBuf writeBytes(ByteBuffer byteBuffer) {
-        this.source.writeBytes(byteBuffer);
+    public FriendlyByteBuf writeBytes(ByteBuffer bytebuffer) {
+        this.source.writeBytes(bytebuffer);
         return this;
     }
 
-    public int writeBytes(InputStream inputStream, int i) throws IOException {
-        return this.source.writeBytes(inputStream, i);
+    public int writeBytes(InputStream inputstream, int i) throws IOException {
+        return this.source.writeBytes(inputstream, i);
     }
 
-    public int writeBytes(ScatteringByteChannel scatteringByteChannel, int i) throws IOException {
-        return this.source.writeBytes(scatteringByteChannel, i);
+    public int writeBytes(ScatteringByteChannel scatteringbytechannel, int i) throws IOException {
+        return this.source.writeBytes(scatteringbytechannel, i);
     }
 
-    public int writeBytes(FileChannel fileChannel, long l, int i) throws IOException {
-        return this.source.writeBytes(fileChannel, l, i);
+    public int writeBytes(FileChannel filechannel, long i, int j) throws IOException {
+        return this.source.writeBytes(filechannel, i, j);
     }
 
     public FriendlyByteBuf writeZero(int i) {
@@ -1305,40 +1359,40 @@
         return this;
     }
 
-    public int writeCharSequence(CharSequence charSequence, Charset charset) {
-        return this.source.writeCharSequence(charSequence, charset);
+    public int writeCharSequence(CharSequence charsequence, Charset charset) {
+        return this.source.writeCharSequence(charsequence, charset);
     }
 
-    public int indexOf(int i, int j, byte b) {
-        return this.source.indexOf(i, j, b);
+    public int indexOf(int i, int j, byte b0) {
+        return this.source.indexOf(i, j, b0);
     }
 
-    public int bytesBefore(byte b) {
-        return this.source.bytesBefore(b);
+    public int bytesBefore(byte b0) {
+        return this.source.bytesBefore(b0);
     }
 
-    public int bytesBefore(int i, byte b) {
-        return this.source.bytesBefore(i, b);
+    public int bytesBefore(int i, byte b0) {
+        return this.source.bytesBefore(i, b0);
     }
 
-    public int bytesBefore(int i, int j, byte b) {
-        return this.source.bytesBefore(i, j, b);
+    public int bytesBefore(int i, int j, byte b0) {
+        return this.source.bytesBefore(i, j, b0);
     }
 
-    public int forEachByte(ByteProcessor byteProcessor) {
-        return this.source.forEachByte(byteProcessor);
+    public int forEachByte(ByteProcessor byteprocessor) {
+        return this.source.forEachByte(byteprocessor);
     }
 
-    public int forEachByte(int i, int j, ByteProcessor byteProcessor) {
-        return this.source.forEachByte(i, j, byteProcessor);
+    public int forEachByte(int i, int j, ByteProcessor byteprocessor) {
+        return this.source.forEachByte(i, j, byteprocessor);
     }
 
-    public int forEachByteDesc(ByteProcessor byteProcessor) {
-        return this.source.forEachByteDesc(byteProcessor);
+    public int forEachByteDesc(ByteProcessor byteprocessor) {
+        return this.source.forEachByteDesc(byteprocessor);
     }
 
-    public int forEachByteDesc(int i, int j, ByteProcessor byteProcessor) {
-        return this.source.forEachByteDesc(i, j, byteProcessor);
+    public int forEachByteDesc(int i, int j, ByteProcessor byteprocessor) {
+        return this.source.forEachByteDesc(i, j, byteprocessor);
     }
 
     public ByteBuf copy() {
@@ -1433,8 +1487,8 @@
         return this.source.equals(object);
     }
 
-    public int compareTo(ByteBuf byteBuf) {
-        return this.source.compareTo(byteBuf);
+    public int compareTo(ByteBuf bytebuf) {
+        return this.source.compareTo(bytebuf);
     }
 
     public String toString() {
