Skip to content

TrialSpawnerData 5.47.0 ​

final class · pocketmine\block\trialspawner\TrialSpawnerData · source

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 ​

php
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 ​

php
public const TAG_CURRENT_MOBS = "current_mobs"

TAG_NEXT_MOB_SPAWN_TICKS ​

php
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 ​

php
public const TAG_REGISTERED_PLAYERS = "registered_players"

TAG_SELECTED_LOOT_TABLE ​

php
public const TAG_SELECTED_LOOT_TABLE = "selected_loot_table"

TAG_SPAWN_DATA ​

php
public const TAG_SPAWN_DATA = "spawn_data"

TAG_TOTAL_MOBS_SPAWNED ​

php
public const TAG_TOTAL_MOBS_SPAWNED = "total_mobs_spawned"

Properties ​

$cooldownEndsAt ​

php
public int $cooldownEndsAt

$currentMobs ​

php
public array $currentMobs

$detectedPlayers ​

php
public array $detectedPlayers

$ejectingLootTable ​

php
public ?string $ejectingLootTable

$nextMobSpawnsAt ​

php
public int $nextMobSpawnsAt

$nextSpawnData ​

php
public ?\pocketmine\block\trialspawner\TrialSpawnerSpawnData $nextSpawnData

$totalMobsSpawned ​

php
public int $totalMobsSpawned

Methods ​

countAdditionalPlayers() ​

php
public function countAdditionalPlayers() : int

Additional players beyond the first one (the mob counts grow with them).

hasFinishedSpawningAllMobs() ​

php
public function hasFinishedSpawningAllMobs(\pocketmine\block\trialspawner\TrialSpawnerConfig $config, int $additionalPlayers) : bool

haveAllCurrentMobsDied() ​

php
public function haveAllCurrentMobsDied() : bool

isCooldownFinished() ​

php
public function isCooldownFinished(int $now) : bool

isReadyToEjectItems() ​

php
public function isReadyToEjectItems(int $now, int $timeBetweenEjections, int $targetCooldownLength) : bool

isReadyToOpenShutter() ​

php
public function isReadyToOpenShutter(int $now, int $delayBeforeOpen, int $targetCooldownLength) : bool

isReadyToSpawnNextMob() ​

php
public function isReadyToSpawnNextMob(int $now, \pocketmine\block\trialspawner\TrialSpawnerConfig $config, int $additionalPlayers) : bool

readSaveData() ​

php
public function readSaveData(\pocketmine\nbt\tag\CompoundTag $nbt, int $now) : void

reset() ​

php
public function reset() : void

Forgets the fight and the mob to spawn (the spawner goes back to waiting for players).

resetAfterBecomingOminous() ​

php
public function resetAfterBecomingOminous(int $now, \pocketmine\block\trialspawner\TrialSpawnerConfig $ominousConfig) : void

Restarts 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() ​

php
public function resetStatistics() : void

takeRewardedPlayer() ​

php
public function takeRewardedPlayer() : ?string

Removes and returns one of the players still waiting for a reward, or null.

writeSaveData() ​

php
public function writeSaveData(\pocketmine\nbt\tag\CompoundTag $nbt, int $now) : void

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.