The bug
Sitting child pets can teleport to their owner when they grow up but immediately appear sitting again afterwards.
How to reproduce
Spawn one wolf and tame it
Hold right click on the wolf while holding a wolf spawn egg to spawn baby wolves
Make all wolves sit
/entitydata @e[type=wolf] {Sitting:1b}
Move away from the wolves
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
is duplicated by 23
relates to 2
Comments 23
Confirmed in 18w05a.
@@unknown, That issue is MC-696, which involves pets teleporting when the player is attacked within a certain range.
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.
Appears to be confirmed by GenerikB's latest video.