Linking entity movement with player

Discussion in 'Plugin Development' started by davidclue, Nov 8, 2020.

  1. Offline

    davidclue

    I need help, basically I am disguising a player as a wither skeleton and I can change the players camera to the wither skeletons but it is like the spectator camera, I cannot move the entity and the player HUD vanishes. I read on the Protocol wiki that the movement packets are sent from the entity and not the player itself when you change the players camera, so I assume I would need to receive packets sent by the entity itself and get the movement packets and send them to the player. I have tried to read the packets incoming from an entity using
    Code:
    private EntitySkeletonWither entity;
    Bukkit.getLogger().info("Packet: "+entity.P());
    But all I am receiving is:
    Packet: net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntityLiving@63315279
    And the numbers at the end are different for every packet and this packet is received every tick. How would I go about receiving the movement packets from an entity and sending the movement packets to the player, I then would teleport the entity to the player. I see there is a entity.getControllerMove() method but I do not understand how to use it or if its even related at all.
     
  2. Offline

    Mathias Eklund

    If you are trying to sync a players movements to that of an entity then perhaps what you'd need to do is to manually get the entities location data and transfer it to the player? I don't know how friendly this would be for your server but trying to do anything like this without writing a mod is guaranteed to not be very kind to it regardless.
     
  3. Offline

    davidclue

    No that does not work as the entity does not move and as I said the players movement packets are sent from the entity not the player so I cannot use player move event. I need to find a way of receiving move packets from the entity and sending the motion to the player, however I have no idea how to do this and cannot find anything about it.
     

Share This Page