ProtocolLib

3M Downloads

Unable to deepclone ENTITY_METADATA packet in 1.17

Rothes opened this issue ยท 7 comments

commented

Describe the bug
Unable to deepclone ENTITY_METADATA packet in 1.17.

To Reproduce

  1. Listen on ENTITY_METADATA
  2. Run packet.deepClone() on event
  3. See error

Expected behavior
No error

StackTrace
https://paste.ubuntu.com/p/qm2fgQK4R9/

Version Info
https://paste.ubuntu.com/p/TFRqMDRbvF/

Additional context
Also occur on other servers and plugins.

commented

NOTE this also occurs on 1.18.
And it should.

commented

Full StackTrace:
https://pastebin.ubuntu.com/p/qtqsKTshzB/

This server is running Paper version git-Paper-152 (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT) (Git: 78999b5)

commented

Any updates on this?

commented

๐Ÿ““ Noted down to look at before v5 release!

commented

Hi,
Does someone mind to try that out with this build? It contains some other changes related to reflections as well, so feel free to notify me about any issue you encounter as well :shipit: . I did some testing and it seems like everything is working fine now, would be nice if someone could confirm that ๐Ÿ˜ƒ

commented

Hi, Does someone mind to try that out with this build? It contains some other changes related to reflections as well, so feel free to notify me about any issue you encounter as well :shipit: . I did some testing and it seems like everything is working fine now, would be nice if someone could confirm that ๐Ÿ˜ƒ

Hi, thanks for the fixes but it seems not fixed it completely. Or it's not merged into this build?

