1.16.2 Support?
MrKorvic opened this issue ยท 6 comments
Describe the question
Updating a player respawn packet for 1.16.2, however, I'm getting a FieldAccessException when modifying dimensions stating that the ResourceKey class isn't included in the respawn packet. Tried commenting out a few lines of data on the packet to see if I could single out the actual issue, and it stops throwing the FieldAccessException when I remove the dimensions portion of the data.
My question is; Is ProtocolLib supporting 1.16.2 in the dev builds yet, and if so, then does the dimension need to be wrapped in a new object now or somesuch? I can't imagine they changed the packet this much since 1.16.1, but I figured I'd check if anyone knows the specifics as I couldn't find an announcement/sticky issue regarding 1.16.2 yet.
API method(s) used
Paper RC6 (1.16.2 latest) & ProtocolLib 4.6.0-SNAPSHOT b476
Code
private static PacketContainer buildRespawn(int dimension, Object resourceKey, Object nmsWorld, long seed, Player p) throws IllegalAccessException {
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
PacketContainer output = manager.createPacket(PacketType.Play.Server.RESPAWN);
output.getDimensions().write(0, dimension); //a
output.getSpecificModifier(RESOURCE_KEY_CLASS).write(1, resourceKey); //b
output.getLongs().write(0, Hashing.sha256().hashLong(seed).asLong()); //c
output.getGameModes().write(0, EnumWrappers.NativeGameMode.fromBukkit(p.getGameMode())); //d
output.getGameModes().write(1, EnumWrappers.NativeGameMode.fromBukkit(p.getGameMode())); //e
output.getBooleans().write(0, DEBUG_WORLD_FIELD.getBoolean(nmsWorld)); //f
output.getBooleans().write(1, p.getWorld().getWorldType() == WorldType.FLAT); //g
output.getBooleans().write(2, true); //h
return output;
}
Duplicate #934
np, yeah for some reason they changed it from 1.16 to 1.16.1 and again from 1.16.1 to 1.16.2
@MrKorvic were you able to get it working with the new build? im having a hard time working it out
@jaypitti Yeah, with build 478 I was able to simply drop the getSpecificModifier
write to index 0 and there were no issues.
private static PacketContainer buildRespawn(int dimension, Object resourceKey, Object nmsWorld, long seed, Player p) throws IllegalAccessException {
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
PacketContainer output = manager.createPacket(PacketType.Play.Server.RESPAWN);
output.getDimensions().write(0, dimension); //a
output.getSpecificModifier(RESOURCE_KEY_CLASS).write(0, resourceKey); //b
output.getLongs().write(0, Hashing.sha256().hashLong(seed).asLong()); //c
output.getGameModes().write(0, EnumWrappers.NativeGameMode.fromBukkit(p.getGameMode())); //d
output.getGameModes().write(1, EnumWrappers.NativeGameMode.fromBukkit(p.getGameMode())); //e
output.getBooleans().write(0, DEBUG_WORLD_FIELD.getBoolean(nmsWorld)); //f
output.getBooleans().write(1, p.getWorld().getWorldType() == WorldType.FLAT); //g
output.getBooleans().write(2, true); //h
return output;
}
@MrKorvic any change you could help me out with this? Ive got it "working" but the player cant load any more chunks after the dimension is changed