Cars system

Discussion in 'Plugin Development' started by thewalkingplay, Jan 22, 2015.

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

    thewalkingplay

    Hi, i'm making a real life plugin and i need make a car system, my code:

    Code:
    package me.thewalkingplay.reallife.cars;
    
    import org.bukkit.entity.Minecart;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.vehicle.VehicleMoveEvent;
    import org.bukkit.util.Vector;
    
    import me.thewalkingplay.reallife.Plugin;
    import me.thewalkingplay.reallife.eventos.Events;
    
    public class Cars extends Events {
    
        public Cars(Plugin pl) {
            super(pl);
        }
      
        @EventHandler
        public void aoCarro(VehicleMoveEvent e) {
          
            if (e.getVehicle() instanceof Minecart) {
              
                Vector speed = e.getVehicle().getVelocity().multiply(10);
                Minecart m = (Minecart) e.getVehicle();
                m.setVelocity(speed);
              
              
              
            }
          
          
          
        }
      
    
    
    }
    My code make the minecart more faster, but the minecart don't run on blocks, what can i do?

    Sorry for my english, i'm brazilian
     
    Last edited: Jan 23, 2015
  2. Offline

    mine-care

    @thewalkingplayminecart is an entity, you can either customize its behavior (hard nms) or use velocities to force it move on ground too
     
Thread Status:
Not open for further replies.

Share This Page