ProtocolLib

3M Downloads

IChatBaseComponent doesn't exist in PacketPlayOutScoreboardTeam

Nononitas opened this issue ยท 8 comments

commented

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

commented

The data of the scoreboard in 1.17 needs to be written into the subclass of the scoreboard, you cannot write directly:
image

commented

I don't understand.
According to the PacketWrapper and wiki.vg it should work ?

commented

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)

commented

Ok thank you

commented

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.

commented

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

commented
commented

Thank you seems to work now