Increase Boat Speed

Discussion in 'Plugin Development' started by DogeDebugger, Feb 3, 2015.

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

    DogeDebugger

    I'm trying to simulate a car by manipulating boat velocity. Here's what i have:
    Code:
    @EventHandler
        public void move(VehicleMoveEvent event) {
            Vehicle car = event.getVehicle();
            if(car instanceof Boat) {   
                ((Boat) car).setMaxSpeed(100.0D);
                car.setVelocity(car.getVelocity().multiply(100.0D));
                ((Boat) car).setWorkOnLand(true);
            }
        }
    It doesn't work. Is there anything wrong with my code?
     
  2. Offline

    teej107

  3. Offline

    ReadySetPawn

    Didn't you just make a thread about this on the spigot forums?
     
  4. Offline

    DogeDebugger

    ik i did lol

    @teej107
    i had it broadcast the velocity, but its mostly gibberish:

    Code:
    :27 INFO]: 1.8372625146499533,0.0,-2.9378038878685953
    [21:24:27 INFO]: 1.83734697002483,0.0,-2.937751068939348
    [21:24:27 INFO]: 1.8559902996339668,0.0,0.0
    [21:24:33 INFO]: 0.0016151391145130358,0.0,-0.0011010716913464416
    [21:24:33 INFO]: 0.01958933027148263,0.0,-0.01335442676147965
    [21:24:33 INFO]: 0.19789245124710145,0.0,-0.13490712598155002
    [21:24:33 INFO]: 1.9634417462372924,0.0,-1.3385163574851053
    [21:24:33 INFO]: 2.8630093785099495,0.0,-1.9517690769857419
    [21:24:33 INFO]: 2.8630093785099495,0.0,-1.951769076985742
    [21:24:33 INFO]: 2.8630093785099495,0.0,-1.9517690769857423
    [21:24:33 INFO]: 2.8630093785099495,0.0,-1.9517690769857428
     
    Last edited by a moderator: Feb 5, 2015
  5. Offline

    teej107

  6. Offline

    DogeDebugger

    that didnt help much.

    Code:
    @EventHandler
        public void move(VehicleMoveEvent event) {
            Vehicle car = event.getVehicle();
            if(car instanceof Boat) {  
                ((Boat)car).setVelocity(car.getVelocity().multiply(10.0D));
                ((Boat) car).setOccupiedDeceleration(10.0D);
            }
        }
    @teej107
     
  7. Offline

    1Rogue

    The deceleration field just adds to the rate of deceleration (it defaults to -1). Setting it to 10 would make it stop 10 times faster. You'd either have to use NMS or keep trying with your velocity method I believe.
     
  8. Offline

    DogeDebugger

    that sucks. thanks for the tip tho.
    erm, have any idea what do do with the velocities? :]
    @1Rogue
     
Thread Status:
Not open for further replies.

Share This Page