Rather, they simply can't pass through. I know notch was too lazy to do this, but after seeing that you can make fireballs destroy blocks in the same way dragons do (yay meteors) I figured it might be fun to have a way for dragons to NOT horrifically ruin your terrain. If no-one does this, I'll do it myself eventually, I'm just a little busy atm :3
Wait.. did codename_B just ask for someone else to make a simple plugin for him O_O... something is going on here!
Ok let me do this in a few minutes Code: public class main extends JavaPlugin implements Listener{ @Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); } @EventHandler public void dr (EntityExplodeEvent e) { if(e.getEntity() instanceof EnderDragon) { e.setCancelled(true); }}} EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Eh well I'm working on homework right now ;P so I can't multitask that much brain power to this lawl. Maybe later if no one else does it.
I still plan on doing this in 10 lines, I'm still working on homework (I took about a 4 hours break cleaning the house x.x) so I'll get to it sooner or later.
I was thinking more of rewriting the move method of the dragon to give them the ability to "nest" on blocks. See the tutorial on overriding mob behaviour.
Without an entityMoveEvent this has got to be alot harder that it sounds. I remeber a plugin in which you could ride a dragon to a set location, maybe its worth looking that up and checking out the code. Im sure the dragon would avoid mountains and stuff in the way. EDIT: here it is http://dev.bukkit.org/server-mods/dragontravel/ Since the player is riding the dragon maybe they used the player move event. im just guessing
Time to give this a go https://dl.dropbox.com/u/51143191/DragonBlock.jar Done. Source (https://github.com/Husky--/DragonBlock) HAH, don't worry about that, my code is retarded. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Awww. You need to give this amateur codename_b some help, and you failed! Seems like this is harder than everyone thought.
Theres no entitymoveevent, so i had to work off playermoveevent, then check if there was a dragon nearby the player, then if its location was null, if it was teleport it to the players y coord. Seemed to turn out all the cows went flying when an enderdragon came near!
Code: getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { public void Run(){ for(World world : getServer().getWorlds()){ for(Entity entity : world.getEntities()){ if(entity.getType().equals(EntityType.EnderDragon){ if(entity.getBlock().getType().equals(Material.AIR) == false){ event.setCancelled(true); } } } } } }, 0L, 1L)
that was my original idea. Download : https://dl.dropbox.com/u/51143191/Dragon.jar Source : https://github.com/Husky--/DragonBlock EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Wouldn't that cause massive lag? Every time you or anyone moves, it would start a new repeating task, which would stack up and eventually freeze the server?