Minecart rideable

Discussion in 'Spigot Plugin Development' started by iStokBroodje, Jun 24, 2016.

  1. Hi,

    I want to make a plugin that like the title said: Minecart rideable. So u can ride a minecart with the: WASD keys. Like you walk but than into a plugin. Don't know exactly with what kinda methods I can do this.

    Hopefully u guys can help me.

    Bye,
    iStokBroodje
     
  2. MiniDigger

    Supporter

    you need to make a custom entity and override the g method.
     
  3. I will try, thank you ;D.
     
  4. I've let him ride with the controls. But only now I need to make something like a Bumper Car so when you bump to another car, the car will go back 3 blocks.
    This is my code:

    Code (Text):
        @EventHandler
        public void onBeuk(VehicleCollisionEvent e) {
            Vehicle cart = e.getVehicle();
            Entity passenger = cart.getPassenger();
           
            if(!(passenger instanceof Player)) {
                return;
            }
           
            Player p = (Player) passenger;
           
            if((cart instanceof Minecart) && (cart.getCustomName().equalsIgnoreCase("botsauto"))) {
                Minecart car = (Minecart)cart;
           
                Vector vec = car.getVelocity();
                vec.setX(10);
                vec.setY(0);
                vec.setZ(10);
                car.setVelocity(vec);
            }
        }