mojira.dev
MC-257540

Sheep eat half as often as they did before 21w39a

I was experimenting with an automated wool farm where the limiting factor is the rate at which sheep eat grass to regrow wool, and found the rates were about half of what I had expected.

Investigating, I found that when 21w39a started evaluating goals every other tick instead of every tick, the 1/1000 chance of adult sheep eating (and the 1/50 chance of baby sheep eating) was not adjusted with reducedTickDelay like it seems other chance-based goal activation was. The result is that sheep now eat only half as often as they did before 21w39a.

The specific code in question is in net.minecraft.world.entity.ai.goal.EatBlockGoal:

public boolean canUse() {
        if (this.mob.getRandom().nextInt(this.mob.isBaby() ? 50 : 1000) != 0) {
            return false;
        }

which has remained unchanged since 1.14.4 (I haven't checked earlier versions). I compare this to, for example, the chance for pandas to sneeze, which changed like this in 21w39a to maintain the previous chances:

if (!this.panda.isBaby() || !this.panda.canPerformAction()) {
                 return false;
             }
-            if (this.panda.isWeak() && this.panda.random.nextInt(500) == 1) {
+            if (this.panda.isWeak() && this.panda.random.nextInt(PandaSneezeGoal.reducedTickDelay(500)) == 1) {
                 return true;
             }
-            return this.panda.random.nextInt(6000) == 1;
+            return this.panda.random.nextInt(PandaSneezeGoal.reducedTickDelay(6000)) == 1;
         }

 

Attachments

Comments 1

Can confirm with testing the same in-game farm between 1.17.1 and 1.21.5 pre release 2.

The farm ensures there is grass to eat every game tick, where it consumes one bonemeal/shear use = 1 eat, allowing to determine what tick cycle the sheep is on.

World Download:

[media]


There is five different methods to verify the bug exists with this design.

  1. Baby sheep grow time. (fastest to check since /tick sprint didn’t exist yet)

  2. Baby sheep bonemeal consumption rate (count up all missing bonemeal divide by time

  3. Adult sheep wool production rates (# of wool/time passed)

  4. Adult sheep bonemeal consumption rate (count up all missing bonemeal divide by time)

  5. Checking which dispensers are doing the work for bonemeal-ing/shearing

How to test yourself:

  1. Download attached world file containing the farm located in the end next to the fountain.

  2. Load the world in whatever version you want to test (pre-21w39a or post-21w39a)

  3. Check before each test run (of any the 5 testing methods) that:

    1. There is no sheep already in the farm (remove it if so)

    2. No wool in the output barrel (remove it if so)

    3. All bonemeal chests are fully stocked

    4. Shear dispensers are filled with all brand new shears (if doing #5 method)

    5. There is a grass block with a short grass block on top

  4. Flip the lever to turn on the farm, you should hear very fast and loud clicking occurring on every game tick (20 times/sec).

  5. Press a button on one of the command block to place a sheep into the cell. ONLY HAVE ONE SHEEP IN FARM NO MORE since it will break otherwise.

  6. Observe and record the data based on your selected method of measurement.

  7. Remove the sheep from existence at end of test before turning off farm to unsure data is correct (or count up when /tick freeze is active).

Test results:
Not to leave my pc running for 10 hours to get average wool rates, only documenting baby sheep. But from designing a better (different) wool farm on 1.21.5 pre release 2, I can confirm the rates align near perfectly with sheep eating every 2nd gt, instead of the the expected every tick (so my rates got cut in half 😞 from this bug).

1.17.1 rates:

Time to grow up

bonemeal consumed

Bonemeal use rate (per sec)

Dispensers Used

1:26

5+2+8+4=19

0.22

4/4

1:15

4+6+3+6=19

0.253…

4/4

1:23

4+7+1+7=19

0.23

4/4

1:15

4+2+7+6=19

0.253…

4/4

1.21.5 pre release 2 rates:

Time to grow up

bonemeal consumed

Bonemeal use rate (per sec)

Dispensers Used

2:01

9+9+0+0=18

0.149

2/4

2:07

0+0+9+9=18

0.142

2/4

2:08

9+9+0+0=18

0.141

2/4

1:58

12+7+0+0=19

0.161

2/4

Note that this was with the regular {Age:-24000}, like if you were to breed two sheep. The longer you set this to be, the bigger the difference will be between the two tables (since 1 eat = -10% of remaining time).

It is not the same two dispensers that is doing all the work for every sheep, but it is always a set of dispensers that are set 2 game ticks apart, never ones with 1 game tick difference.

TLDR: Wool farms are twice as slow post 21w39a with (natural base game) baby sheep taking 54% longer to grow up (average fraction of the data above).

[media][media]

Anomie X

(Unassigned)

Plausible

Platform

Normal

Mob behaviour

1.19.2, 22w45a

25w32a

Retrieved