Making Horses Swim

Discussion in 'Plugin Development' started by MistPhizzle, Jul 20, 2013.

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

    MistPhizzle

    Is it possible to allow horses to swim? I know Minecraft kicks you off the horse automatically when you enter deep water. Just wondering if it is possible. I haven't been able to figure out a workaround.

    Thanks in advance.
     
    GetGoodKid likes this.
  2. Offline

    GetGoodKid

    I would also like to know!
     
  3. Offline

    clienthax

    you would prob have to override the nms class that controls the behavior for the entity
     
  4. Offline

    DrMedia

    Code:
    [/FONT]
    [FONT=arial]HashMap<Entity, Block> blocks = new Map<Entity, Block>();[/FONT]
    [FONT=arial]@Override public void onEnable() { getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { @Override public void run() { World world = Bukkit.getWorld("world"); for (Entity e : world.getEntities()) {[/FONT]
    [FONT=arial]Block block = loc.[/FONT][FONT=arial]add(0, -1, 0).[/FONT][FONT=arial]getBlock();[/FONT][FONT=arial] if (e.getType() == EntityType.HORSE) {[/FONT]
    [FONT=arial] if(block.getType() == Material.Water){[/FONT]
    [FONT=arial] blocks.put(e, b);[/FONT]
    [FONT=arial] b.setType(Material.GLASS);[/FONT]
    [FONT=arial] } else if (blocks.containsKey(e) && block.getType() == Material.GLASS){[/FONT]
    [FONT=arial] blocks.remove(e);[/FONT]
    [FONT=arial] Block b = blocks.get(e);[/FONT]
    [FONT=arial] b.setType(Material.Water);[/FONT]
    [FONT=arial] }[/FONT]
    [FONT=arial] } } } }, 2, 2); }[/FONT]
    [FONT=arial]


    Maybe this would work? I didn't use and IDE so don't expect it to be error free and I also whipped it up in about 20 seconds.[/CODE][/FONT]
     
Thread Status:
Not open for further replies.

Share This Page