Flying mount mod?

Discussion in 'Archived: Plugin Requests' started by turtlelord, Nov 2, 2011.

  1. Offline

    turtlelord

    Any chance of a flying mount plugin?
    basically just magic carpet, but replace the square glass with a dragon or a phoenix? o.o
    sure it wouldnt work too well, or be effective at all, but it would be awesomeee!
     
  2. Offline

    Kierrow

    i could throw that together for you once a stable build for 1.9 is out.
    it should actually be kinda easy and i love the idea ;)
     
  3. Offline

    turtlelord

    you tried it without the 50 line limit aswell i hope? :p
     
  4. Of course, the finished one (when a RB for 1.9 comes out ;)) will have more than 50 lines, too (for example to remove a players dragon when the player logs off while flying) ;)
     
  5. Offline

    Technius

    Easy? You sure? Enderdragons move randomly when you get on them. How are you going to control the dragon? Move it towards where you're looking at? How are you even going to make it move towards where you're looking at? onTimerTick? Might cause lag.

    *Sorry for the offensive nature of this post. I just had to say something*
     
  6. Offline

    turtlelord

    nononoi was thinking just a dragon shaped magiccarpet :) or other shapes too
    you could limit certain shapes like phoenixes to mods etc :D
     
  7. Offline

    Kierrow

    no, you're of course absolutely right, i was just saying that i like the idea.
    of course this would be glitchy, but what can you do? I'm going to definitely try this out.
     
  8. need code which does this?
    Show Spoiler
    Code:java
    1. package de.V10lator.RideThaDragon;
    2.  
    3. import java.util.HashMap;
    4. import java.util.Map.Entry;
    5.  
    6. import org.bukkit.Location;
    7. import org.bukkit.Server;
    8. import org.bukkit.command.Command;
    9. import org.bukkit.command.CommandSender;
    10. import org.bukkit.entity.CreatureType;
    11. import org.bukkit.entity.LivingEntity;
    12. import org.bukkit.entity.Player;
    13. import org.bukkit.event.Event;
    14. import org.bukkit.event.player.PlayerListener;
    15. import org.bukkit.event.player.PlayerMoveEvent;
    16. import org.bukkit.plugin.java.JavaPlugin;
    17.  
    18. public class RideThaDragon extends JavaPlugin
    19. {
    20. private final HashMap<String, LivingEntity> dragons = new HashMap<String, LivingEntity>();
    21. public void onEnable()
    22. {
    23. Server s = getServer();
    24. s.getScheduler().scheduleSyncRepeatingTask(this, new DragonControl(), 1L, 1L);
    25. s.getLogger().info("[RideThaDragon] enabled!");
    26. }
    27. public void onDisable()
    28. {
    29. Server s =getServer();
    30. s.getScheduler().cancelTasks(this);
    31. for(LivingEntity dragon: dragons.values())
    32. {
    33. dragon.eject();
    34. dragon.remove();
    35. }
    36. s.getLogger().info("[RideThaDragon] disabled!");
    37. }
    38. public boolean onCommand(CommandSender sender, Command command,
    39. String label, String[] args)
    40. {
    41. if(!(sender instanceof Player) || !sender.hasPermission("dragon.ride"))
    42. return true;
    43. Player player = (Player)sender;
    44. String pn = player.getName();
    45. if(dragons.containsKey(pn))
    46. {
    47. LivingEntity dragon = dragons.get(pn);
    48. dragon.eject();
    49. dragon.remove();
    50. dragons.remove(pn);
    51. }
    52. else
    53. {
    54. LivingEntity dragon = player.getWorld().spawnCreature(player.getLocation(), CreatureType.ENDER_DRAGON);
    55. dragons.put(player.getName(), dragon);
    56. dragon.setPassenger(player);
    57. }
    58. return true;
    59. }
    60. private class DragonControl implements Runnable
    61. {
    62. public void run()
    63. {
    64. Server s = getServer();
    65. for(Entry<String, LivingEntity> e: dragons.entrySet())
    66. {
    67. String pn = e.getKey();
    68. Player player = s.getPlayerExact(pn);
    69. LivingEntity dragon = e.getValue();
    70. if(player == null || !player.isOnline())
    71. {
    72. dragon.remove();
    73. dragons.remove(pn);
    74. continue;
    75. }
    76. Location ploc = player.getEyeLocation();
    77. Location dloc = dragon.getLocation();
    78. dloc.setPitch(ploc.getPitch());
    79. dloc.setYaw(ploc.getYaw());
    80. dragon.setVelocity(dloc.getDirection());
    81. }
    82. }
    83. }
    84. }
    85.  
    If you have any improvements I would be happy to get them. :)
     
  9. Offline

    Kierrow

    sry, wont be trying to do that as of right now.
    i'm busy preparing my server for 1.9 - writing plugins and stuff... and school...

    however, if i have any time after 1.9, i'll be happy to take a look at your code :)
     
  10. Offline

    Technius

    Thanks, I didn't think of a Runnable.

    You're right, it's really buggy and weird.

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

Share This Page