EnderDragon Riding Help?

Discussion in 'Plugin Development' started by StaticJava, Nov 7, 2014.

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

    StaticJava

    Hey Bukkit,

    I'm using this tutorial: http://forums.bukkit.org/threads/tutorial-1-7-5-wasd-entity-riding.163019/ to ride on an EnderDragon for a minigame. However, I have one question. How can I make the EnderDragon have 3 passengers; one in the front, and two more; one on each wing?

    I only want the one passenger in the front to be able to control the EnderDragon.

    I think when using the tutorial above, I should set the controller to the passenger in the front, as the other 2 passengers shouldn't be able to control the EnderDragon.

    My custom entity class:

    Code:java
    1. package me.staticjava;
    2.  
    3. import net.minecraft.server.v1_7_R3.EntityEnderDragon;
    4. import net.minecraft.server.v1_7_R3.EntityHuman;
    5. import net.minecraft.server.v1_7_R3.EntityLiving;
    6. import net.minecraft.server.v1_7_R3.World;
    7. import org.bukkit.Bukkit;
    8.  
    9. /**
    10. * Created by StaticJava. Implemented from {[url]https://forums.bukkit.org/threads/tutorial-1-7-5-wasd-entity-riding.163019/}[/url].
    11. */
    12. public class CustomEntityEnderDragon extends EntityEnderDragon {
    13.  
    14. private String rider;
    15.  
    16. public CustomEntityEnderDragon(World world, String rider) {
    17. super(world);
    18. this.rider = rider;
    19. }
    20.  
    21. @Override
    22. public void e(float sideMot, float forMot) {
    23. if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
    24. super.e(sideMot, forMot);
    25. this.W = 0.5F;
    26. return;
    27. }
    28.  
    29. EntityHuman human = (EntityHuman) this.passenger;
    30. if (human.getBukkitEntity() != Bukkit.getPlayerExact(rider).getPlayer()) {
    31. super.e(sideMot, forMot);
    32. this.W = 0.5F;
    33. return;
    34. }
    35.  
    36. this.lastYaw = this.yaw = this.passenger.yaw;
    37. this.pitch = this.passenger.pitch * 0.5F;
    38.  
    39. this.b(this.yaw, this.pitch);
    40. this.aO = this.aM = this.yaw;
    41.  
    42. this.W = 1.0F;
    43.  
    44. sideMot = ((EntityLiving) this.passenger).bd * 0.5F;
    45. forMot = ((EntityLiving) this.passenger).be;
    46.  
    47. if (forMot <= 0.0F) {
    48. forMot *= 0.25F;
    49. }
    50.  
    51. sideMot *= 0.75F;
    52.  
    53. float speed = 0.40F;
    54. this.i(speed);
    55. super.e(sideMot, forMot);
    56. }
    57. }
    58.  


    Any help is appreciated!

    Thanks,
    StaticJava

    DSH105
     
  2. Offline

    Skionz

    StaticJava You can't really unless you constantly teleport the players or use vectors and velocity.
     
  3. Offline

    StaticJava

    Are you talking about the 2 guys on the wings? If so, do you have an idea of how this can be done?
     
  4. Offline

    Skionz

    StaticJava Yes the 2 guys on the wings. Use vectors or teleportation.
     
  5. Offline

    StaticJava

    Would you be able to aid me in using Vectors? What would I have to do?
     
  6. Offline

    Skionz

    StaticJava Not really. You would have to keep the players relative to the dragon probably by using a scheduler
     
  7. Offline

    TheCodingCat

    why dont you just stack the 2 players on top of the player in the middle xD.
     
  8. Offline

    StaticJava

    -.- Can't :/

    Skionz How would I do it via the Schedulers method? Would I be able to spawn an invisible entity and make the other 2 guys ride on those? If so, how would I make those entities move with respect to the enderdragon? Sent you a request on Skype if you wanna help there :p
     
  9. Offline

    TheCodingCat

    you can make a player ride a player who is riding a player who is riding an enderdragon StaticJava :-:
     
  10. Offline

    StaticJava

    I know, but I don't want to do that :p It would look extremely stupid.
    Maybe if I have 2 minecarts attached to the EnderDragon? Would that work?
     
  11. Offline

    Skionz

    StaticJava How would you attach the minecarts to the dragon?
     
  12. Offline

    StaticJava

    I thought of a new method. I will set the 2 players as a passenger of the main rider. This should work, but how would I edit the location of the 2 passengers? Do I have to use packets?
     
  13. Offline

    Skionz

    StaticJava I'm pretty sure you can't therefore you have to manipulate velocity
     
  14. Offline

    StaticJava

    Alright, but how do I do this... :/ If I choose to manipulate velocity, how do I do that and make sure it updates instantly as soon as the main rider changes velocity? Are you able to accept my Skype request?
     
  15. Offline

    Mysticate

    StaticJava Even if you can manage to manipulate their velocity, it'll look extremely glitchy and won't be very pretty. The easiest and most efficient method would be to do as TheCodingCat said.
     
  16. Offline

    EvilWitchdoctor

    I know it's been over a month since the last post here, but I think I found a decent solution for anyone still interested.
    If it is possible to set players riding No-AI bats (and I'm not sure that it is) then you could spawn the bats on the dragon's wings, give them permanent invisibility, and then update their velocity to match the dragon's every time you change the dragon's velocity. That should keep the players nicely on the bats and the bats nicely lined up...
     
    Last edited: Dec 25, 2014
    Skionz likes this.
  17. Offline

    ChipDev

    Well, I think the wings are different entities ;O
     
  18. Offline

    EvilWitchdoctor

    @ChipDev I didn't think of that, but yes that's true! You can get the separate parts of the dragon with
    Code:
    Iterator<ComplexEntityPart> pi = entity.getParts().iterator();
    And then go through through the CompledEnityPart iterator.
    I don't know which entity parts in the iterator represent the wings, but that's something that can be determined by testing or research.
     
Thread Status:
Not open for further replies.

Share This Page