Skip to content

Creaking 5.46.0 ​

class · pocketmine\entity\monster\Creaking · source

Extends Monster

Creaking (Bedrock values, creaking.json): 1 health, 0.9x2.7, movement 0.4, attack 3 every 2 seconds.

  • Neutral: strolls slowly until a player within 12 blocks looks at it (120 degree field of view), who becomes its target (minecraft:looked_at, set_target "once_and_keep_scanning").
  • Hostile: frozen in place while any player within 24 blocks (not wearing a carved pumpkin) looks at it; when nobody looks it walks to its target and attacks it.
  • Calms down when its target is gone or more than 24 blocks away.
  • Its state ("minecraft:creaking_state") and the sway after a hit ("minecraft:creaking_swaying_ticks", 1 to 6 then reset) are synced to the client as actor properties.

A creaking summoned by a creaking heart ("spawned_by_creaking_heart") remembers the heart's position (NBT "home_pos", like Java) and the heart remembers it (TileCreakingHeart):

  • It takes no damage except from the void and /kill-style suicide damage; a hit only makes it sway, and a hit by a player makes the heart react (CreakingHeart::onCreakingHurt()). It is fire proof and never despawns.
  • It crumbles (bark particles and death sound, despawns without drops or experience) by day or when more than 34 blocks from its heart, unless it has a name tag; the heart then summons another one when it can. It also crumbles when its heart no longer knows it (heart replaced, or it forgot a creaking that wasn't loaded in time).
  • When the heart is broken it twitches for 2.25 seconds, then crumbles. A creaking spawned by a player (spawn egg, summon) has none of this and dies from its single health point.

Not implemented: the heart's 32 block home restriction on movement (a creaking going farther than 34 blocks just crumbles and is replaced), crumbling after sharing a block with a player for 5 seconds, player-spawned creakings avoiding damage blocks and taking lava damage.

Constants ​

ACTIVATION_RANGE ​

php
public const ACTIVATION_RANGE = 12.0

ATTACK_COOLDOWN ​

php
public const ATTACK_COOLDOWN = 40

ATTACK_DAMAGE ​

php
public const ATTACK_DAMAGE = 3.0

FIELD_OF_VIEW ​

php
public const FIELD_OF_VIEW = 120.0

HEART_DESPAWN_DISTANCE ​

php
public const HEART_DESPAWN_DISTANCE = 34.0

home_distance above which a heart-bound creaking crumbles

MAX_SWAYING_TICKS ​

php
public const MAX_SWAYING_TICKS = 6

creaking_swaying_ticks goes from 1 to this, then back to 0 (it sways for exactly 5 ticks)

OBSERVATION_RANGE ​

php
public const OBSERVATION_RANGE = 24.0

STATE_CRUMBLING ​

php
public const STATE_CRUMBLING = 4

STATE_HOSTILE_OBSERVED ​

php
public const STATE_HOSTILE_OBSERVED = 1

STATE_HOSTILE_UNOBSERVED ​

php
public const STATE_HOSTILE_UNOBSERVED = 2

STATE_NEUTRAL ​

php
public const STATE_NEUTRAL = 0

STATE_TWITCHING ​

php
public const STATE_TWITCHING = 3

TAG_HOME_POS ​

php
public const TAG_HOME_POS = "home_pos"

TWITCH_TICKS ​

php
public const TWITCH_TICKS = 45

minecraft:twitching timer: 2.25 seconds

Methods ​

attack() ​

php
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : void

attackMelee() ​

php
public function attackMelee(\pocketmine\entity\Living $target, float $baseDamage) : bool

canDespawn() ​

php
public function canDespawn() : bool

crumble() ​

php
public function crumble() : void

Makes the creaking crumble: bark particles and death sound, then it despawns without drops (minecraft:crumble).

entityBaseTick() protected ​

php
protected function entityBaseTick(int $tickDiff = 1) : bool

getHeartPosition() ​

php
public function getHeartPosition() : ?\pocketmine\math\Vector3

Returns the position of the creaking heart that summoned this creaking, or null if it wasn't summoned by one.

getHeartTile() ​

php
public function getHeartTile() : ?\pocketmine\block\tile\CreakingHeart

Returns the heart's block entity if its chunk is loaded and it still has this creaking.

getInitialSizeInfo() protected ​

php
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfo

getName() ​

php
public function getName() : string

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

getPickedItem() ​

php
public function getPickedItem() : ?\pocketmine\item\Item

getState() ​

php
public function getState() : int

getSwayingTicks() ​

php
public function getSwayingTicks() : int

getXpDropAmount() ​

php
public function getXpDropAmount() : int

initEntity() protected ​

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

isFireProof() ​

php
public function isFireProof() : bool

isFrozen() ​

php
public function isFrozen() : bool

Returns whether the creaking can't move or attack (minecraft:immobile: watched, twitching or crumbling).

isHeartBound() ​

php
public function isHeartBound() : bool

Returns whether the creaking was summoned by a creaking heart (and is protected by it).

registerGoals() protected ​

php
protected function registerGoals() : void

saveNBT() ​

php
public function saveNBT() : \pocketmine\nbt\tag\CompoundTag

setHeartPosition() ​

php
public function setHeartPosition(?\pocketmine\math\Vector3 $pos) : void

Ties the creaking to the creaking heart at the given position. Use TileCreakingHeart::setCreaking() to bind both sides.

startTwitching() ​

php
public function startTwitching() : void

Makes the creaking twitch for Creaking::TWITCH_TICKS ticks, then crumble (its heart was broken).

syncNetworkData() protected ​

php
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void

tryChangeMovement() protected ​

php
protected function tryChangeMovement() : void

updateLookedAt() ​

php
public function updateLookedAt() : void

Updates the creaking's state from who is looking at it (looked_at_cooldown 0.1 s: called every 2 ticks).

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