diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/MultiSpellSlot.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/MultiSpellSlot.java index 0951bc5f..470a6a51 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/MultiSpellSlot.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/MultiSpellSlot.java @@ -20,6 +20,7 @@ import com.minelittlepony.unicopia.util.serialization.NbtSerialisable; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.PacketByteBuf; import net.minecraft.network.RegistryByteBuf; import net.minecraft.network.codec.PacketCodecs; import net.minecraft.registry.RegistryWrapper.WrapperLookup; @@ -165,7 +166,7 @@ class MultiSpellSlot implements SpellSlots, NbtSerialisable { @Override public Optional write(Status status, WrapperLookup lookup) { if (status != Status.DEFAULT) { - ByteBuf buffer = Unpooled.buffer(); + ByteBuf buffer = new PacketByteBuf(Unpooled.buffer()); buffer.writeByte(1); PacketCodecs.NBT_COMPOUND.encode(buffer, spell.toNBT(lookup)); return Optional.of(buffer); diff --git a/src/main/java/com/minelittlepony/unicopia/util/serialization/PacketCodecUtils.java b/src/main/java/com/minelittlepony/unicopia/util/serialization/PacketCodecUtils.java index bf3d1ccc..0832e68a 100644 --- a/src/main/java/com/minelittlepony/unicopia/util/serialization/PacketCodecUtils.java +++ b/src/main/java/com/minelittlepony/unicopia/util/serialization/PacketCodecUtils.java @@ -20,13 +20,13 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; public interface PacketCodecUtils { - PacketCodec BUFFER = PacketCodec.of((buffer, bytes) -> { + PacketCodec BUFFER = PacketCodec.of((bytes, buffer) -> { buffer.writeInt(bytes.writerIndex()); buffer.writeBytes(bytes); }, buffer -> new PacketByteBuf(buffer.readBytes(buffer.readInt()))); PacketCodec> OPTIONAL_BUFFER = PacketCodecs.optional(BUFFER); - PacketCodec REGISTRY_BUFFER = PacketCodec.of((buffer, bytes) -> { + PacketCodec REGISTRY_BUFFER = PacketCodec.of((bytes, buffer) -> { buffer.writeInt(bytes.writerIndex()); buffer.writeBytes(bytes); }, buffer -> new RegistryByteBuf(buffer.readBytes(buffer.readInt()), buffer.getRegistryManager()));