[20:02:48 ่ญฆๅ‘Š]: [ProtocolStringReplacer] Exception which may be a ProtocolLib side problem:
java.lang.RuntimeException: Unable to clone object PacketContainer[type=ENTITY_METADATA[class=PacketPlayOutEntityMetadata, id=77], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[private final int net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata.a, private final java.util.List net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata.b]]] (com.comphenix.protocol.events.PacketContainer)
        at com.comphenix.protocol.reflect.cloning.SerializableCloner.clone(SerializableCloner.java:44) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.events.PacketContainer.deepClone(PacketContainer.java:239) ~[ProtocolLib 1.19.jar:?]
        at me.rothes.protocolstringreplacer.packetlisteners.server.EntityMetadata.process(EntityMetadata.java:38) ~[ProtocolStringReplacer v2.9.0.jar:?]
        at me.rothes.protocolstringreplacer.packetlisteners.server.AbstractServerPacketListener.access$100(AbstractServerPacketListener.java:26) ~[ProtocolStringReplacer v2.9.0.jar:?]
        at me.rothes.protocolstringreplacer.packetlisteners.server.AbstractServerPacketListener$1.onPacketSending(AbstractServerPacketListener.java:41) ~[ProtocolStringReplacer v2.9.0.jar:?]
        at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.injector.PacketFilterManager.postPacketToListeners(PacketFilterManager.java:552) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:526) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.injector.netty.manager.NetworkManagerInjector.onPacketSending(NetworkManagerInjector.java:95) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector.processOutbound(NettyChannelInjector.java:524) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector.access$000(NettyChannelInjector.java:41) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector$2.proxyRunnable(NettyChannelInjector.java:466) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.injector.netty.channel.NettyEventLoopProxy.execute(NettyEventLoopProxy.java:220) ~[ProtocolLib 1.19.jar:?]
        at net.minecraft.network.Connection.writePacket(Connection.java:435) ~[?:?]
        at net.minecraft.network.Connection.send(Connection.java:382) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.send(ServerGamePacketListenerImpl.java:2122) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.send(ServerGamePacketListenerImpl.java:2108) ~[?:?]
        at net.minecraft.server.level.ServerEntity.sendPairingData(ServerEntity.java:287) ~[?:?]
        at net.minecraft.server.level.ServerEntity.addPairing(ServerEntity.java:270) ~[?:?]
        at net.minecraft.server.level.ChunkMap$TrackedEntity.updatePlayer(ChunkMap.java:2345) ~[?:?]
        at net.minecraft.server.level.ChunkMap$TrackedEntity.updatePlayers(ChunkMap.java:2258) ~[?:?]
        at net.minecraft.server.level.ChunkMap.addEntity(ChunkMap.java:1993) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.server.level.ServerChunkCache.addEntity(ServerChunkCache.java:1198) ~[?:?]
        at net.minecraft.server.level.ServerLevel$EntityCallbacks.onTrackingStart(ServerLevel.java:2563) ~[?:?]
        at net.minecraft.server.level.ServerLevel$EntityCallbacks.b(ServerLevel.java:2501) ~[?:?]
        at net.minecraft.world.level.entity.PersistentEntitySectionManager.startTracking(PersistentEntitySectionManager.java:227) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.world.level.entity.PersistentEntitySectionManager.addEntity(PersistentEntitySectionManager.java:187) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.world.level.entity.PersistentEntitySectionManager.addNewEntity(PersistentEntitySectionManager.java:166) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.server.level.ServerLevel.addEntity(ServerLevel.java:1511) ~[?:?]
        at net.minecraft.server.level.ServerLevel.addFreshEntity(ServerLevel.java:1415) ~[?:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftWorld.dropItem(CraftWorld.java:708) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at org.bukkit.craftbukkit.v1_18_R2.CraftWorld.dropItem(CraftWorld.java:697) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at org.bukkit.craftbukkit.v1_18_R2.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:932) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.server.level.ServerPlayer.die(ServerPlayer.java:885) ~[?:?]
        at net.minecraft.world.entity.LivingEntity.hurt(LivingEntity.java:1492) ~[?:?]
        at net.minecraft.world.entity.player.Player.hurt(Player.java:979) ~[?:?]
        at net.minecraft.server.level.ServerPlayer.hurt(ServerPlayer.java:1067) ~[?:?]
        at net.minecraft.world.entity.projectile.AbstractArrow.onHitEntity(AbstractArrow.java:422) ~[?:?]
        at net.minecraft.world.entity.projectile.Projectile.onHit(Projectile.java:225) ~[?:?]
        at net.minecraft.world.entity.projectile.Projectile.preOnHit(Projectile.java:216) ~[?:?]
        at net.minecraft.world.entity.projectile.AbstractArrow.preOnHit(AbstractArrow.java:305) ~[?:?]
        at net.minecraft.world.entity.projectile.AbstractArrow.tick(AbstractArrow.java:241) ~[?:?]
        at net.minecraft.world.entity.projectile.Arrow.tick(Arrow.java:112) ~[?:?]
        at net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1218) ~[?:?]
        at net.minecraft.server.level.ServerLevel.lambda$tick$5(ServerLevel.java:697) ~[?:?]
        at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:43) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:675) ~[?:?]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1619) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:522) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1482) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1246) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:320) ~[purpur-1.18.2.jar:git-Purpur-1623]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Unable to find a method that matches {modifiers=[required: 1000, banned: 0], return=Exact class net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata, params=[{Type: Exact class net.minecraft.network.PacketDataSerializer, Index: 0}], paramCount=1}
        at com.comphenix.protocol.reflect.FuzzyReflection.getMethod(FuzzyReflection.java:174) ~[ProtocolLib 1.19.jar:?]
        at com.comphenix.protocol.events.PacketContainer.readObject(PacketContainer.java:313) ~[ProtocolLib 1.19.jar:?]
        at jdk.internal.reflect.GeneratedMethodAccessor68.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1231) ~[?:?]
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2408) ~[?:?]
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2242) ~[?:?]
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1742) ~[?:?]
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:514) ~[?:?]
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:472) ~[?:?]
        at com.comphenix.protocol.reflect.cloning.SerializableCloner.clone(SerializableCloner.java:42) ~[ProtocolLib 1.19.jar:?]
        ... 53 more

ProtocolLib v5.0.0-SNAPSHOT (From #1601)
git-Purpur-1623 (MC: 1.18.2)*

commented

There were some recent modifications to packet cloning, if someone is still experiencing this issue (the exception might look different, just check if the stack trace contains "PacketContainer.deepClone") then please post the new stack trace here. Thanks :)