Stop zombies from entering water ?

Discussion in 'Plugin Development' started by ThunderWaffeMC, Jul 15, 2014.

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

    ThunderWaffeMC

    Hi! Quick question: Would it be possible to stop mobs from entering water by themselves? (for example; a zombie walking into water to get to a player). How would I do this?

    Thanks!
     
  2. Offline

    Zettelkasten

    Maybe you can use EntityTargetEvent and check if the zombie needs to go through water, but that would be pretty complicated.
     
    ThunderWaffeMC likes this.
  3. Offline

    mythbusterma

    ThunderWaffeMC

    You could try using BKCommonLib, which has an EntityMoveEvent that would be called, and then you could see if they move into water and then teleport them.
     
  4. Offline

    caderape

    or you can check the block where the player is, and if it's water, u add him to an arraylist and you cancel entitytarget for players in the arraylist.
     
  5. Offline

    mythbusterma

    caderape

    Won't stop entities from traveling though water to reach the Player, however.
     
  6. Offline

    ThunderWaffeMC

    Yes but if I were to teleport the entity, wouldn't it just go straight back to the water?

    There should be a way to change the path the entity takes to get to the target. Or maybe if the entity reaches water, keep walking around the water (which calculates the shortest distance to the target) until it reaches the target.
     
  7. Offline

    mythbusterma

    ThunderWaffeMC

    Yes it would, so your plugin would cause the entity to continuously try to run in to the water. You could try and write a path-finding algorithm and then re-implement the zombie class to a custom one so that it would use different path-finding behavior, however this would be quite a bit of work and would break quite a few other other plugins.
     
Thread Status:
Not open for further replies.

Share This Page