TrialSpawnerData 5.47.0
The fight state of a trial spawner (vanilla TrialSpawnerStateData): the players taking part, the mobs it spawned that are still alive (by persistent entity ID), how many it spawned, and its timers.
The timers are server ticks while the spawner is loaded; they are saved as the ticks left (PocketMine has no world age), so a cooldown only runs while the spawner's chunk is loaded.
Constants
TAG_COOLDOWN_TICKS_LEFT
public const TAG_COOLDOWN_TICKS_LEFT = "pm_cooldown_ticks_left"Ticks left before the cooldown ends (PocketMine; vanilla saves the end time as cooldown_end_at).
TAG_CURRENT_MOBS
public const TAG_CURRENT_MOBS = "current_mobs"TAG_NEXT_MOB_SPAWN_TICKS
public const TAG_NEXT_MOB_SPAWN_TICKS = "pm_next_mob_spawn_ticks"Ticks left before the next mob may spawn (PocketMine; vanilla saves next_mob_spawns_at).
TAG_REGISTERED_PLAYERS
public const TAG_REGISTERED_PLAYERS = "registered_players"TAG_SELECTED_LOOT_TABLE
public const TAG_SELECTED_LOOT_TABLE = "selected_loot_table"TAG_SPAWN_DATA
public const TAG_SPAWN_DATA = "spawn_data"TAG_TOTAL_MOBS_SPAWNED
public const TAG_TOTAL_MOBS_SPAWNED = "total_mobs_spawned"Properties
$cooldownEndsAt
public int $cooldownEndsAt$currentMobs
public array $currentMobs$detectedPlayers
public array $detectedPlayers$ejectingLootTable
public ?string $ejectingLootTable$nextMobSpawnsAt
public int $nextMobSpawnsAt$nextSpawnData
public ?\pocketmine\block\trialspawner\TrialSpawnerSpawnData $nextSpawnData$totalMobsSpawned
public int $totalMobsSpawnedMethods
countAdditionalPlayers()
public function countAdditionalPlayers() : intAdditional players beyond the first one (the mob counts grow with them).
hasFinishedSpawningAllMobs()
public function hasFinishedSpawningAllMobs(\pocketmine\block\trialspawner\TrialSpawnerConfig $config, int $additionalPlayers) : boolhaveAllCurrentMobsDied()
public function haveAllCurrentMobsDied() : boolisCooldownFinished()
public function isCooldownFinished(int $now) : boolisReadyToEjectItems()
public function isReadyToEjectItems(int $now, int $timeBetweenEjections, int $targetCooldownLength) : boolisReadyToOpenShutter()
public function isReadyToOpenShutter(int $now, int $delayBeforeOpen, int $targetCooldownLength) : boolisReadyToSpawnNextMob()
public function isReadyToSpawnNextMob(int $now, \pocketmine\block\trialspawner\TrialSpawnerConfig $config, int $additionalPlayers) : boolreadSaveData()
public function readSaveData(\pocketmine\nbt\tag\CompoundTag $nbt, int $now) : voidreset()
public function reset() : voidForgets the fight and the mob to spawn (the spawner goes back to waiting for players).
resetAfterBecomingOminous()
public function resetAfterBecomingOminous(int $now, \pocketmine\block\trialspawner\TrialSpawnerConfig $ominousConfig) : voidRestarts the fight with the ominous config (vanilla resetAfterBecomingOminous): the mobs spawned so far are forgotten, the mob to spawn is picked again from the ominous config, and the first ominous item spawner comes after TrialSpawnerConfig::getTicksBetweenItemSpawners() (during a fight, the cooldown end is the time of the next item spawner). The players taking part stay.
resetStatistics()
public function resetStatistics() : voidtakeRewardedPlayer()
public function takeRewardedPlayer() : ?stringRemoves and returns one of the players still waiting for a reward, or null.
writeSaveData()
public function writeSaveData(\pocketmine\nbt\tag\CompoundTag $nbt, int $now) : void