com.comphenix.protocol.reflect.FieldAccessException: No field with type net.minecraft.server.v1_16_R1.EnumDifficulty exists in class PacketPlayOutRespawn.
MrKorvic opened this issue ยท 3 comments
Describe the bug
Similar to the DimensionManager issue, When attempting to play the respawn packet to a player, ProtocolLib fails to find the v1_16_R1 EnumDifficulty field.
To Reproduce
Steps to reproduce the behavior:
- Get ProtocolManager
- Create a PacketContainer with PacketType.Play.Server.RESPAWN
- Write data to the packet's dimensions using packet#getDifficulties#write. This can even be done using the player's current world difficulty and a fieldIndex of 0.
- Observe FieldAccessException in the console.
Expected behavior
Should set the packet's difficulty to the one provided.
Screenshots
https://i.imgur.com/VdDhJiV.png
https://i.imgur.com/kuAr0hL.png
Version Info
https://pastebin.com/TzaM4XgK
1.16 has no difficultly field (ref). That's not a fault of ProtocolLib.
However for the respawn packet it's still necessary to set the World Name. This is also a ResourceKey
similar to #893. As a workaround we used a combination of reflection and use a specific StructureModifier
for the ResourceKey
class.
Nevertheless an official way would be much better.
1.16 has no difficultly field (ref). That's not a fault of ProtocolLib.
However for the respawn packet it's still necessary to set the World Name. This is also a
ResourceKey
similar to #893. As a workaround we used a combination of reflection and use a specificStructureModifier
for theResourceKey
class.Nevertheless an official way would be much better.
So for 1.16+ I can just ignore the difficulty field altogether, you think?
1.16 has no difficultly field (ref). That's not a fault of ProtocolLib.
However for the respawn packet it's still necessary to set the World Name. This is also aResourceKey
similar to #893. As a workaround we used a combination of reflection and use a specificStructureModifier
for theResourceKey
class.
Nevertheless an official way would be much better.So for 1.16+ I can just ignore the difficulty field altogether, you think?
he's directly telling you that there is no difficulty field. theres nothing to ignore. so no.. but yes.