Minestom / Hephaistos

NBT & Anvil save format library
MIT License
60 stars 11 forks source link

Issues when using a player head with custom skin #16

Closed nicolasvac closed 2 years ago

nicolasvac commented 2 years ago

Basically what happens is that it wont let me select the custom skin head and remove it from my inventory.

This is the error:

java.nio.BufferUnderflowException
        at java.base/java.nio.Buffer.nextGetIndex(Buffer.java:699)
        at java.base/java.nio.DirectByteBuffer.get(DirectByteBuffer.java:324)
        at net.minestom.server.utils.binary.BinaryReader.readByte(BinaryReader.java:59)
        at net.minestom.server.utils.binary.BinaryReader.read(BinaryReader.java:259)
        at java.base/java.io.DataInputStream.readByte(DataInputStream.java:271)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readFullyFormedTag(Extensions.kt:12)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion$readContents$$inlined$Kompound$1.run(NBT.kt:222)
        at org.jglrxavpok.hephaistos.nbt.NBT$Companion.Compound(NBT.kt:108)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion.readContents(NBTCompound.kt:96)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion.readContents(NBTCompound.kt:58)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readTag(Extensions.kt:27)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readFullyFormedTag(Extensions.kt:18)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion$readContents$$inlined$Kompound$1.run(NBT.kt:222)
        at org.jglrxavpok.hephaistos.nbt.NBT$Companion.Compound(NBT.kt:108)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion.readContents(NBTCompound.kt:96)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion.readContents(NBTCompound.kt:58)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readTag(Extensions.kt:27)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readFullyFormedTag(Extensions.kt:18)
        at org.jglrxavpok.hephaistos.nbt.NBTReader.readNamed(NBTReader.kt:48)
        at org.jglrxavpok.hephaistos.nbt.NBTReader.read(NBTReader.kt:58)
        at net.minestom.server.utils.binary.BinaryReader.readTag(BinaryReader.java:274)
        at net.minestom.server.utils.NBTUtils.readItemStack(NBTUtils.java:116)
        at net.minestom.server.utils.binary.BinaryReader.readItemStack(BinaryReader.java:193)
        at net.minestom.server.network.packet.client.play.ClientClickWindowPacket$ChangedSlot.<init>(ClientClickWindowPacket.java:39)
        at net.minestom.server.utils.binary.BinaryReader.readList(BinaryReader.java:248)
        at net.minestom.server.utils.binary.BinaryReader.readVarIntList(BinaryReader.java:238)
        at net.minestom.server.network.packet.client.play.ClientClickWindowPacket.<init>(ClientClickWindowPacket.java:23)
        at net.minestom.server.network.packet.client.ClientPacketsHandler.create(ClientPacketsHandler.java:35)
        at net.minestom.server.network.PacketProcessor.create(PacketProcessor.java:33)
        at net.minestom.server.network.PacketProcessor.process(PacketProcessor.java:48)
        at net.minestom.server.network.player.PlayerSocketConnection.processPackets(PlayerSocketConnection.java:109)
        at net.minestom.server.network.socket.Worker.lambda$run$0(Worker.java:74)
        at java.base/sun.nio.ch.SelectorImpl.processReadyEvents(SelectorImpl.java:294)
        at java.base/sun.nio.ch.WEPollSelectorImpl.processEvents(WEPollSelectorImpl.java:180)
        at java.base/sun.nio.ch.WEPollSelectorImpl.doSelect(WEPollSelectorImpl.java:116)
        at java.base/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:129)
        at java.base/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:167)
        at net.minestom.server.network.socket.Worker.run(Worker.java:63)
java.nio.BufferUnderflowException
        at java.base/java.nio.DirectByteBuffer.get(DirectByteBuffer.java:324)
        at net.minestom.server.utils.binary.BinaryReader.readByte(BinaryReader.java:59)
        at net.minestom.server.utils.binary.BinaryReader.read(BinaryReader.java:259)
        at java.base/java.io.DataInputStream.readByte(DataInputStream.java:271)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readFullyFormedTag(Extensions.kt:12)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion$readContents$$inlined$Kompound$1.run(NBT.kt:222)
        at org.jglrxavpok.hephaistos.nbt.NBT$Companion.Compound(NBT.kt:108)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion.readContents(NBTCompound.kt:96)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion.readContents(NBTCompound.kt:58)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readTag(Extensions.kt:27)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readFullyFormedTag(Extensions.kt:18)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion$readContents$$inlined$Kompound$1.run(NBT.kt:222)
        at org.jglrxavpok.hephaistos.nbt.NBT$Companion.Compound(NBT.kt:108)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion.readContents(NBTCompound.kt:96)
        at org.jglrxavpok.hephaistos.nbt.NBTCompound$Companion.readContents(NBTCompound.kt:58)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readTag(Extensions.kt:27)
        at org.jglrxavpok.hephaistos.nbt.ExtensionsKt.readFullyFormedTag(Extensions.kt:18)
        at org.jglrxavpok.hephaistos.nbt.NBTReader.readNamed(NBTReader.kt:48)
        at org.jglrxavpok.hephaistos.nbt.NBTReader.read(NBTReader.kt:58)
        at net.minestom.server.utils.binary.BinaryReader.readTag(BinaryReader.java:274)
        at net.minestom.server.utils.NBTUtils.readItemStack(NBTUtils.java:116)
        at net.minestom.server.utils.binary.BinaryReader.readItemStack(BinaryReader.java:193)
        at net.minestom.server.network.packet.client.play.ClientClickWindowPacket$ChangedSlot.<init>(ClientClickWindowPacket.java:39)
        at net.minestom.server.utils.binary.BinaryReader.readList(BinaryReader.java:248)
        at net.minestom.server.utils.binary.BinaryReader.readVarIntList(BinaryReader.java:238)
        at net.minestom.server.network.packet.client.play.ClientClickWindowPacket.<init>(ClientClickWindowPacket.java:23)
        at net.minestom.server.network.packet.client.ClientPacketsHandler.create(ClientPacketsHandler.java:35)
        at net.minestom.server.network.PacketProcessor.create(PacketProcessor.java:33)
        at net.minestom.server.network.PacketProcessor.process(PacketProcessor.java:48)
        at net.minestom.server.network.player.PlayerSocketConnection.processPackets(PlayerSocketConnection.java:109)
        at net.minestom.server.network.socket.Worker.lambda$run$0(Worker.java:74)
        at java.base/sun.nio.ch.SelectorImpl.processReadyEvents(SelectorImpl.java:294)
        at java.base/sun.nio.ch.WEPollSelectorImpl.processEvents(WEPollSelectorImpl.java:180)
        at java.base/sun.nio.ch.WEPollSelectorImpl.doSelect(WEPollSelectorImpl.java:116)
        at java.base/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:129)
        at java.base/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:167)
        at net.minestom.server.network.socket.Worker.run(Worker.java:63)
nicolasvac commented 2 years ago

The code for generating the custom head is present here: https://github.com/Minestom/Minestom/issues/588

jglrxavpok commented 2 years ago

Looked like a Minestom issue: https://github.com/Minestom/Minestom/issues/588