ProtocolLib

3M Downloads

SPAWN_ENTITY listener in 1.19.4 doesn't work

romanalexander opened this issue ยท 3 comments

commented
  • This issue is not solved in a development build

Describe the bug
Using the latest development build. I also tried the WIP PR for 1.19.4, still doesn't work.

To Reproduce
Steps to reproduce the behavior:

  1. Use MonitorAdapter and log all packets
  2. spawn a chicken
  3. displays every packet except SPAWN_ENTITY

Version Info
/protocol dump
https://gist.github.com/romanalexander/cf77effa4807f82b094909b90113fcb9
Server version Paper

Additional context
Logs from listening to all send/receive packets:

[21:39:35] [Server thread/INFO]: Server command: /mob chicken
[21:39:35] [Server thread/INFO]: onPacketSending: PacketContainer[type=SYSTEM_CHAT[class=ClientboundSystemChatPacket, id=100], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@2410924c, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@76c92133, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@45615e23]]]
[21:39:35] [Server thread/INFO]: onPacketSending: PacketContainer[type=REL_ENTITY_MOVE[class=PacketPlayOutRelEntityMove, id=43], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@6ae4ebe9, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@25bb20d0, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@1f0e8500, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@16dad329, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@5bacc9b8, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@27edcfbd, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@4c2068c5, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@ca3a9f3, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@31ff40d6]]]
[21:39:35] [Server thread/INFO]: onPacketSending: PacketContainer[type=ENTITY_METADATA[class=PacketPlayOutEntityMetadata, id=82], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@7826e173, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@378fd8f2]]]
[21:39:35] [Server thread/INFO]: onPacketSending: PacketContainer[type=UPDATE_ATTRIBUTES[class=PacketPlayOutUpdateAttributes, id=106], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@267203c1, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@6dc00e29]]]
[21:39:35] [Server thread/INFO]: onPacketSending: PacketContainer[type=ENTITY_VELOCITY[class=PacketPlayOutEntityVelocity, id=84], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@6b234365, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@5df939cb, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@3025c51b, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@bd20b]]]
[21:39:35] [Server thread/INFO]: onPacketSending: PacketContainer[type=ENTITY_TELEPORT[class=PacketPlayOutEntityTeleport, id=104], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@2537cbd3, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@401834c0, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@2bde682c, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@46e8034e, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@5d1a2113, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@5c25a044, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@4e22ce4]]]
[21:39:35] [Server thread/INFO]: onPacketSending: PacketContainer[type=UPDATE_ATTRIBUTES[class=PacketPlayOutUpdateAttributes, id=106], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@267203c1, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@6dc00e29]]]
[21:39:35] [Netty Epoll Server IO #1/INFO]: onPacketReceiving: PacketContainer[type=POSITION[class=PacketPlayInPosition, id=20], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@22853e97, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@e194416, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@20c6d1fc, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@3d2a4175, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@36d0a1c1, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@722d6af9, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@64f20c71, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@b3cc873]]]
[21:39:36] [Server thread/INFO]: onPacketSending: PacketContainer[type=UPDATE_TIME[class=PacketPlayOutUpdateTime, id=94], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@1515d6b8, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@2f84bbd0]]]
[21:39:37] [Server thread/INFO]: onPacketSending: PacketContainer[type=UPDATE_TIME[class=PacketPlayOutUpdateTime, id=94], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@1515d6b8, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@2f84bbd0]]]
[21:39:37] [Server thread/INFO]: onPacketSending: PacketContainer[type=NAMED_SOUND_EFFECT[class=PacketPlayOutNamedSoundEffect, id=98], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@296bd45, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@e0816bd, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@7fdea0b8, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@6ace26ab, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@5d05d222, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@13769ac1, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@19273377, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@247b586]]]
[21:39:38] [Server thread/INFO]: onPacketSending: PacketContainer[type=UPDATE_TIME[class=PacketPlayOutUpdateTime, id=94], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@1515d6b8, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@2f84bbd0]]]
[21:39:38] [Server thread/INFO]: onPacketSending: PacketContainer[type=REL_ENTITY_MOVE[class=PacketPlayOutRelEntityMove, id=43], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@6ae4ebe9, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@25bb20d0, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@1f0e8500, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@16dad329, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@5bacc9b8, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@27edcfbd, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@4c2068c5, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@ca3a9f3, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@31ff40d6]]]
commented

It seems like the AddEntity packet is now bundled in ClientboundBundlePacket. It would be nice if we could fire an event for each packet in the bundle

commented

In my own plugin I made it listen for bundles by default and fire a listener + monitor event for every packet inside the bundle. For cancelled packets the bundle packet is modified to remove the iterated packet. If all packets are cancelled it cancels the bundle packet itself.

Pretty much all spawn packets, map packets, etc. are now inside bundles. Having such a feature in protocollib is pretty much essential as otherwise plugins will break. The algo for it isn't too complicated either but its more of a hack atm.

Having every plugin register a Bundle listener and modify the packet themselves would be horrible for performance. I hope this gets added as an option or default for newly registered listeners.

commented

I should also clarify that the ProtocolLib build 616 does not support listening to the Bundle packet at all (it is not in this enum nor can you use the ClientboundBundlePacket packet class with fromClass(), throws because its null)

Currently I dont use protocollib at all for packet handling and print a warning until this is fixed, as not even this workaround of listening for the bundle packet works because of it.