ResourceKey reflection
Peng1104 opened this issue ยท 3 comments
Is your feature request related to a problem? Please describe.
I am trying to create the Respawn packet for the 1.16_R1 / 1.16_R2 but there is a huge change in this version, the DimensionManager is on the 1.16_R1 a ResourceKey the same for the new filed in the packet the ResourceKey for the world. Spigot Post
Describe the solution you'd like
I need a class that is equivalent to the ResourceKey of the minecraft server something like the MinecraftKey class, a way that I can create or modify it (I am lost with it)
@games647 Ok i got for the capture of a ResourceKey for a given World, but how can I manipulate / create it using reflections?
For the world for example: I want the world that the packet is handling, I would need something like:
ResourceKey worldKey = packet.getSpecificModifier(resourceKeyClass).readSafely(1); // The protocolLib ResourceKey
MinecraftKey key = worldKey.getKey(); //The needed part
World world = Bukkit.getWorld(key.getKey());
You don't need reflection to modify it. There is a fixed modifier for it:
ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java
Lines 998 to 1001 in 4bc9e8b
EDIT: This was added in the mentioned tickets.