How to make my 'car' go up blocks?

Discussion in 'Plugin Development' started by scarabcoder, Jun 8, 2014.

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

    scarabcoder

    I am developing a car plugin (with extra features from other car plugins), but I have NO IDEA how to do it. Here is the schedule I use to drive the car. It can drive correctly in the direction you look, but it can't go up blocks:
    Code:java
    1. Bukkit.getScheduler().scheduleAsyncRepeatingTask(this, new Runnable(){
    2.  
    3. @Override
    4. public void run() {
    5. if(car.getPassenger() != null){
    6. if(car.getPassenger() instanceof Player){
    7. Player p = (Player) car.getPassenger();
    8. if(p.hasPermission(new Permission("airwaves.usecar")) || (p.isOp())){
    9. Vector v = p.getLocation().getDirection();
    10. car.setVelocity(new Vector(v.getX() * 2, car.getVelocity().getY(), v.getZ() * 2));
    11. }
    12. }
    13. }
    14. }
    15.  
    16. }, 1,1);
     
  2. Offline

    Onlineids

    scarabcoder If you have no idea how to make the car plugin, you probably shouldn't be..
     
    Schaakmatth and Zupsub like this.
  3. Offline

    scarabcoder

    Onlineids It's a custom car plugin... But could someone at least tell me how, a bit??
     
  4. Offline

    Onlineids

  5. Offline

    Regablith

    Onlineids You don't have to be such a dick, he's asking for help.
     
    Aengo likes this.
  6. Offline

    scarabcoder

    Onlineids Okay okay... I just could find ANYTHING ANYWHERE on it at all, so I would like to know at least a bit how.
     
  7. Offline

    Onlineids

    Regablith The problem is if I tell him how to make it he learns nothing, if you weren't so caught up in being a dick yourself and speed reading you would realize that.
     
  8. Onlineids People don't come to this subforum and post because they know how to do something. Saying you'll only help people that know how to do what they're doing makes no sense, because if they knew, they wouldn't be here in the first place.
    I agree that one should not paste in some code for him so he can copy and paste it into his program, but this is a topic for helping. If you're not going to provide SOME level of assistance here, I'd suggest you get out.
     
  9. Offline

    Gater12

  10. Offline

    Onlineids

    xYourFreindx You forgot this is also a forum, for discussing -_-
     
  11. Offline

    scarabcoder

    Onlineids Yes, but how else would I learn? I've tried so many different methods, and none of them work.
     
  12. Onlineids That's why it was a suggestion. Because the attitude you showed previously suggests that removing yourself really is the best option. At least for this thread.
     
    TCO_007 likes this.
  13. Offline

    teej107

    scarabcoder Well to be honest, the fact that the car can't go up blocks makes it realistic. What is the car exactly? a minecart?
     
  14. Offline

    bubba1234119

    Make it so when it collides with a block you set the velocity upwards to 1.
     
  15. Offline

    TCO_007

    Also, if it is a vehicle like a boat that when it hits a block at a high speed it breaks, you need to make sure it doesnt break by cancelling that event. I believe you would have to do that anyways XD
     
  16. Offline

    scarabcoder

    teej107 Yeah it's a Minecart. Though I would at least like it to go up stairs, like a ramp.

    Gater12 There's nothing there... Maybe Bukkit.org blocks videos?
    bubba1234119 I was thinking of that, but I have no way of checking if it collided with a block. EDIT: Wait, there's vehicle collide with block event! Great, let's see if that works.
    TCO_007 Ah... I didn't think of that. Great idea!

    UPDATE: I found out how to do it. For those also wondering, I used VehicleBlockCollisionEvent, and just have it make the minecart go up by setting the y velocity to 0.25. It works now!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
Thread Status:
Not open for further replies.

Share This Page