Raid 5.46.0
A raid on a village (Bedrock rules, see https://minecraft.wiki/w/Raid):
- it starts when the Raid Omen of a player in the village runs out; the red "Raid" bar charges for 15 seconds while the village bells ring, then the first wave comes, and 15 seconds pass between waves;
- each wave (
RaidWaves) spawns at once on a free spot at the edge of the village (up to 64 blocks from its centre horizontally, 16 vertically) with the raid horn; illagers, witches and ravagers already within 96 blocks join it; raiders walk to the village centre and attack villagers, players and iron golems; - the bar shows the raiders left in the wave (and their number once fewer than 3 remain), for players within 64 blocks horizontally and 44 vertically of the centre;
- when the last wave is defeated, players who killed a raider get Hero of the Village (40 minutes) and villagers celebrate; when the village stops being a village (beds gone, or all its villagers dead) the raiders win and celebrate; after 48000 ticks (or when the difficulty is set to peaceful) the raid expires.
Waves only progress while a player is near the village (the raiders would be in unloaded chunks otherwise); the expiry time keeps running.
Constants
BAR_RANGE_HORIZONTAL
public const BAR_RANGE_HORIZONTAL = 64.0BAR_RANGE_VERTICAL
public const BAR_RANGE_VERTICAL = 44.0END_TICKS
public const END_TICKS = 600HERO_DURATION
public const HERO_DURATION = 48000HORN_INTERVAL
public const HORN_INTERVAL = 600JOIN_RANGE
public const JOIN_RANGE = 96.0LEAVE_RANGE
public const LEAVE_RANGE = 112.0MAX_TICKS
public const MAX_TICKS = 48000PREPARE_TICKS
public const PREPARE_TICKS = 300SPAWN_RANGE_HORIZONTAL
public const SPAWN_RANGE_HORIZONTAL = 64SPAWN_RANGE_VERTICAL
public const SPAWN_RANGE_VERTICAL = 16Methods
__construct()
public function __construct(int $id, \pocketmine\math\Vector3 $center, int $omenLevel, int $difficulty, bool $hadVillagers)addHero()
public function addHero(\pocketmine\player\Player $player) : voidcheckVillage()
public function checkVillage(\pocketmine\world\World $world) : boolReturns whether the village still stands (and remembers its beds for the villagers to hide in).
countRaiders()
public function countRaiders(\pocketmine\world\World $world, bool $leaveFar = false) : intCounts the living raiders of this raid in the world; with $leaveFar, raiders too far from the village (or in another world) leave the raid.
end()
public function end(\pocketmine\world\World $world, \pocketmine\world\raid\RaidStatus $status) : voidEnds the raid: shows the result on the bar, rewards the heroes or makes the raiders celebrate.
findSpawnSpot()
public function findSpawnSpot(\pocketmine\world\World $world) : ?\pocketmine\math\Vector3Finds where a wave spawns: a free spot on any block but leaves or scaffolding, at the edge of the village if possible, at most 64 blocks away horizontally and 16 vertically.
finish()
public function finish(\pocketmine\world\World $world) : voidCalled when the result has been shown long enough, or when the raid is dropped.
fromArray()
public static function fromArray(array $data) : ?selfgetBeds()
public function getBeds() : arraygetBossBar()
public function getBossBar() : \pocketmine\world\raid\RaidBossBargetCenter()
public function getCenter() : \pocketmine\math\Vector3getCooldown()
public function getCooldown() : intTicks before the next wave, or -1 while a wave is being fought.
getHeroes()
public function getHeroes() : arraygetId()
public function getId() : intgetMountedRiders()
public function getMountedRiders() : intgetOmenLevel()
public function getOmenLevel() : intgetRaidersAlive()
public function getRaidersAlive() : intgetStatus()
public function getStatus() : \pocketmine\world\raid\RaidStatusgetTicks()
public function getTicks() : intgetTotalWaves()
public function getTotalWaves() : intgetWave()
public function getWave() : intNumber of waves spawned so far.
isInBarRange()
public function isInBarRange(\pocketmine\math\Vector3 $pos) : boolWhether the position is close enough to the centre to see the raid bar.
isOngoing()
public function isOngoing() : boolonRaiderDeath()
public function onRaiderDeath(?\pocketmine\player\Player $killer) : voidCalled when a raider of this raid dies.
setBeds()
public function setBeds(array $beds) : voidsetCooldown()
public function setCooldown(int $ticks) : voidChanges the wait before the next wave (only between waves).
spawnNextWave()
public function spawnNextWave(\pocketmine\world\World $world, array $players) : voidSpawns the next wave. If no spawn spot is found, the wave is skipped (Bedrock).
tick()
public function tick(\pocketmine\world\World $world) : boolCalled every tick by the RaidManager. Returns false when the raid is over and can be forgotten.
toArray()
public function toArray() : arraytryMountRider()
public static function tryMountRider(\pocketmine\entity\monster\Ravager $ravager, \pocketmine\entity\Living $rider) : boolHook for ravager riders (a pillager or an evoker on some ravagers of waves 5 and 7). Returns whether the rider was mounted; if not, it raids on foot next to the ravager.
