mojira.dev
MC-28440

Sitting child pets teleporting to owner when growing up

The bug

Sitting child pets can teleport to their owner when they grow up but immediately appear sitting again afterwards.

How to reproduce

  1. Spawn one wolf and tame it

  2. Hold right click on the wolf while holding a wolf spawn egg to spawn baby wolves

  3. Make all wolves sit

    /entitydata @e[type=wolf] {Sitting:1b}
  4. Move away from the wolves

  5. Change their age so they will grow up rather fast

    /entitydata @e[type=wolf] {Age:-100}

    → Some wolves teleported to you

Code analysis

Based on 1.12 decompiled using MCP 9.40 PRE 1

It looks like the method net.minecraft.entity.Entity.setSize(float, float) is indirectly causing this since it is calling the method net.minecraft.entity.Entity.moveEntity(MoverType, double, double, double) without a downwards motion. This causes the onGround field to be set to false which then causes the EntityAISit task to be reset.

Calling that method with the default gravity downwards motion (if the entity has gravity enabled) might result in unexpected behavior. Instead the onGround value could be restored or only motion values could be set, but this could result in different behavior as well.

Linked issues

MC-31166 puppy dogs teleport to player when grown up Resolved MC-36007 Wolf/Dog Teleports to owner when it Grows up/ages Resolved MC-56383 Bug with pets that have been bred Resolved MC-61504 Dogs teleporting Resolved MC-61979 Sitting dogs teleport upon aging Resolved

Comments 23

Appears to be confirmed by GenerikB's latest video.

Confirmed.

Patrick Spencer

This isn't a bug, it's Cat Fancy Home Delivery Service! Duh! XD

This affects me on 1.7.2.

Confirming this for 1.7.4. I was branch mining and suddenly one of my dogs was in the mine.

13 more comments

Confirmed in 18w05a.

@@unknown, That issue is MC-696, which involves pets teleporting when the player is attacked within a certain range.

Maarten de Vuijst

Recently started a Survival game in Minecraft Java 1.12.2 Vanilla
Summoned two wolves (cheats activated via game opening to LAN), which I tamed and bred, creating a young pup. All were told to sit down, so as not to disturb me in my farms.
While working my farms, circa 20 levels down from the dogs, suddenly one of the dogs appeared sitting next to me. As there are still two dogs in the original location, my guess is that the young pup, upon reaching adulthood, teleported to me while still being commanded to sit down.

As the expected behaviour is that the pup, on reaching adulthood, will continue to be at the original location if told to sit down, this would count as a bug.

This can be useful if you have a large pack of tamed wolves and you breed all of them a certain period of time before entering a dangerous area. Once they mature, they will all be down in the caves with you. But, I'd rather just have this fixed.

This is still present in 1.13.2

Can't reproduce in 1.15 pre-1, is this still an issue?

Keenan Lee

(Unassigned)

Confirmed

Mob behaviour

baby, cat, dog, ocelot, pet, sitting, teleport, wolf

Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 1.7.1, Minecraft 1.7.2, Minecraft 1.7.4, ..., Minecraft 18w31a, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 1.14 Pre-Release 5, Minecraft 1.14

Retrieved