mojira.dev
MC-186335

Bees age calculation inside hive/nest is broken

When a bee exits a hive/nest, its new age is calculated something like:

new_age = old_age + TicksInHive * 20;
    if (new_age > 0){new_age = 0;}

That makes bees grow 20 times faster than it should when are babies, and always set adult bees age (breeding cooldown) to 0.

 

video: https://www.youtube.com/watch?v=73KonEmlZ9M

20w22a code:

[media]

It seems that ageUp() input has to be some sort of time in seconds rather than ticks to work properly, but just that doesn't solve the bug for adult bees.

 

My fix proposal:

[media]

 

Almost forgot: ticksInHive stops counting when reaches MinOccupationTicks (+1, because of a <= or something), so if bees stay longer than MinOccupationTicks inside the nest for any reason (night, rain), they wouldn't grow the amount they should. To fix this, ticksInHive has to keep increasing regardless of whether it surpasses MinOccupationTicks, or just stop it when equals the bee's Age (-Age when its a baby/negative age).

 

Edit: seems it has been fixed already, great 😃 I'm a bit worried with my suggestion about ticksInHive stop counting when equals the bee's Age. When the Age value is less than MinOccupationTicks this can lead to bees getting stuck inside its hive, because ticksInHive not reaching MinOccupationTicks. The real limit for ticksInHive should be:

Math.max(MinOccupationTicks,Math.abs(old_Age))

 

 

(its weird having an InLove timer and an Age timer when both are the same thing, positive Ages and negative Ages. Just forget about InLove timer)

 

Linked issues

Attachments

Comments 3

Relates to MC-166135. Fix was implemented incorrectly.

Confirmed. Bacy bees don't grow instantly in nests/hives, but they do grow within a minute.

If I understand correctly from the description and video, bees are growing 20 times faster in hives than outside of hives? (because the time is set to ticks and not seconds?)

FACS01

coschevi

Confirmed

Important

Mob behaviour

Age, Beehive, Breeding, bee

20w22a

1.16 Pre-release 1

Retrieved