Skip to content

CreakingHeart 5.46.0 ​

class · pocketmine\block\tile\CreakingHeart · source

Extends Tile

Block entity of a creaking heart: remembers the creaking the heart summoned (by its persistent UniqueID, like the vanilla heart remembers its creaking's UUID) and the hurt-reaction cooldown. The creaking remembers the heart's position (Creaking::getHeartPosition()).

Constants ​

LOAD_GRACE_TICKS ​

php
public const LOAD_GRACE_TICKS = 20

Ticks after loading during which a saved creaking that wasn't found yet is still waited for (vanilla: 20). Its chunk may load a little later than the heart's.

TAG_CREAKING ​

php
public const TAG_CREAKING = "creaking"

Methods ​

__construct() ​

php
public function __construct(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos)

clearCreaking() ​

php
public function clearCreaking() : void

Forgets the creaking (it crumbled, died or was replaced).

getCreaking() ​

php
public function getCreaking() : ?\pocketmine\entity\monster\Creaking

Returns the heart's creaking if it is loaded. A saved creaking still missing after LOAD_GRACE_TICKS is forgotten (vanilla), so the heart can summon another one; if it loads later it crumbles (no longer bound).

getCreakingUniqueId() ​

php
public function getCreakingUniqueId() : ?int

getOutputSignal() ​

php
public function getOutputSignal() : int

hasCreaking() ​

php
public function hasCreaking() : bool

Returns whether the heart has a creaking, even if it wasn't found (loaded) yet.

isBoundTo() ​

php
public function isBoundTo(\pocketmine\entity\monster\Creaking $creaking) : bool

Returns whether the creaking is the one this heart summoned.

onBlockDestroyedHook() protected ​

php
protected function onBlockDestroyedHook() : void

readSaveData() ​

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

setCreaking() ​

php
public function setCreaking(\pocketmine\entity\monster\Creaking $creaking) : void

Binds a creaking to this heart (and the heart to the creaking).

tryStartHurtReaction() ​

php
public function tryStartHurtReaction(int $currentTick, int $cooldown) : bool

Starts the hurt-reaction cooldown if it is over and returns whether the heart may react to a hit now.

writeSaveData() protected ​

php
protected function writeSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.