The Golden Dandelion is a new type of flower that can be used to stop baby mobs from aging. However, its current behavior resets the age of an affected mob instead of freezing the age tick timer, resulting in baby mobs taking their full time to grow into adults instead of the time since the Golden Dandelion was used on them.
Expected result:
Feeding a baby mob a Golden Dandelion should stop its negaitve age counter from ticking up from the value it was fed.
Actual result:
Feeding a baby mob a Golden Dandelion resets its age to its lowest possible value and stops it from ticking up.
Attachments
Comments 4
This behavior also occurs when summoning a mob via commands with an age lower than the default for baby mobs:
This behavior stems from its implementation found in the mobInteract method within AgeableMob.class
protected InteractionResult mobInteract(final Player player, final InteractionHand hand) {
ItemStack itemInHand = player.getItemInHand(hand);
if (itemInHand.getItem() == Items.GOLDEN_DANDELION && this.isBaby() && this.ageLockParticleTimer == 0 && !this.is(EntityTypeTags.CANNOT_BE_AGE_LOCKED)) {
this.setAgeLocked(!this.isAgeLocked());
this.setAge(-24000);
this.ageLockParticleTimer = 40;
itemInHand.consume(1, player);
this.level().playSound((Entity)null, this.blockPosition(), this.isAgeLocked() ? SoundEvents.GOLDEN_DANDELION_USE : SoundEvents.GOLDEN_DANDELION_UNUSE, SoundSource.PLAYERS, 1.0F, 1.0F);
return InteractionResult.SUCCESS;
} else {
return super.mobInteract(player, hand);
}
}In the code, this.setAge(-24000) is explicitly called.
Thank you for helping us improve Minecraft! We saved your files: