RaiderTrait 5.46.0
Implementation of Raider. The using class must call RaiderTrait::loadRaiderData(), RaiderTrait::saveRaiderData(), RaiderTrait::syncRaiderData() and RaiderTrait::registerRaiderGoals() from initEntity(), saveNBT(), syncNetworkData() and registerGoals().
Captains wear the ominous banner in the chest armor slot, which is where Bedrock puts it (Java uses the head).
Methods
canBePatrolLeader()
public function canBePatrolLeader() : boolcanDespawn()
public function canDespawn() : boolRaiders taking part in a raid never despawn until the raid is over (vanilla).
getPatrolTarget()
public function getPatrolTarget() : ?\pocketmine\math\Vector3getRaidCenter()
public function getRaidCenter() : ?\pocketmine\math\Vector3getRaidId()
public function getRaidId() : ?intgetRaidWave()
public function getRaidWave() : intgetRaiderDrops() protected
protected function getRaiderDrops() : arrayExtra drops of a captain: its ominous banner, and an ominous bottle of a random level (Bad Omen I-V) when it was killed by a player outside a raid (1.21+; captains no longer give Bad Omen directly).
isCelebrating()
public function isCelebrating() : boolisPatrolLeader()
public function isPatrolLeader() : boolisPatrolling()
public function isPatrolling() : booljoinRaid()
public function joinRaid(int $raidId, int $wave, \pocketmine\math\Vector3 $center) : voidleaveRaid()
public function leaveRaid() : voidloadRaiderData() protected
protected function loadRaiderData(\pocketmine\nbt\tag\CompoundTag $nbt) : voidonDeath() protected
protected function onDeath() : voidregisterRaiderGoals() protected
protected function registerRaiderGoals(int $movePriority, int $targetPriority, bool $victimsOutsideRaids) : voidAdds the patrol and raid goals: walking with the patrol or to the raided village at $movePriority, and attacking the raid victims (Raider::isRaidVictim()) within 16 blocks, always (vanilla illagers and ravagers) or only while raiding (witches).
saveRaiderData() protected
protected function saveRaiderData(\pocketmine\nbt\tag\CompoundTag $nbt) : voidsetCelebrating()
public function setCelebrating(bool $celebrating) : voidsetPatrolLeader()
public function setPatrolLeader(bool $leader) : voidsetPatrolTarget()
public function setPatrolTarget(?\pocketmine\math\Vector3 $target) : voidsetPatrolling()
public function setPatrolling(bool $patrolling) : voidsyncRaiderData() protected
protected function syncRaiderData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void