Solved How do you use PacketPlayInSteerVehicle

Discussion in 'Plugin Development' started by KingOfAdventure, May 8, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    KingOfAdventure

    I'm currently making a plugin and on the forums I found that I need to use this for the thing I want to make (riding an entity): PacketPlayInSteerVehicle, but how do you use it.

    So far I got like this:

    Code:
    PacketPlayInSteerVehicle ppisv = new PacketPlayInSteerVehicle();
    
    //I know that there needs to be something here to specify the player, but I don't know what (I think some packet sending or something like that)
    
    //Use variables
    boolean shift = ppisv.d();
    boolean space = ppisv.c();
    float forward = ppisv.b();
    float side = ppisv.a();
    Does anyone know how to specify the player where you want this information from? If you do, please add some code since I'm still a bit new to craftbukkit. Thank you for reading this post :).
     
  2. Offline

    RingOfStorms

    You will probably want to use something like protocollib in order to listen to packets and then read the steer packet.
     
  3. Offline

    KingOfAdventure

    First of all, thanks for the reply :).
    @AdamQpzm I want to make my custom ridable with wasd/space/shift controls. I'm currently using this tutorial : https://bukkit.org/threads/tutorial-1-7-5-wasd-entity-riding.163019/ .
    @RingOfStorms Thank you for the tip! It solved my problem :)

    For other users with the same problem:


    I found a way to use that event with protocol lib.

    For other people with the same troubles :

    Code:
    public class InputListener extends PacketAdapter{
    
    
      
        public InputListener(Plugin plugin, ListenerPriority listenerPriority,PacketType[] types) {
            super(plugin, listenerPriority, types);
        }
    
      
        @Override
        public void onPacketReceiving(PacketEvent event) {     
            if(event.getPacketType().equals(PacketType.Play.Client.STEER_VEHICLE)){
                PacketPlayInSteerVehicle ppisv = (PacketPlayInSteerVehicle) event.getPacket().getHandle();
              
                  
                //Usage ppisv
                boolean shift = ppisv.d();
                boolean space = ppisv.c();
                float forward = ppisv.b();
                float side = ppisv.a();
              
            }
        }
    }

    And in on enable
    Code:
    ProtocolLibrary.getProtocolManager().addPacketListener(new InputListener(this,  ListenerPriority.HIGHEST, new PacketType[]{PacketType.Play.Client.STEER_VEHICLE}));
     
  4. Offline

    rcth

    It's easy. Add LibsDisguises in your plugin (and your server ofcourse). Create a horse and disguise it as a minecart or something else.

    http://pastebin.com/P9as5FMY Example
     
  5. Offline

    KingOfAdventure

    Thanks for the idea @rcth, but I'm making something really complex. I can't use normal Minecraft entities for that (I'm making custom mobs with NMS). But thanks anyways :)!
     
Thread Status:
Not open for further replies.

Share This Page