ProtocolLib

3M Downloads

WrappedDataWatcher not working the same on 1.17 as it did on 1.16

Jaimss opened this issue ยท 4 comments

commented

Make sure you're doing the following

  • You're using the latest build for your server version
  • This isn't an issue caused by another plugin
  • You've checked for duplicate issues
  • You didn't use /reload
    image

Describe the question
What is the new way to create a WrappedDataWatcher for the PacketType.Play.Server.ENTITY_METADATA packet. In 1.16.x I was using WrappedDataWatcher(metaDataPacket#watchableCollectionModifier#read(0)) and it was working fine. In 1.17.1, I am getting an error that metaDataPacket#watchableCollectionModifier#read(0) is returning null:
Error Pastebin
Code Pastebin(Protocol.kt)

API method(s) used
See the Protocol.kt file linked above for more detail, but the issue I'm having is with WrappedDataWatcher(List<WrappedWatchableObject>)

Expected behavior
No error, the wrapped data watcher works as it did in 1.16.

Code
Error & Code linked above.
Full project on github

Additional context
My code is for a library that sends spawn and destroy packets for armor stands. It is a packet based hologram library. I have tried just using WrappedDataWatcher() with no constructor args, but that doesn't work because the entity id is the same every time, so only one of the Hologram Lines (entityies) shows up.

commented

What I meant was that it's valid for the server to give you a null watchable collection, so you have to handle that case. You may have to create your own fake entities somehow. I know holographic displays does more or less what you're after: https://github.com/filoghost/HolographicDisplays

commented

Did you try with WrappedWatchableObject instead of WrappedDataWatcher. Works for me (client side glowing), but sorry, can't give you a code cause it's in Skript

commented

Looks like per the source it can be null

commented

Looks like per the source it can be null

Yes, that is what the error is saying, and what I noticed that metaDataPacket#watchableCollectionModifier#read(0) is returning null, so when I do WrappedDataWatcher(that), that is null which means it can't do whatever it needs to do.

This what not an issue in 1.16, so I'm asking what the solution might be in 1.17.

Basically, how can I associate the Entity Metadata packet with the Spawn Entity Living Packet in newer versions?