Creating a simple car

Discussion in 'Plugin Development' started by ChintziSecilMC, Oct 10, 2015.

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

    ChintziSecilMC

    So i'm wanting to know how i could make it so that a mine cart or boat can move on land without rails/water, I've tried many ways but have not been the slightest successful in any, so i was wondering if anyone has some ideas on how i would go about doing this thnx.
     
  2. Offline

    teej107

    Have you tried this?
     
    ChintziSecilMC likes this.
  3. Offline

    ChintziSecilMC

    @teej107 no xD. how would i apply it?
     
  4. Offline

    Scimiguy

    @ChintziSecilMC
    With basic Java?

    1. Listen for player entering cart
    2. Use that method
    3. ???
     
  5. Offline

    Zombie_Striker

    @Scimiguy
    4. Profit

    But seriously, you would use it as such
    Code:
    //inside a runnable
    public void run(){
    for(Minecarts m : MineCartsThatMoveOnLand){
    if(m.getPassager() != null){//there is an entitiy inside it
    m.setDerailedVelocityMod(m.getPassager().getLocation().getDirection().multiplied(/*if you want it to go faster/slower*/));
    }
    }
    }
     
  6. Offline

    Scimiguy

    @Zombie_Striker
    Would you not use VehicleEnterEvent? Seems better performance than running something all the time
     
  7. Offline

    Zombie_Striker

    @Scimiguy
    But that would mean that it will only set the direction ONCE (when the player enters the minecart), meaning that it will only go in ONE direction, not where the player is looking. If you want it to continually go in any direction, you would need a runnable.
     
  8. Offline

    Hex_27

    @Zombie_Striker actually, you can listen for player move event. Moving the screen is considered a move event.
     
  9. Offline

    Zombie_Striker

    @Hex_27
    True, but doesn't the Modifier decrease? That would mean if the player does not move his head (because PlayerMoveEVent only gets fired when a player moves his head or WALKS (not rides)), it will only trigger once and as such the minecart would stop.
     
  10. Offline

    Hex_27

    @Zombie_Striker
    Nope, I did it with planes, it works fine. I did it with a moving minecart that travelled along the floor too, but it couldn't move up blocks, and I didn't use that way.
     
Thread Status:
Not open for further replies.

Share This Page