--- a/net/minecraft/network/FriendlyByteBuf.java
+++ b/net/minecraft/network/FriendlyByteBuf.java
@@ -17,6 +17,8 @@
 import io.netty.util.ByteProcessor;
 import it.unimi.dsi.fastutil.ints.IntArrayList;
 import it.unimi.dsi.fastutil.ints.IntList;
+import io.papermc.paper.adventure.PaperAdventure; // Paper
+import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -34,6 +36,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;
@@ -59,6 +62,7 @@
 import net.minecraft.nbt.NbtOps;
 import net.minecraft.nbt.Tag;
 import net.minecraft.network.chat.Component;
+import net.minecraft.network.chat.MutableComponent;
 import net.minecraft.resources.ResourceKey;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.util.Crypt;
@@ -70,13 +74,16 @@
 import net.minecraft.world.level.Level;
 import net.minecraft.world.phys.BlockHitResult;
 import net.minecraft.world.phys.Vec3;
+import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack; // CraftBukkit
 
 public class FriendlyByteBuf extends ByteBuf {
+
     private static final int MAX_VARINT_SIZE = 5;
     private static final int MAX_VARLONG_SIZE = 10;
     public static final int DEFAULT_NBT_QUOTA = 2097152;
     private final ByteBuf source;
-    public static final short MAX_STRING_LENGTH = Short.MAX_VALUE;
+    public java.util.Locale adventure$locale; // Paper
+    public static final short MAX_STRING_LENGTH = 32767;
     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;
@@ -87,9 +94,9 @@
     }
 
     public static int getVarIntSize(int value) {
-        for(int i = 1; i < 5; ++i) {
-            if ((value & -1 << i * 7) == 0) {
-                return i;
+        for (int j = 1; j < 5; ++j) {
+            if ((value & -1 << j * 7) == 0) {
+                return j;
             }
         }
 
@@ -97,9 +104,9 @@
     }
 
     public static int getVarLongSize(long value) {
-        for(int i = 1; i < 10; ++i) {
-            if ((value & -1L << i * 7) == 0L) {
-                return i;
+        for (int j = 1; j < 10; ++j) {
+            if ((value & -1L << j * 7) == 0L) {
+                return j;
             }
         }
 
@@ -109,23 +116,26 @@
     /** @deprecated */
     @Deprecated
     public <T> T readWithCodec(Codec<T> codec) {
-        CompoundTag compoundTag = this.readAnySizeNbt();
-        return Util.getOrThrow(codec.parse(NbtOps.INSTANCE, compoundTag), (error) -> {
-            return new DecoderException("Failed to decode: " + error + " " + compoundTag);
+        CompoundTag nbttagcompound = this.readAnySizeNbt();
+
+        return Util.getOrThrow(codec.parse(NbtOps.INSTANCE, nbttagcompound), (s) -> {
+            return new DecoderException("Failed to decode: " + s + " " + nbttagcompound);
         });
     }
 
     /** @deprecated */
     @Deprecated
     public <T> void writeWithCodec(Codec<T> codec, T object) {
-        Tag tag = Util.getOrThrow(codec.encodeStart(NbtOps.INSTANCE, object), (error) -> {
-            return new EncoderException("Failed to encode: " + error + " " + object);
+        Tag nbtbase = (Tag) Util.getOrThrow(codec.encodeStart(NbtOps.INSTANCE, object), (s) -> {
+            return new EncoderException("Failed to encode: " + s + " " + object);
         });
-        this.writeNbt((CompoundTag)tag);
+
+        this.writeNbt((CompoundTag) nbtbase);
     }
 
     public <T> void writeId(IdMap<T> registry, T value) {
         int i = registry.getId(value);
+
         if (i == -1) {
             throw new IllegalArgumentException("Can't find id for '" + value + "' in map " + registry);
         } else {
@@ -137,15 +147,18 @@
         switch (entry.kind()) {
             case REFERENCE:
                 int i = registryEntries.getId(entry);
+
                 if (i == -1) {
-                    throw new IllegalArgumentException("Can't find id for '" + entry.value() + "' in map " + registryEntries);
+                    Object object = entry.value();
+
+                    throw new IllegalArgumentException("Can't find id for '" + object + "' in map " + registryEntries);
                 }
 
                 this.writeVarInt(i + 1);
                 break;
             case DIRECT:
                 this.writeVarInt(0);
-                writer.accept((T)this, entry.value());
+                writer.accept(this, entry.value());
         }
 
     }
@@ -153,15 +166,18 @@
     @Nullable
     public <T> T readById(IdMap<T> registry) {
         int i = this.readVarInt();
+
         return registry.byId(i);
     }
 
     public <T> Holder<T> readById(IdMap<Holder<T>> registryEntries, FriendlyByteBuf.Reader<T> reader) {
         int i = this.readVarInt();
+
         if (i == 0) {
-            return Holder.direct(reader.apply((T)this));
+            return Holder.direct(reader.apply(this));
         } else {
-            Holder<T> holder = registryEntries.byId(i - 1);
+            Holder<T> holder = (Holder) registryEntries.byId(i - 1);
+
             if (holder == null) {
                 throw new IllegalArgumentException("Can't find element with id " + i);
             } else {
@@ -171,66 +187,70 @@
     }
 
     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, FriendlyByteBuf.Reader<T> reader) {
         int i = this.readVarInt();
-        C collection = collectionFactory.apply(i);
+        C c0 = collectionFactory.apply(i); // CraftBukkit - decompile error
 
-        for(int j = 0; j < i; ++j) {
-            collection.add(reader.apply((T)this));
+        for (int j = 0; j < i; ++j) {
+            c0.add(reader.apply(this));
         }
 
-        return collection;
+        return c0;
     }
 
     public <T> void writeCollection(Collection<T> collection, FriendlyByteBuf.Writer<T> writer) {
         this.writeVarInt(collection.size());
+        Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
 
-        for(T object : collection) {
-            writer.accept((T)this, object);
+        while (iterator.hasNext()) {
+            T t0 = iterator.next();
+
+            writer.accept(this, t0);
         }
 
     }
 
     public <T> List<T> readList(FriendlyByteBuf.Reader<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, FriendlyByteBuf.Reader<K> keyReader, FriendlyByteBuf.Reader<V> valueReader) {
         int i = this.readVarInt();
-        M map = mapFactory.apply(i);
+        M m0 = mapFactory.apply(i); // CraftBukkit - decompile error
 
-        for(int j = 0; j < i; ++j) {
-            K object = keyReader.apply((K)this);
-            V object2 = valueReader.apply((V)this);
-            map.put(object, object2);
+        for (int j = 0; j < i; ++j) {
+            K k0 = keyReader.apply(this);
+            V v0 = valueReader.apply(this);
+
+            m0.put(k0, v0);
         }
 
-        return map;
+        return m0;
     }
 
     public <K, V> Map<K, V> readMap(FriendlyByteBuf.Reader<K> keyReader, FriendlyByteBuf.Reader<V> valueReader) {
@@ -239,50 +259,50 @@
 
     public <K, V> void writeMap(Map<K, V> map, FriendlyByteBuf.Writer<K> keyWriter, FriendlyByteBuf.Writer<V> valueWriter) {
         this.writeVarInt(map.size());
-        map.forEach((key, value) -> {
-            keyWriter.accept((K)this, key);
-            valueWriter.accept((V)this, value);
+        map.forEach((object, object1) -> {
+            keyWriter.accept(this, object);
+            valueWriter.accept(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 = 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 = 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, FriendlyByteBuf.Writer<T> writer) {
         if (value.isPresent()) {
             this.writeBoolean(true);
-            writer.accept((T)this, value.get());
+            writer.accept(this, value.get());
         } else {
             this.writeBoolean(false);
         }
@@ -290,18 +310,18 @@
     }
 
     public <T> Optional<T> readOptional(FriendlyByteBuf.Reader<T> reader) {
-        return this.readBoolean() ? Optional.of(reader.apply((T)this)) : Optional.empty();
+        return this.readBoolean() ? Optional.of(reader.apply(this)) : Optional.empty();
     }
 
     @Nullable
     public <T> T readNullable(FriendlyByteBuf.Reader<T> reader) {
-        return (T)(this.readBoolean() ? reader.apply((T)this) : null);
+        return this.readBoolean() ? reader.apply(this) : null;
     }
 
     public <T> void writeNullable(@Nullable T value, FriendlyByteBuf.Writer<T> writer) {
         if (value != null) {
             this.writeBoolean(true);
-            writer.accept((T)this, value);
+            writer.accept(this, value);
         } else {
             this.writeBoolean(false);
         }
@@ -311,15 +331,15 @@
     public <L, R> void writeEither(Either<L, R> either, FriendlyByteBuf.Writer<L> leftWriter, FriendlyByteBuf.Writer<R> rightWriter) {
         either.ifLeft((object) -> {
             this.writeBoolean(true);
-            leftWriter.accept((L)this, object);
+            leftWriter.accept(this, object);
         }).ifRight((object) -> {
             this.writeBoolean(false);
-            rightWriter.accept((R)this, object);
+            rightWriter.accept(this, object);
         });
     }
 
     public <L, R> Either<L, R> readEither(FriendlyByteBuf.Reader<L> leftReader, FriendlyByteBuf.Reader<R> rightReader) {
-        return this.readBoolean() ? Either.left(leftReader.apply((L)this)) : Either.right(rightReader.apply((R)this));
+        return this.readBoolean() ? Either.left(leftReader.apply(this)) : Either.right(rightReader.apply(this));
     }
 
     public byte[] readByteArray() {
@@ -333,21 +353,27 @@
     }
 
     public byte[] readByteArray(int maxSize) {
-        int i = this.readVarInt();
-        if (i > maxSize) {
-            throw new DecoderException("ByteArray with size " + i + " is bigger than allowed " + maxSize);
+        int j = this.readVarInt();
+
+        if (j > maxSize) {
+            throw new DecoderException("ByteArray with size " + j + " is bigger than allowed " + maxSize);
         } else {
-            byte[] bs = new byte[i];
-            this.readBytes(bs);
-            return bs;
+            byte[] abyte = new byte[j];
+
+            this.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;
@@ -358,32 +384,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((long[])null);
+        return this.readLongArray((long[]) null);
     }
 
     public long[] readLongArray(@Nullable long[] toArray) {
@@ -391,17 +422,18 @@
     }
 
     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;
@@ -410,9 +442,10 @@
     @VisibleForTesting
     public byte[] accessByteBufWithCorrectSize() {
         int i = this.writerIndex();
-        byte[] bs = new byte[i];
-        this.getBytes(0, bs);
-        return bs;
+        byte[] abyte = new byte[i];
+
+        this.getBytes(0, abyte);
+        return abyte;
     }
 
     public BlockPos readBlockPos() {
@@ -443,9 +476,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) {
@@ -454,20 +488,33 @@
     }
 
     public Component readComponent() {
-        Component component = Component.Serializer.fromJson(this.readUtf(262144));
-        if (component == null) {
+        MutableComponent ichatmutablecomponent = Component.Serializer.fromJson(this.readUtf(262144));
+
+        if (ichatmutablecomponent == null) {
             throw new DecoderException("Received unexpected null component");
         } else {
-            return component;
+            return ichatmutablecomponent;
         }
     }
 
+    // Paper start
+    public FriendlyByteBuf writeComponent(final net.kyori.adventure.text.Component component) {
+        return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144);
+    }
+
+    @Deprecated
+    public FriendlyByteBuf writeComponent(final net.md_5.bungee.api.chat.BaseComponent[] component) {
+        return this.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(component), 262144);
+    }
+    // Paper end
+
     public FriendlyByteBuf writeComponent(Component text) {
-        return this.writeUtf(Component.Serializer.toJson(text), 262144);
+        //return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); // Paper - comment
+        return this.writeUtf(PaperAdventure.asJsonString(text, this.adventure$locale), 262144); // Paper
     }
 
     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) {
@@ -478,32 +525,34 @@
         int i = 0;
         int j = 0;
 
-        byte b;
+        byte b0;
+
         do {
-            b = this.readByte();
-            i |= (b & 127) << j++ * 7;
+            b0 = this.readByte();
+            i |= (b0 & 127) << j++ * 7;
             if (j > 5) {
                 throw new RuntimeException("VarInt too big");
             }
-        } while((b & 128) == 128);
+        } while ((b0 & 128) == 128);
 
         return i;
     }
 
     public long readVarLong() {
-        long l = 0L;
-        int i = 0;
+        long i = 0L;
+        int j = 0;
+
+        byte b0;
 
-        byte b;
         do {
-            b = this.readByte();
-            l |= (long)(b & 127) << i++ * 7;
-            if (i > 10) {
+            b0 = this.readByte();
+            i |= (long) (b0 & 127) << j++ * 7;
+            if (j > 10) {
                 throw new RuntimeException("VarLong too big");
             }
-        } while((b & 128) == 128);
+        } while ((b0 & 128) == 128);
 
-        return l;
+        return i;
     }
 
     public FriendlyByteBuf writeUUID(UUID uuid) {
@@ -517,7 +566,7 @@
     }
 
     public FriendlyByteBuf writeVarInt(int value) {
-        while((value & -128) != 0) {
+        while ((value & -128) != 0) {
             this.writeByte(value & 127 | 128);
             value >>>= 7;
         }
@@ -527,12 +576,12 @@
     }
 
     public FriendlyByteBuf writeVarLong(long value) {
-        while((value & -128L) != 0L) {
-            this.writeByte((int)(value & 127L) | 128);
+        while ((value & -128L) != 0L) {
+            this.writeByte((int) (value & 127L) | 128);
             value >>>= 7;
         }
 
-        this.writeByte((int)value);
+        this.writeByte((int) value);
         return this;
     }
 
@@ -541,9 +590,9 @@
             this.writeByte(0);
         } else {
             try {
-                NbtIo.write(compound, new ByteBufOutputStream(this));
-            } catch (IOException var3) {
-                throw new EncoderException(var3);
+                NbtIo.write(compound, (DataOutput) (new ByteBufOutputStream(this)));
+            } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
+                throw new EncoderException(ioexception);
             }
         }
 
@@ -563,34 +612,41 @@
     @Nullable
     public CompoundTag readNbt(NbtAccounter sizeTracker) {
         int i = this.readerIndex();
-        byte b = this.readByte();
-        if (b == 0) {
+        byte b0 = this.readByte();
+
+        if (b0 == 0) {
             return null;
         } else {
             this.readerIndex(i);
 
             try {
                 return NbtIo.read(new ByteBufInputStream(this), sizeTracker);
-            } catch (IOException var5) {
-                throw new EncoderException(var5);
+            } catch (IOException ioexception) {
+                throw new EncoderException(ioexception);
             }
         }
     }
 
     public FriendlyByteBuf writeItem(ItemStack stack) {
-        if (stack.isEmpty()) {
+        if (stack.isEmpty() || stack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
             this.writeBoolean(false);
         } else {
             this.writeBoolean(true);
             Item item = stack.getItem();
+
             this.writeId(BuiltInRegistries.ITEM, item);
             this.writeByte(stack.getCount());
-            CompoundTag compoundTag = null;
+            CompoundTag nbttagcompound = null;
+
             if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) {
-                compoundTag = stack.getTag();
+                // Spigot start - filter
+                stack = stack.copy();
+                // CraftItemStack.setItemMeta(stack, CraftItemStack.getItemMeta(stack)); // Paper - This is no longer with raw NBT being handled in metadata
+                // Spigot end
+                nbttagcompound = stack.getTag();
             }
 
-            this.writeNbt(compoundTag);
+            this.writeNbt(nbttagcompound);
         }
 
         return this;
@@ -600,11 +656,17 @@
         if (!this.readBoolean()) {
             return ItemStack.EMPTY;
         } else {
-            Item item = this.readById(BuiltInRegistries.ITEM);
-            int i = this.readByte();
-            ItemStack itemStack = new ItemStack(item, i);
-            itemStack.setTag(this.readNbt());
-            return itemStack;
+            Item item = (Item) this.readById(BuiltInRegistries.ITEM);
+            byte b0 = this.readByte();
+            ItemStack itemstack = new ItemStack(item, b0);
+
+            itemstack.setTag(this.readNbt());
+            // CraftBukkit start
+            if (false && itemstack.getTag() != null) { // Paper - This is no longer needed with raw NBT being handled in metadata
+                CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
+            }
+            // CraftBukkit end
+            return itemstack;
         }
     }
 
@@ -613,19 +675,23 @@
     }
 
     public String readUtf(int maxLength) {
-        int i = getMaxEncodedUtfLength(maxLength);
-        int j = this.readVarInt();
-        if (j > i) {
-            throw new DecoderException("The received encoded string buffer length is longer than maximum allowed (" + j + " > " + i + ")");
-        } else if (j < 0) {
+        int j = FriendlyByteBuf.getMaxEncodedUtfLength(maxLength);
+        int k = this.readVarInt();
+
+        if (k > j) {
+            throw new DecoderException("The received encoded string buffer length is longer than maximum allowed (" + k + " > " + j + ")");
+        } else if (k < 0) {
             throw new DecoderException("The received encoded string buffer length is less than zero! Weird string!");
         } else {
-            String string = this.toString(this.readerIndex(), j, StandardCharsets.UTF_8);
-            this.readerIndex(this.readerIndex() + j);
-            if (string.length() > maxLength) {
-                throw new DecoderException("The received string length is longer than maximum allowed (" + string.length() + " > " + maxLength + ")");
+            String s = this.toString(this.readerIndex(), k, StandardCharsets.UTF_8);
+
+            this.readerIndex(this.readerIndex() + k);
+            if (s.length() > maxLength) {
+                int l = s.length();
+
+                throw new DecoderException("The received string length is longer than maximum allowed (" + l + " > " + maxLength + ")");
             } else {
-                return string;
+                return s;
             }
         }
     }
@@ -636,15 +702,18 @@
 
     public FriendlyByteBuf writeUtf(String string, int maxLength) {
         if (string.length() > maxLength) {
-            throw new EncoderException("String too big (was " + string.length() + " characters, max " + maxLength + ")");
+            int j = string.length();
+
+            throw new EncoderException("String too big (was " + j + " characters, max " + maxLength + ")");
         } else {
-            byte[] bs = string.getBytes(StandardCharsets.UTF_8);
-            int i = getMaxEncodedUtfLength(maxLength);
-            if (bs.length > i) {
-                throw new EncoderException("String too big (was " + bs.length + " bytes encoded, max " + i + ")");
+            byte[] abyte = string.getBytes(StandardCharsets.UTF_8);
+            int k = FriendlyByteBuf.getMaxEncodedUtfLength(maxLength);
+
+            if (abyte.length > k) {
+                throw new EncoderException("String too big (was " + abyte.length + " bytes encoded, max " + k + ")");
             } else {
-                this.writeVarInt(bs.length);
-                this.writeBytes(bs);
+                this.writeVarInt(abyte.length);
+                this.writeBytes(abyte);
                 return this;
             }
         }
@@ -664,8 +733,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) {
@@ -692,8 +762,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);
         }
     }
 
@@ -703,23 +773,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());
     }
 
@@ -732,26 +805,31 @@
     }
 
     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)));
         }
     }
 
     public GameProfile readGameProfile() {
-        UUID uUID = this.readUUID();
-        String string = this.readUtf(16);
-        GameProfile gameProfile = new GameProfile(uUID, string);
-        gameProfile.getProperties().putAll(this.readGameProfileProperties());
-        return gameProfile;
+        UUID uuid = this.readUUID();
+        String s = this.readUtf(16);
+        GameProfile gameprofile = new GameProfile(uuid, s);
+
+        gameprofile.getProperties().putAll(this.readGameProfileProperties());
+        return gameprofile;
     }
 
     public void writeGameProfile(GameProfile gameProfile) {
@@ -761,12 +839,14 @@
     }
 
     public PropertyMap readGameProfileProperties() {
-        PropertyMap propertyMap = new PropertyMap();
-        this.readWithCount((buf) -> {
+        PropertyMap propertymap = new PropertyMap();
+
+        this.readWithCount((packetdataserializer) -> {
             Property property = this.readProperty();
-            propertyMap.put(property.getName(), property);
+
+            propertymap.put(property.getName(), property);
         });
-        return propertyMap;
+        return propertymap;
     }
 
     public void writeGameProfileProperties(PropertyMap propertyMap) {
@@ -774,13 +854,15 @@
     }
 
     public Property readProperty() {
-        String string = this.readUtf();
-        String string2 = this.readUtf();
+        String s = this.readUtf();
+        String s1 = this.readUtf();
+
         if (this.readBoolean()) {
-            String string3 = this.readUtf();
-            return new Property(string, string2, string3);
+            String s2 = this.readUtf();
+
+            return new Property(s, s1, s2);
         } else {
-            return new Property(string, string2);
+            return new Property(s, s1);
         }
     }
 
@@ -816,8 +898,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() {
@@ -916,8 +998,8 @@
         return this.source.ensureWritable(i);
     }
 
-    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) {
@@ -1000,48 +1082,48 @@
         return this.source.getDouble(i);
     }
 
-    public ByteBuf getBytes(int i, ByteBuf byteBuf) {
-        return this.source.getBytes(i, byteBuf);
+    public ByteBuf getBytes(int i, ByteBuf bytebuf) {
+        return this.source.getBytes(i, bytebuf);
     }
 
-    public ByteBuf getBytes(int i, ByteBuf byteBuf, int j) {
-        return this.source.getBytes(i, byteBuf, j);
+    public ByteBuf getBytes(int i, ByteBuf bytebuf, int j) {
+        return this.source.getBytes(i, bytebuf, j);
     }
 
-    public ByteBuf getBytes(int i, ByteBuf byteBuf, int j, int k) {
-        return this.source.getBytes(i, byteBuf, j, k);
+    public ByteBuf getBytes(int i, ByteBuf bytebuf, int j, int k) {
+        return this.source.getBytes(i, bytebuf, j, k);
     }
 
-    public ByteBuf getBytes(int i, byte[] bs) {
-        return this.source.getBytes(i, bs);
+    public ByteBuf getBytes(int i, byte[] abyte) {
+        return this.source.getBytes(i, abyte);
     }
 
-    public ByteBuf getBytes(int i, byte[] bs, int j, int k) {
-        return this.source.getBytes(i, bs, j, k);
+    public ByteBuf getBytes(int i, byte[] abyte, int j, int k) {
+        return this.source.getBytes(i, abyte, j, k);
     }
 
-    public ByteBuf getBytes(int i, ByteBuffer byteBuffer) {
-        return this.source.getBytes(i, byteBuffer);
+    public ByteBuf getBytes(int i, ByteBuffer bytebuffer) {
+        return this.source.getBytes(i, bytebuffer);
     }
 
-    public ByteBuf getBytes(int i, OutputStream outputStream, int j) throws IOException {
-        return this.source.getBytes(i, outputStream, j);
+    public ByteBuf getBytes(int i, OutputStream outputstream, int j) throws IOException {
+        return this.source.getBytes(i, outputstream, j);
     }
 
-    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 ByteBuf setBoolean(int i, boolean bl) {
-        return this.source.setBoolean(i, bl);
+    public ByteBuf setBoolean(int i, boolean flag) {
+        return this.source.setBoolean(i, flag);
     }
 
     public ByteBuf setByte(int i, int j) {
@@ -1072,12 +1154,12 @@
         return this.source.setIntLE(i, j);
     }
 
-    public ByteBuf setLong(int i, long l) {
-        return this.source.setLong(i, l);
+    public ByteBuf setLong(int i, long j) {
+        return this.source.setLong(i, j);
     }
 
-    public ByteBuf setLongLE(int i, long l) {
-        return this.source.setLongLE(i, l);
+    public ByteBuf setLongLE(int i, long j) {
+        return this.source.setLongLE(i, j);
     }
 
     public ByteBuf setChar(int i, int j) {
@@ -1088,52 +1170,52 @@
         return this.source.setFloat(i, f);
     }
 
-    public ByteBuf setDouble(int i, double d) {
-        return this.source.setDouble(i, d);
+    public ByteBuf setDouble(int i, double d0) {
+        return this.source.setDouble(i, d0);
     }
 
-    public ByteBuf setBytes(int i, ByteBuf byteBuf) {
-        return this.source.setBytes(i, byteBuf);
+    public ByteBuf setBytes(int i, ByteBuf bytebuf) {
+        return this.source.setBytes(i, bytebuf);
     }
 
-    public ByteBuf setBytes(int i, ByteBuf byteBuf, int j) {
-        return this.source.setBytes(i, byteBuf, j);
+    public ByteBuf setBytes(int i, ByteBuf bytebuf, int j) {
+        return this.source.setBytes(i, bytebuf, j);
     }
 
-    public ByteBuf setBytes(int i, ByteBuf byteBuf, int j, int k) {
-        return this.source.setBytes(i, byteBuf, j, k);
+    public ByteBuf setBytes(int i, ByteBuf bytebuf, int j, int k) {
+        return this.source.setBytes(i, bytebuf, j, k);
     }
 
-    public ByteBuf setBytes(int i, byte[] bs) {
-        return this.source.setBytes(i, bs);
+    public ByteBuf setBytes(int i, byte[] abyte) {
+        return this.source.setBytes(i, abyte);
     }
 
-    public ByteBuf setBytes(int i, byte[] bs, int j, int k) {
-        return this.source.setBytes(i, bs, j, k);
+    public ByteBuf setBytes(int i, byte[] abyte, int j, int k) {
+        return this.source.setBytes(i, abyte, j, k);
     }
 
-    public ByteBuf setBytes(int i, ByteBuffer byteBuffer) {
-        return this.source.setBytes(i, byteBuffer);
+    public ByteBuf setBytes(int i, ByteBuffer bytebuffer) {
+        return this.source.setBytes(i, bytebuffer);
     }
 
-    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 ByteBuf setZero(int i, int j) {
         return this.source.setZero(i, j);
     }
 
-    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() {
@@ -1228,52 +1310,52 @@
         return this.source.readRetainedSlice(i);
     }
 
-    public ByteBuf readBytes(ByteBuf byteBuf) {
-        return this.source.readBytes(byteBuf);
+    public ByteBuf readBytes(ByteBuf bytebuf) {
+        return this.source.readBytes(bytebuf);
     }
 
-    public ByteBuf readBytes(ByteBuf byteBuf, int i) {
-        return this.source.readBytes(byteBuf, i);
+    public ByteBuf readBytes(ByteBuf bytebuf, int i) {
+        return this.source.readBytes(bytebuf, i);
     }
 
-    public ByteBuf readBytes(ByteBuf byteBuf, int i, int j) {
-        return this.source.readBytes(byteBuf, i, j);
+    public ByteBuf readBytes(ByteBuf bytebuf, int i, int j) {
+        return this.source.readBytes(bytebuf, i, j);
     }
 
-    public ByteBuf readBytes(byte[] bs) {
-        return this.source.readBytes(bs);
+    public ByteBuf readBytes(byte[] abyte) {
+        return this.source.readBytes(abyte);
     }
 
-    public ByteBuf readBytes(byte[] bs, int i, int j) {
-        return this.source.readBytes(bs, i, j);
+    public ByteBuf readBytes(byte[] abyte, int i, int j) {
+        return this.source.readBytes(abyte, i, j);
     }
 
-    public ByteBuf readBytes(ByteBuffer byteBuffer) {
-        return this.source.readBytes(byteBuffer);
+    public ByteBuf readBytes(ByteBuffer bytebuffer) {
+        return this.source.readBytes(bytebuffer);
     }
 
-    public ByteBuf readBytes(OutputStream outputStream, int i) throws IOException {
-        return this.source.readBytes(outputStream, i);
+    public ByteBuf readBytes(OutputStream outputstream, int i) throws IOException {
+        return this.source.readBytes(outputstream, i);
     }
 
-    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 ByteBuf skipBytes(int i) {
         return this.source.skipBytes(i);
     }
 
-    public ByteBuf writeBoolean(boolean bl) {
-        return this.source.writeBoolean(bl);
+    public ByteBuf writeBoolean(boolean flag) {
+        return this.source.writeBoolean(flag);
     }
 
     public ByteBuf writeByte(int i) {
@@ -1304,12 +1386,12 @@
         return this.source.writeIntLE(i);
     }
 
-    public ByteBuf writeLong(long l) {
-        return this.source.writeLong(l);
+    public ByteBuf writeLong(long i) {
+        return this.source.writeLong(i);
     }
 
-    public ByteBuf writeLongLE(long l) {
-        return this.source.writeLongLE(l);
+    public ByteBuf writeLongLE(long i) {
+        return this.source.writeLongLE(i);
     }
 
     public ByteBuf writeChar(int i) {
@@ -1320,84 +1402,84 @@
         return this.source.writeFloat(f);
     }
 
-    public ByteBuf writeDouble(double d) {
-        return this.source.writeDouble(d);
+    public ByteBuf writeDouble(double d0) {
+        return this.source.writeDouble(d0);
     }
 
-    public ByteBuf writeBytes(ByteBuf byteBuf) {
-        return this.source.writeBytes(byteBuf);
+    public ByteBuf writeBytes(ByteBuf bytebuf) {
+        return this.source.writeBytes(bytebuf);
     }
 
-    public ByteBuf writeBytes(ByteBuf byteBuf, int i) {
-        return this.source.writeBytes(byteBuf, i);
+    public ByteBuf writeBytes(ByteBuf bytebuf, int i) {
+        return this.source.writeBytes(bytebuf, i);
     }
 
-    public ByteBuf writeBytes(ByteBuf byteBuf, int i, int j) {
-        return this.source.writeBytes(byteBuf, i, j);
+    public ByteBuf writeBytes(ByteBuf bytebuf, int i, int j) {
+        return this.source.writeBytes(bytebuf, i, j);
     }
 
-    public ByteBuf writeBytes(byte[] bs) {
-        return this.source.writeBytes(bs);
+    public ByteBuf writeBytes(byte[] abyte) {
+        return this.source.writeBytes(abyte);
     }
 
-    public ByteBuf writeBytes(byte[] bs, int i, int j) {
-        return this.source.writeBytes(bs, i, j);
+    public ByteBuf writeBytes(byte[] abyte, int i, int j) {
+        return this.source.writeBytes(abyte, i, j);
     }
 
-    public ByteBuf writeBytes(ByteBuffer byteBuffer) {
-        return this.source.writeBytes(byteBuffer);
+    public ByteBuf writeBytes(ByteBuffer bytebuffer) {
+        return this.source.writeBytes(bytebuffer);
     }
 
-    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 ByteBuf writeZero(int i) {
         return this.source.writeZero(i);
     }
 
-    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() {
@@ -1492,8 +1574,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() {
@@ -1529,19 +1611,21 @@
     }
 
     @FunctionalInterface
-    public interface Reader<T> extends Function<FriendlyByteBuf, T> {
-        default FriendlyByteBuf.Reader<Optional<T>> asOptional() {
-            return (buf) -> {
-                return buf.readOptional(this);
+    public interface Writer<T> extends BiConsumer<FriendlyByteBuf, T> {
+
+        default FriendlyByteBuf.Writer<Optional<T>> asOptional() {
+            return (packetdataserializer, optional) -> {
+                packetdataserializer.writeOptional(optional, this);
             };
         }
     }
 
     @FunctionalInterface
-    public interface Writer<T> extends BiConsumer<FriendlyByteBuf, T> {
-        default FriendlyByteBuf.Writer<Optional<T>> asOptional() {
-            return (buf, value) -> {
-                buf.writeOptional(value, this);
+    public interface Reader<T> extends Function<FriendlyByteBuf, T> {
+
+        default FriendlyByteBuf.Reader<Optional<T>> asOptional() {
+            return (packetdataserializer) -> {
+                return packetdataserializer.readOptional(this);
             };
         }
     }
