How to create a vehicle/spaceship

Discussion in 'Plugin Development' started by goodstuff20, Feb 8, 2013.

Thread Status:
Not open for further replies.
  1. I wanted to know if it was possible to create a vehicle (it can also be a boat - so no new shape) and if how.

    Hope someone knows...
     
  2. goodstuff20
    The only way of doing this besides a client mod is to move a huge set of blocks like movecraft does. However this creates a lot of lag and is really inefficient.
     
  3. Really?!? Even if its only one block?
     
  4. Offline

    evilmidget38

    goodstuff20 A single block wouldn't create an issue. If you're familiar with the plugin WorldEdit, you can compare it to that. Changing a few blocks generally has no noticeable change on your server, but if you were to change 100,000 blocks the server is generally going to lag.
     
  5. So if I only use one block as a vehicle & don't move too fast - and if it is then possible to create a vehicle - how?
     
  6. Offline

    MrTwiggy

    I think some people didn't understand what you were saying (or I am misunderstanding). If you want to use a boat or minecart, you can just keep track of it and then alter it's velocity based on player input, which shouldn't be too laggy (at least, not as laggy as using block changes to 'move' a giant ship)
     
  7. Ok - I'm rather new in bukkit - could you show me some pseudo code or real code pls?
     
  8. Offline

    Yukari

    Well, give some examples of when you'd want the minecart to do something.
     
  9. I would like to be able to drive the minecart/boat like a car(can be the same like a boat on the street)
     
  10. Offline

    Yukari

    You want the minecart to drive on land (without rails,) like a boat does, only faster?
     
  11. Yes - but it can also be a boat driving on land - to make the controls easier

    so does anybody know how to let a player controll a boat as a car (driving on the street)?
    Pseudo code is fine

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  12. Offline

    jayfella

    we arent going to code it for you. You show us YOUR code, we help you along the way.
     
  13. Offline

    microgeek

    >PlayerMoveEvent:
    >>Check if player is in boat
    >>>Change the boat's velocity based on the player's velocity
    >>>>Have a car?
     
  14. Thx micro geek - but I didn't quite get how to do the velocity
     
  15. Offline

    mastermustard

    im not all to certain if this will work but setWorkOnLand.setMaxSpeed()

    im 90% possitive that wont work so if it doesnt heres the api reference
    http://jd.bukkit.org/rb/doxygen/dc/dbd/interfaceorg_1_1bukkit_1_1entity_1_1Boat.html

    wait that wont work it would have to be

    Code:
    setWorkOnLand(true);
    setMaxSpeed(speed);
    youd need to replace "speed" with the speed of the boat

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  16. Thx master mustard
     
  17. Offline

    mastermustard

    tell me if that code bit i gave you doesnt work once you export your code out into a jar i like to know what things do or dont work
     
  18. Ok will do

    How do check if a player is inside a boat?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  19. Offline

    microgeek

    player.getVehicle() instanceof Boat
     
  20. Thx

    Um setWorkOnLand(true);

    Doesn't work

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  21. Offline

    mastermustard

    show me the code
     
  22. public void VehicleEnter(VehicleEnterEvent evt, Player player, Entity Boat) {
    if(player.getVehicle() instanceof Boat) {
    boolean setWorkOnLand(true);
    }
    }
     
  23. Offline

    mastermustard

    what are you trying to get it to do and if u want it to move on land youd need it to be VehicleMoveEvent (idk if thats an event but sumtin like that
     
  24. Ok thx - could you give me some code or something? (Just a question)
     
  25. And should it be the constructor or not (with void)?
     
Thread Status:
Not open for further replies.

Share This Page