AgeLockTrait 5.47.0
Golden dandelion age lock of baby mobs (Bedrock minecraft:ageable pause_growth_items / reset_growth_items, Java AgeableMob): using a golden dandelion on a baby stops it from growing up (and makes it persistent), using another one lets it grow again. Both restart its growth from the beginning. A locked baby doesn't grow and feeding doesn't age it. After each use the dandelion can't be used on it for 2 seconds, while particles show above it.
For Mob subclasses: the using class restarts the growth in AgeLockTrait::restartGrowth() and stops growing while AgeLockTrait::isAgeLocked().
Constants
AGE_LOCK_COOLDOWN_TICKS
public const AGE_LOCK_COOLDOWN_TICKS = 40TAG_AGE_LOCKED
public const TAG_AGE_LOCKED = "AgeLocked"Methods
canBeAgeLocked() protected
protected function canBeAgeLocked() : boolReturns whether a golden dandelion can lock the age of this mob (Bedrock: the golden dandelion is in its pause_growth_items).
getAgeLockCooldown()
public function getAgeLockCooldown() : intReturns the ticks left before the golden dandelion can be used on this baby again.
isAgeLocked()
public function isAgeLocked() : boolReturns whether a golden dandelion stopped this baby from growing up.
isGoldenDandelion()
public static function isGoldenDandelion(\pocketmine\item\Item $item) : boolloadAgeLock() protected
protected function loadAgeLock(\pocketmine\nbt\tag\CompoundTag $nbt) : voidrestartGrowth() protected
abstract protected function restartGrowth() : voidMakes the baby start growing up again from the beginning.
saveAgeLock() protected
protected function saveAgeLock(\pocketmine\nbt\tag\CompoundTag $nbt) : voidsetAgeLocked()
public function setAgeLocked(bool $locked) : voidtickAgeLock() protected
protected function tickAgeLock(int $tickDiff) : voidShows the lock/unlock particles (one every other tick, as Java) and runs the cooldown down. Only called while AgeLockTrait::getAgeLockCooldown() is above 0.
tryUseGoldenDandelion() protected
protected function tryUseGoldenDandelion(\pocketmine\player\Player $player, \pocketmine\item\Item $item) : boolLocks or unlocks the age of this baby if the player uses a golden dandelion on it. Returns whether it did.
