IChatBaseComponent doesn't exist in PacketPlayOutScoreboardTeam
Nononitas opened this issue ยท 8 comments
Describe the bug
" com.comphenix.protocol.reflect.FieldAccessException: No field with type net.minecraft.network.chat.IChatBaseComponent exists in class PacketPlayOutScoreboardTeam."
To Reproduce
Send a PacketPlayOutScoreboardTeam in Mode 0 with prefix, suffix and displayname
Expected behavior
The error should occur
Version Info
https://pastebin.com/V9t2yTfm
Additional context
Version and fork is visible in the protocoldump
I don't understand.
According to the PacketWrapper and wiki.vg it should work ?
wiki.vg is always outdated and inaccurate, you should be more inclined to read the Minecraft source code. ProtocolLib currently does not seem to provide a wrapper for this team packet subclass (PacketPlayOutScoreboardTeam.b
)
wiki.vg is always outdated and inaccurate
[citation needed]
The wiki shows the packets as they're serialized, which is often different from how they're represented in the NMS source. So the wiki is a good place to start -- and is especially useful for entity metadata -- but you are correct in that ProtocolLib bases the modifiers on the source.
As for the initial question, @Nononitas, use packet.getStructures()
to access the b
inner class. From there, you can access the chat components.
Could you explain a bit more how I work with that or give an example, because I don't understand how to use it.
My intention would be doing it like that
WrappedChatComponent chatComponent = WrappedChatComponent.fromText(value);
StructureModifier<WrappedChatComponent> structureModifier = new StructureModifier<>(WrappedChatComponent.class);
InternalStructure internalStructure = ;
//setting the prefix
packet.getStructures().write(1, internalStructure);
but this doesn't seems right
If you know kotlin, you can check my code, it works well:
https://github.com/jiangdashao/VirtualTag/blob/master/src/main/kotlin/me/rerere/virtualtag/tag/VirtualTeam.kt#L44