yup, I placed carpets on top of the fences so that I could jump in and out but the animals would stay in.
This seemed to have allowed rabbits to also jump out, but other animals remain trapped. But like I said before, this probably isn't a bug, just a consequence of a hopping personality of the rabbits 😛
Jonathan Hynes, they do escape if you have carpets on top of them. Other entities don't.
But that's probably because rabbits naturally jump around whereas pigs and cows don't unless they feel like they have to. So yeah, probably not a bug 🙂
After looking at the code I believe my initial guess was indeed correct.
Code extract from the pig class:
this.i.a(3, new ys(this, 1.0D)):
this.i.a(4, new aaf(this, 1.2D, amh.bY, false)):
this.i.a(4, new aaf(this, 1.2D, amh.bR, false)):
Code extract from the rabbit class:
this.i.a(2, new aaf(this, 1.0D, amh.bR, false));
this.i.a(3, new ys(this, 0.8D)):
"aaf" is the AI that determines that the entity should follow a player holding an specific item (Carrot on a stick and carrots for pigs, and just carrot for rabbits).
"ys" is the AI that makes the entity mate.
As you can see, the mating AI has a smaller priority (smaller means it gets executed first) than the follow AI on the pig,
But, on the rabbit, the follow AI has a smaller priority than the mating AI. Therefore the rabbit will attempt to follow before mating.
Okay so I tested it again, and the rabbits indeed are NOT teleporting. It seemed to me that they were because they were escaping from the fence pane I built. But they are scaring because they can jump higher than 1.5 blocks (which I'm guessing is an intended behaviour?).
So yeah, sorry about the wrong report, they do not teleport. Raising the fences another block high guarantees that the rabbits stay in.
The other problem is still valid though. They don't breed if there's anyone around holding a carrot.
If I were to guess what the problem is AI priority. The AI that determines if the rabbit should follow a player has higher priority than the one that says it should mate.
Same comment I made on #MC-68265:
After looking at the code I believe my initial guess was indeed correct.
Code extract from the pig class:
this.i.a(3, new ys(this, 1.0D)):
this.i.a(4, new aaf(this, 1.2D, amh.bY, false)):
this.i.a(4, new aaf(this, 1.2D, amh.bR, false)):
Code extract from the rabbit class:
this.i.a(2, new aaf(this, 1.0D, amh.bR, false));
this.i.a(3, new ys(this, 0.8D)):
"aaf" is the AI that determines that the entity should follow a player holding an specific item (Carrot on a stick and carrots for pigs, and just carrot for rabbits).
"ys" is the AI that makes the entity mate.
As you can see, the mating AI has a smaller priority (smaller means it gets executed first) than the follow AI on the pig,
But, on the rabbit, the follow AI has a smaller priority than the mating AI. Therefore the rabbit will attempt to follow before mating.