CreakingHeart 5.46.0
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
public const LOAD_GRACE_TICKS = 20Ticks 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
public const TAG_CREAKING = "creaking"Methods
__construct()
public function __construct(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos)clearCreaking()
public function clearCreaking() : voidForgets the creaking (it crumbled, died or was replaced).
getCreaking()
public function getCreaking() : ?\pocketmine\entity\monster\CreakingReturns 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()
public function getCreakingUniqueId() : ?intgetOutputSignal()
public function getOutputSignal() : inthasCreaking()
public function hasCreaking() : boolReturns whether the heart has a creaking, even if it wasn't found (loaded) yet.
isBoundTo()
public function isBoundTo(\pocketmine\entity\monster\Creaking $creaking) : boolReturns whether the creaking is the one this heart summoned.
onBlockDestroyedHook() protected
protected function onBlockDestroyedHook() : voidreadSaveData()
public function readSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : voidsetCreaking()
public function setCreaking(\pocketmine\entity\monster\Creaking $creaking) : voidBinds a creaking to this heart (and the heart to the creaking).
tryStartHurtReaction()
public function tryStartHurtReaction(int $currentTick, int $cooldown) : boolStarts the hurt-reaction cooldown if it is over and returns whether the heart may react to a hit now.
writeSaveData() protected
protected function writeSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void