1.16.5 How can I change a mob to an player skin

Discussion in 'Spigot Plugin Development' started by Lolmaster5000, Jun 26, 2021.

  1. I googled a bit and didnt find any answers, can somebody help me.

    I dont want a plugin, I really want to code it myself.
  2. I'm not 100% sure of how the internals of NMS works, but I'm not sure this is the best solution. I would think that all entity objects have a field of their entity id or entity type of some way. So I would find out what the field is called across all versions I would want to support and use reflection to set that field to whatever I want. After that send packets to all players to despawn and respawn the entity so it is updated for them.
  3. That's a good solution ( not even sure if it would work, and I don't think so ), but only for servers runing java 15 or lower, as in java 16, illegal access reflections are not allowed, and the entity id field is private
  4. Wait, did they remove the setAccessible method? (Im looking at the javadocs for java 16 and it looks like it is still there so I am very confused)
  5. You have to add a command line argument. Past Java 9, using setAccessible throws an exception.
    • Agree Agree x 1
  6. No, it's still there, but as in java 16, this will throw an exception if your plugin is not a module, and that module is not in the jar you are trying to access
  7. In java 9 to 15, there's still a "hack" to bypass that, in java 16 they blocked it