aadnk / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
288 stars 92 forks source link

[1.18.2] Holder<DimensionManager> does not translate to a known ProtocolLib StructureModifier #196

Open ineanto opened 2 years ago

ineanto commented 2 years ago

Make sure you're doing the following

Describe the question Hi. I'm currently working on a plugin which changes the skin and name of the player. I send a PacketPlayOutRespawn to the player to update the player view of his skin. Unfortunately, I'm unable to create the packet because in 1.18, the a field was changed from DimensionManager to Holder<DimensionManager>:

https://i.imgur.com/JfAYwVH.png

API method(s) used packet.getModifier().writeSafely(0, ?)

Expected behavior I expect the client to not crash and complaining that Holder.a() can't be called because var0 (the a field) is null...

Code

WrapperPacketPlayOutRespawn comes from this Spigot thread: https://www.spigotmc.org/threads/protocollib-create-a-packetplayoutrespawn.469718/

final PacketContainer container = NickoBukkit.getInstance().getProtocolManager().createPacket(PacketType.Play.Server.RESPAWN);
final WrapperPacketPlayOutRespawn respawn = new WrapperPacketPlayOutRespawn(
final World world = player.getWorld();
respawn.setDifficulty(world.getDifficulty());
respawn.setGameMode(player.getGameMode());
respawn.setSeed(world.getSeed());
container.getBooleans().write(1, true);
//respawn.setWorldType(world.getWorldType());
respawn.setWorld(world);
respawn.sendPacket(player);

Thank you to anyone in advance who will help me tackle this issue.