mojira.dev
MC-48616

All Mobs move extremely slowly in water

I tamed a group of dogs and then tried to go across a body of water on a boat. The dogs jumped in the water but almost couldn't move. They also never ported over to me as I moved away from them. I went 1000 blocks before I noticed they weren't following me. When I went back they were still stuck in the water where I first got on my boat. As a side note I've noticed most mobs moving slower than normal in water.


Comments from @unknown:
Tested in 14w34c. Please add this into the description. Maybe Mojang will fix this before the 1.8 release.

Testcase:
1. Set creative mode. Find a lake. Equip enough zombie spawn eggs and a sword.
2. Set survival mode. Set night.
3. Spawn a zombie and attract him into the water, by keeping the same direction of movement.
Observed behavior: The zombie moves with a reasonable speed (just a bit slower in the water)
4. Change the direction of movement.
Observed behavior: The zombie will change direction to follow the player and his movement speed becomes almost 0.


I made some research based on the latest Forge.

The problem is located in class EntityLivingBase method onLivingUpdate

Here is a pseudo-code:

/**onLivingUpdate is called frequently so the entity can update its state every tick as required.*/
call onLivingUpdate 
    if motionX < 0.005 set motionX = 0
    if motionY < 0.005 set motionY = 0
    if motionZ < 0.005 set motionZ = 0

    call moveEntityWithHeading(float strafe=0, float forward=0.0067620003)
        if entity is in water then set friction = 0.02
        call moveFlying(float strafe, float forward, float friction)
            motionX = motionX + something what depends on strafe forward friction
            motionZ = motionZ + something what depends on strafe forward friction
        end moveFlying
        // for a normal zombie which is turning in water, motionX and motionZ will be approximately 0.0045.
        // this value will be reset to 0 at the next onLivingUpdate call
        // therefore entities will never be able to speed up in water if they make the mistake to stop and turn around

        // moveEntity tries to move the entity by the passed in displacement
        call moveEntity(motionX, motionY, motionZ)
    end moveEntityWithHeading
end onLivingUpdate

Note: moveFlying is called always. The name chosen by Forge guys is misleading.

A friction value = 0.03 would solve the problem. To be tested with diagonal movement!!
On ground covered by snow, the friction is 0.23.
The "friction" name for this coeficient may also be misleading.
Another parameter with the same purpose is jumpMovementFactor (also 0.02). It is applied when the entity is jumping in the water and for a short time is above the water (if is a zombie, will burn a little bit)

Linked issues

MC-48331 Mobs when in water won't swim towards you but still track you when you lure them to yourself Resolved MC-48749 Mobs going too slow while in water (DUPLICATE) Resolved MC-48953 Animals get stuck in water Resolved MC-65225 Animals moving extremely slow in water Resolved MC-65500 Chickens move really slow on water Resolved

Comments 38

Daniel Goerner

I can confirm this. It takes a long time for (passive) mobs to cross a little stream.

My issue of this was marked confirmed, then they found out it was a dupe of this one, so unconfirmed it, and this issue isn't confirmed? Someone confirm this!

I think I noticed this with chickens in 14w21b. It was in one of those smallish lakes, and I decided to use a lead because it was TOO SLOW.

Still an issue in w28a.

Still in 14w29b. Please confirm.

28 more comments

Thank you, thank you, a year and a half of waiting for this moment.
ProfMobius is better than Dinnerbone. πŸ˜›

@unknown never worked on the ai for mobs, this has never been his department.
@unknown worked on this department since he's hired.
You can't say @unknown is worse because of this. πŸ˜›

please do not discuss a joke. What is important is repaired bug =)

Doesn't this bug still kinda exist? Mobs are way faster in water in release 1.7.4 than 15w45a or any later version.

Should I make a new bug report? Or should this be reopened?... Or should I suggest it as a feature on reddit or https://feedback.minecraft.net

It's very easy to notice when you see foxes hunting fish in water, how this bug is still in the game, altough not as severe.

Β 

And so I tested it in different versions.

14w05b (before the bug) : Zombie: 9.5 seconds to swim to the player

15w45a ("fix version"): Zombie: 18 seconds to swim to the player

Latest version: Zombie/Creeper: about ~15 seconds to the player in water (Zombies now sink to the bottom so I tested with Creepers too)

Matthew

migrated

Confirmed

animal, mob, movement, swimming

Minecraft 14w07a, Minecraft 14w29b, Minecraft 14w30c, Minecraft 14w31a, Minecraft 14w33c, ..., Minecraft 15w31c, Minecraft 15w32a, Minecraft 15w42a, Minecraft 15w43c, Minecraft 15w44a

Minecraft 15w45a

Retrieved