PocketMine-MP 5.14.2 git-50e2c469a547a16a23b2dc691e70a51d34e29395
pocketmine\block\BaseSign Class Reference
+ Inheritance diagram for pocketmine\block\BaseSign:
+ Collaboration diagram for pocketmine\block\BaseSign:

Public Member Functions

 __construct (BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, WoodType $woodType, \Closure $asItemCallback)
 
 __clone ()
 
 __toString ()
 
 addVelocityToEntity (Entity $entity)
 
 asItem ()
 
 blocksDirectSkyLight ()
 
 burnsForever ()
 
 calculateIntercept (Vector3 $pos1, Vector3 $pos2)
 
 canBeFlowedInto ()
 
 canBePlaced ()
 
 canBePlacedAt (Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock)
 
 canBeReplaced ()
 
 canClimb ()
 
 collidesWithBB (AxisAlignedBB $bb)
 
 describeBlockItemState (RuntimeDataDescriber $w)
 
 generateStatePermutations ()
 
 getAffectedBlocks ()
 
 getAllSides ()
 
 getBreakInfo ()
 
 getCollisionBoxes ()
 
 getDrops (Item $item)
 
 getDropsForCompatibleTool (Item $item)
 
 getDropsForIncompatibleTool (Item $item)
 
 getEditorEntityRuntimeId ()
 
 getEnchantmentTags ()
 
 getFlameEncouragement ()
 
 getFlammability ()
 
 getFrictionFactor ()
 
 getFuelTime ()
 
 getHorizontalSides ()
 
 getIdInfo ()
 
 getLightFilter ()
 
 getLightLevel ()
 
 getMaxStackSize ()
 
 getModelPositionOffset ()
 
 getName ()
 
 getPickedItem (bool $addUserData=false)
 
 getPosition ()
 
 getSide (int $side, int $step=1)
 
 getSilkTouchDrops (Item $item)
 
 getStateId ()
 
 getSupportType (int $facing)
 
 getText ()
 
 getTypeId ()
 
 getTypeTags ()
 
 getXpDropForTool (Item $item)
 
 hasEntityCollision ()
 
 hasSameTypeId (Block $other)
 
 hasTypeTag (string $tag)
 
 isAffectedBySilkTouch ()
 
 isFireProofAsItem ()
 
 isFlammable ()
 
 isFullCube ()
 
 isSameState (Block $other)
 
 isSolid ()
 
 isTransparent ()
 
 isWaxed ()
 
 onAttack (Item $item, int $face, ?Player $player=null)
 
 onBreak (Item $item, ?Player $player=null, array &$returnedItems=[])
 
 onEntityInside (Entity $entity)
 
 onEntityLand (Entity $entity)
 
 onIncinerate ()
 
 onInteract (Item $item, int $face, Vector3 $clickVector, ?Player $player=null, array &$returnedItems=[])
 
 onNearbyBlockChange ()
 
 onPostPlace ()
 
 onProjectileHit (Projectile $projectile, RayTraceResult $hitResult)
 
 onRandomTick ()
 
 onScheduledUpdate ()
 
 place (BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player=null)
 
 position (World $world, int $x, int $y, int $z)
 
 readStateFromWorld ()
 
 setEditorEntityRuntimeId (?int $editorEntityRuntimeId)
 
 setText (SignText $text)
 
 setWaxed (bool $waxed)
 
 ticksRandomly ()
 
 updateText (Player $author, SignText $text)
 
 writeStateToWorld ()
 

Public Attributes

const EMPTY_STATE_ID = (BlockTypeIds::AIR << self::INTERNAL_STATE_DATA_BITS) | (-7482769108513497636 & self::INTERNAL_STATE_DATA_MASK)
 
const INTERNAL_STATE_DATA_BITS = 11
 
const INTERNAL_STATE_DATA_MASK = ~(~0 << self::INTERNAL_STATE_DATA_BITS)
 

Protected Member Functions

 describeBlockOnlyState (RuntimeDataDescriber $w)
 
 getAdjacentSupportType (int $facing)
 
 getSupportingFace ()
 
 getXpDropAmount ()
 
 recalculateCollisionBoxes ()
 

Protected Attributes

array $collisionBoxes = null
 
int $editorEntityRuntimeId = null
 
string $fallbackName
 
BlockIdentifier $idInfo
 
Position $position
 
SignText $text
 
BlockTypeInfo $typeInfo
 

Detailed Description

Definition at line 48 of file BaseSign.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\block\BaseSign::__construct ( BlockIdentifier  $idInfo,
string  $name,
BlockTypeInfo  $typeInfo,
WoodType  $woodType,
\Closure  $asItemCallback 
)
Parameters

Closure() : Item $asItemCallback

Definition at line 62 of file BaseSign.php.

Member Function Documentation

◆ __clone()

pocketmine\block\Block::__clone ( )
inherited

Definition at line 128 of file Block.php.

◆ __toString()

pocketmine\block\Block::__toString ( )
inherited
Returns
string

Definition at line 832 of file Block.php.

◆ addVelocityToEntity()

pocketmine\block\Block::addVelocityToEntity ( Entity  $entity)
inherited

Returns a direction vector describing which way an entity intersecting this block should be pushed. This is used by liquids to push entities in liquid currents.

The returned vector is summed with vectors from every other block the entity is intersecting, and normalized to produce a final direction vector.

WARNING: This will not be called if Block::hasEntityCollision() does not return true!

Reimplemented in pocketmine\block\Liquid.

Definition at line 880 of file Block.php.

◆ asItem()

pocketmine\block\BaseSign::asItem ( )

Returns the block as an item. Block-only state such as facing, powered/unpowered, open/closed, etc., is discarded. Block-item state such as colour, wood type, etc. is preserved. Complex state properties stored in the tile data (e.g. inventory) are discarded.

Reimplemented from pocketmine\block\Block.

Definition at line 271 of file BaseSign.php.

◆ blocksDirectSkyLight()

pocketmine\block\Block::blocksDirectSkyLight ( )
inherited

Returns whether this block blocks direct sky light from passing through it. This is independent from the light filter value, which is used during propagation.

In most cases, this is the same as isTransparent(); however, some special cases exist such as leaves and cobwebs, which don't have any additional effect on light propagation, but don't allow direct sky light to pass through.

Reimplemented in pocketmine\block\Cobweb, and pocketmine\block\Leaves.

Definition at line 571 of file Block.php.

◆ burnsForever()

pocketmine\block\Block::burnsForever ( )
inherited

Returns whether fire lit on this block will burn indefinitely.

Reimplemented in pocketmine\block\Bedrock, pocketmine\block\Magma, and pocketmine\block\Netherrack.

Definition at line 745 of file Block.php.

◆ calculateIntercept()

pocketmine\block\Block::calculateIntercept ( Vector3  $pos1,
Vector3  $pos2 
)
inherited

Performs a ray trace along the line between the two positions using the block's collision boxes. Returns the intersection point closest to pos1, or null if no intersection occurred.

Definition at line 959 of file Block.php.

◆ canBeFlowedInto()

pocketmine\block\Block::canBeFlowedInto ( )
inherited

Returns whether this block can be destroyed by liquid flowing into its cell.

Reimplemented in pocketmine\block\Flowable, pocketmine\block\Liquid, and pocketmine\block\UnderwaterTorch.

Definition at line 598 of file Block.php.

◆ canBePlaced()

pocketmine\block\Block::canBePlaced ( )
inherited

Returns whether this block can be placed when obtained as an item.

Reimplemented in pocketmine\block\Air, and pocketmine\block\UnknownBlock.

Definition at line 407 of file Block.php.

◆ canBePlacedAt()

pocketmine\block\Block::canBePlacedAt ( Block  $blockReplace,
Vector3  $clickVector,
int  $face,
bool  $isClickedBlock 
)
inherited

Returns whether this block can replace the given block in the given placement conditions. This is used to allow slabs of the same type to combine into double slabs.

Reimplemented in pocketmine\block\Candle, pocketmine\block\Light, pocketmine\block\PinkPetals, pocketmine\block\SeaPickle, pocketmine\block\Slab, and pocketmine\block\WaterLily.

Definition at line 422 of file Block.php.

◆ canBeReplaced()

pocketmine\block\Block::canBeReplaced ( )
inherited

Returns whether this block can be replaced by another block placed in the same position.

Reimplemented in pocketmine\block\Air, pocketmine\block\BaseFire, pocketmine\block\DoubleTallGrass, pocketmine\block\GlowLichen, pocketmine\block\Light, pocketmine\block\Liquid, pocketmine\block\SnowLayer, and pocketmine\block\Vine.

Definition at line 414 of file Block.php.

◆ canClimb()

pocketmine\block\Block::canClimb ( )
inherited

Returns whether entities can climb up this block.

Reimplemented in pocketmine\block\CaveVines, pocketmine\block\Ladder, pocketmine\block\NetherVines, and pocketmine\block\Vine.

Definition at line 605 of file Block.php.

◆ collidesWithBB()

pocketmine\block\Block::collidesWithBB ( AxisAlignedBB  $bb)
inherited

Returns whether any of the block's collision boxes intersect with the given AxisAlignedBB.

Definition at line 839 of file Block.php.

References pocketmine\math\AxisAlignedBB\intersectsWith().

+ Here is the call graph for this function:

◆ describeBlockItemState()

pocketmine\block\Block::describeBlockItemState ( RuntimeDataDescriber  $w)
inherited

Describes properties of this block which apply to both the block and item form of the block. Examples of suitable properties include colour, skull type, and any other information which IS kept when the block is mined or block-picked.

The method implementation must NOT use conditional logic to determine which properties are written. It must always write the same properties in the same order, regardless of the current state of the block.

Reimplemented in pocketmine\block\AmethystCluster, pocketmine\block\Anvil, pocketmine\block\Dirt, pocketmine\block\Froglight, pocketmine\block\Light, pocketmine\block\MobHead, pocketmine\block\RedMushroomBlock, pocketmine\block\Sponge, pocketmine\block\TNT, pocketmine\block\UnknownBlock, and pocketmine\block\Wood.

Definition at line 299 of file Block.php.

Referenced by pocketmine\block\Block\__construct().

+ Here is the caller graph for this function:

◆ describeBlockOnlyState()

pocketmine\block\Block::describeBlockOnlyState ( RuntimeDataDescriber  $w)
protectedinherited

Describes properties of this block which apply only to the block form of the block. Examples of suitable properties include facing, open/closed, powered/unpowered, on/off, and any other information which IS NOT kept when the block is mined or block-picked.

The method implementation must NOT use conditional logic to determine which properties are written. It must always write the same properties in the same order, regardless of the current state of the block.

Reimplemented in pocketmine\block\Anvil, pocketmine\block\Bamboo, pocketmine\block\BambooSapling, pocketmine\block\Barrel, pocketmine\block\Bed, pocketmine\block\Bedrock, pocketmine\block\Bell, pocketmine\block\BigDripleafHead, pocketmine\block\BrewingStand, pocketmine\block\Button, pocketmine\block\Cake, pocketmine\block\Candle, pocketmine\block\CaveVines, pocketmine\block\ChiseledBookshelf, pocketmine\block\CocoaBlock, pocketmine\block\DaylightSensor, pocketmine\block\DetectorRail, pocketmine\block\Door, pocketmine\block\DoublePitcherCrop, pocketmine\block\DoublePlant, pocketmine\block\EndPortalFrame, pocketmine\block\Farmland, pocketmine\block\FenceGate, pocketmine\block\FillableCauldron, pocketmine\block\FloorCoralFan, pocketmine\block\Furnace, pocketmine\block\GlowLichen, pocketmine\block\Hopper, pocketmine\block\ItemFrame, pocketmine\block\Lantern, pocketmine\block\Leaves, pocketmine\block\Lectern, pocketmine\block\Lever, pocketmine\block\Liquid, pocketmine\block\MobHead, pocketmine\block\NetherPortal, pocketmine\block\PinkPetals, pocketmine\block\Rail, pocketmine\block\RedstoneComparator, pocketmine\block\RedstoneLamp, pocketmine\block\RedstoneRepeater, pocketmine\block\RedstoneTorch, pocketmine\block\Sapling, pocketmine\block\SeaPickle, pocketmine\block\ShulkerBox, pocketmine\block\SimplePressurePlate, pocketmine\block\Slab, pocketmine\block\SmallDripleaf, pocketmine\block\SnowLayer, pocketmine\block\Stair, pocketmine\block\Stem, pocketmine\block\StraightOnlyRail, pocketmine\block\TNT, pocketmine\block\Torch, pocketmine\block\TorchflowerCrop, pocketmine\block\Trapdoor, pocketmine\block\Tripwire, pocketmine\block\TripwireHook, pocketmine\block\Vine, pocketmine\block\Wall, and pocketmine\block\WallCoralFan.

Definition at line 311 of file Block.php.

Referenced by pocketmine\block\Block\__construct().

+ Here is the caller graph for this function:

◆ generateStatePermutations()

pocketmine\block\Block::generateStatePermutations ( )
inherited

Generates copies of this Block in all possible state permutations. Every possible combination of known properties (e.g. facing, open/closed, powered/unpowered, on/off) will be generated.

@phpstan-return \Generator<int, Block, void, void>

Definition at line 322 of file Block.php.

◆ getAdjacentSupportType()

pocketmine\block\Block::getAdjacentSupportType ( int  $facing)
protectedinherited

Definition at line 945 of file Block.php.

◆ getAffectedBlocks()

pocketmine\block\Block::getAffectedBlocks ( )
inherited

Returns a list of blocks that this block is part of. In most cases, only contains the block itself, but in cases such as double plants, beds and doors, will contain both halves.

Returns
Block[]

Reimplemented in pocketmine\block\Bed, pocketmine\block\Door, pocketmine\block\DoublePlant, and pocketmine\block\SmallDripleaf.

Definition at line 825 of file Block.php.

◆ getAllSides()

pocketmine\block\Block::getAllSides ( )
inherited

Returns the six blocks around this block.

Returns
Block[]|\Generator @phpstan-return \Generator<int, Block, void, void>

Definition at line 807 of file Block.php.

◆ getBreakInfo()

pocketmine\block\Block::getBreakInfo ( )
inherited

Returns an object containing information about the destruction requirements of this block.

Definition at line 456 of file Block.php.

◆ getCollisionBoxes()

pocketmine\block\Block::getCollisionBoxes ( )
finalinherited

Returns an array of collision bounding boxes for this block. These are used for:

  • entity movement collision checks (to ensure entities can't clip through blocks)
  • projectile flight paths
  • block placement (to ensure the player can't place blocks inside itself or another entity)
  • anti-cheat checks in plugins
Returns
AxisAlignedBB[]

Definition at line 909 of file Block.php.

◆ getDrops()

pocketmine\block\Block::getDrops ( Item  $item)
inherited

◆ getDropsForCompatibleTool()

pocketmine\block\Block::getDropsForCompatibleTool ( Item  $item)
inherited

Returns an array of Items to be dropped when the block is broken using the correct tool type.

Returns
Item[]

Reimplemented in pocketmine\block\AmethystCluster, pocketmine\block\BaseBanner, pocketmine\block\BaseCoral, pocketmine\block\BaseFire, pocketmine\block\Beetroot, pocketmine\block\BlueIce, pocketmine\block\Bookshelf, pocketmine\block\BrownMushroomBlock, pocketmine\block\BuddingAmethyst, pocketmine\block\Cake, pocketmine\block\CakeWithCandle, pocketmine\block\Candle, pocketmine\block\Carrot, pocketmine\block\CaveVines, pocketmine\block\ChiseledBookshelf, pocketmine\block\ChorusPlant, pocketmine\block\Clay, pocketmine\block\CoalOre, pocketmine\block\Cobweb, pocketmine\block\CocoaBlock, pocketmine\block\CopperOre, pocketmine\block\CoralBlock, pocketmine\block\DiamondOre, pocketmine\block\DoublePitcherCrop, pocketmine\block\EmeraldOre, pocketmine\block\EnderChest, pocketmine\block\Farmland, pocketmine\block\FlowerPot, pocketmine\block\GildedBlackstone, pocketmine\block\Glass, pocketmine\block\GlassPane, pocketmine\block\Glowstone, pocketmine\block\GoldOre, pocketmine\block\Grass, pocketmine\block\GrassPath, pocketmine\block\Gravel, pocketmine\block\Ice, pocketmine\block\InfestedStone, pocketmine\block\IronOre, pocketmine\block\ItemFrame, pocketmine\block\Jukebox, pocketmine\block\LapisOre, pocketmine\block\Leaves, pocketmine\block\Liquid, pocketmine\block\Melon, pocketmine\block\MonsterSpawner, pocketmine\block\MushroomStem, pocketmine\block\Mycelium, pocketmine\block\NetherGoldOre, pocketmine\block\NetherQuartzOre, pocketmine\block\NetherReactor, pocketmine\block\NetherVines, pocketmine\block\NetherWartPlant, pocketmine\block\PackedIce, pocketmine\block\PinkPetals, pocketmine\block\Podzol, pocketmine\block\Potato, pocketmine\block\RedMushroomBlock, pocketmine\block\RedstoneOre, pocketmine\block\Sculk, pocketmine\block\SeaLantern, pocketmine\block\SeaPickle, pocketmine\block\ShulkerBox, pocketmine\block\Slab, pocketmine\block\SmallDripleaf, pocketmine\block\Snow, pocketmine\block\SnowLayer, pocketmine\block\Stem, pocketmine\block\SweetBerryBush, and pocketmine\block\Wheat.

Definition at line 643 of file Block.php.

Referenced by pocketmine\block\HangingRoots\getDropsForIncompatibleTool().

+ Here is the caller graph for this function:

◆ getDropsForIncompatibleTool()

pocketmine\block\Block::getDropsForIncompatibleTool ( Item  $item)
inherited

Returns the items dropped by this block when broken with an incorrect tool type (or tool with a too-low tier).

Returns
Item[]

Reimplemented in pocketmine\block\AmethystCluster, pocketmine\block\DeadBush, pocketmine\block\DoubleTallGrass, and pocketmine\block\HangingRoots.

Definition at line 652 of file Block.php.

◆ getEditorEntityRuntimeId()

pocketmine\block\BaseSign::getEditorEntityRuntimeId ( )

Sets the runtime entity ID of the player editing this sign. Only this player will be able to edit the sign. This is used to prevent multiple players from editing the same sign at the same time, and to prevent players from editing signs they didn't place.

Definition at line 232 of file BaseSign.php.

◆ getEnchantmentTags()

pocketmine\block\Block::getEnchantmentTags ( )
inherited

Returns tags that represent the type of item being enchanted and are used to determine what enchantments can be applied to the item of this block during in-game enchanting (enchanting table, anvil, fishing, etc.).

See also
ItemEnchantmentTags
ItemEnchantmentTagRegistry
AvailableEnchantmentRegistry
Returns
string[]

Definition at line 469 of file Block.php.

◆ getFlameEncouragement()

◆ getFlammability()

◆ getFrictionFactor()

pocketmine\block\Block::getFrictionFactor ( )
inherited

Returns a multiplier applied to the velocity of entities moving on top of this block. A higher value will make the block more slippery (like ice).

Returns
float 0.0-1.0

Reimplemented in pocketmine\block\BlueIce, pocketmine\block\Ice, pocketmine\block\PackedIce, and pocketmine\block\Slime.

Definition at line 541 of file Block.php.

◆ getFuelTime()

pocketmine\block\BaseSign::getFuelTime ( )

Returns the time in ticks which the block will fuel a furnace for.

Reimplemented from pocketmine\block\Block.

Definition at line 275 of file BaseSign.php.

◆ getHorizontalSides()

pocketmine\block\Block::getHorizontalSides ( )
inherited

Returns the 4 blocks on the horizontal axes around the block (north, south, east, west)

Returns
Block[]|\Generator @phpstan-return \Generator<int, Block, void, void>

Definition at line 788 of file Block.php.

◆ getIdInfo()

pocketmine\block\Block::getIdInfo ( )
inherited

Returns an object containing information about how to identify and store this block type, such as type ID and tile type (if any).

Definition at line 136 of file Block.php.

◆ getLightFilter()

pocketmine\block\Block::getLightFilter ( )
inherited

Returns the amount of light this block will filter out when light passes through this block. This value is used in light spread calculation.

Returns
int 0-15

Reimplemented in pocketmine\block\Ice, pocketmine\block\TintedGlass, and pocketmine\block\Water.

Definition at line 560 of file Block.php.

◆ getLightLevel()

◆ getMaxStackSize()

pocketmine\block\BaseSign::getMaxStackSize ( )

Returns the maximum number of this block that can fit into a single item stack.

Reimplemented from pocketmine\block\Block.

Definition at line 94 of file BaseSign.php.

◆ getModelPositionOffset()

pocketmine\block\Block::getModelPositionOffset ( )
inherited

Returns an additional fractional vector to shift the block model's position by based on the current position. Used to randomize position of things like bamboo canes and tall grass.

Reimplemented in pocketmine\block\Bamboo.

Definition at line 926 of file Block.php.

◆ getName()

pocketmine\block\Block::getName ( )
inherited

Returns the printable English name of the block.

Definition at line 143 of file Block.php.

◆ getPickedItem()

pocketmine\block\Block::getPickedItem ( bool  $addUserData = false)
inherited

Returns the item that players will equip when middle-clicking on this block. If addUserData is true, additional data may be added, such as banner patterns, chest contents, etc.

Reimplemented in pocketmine\block\BaseBanner, pocketmine\block\CakeWithCandle, pocketmine\block\Farmland, pocketmine\block\FlowerPot, pocketmine\block\ItemFrame, pocketmine\block\RedMushroomBlock, and pocketmine\block\ShulkerBox.

Definition at line 694 of file Block.php.

References pocketmine\item\Item\setCustomBlockData(), and pocketmine\item\Item\setLore().

+ Here is the call graph for this function:

◆ getPosition()

pocketmine\block\Block::getPosition ( )
finalinherited

Definition at line 609 of file Block.php.

◆ getSide()

pocketmine\block\Block::getSide ( int  $side,
int  $step = 1 
)
inherited

Returns the Block on the side $side, works like Vector3::getSide()

Returns
Block

Definition at line 768 of file Block.php.

References pocketmine\world\Position\getWorld(), and pocketmine\world\Position\isValid().

Referenced by pocketmine\block\Fence\readStateFromWorld(), and pocketmine\block\Thin\readStateFromWorld().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSilkTouchDrops()

pocketmine\block\Block::getSilkTouchDrops ( Item  $item)
inherited

Returns an array of Items to be dropped when the block is broken using a compatible Silk Touch-enchanted tool.

Returns
Item[]

Reimplemented in pocketmine\block\InfestedStone, and pocketmine\block\RedMushroomBlock.

Definition at line 661 of file Block.php.

◆ getStateId()

pocketmine\block\Block::getStateId ( )
inherited

Definition at line 177 of file Block.php.

◆ getSupportType()

pocketmine\block\BaseSign::getSupportType ( int  $facing)

Returns the type of support that the block can provide on the given face. This is used to determine whether blocks placed on the given face can be supported by this block.

Reimplemented from pocketmine\block\Block.

Definition at line 105 of file BaseSign.php.

◆ getText()

pocketmine\block\BaseSign::getText ( )

Returns an object containing information about the sign text.

Definition at line 206 of file BaseSign.php.

◆ getTypeId()

pocketmine\block\Block::getTypeId ( )
inherited

Returns a type ID that identifies this type of block. This allows comparing basic block types, e.g. wool, stone, glass, etc. Type ID will not change for a given block type.

Information such as colour, powered, open/closed, etc. is not included in this ID. If you want to get a state ID that includes this information, use Block::getStateId() instead.

See also
BlockTypeIds

Definition at line 156 of file Block.php.

Referenced by pocketmine\data\bedrock\block\convert\BlockObjectToStateSerializer\map(), and pocketmine\item\Bucket\onInteractBlock().

+ Here is the caller graph for this function:

◆ getTypeTags()

pocketmine\block\Block::getTypeTags ( )
inherited
Returns
string[]

Definition at line 200 of file Block.php.

◆ getXpDropAmount()

pocketmine\block\Block::getXpDropAmount ( )
protectedinherited

◆ getXpDropForTool()

pocketmine\block\Block::getXpDropForTool ( Item  $item)
inherited

Returns how much XP will be dropped by breaking this block with the given item.

Definition at line 668 of file Block.php.

◆ hasEntityCollision()

◆ hasSameTypeId()

pocketmine\block\Block::hasSameTypeId ( Block  $other)
inherited

Returns whether the given block has the same type ID as this one.

Definition at line 184 of file Block.php.

Referenced by pocketmine\block\Chest\onPostPlace(), and pocketmine\block\Liquid\onScheduledUpdate().

+ Here is the caller graph for this function:

◆ hasTypeTag()

pocketmine\block\Block::hasTypeTag ( string  $tag)
inherited

Returns whether this block type has the given type tag. Type tags are used as a dynamic way to tag blocks as having certain properties, allowing type checks which are more dynamic than hardcoding a bunch of IDs or a bunch of instanceof checks.

For example, grass blocks, dirt, farmland, podzol and mycelium are all dirt-like blocks, and support the placement of blocks like flowers, so they have a common tag which allows them to be identified as such.

Definition at line 212 of file Block.php.

◆ isAffectedBySilkTouch()

◆ isFireProofAsItem()

pocketmine\block\Block::isFireProofAsItem ( )
inherited

Definition at line 723 of file Block.php.

◆ isFlammable()

pocketmine\block\Block::isFlammable ( )
inherited

Returns whether this block can catch fire.

Definition at line 752 of file Block.php.

◆ isFullCube()

pocketmine\block\Block::isFullCube ( )
inherited

Definition at line 949 of file Block.php.

◆ isSameState()

pocketmine\block\Block::isSameState ( Block  $other)
inherited

Returns whether the given block has the same type and properties as this block.

Note: Tile data (e.g. sign text, chest contents) are not compared here.

Definition at line 193 of file Block.php.

◆ isSolid()

pocketmine\block\BaseSign::isSolid ( )
Deprecated:
TL;DR: Don't use this function. Its results are confusing and inconsistent.

No one is sure what the meaning of this property actually is. It's borrowed from Minecraft Java Edition, and is used by various blocks for support checks.

Things like signs and banners are considered "solid" despite having no collision box, and things like skulls and flower pots are considered non-solid despite obviously being "solid" in the conventional, real-world sense.

Reimplemented from pocketmine\block\Block.

Definition at line 90 of file BaseSign.php.

◆ isTransparent()

pocketmine\block\Transparent::isTransparent ( )
inherited

Returns whether this block allows any light to pass through it.

Reimplemented from pocketmine\block\Block.

Reimplemented in pocketmine\block\Slab.

Definition at line 34 of file Transparent.php.

◆ isWaxed()

pocketmine\block\BaseSign::isWaxed ( )

Returns whether the sign has been waxed using a honeycomb. If true, the sign cannot be edited by a player.

Definition at line 219 of file BaseSign.php.

◆ onAttack()

pocketmine\block\Block::onAttack ( Item  $item,
int  $face,
?Player  $player = null 
)
inherited

Called when this block is attacked (left-clicked) by a player attempting to start breaking it in survival.

Returns
bool if an action took place, prevents starting to break the block if true.

Reimplemented in pocketmine\block\DragonEgg, pocketmine\block\ItemFrame, and pocketmine\block\Lectern.

Definition at line 531 of file Block.php.

◆ onBreak()

pocketmine\block\Block::onBreak ( Item  $item,
?Player  $player = null,
array &  $returnedItems = [] 
)
inherited

Do the actions needed so the block is broken with the Item

Parameters
Item[]&$returnedItemsItems to be added to the target's inventory (or dropped, if full)

Reimplemented in pocketmine\block\Ice, pocketmine\block\Jukebox, and pocketmine\block\TNT.

Definition at line 478 of file Block.php.

◆ onEntityInside()

pocketmine\block\Block::onEntityInside ( Entity  $entity)
inherited

Called when an entity's bounding box clips inside this block's cell. Note that the entity may not be intersecting with the collision box or bounding box.

WARNING: This will not be called if Block::hasEntityCollision() returns false.

Returns
bool Whether the block is still the same after the intersection. If it changed (e.g. due to an explosive being ignited), this should return false.

Reimplemented in pocketmine\block\BaseFire, pocketmine\block\BigDripleafHead, pocketmine\block\Cactus, pocketmine\block\CaveVines, pocketmine\block\Cobweb, pocketmine\block\Ladder, pocketmine\block\Lava, pocketmine\block\LavaCauldron, pocketmine\block\Magma, pocketmine\block\NetherPortal, pocketmine\block\NetherVines, pocketmine\block\PressurePlate, pocketmine\block\SweetBerryBush, pocketmine\block\Vine, pocketmine\block\Water, pocketmine\block\WaterCauldron, and pocketmine\block\WitherRose.

Definition at line 867 of file Block.php.

◆ onEntityLand()

pocketmine\block\Block::onEntityLand ( Entity  $entity)
inherited

Called when an entity lands on this block (usually due to falling).

Returns
float|null The new vertical velocity of the entity, or null if unchanged.

Reimplemented in pocketmine\block\Bed, pocketmine\block\Farmland, pocketmine\block\HayBale, and pocketmine\block\Slime.

Definition at line 888 of file Block.php.

◆ onIncinerate()

pocketmine\block\Block::onIncinerate ( )
inherited

Called when this block is burned away by being on fire.

Reimplemented in pocketmine\block\TNT.

Definition at line 759 of file Block.php.

◆ onInteract()

pocketmine\block\BaseSign::onInteract ( Item  $item,
int  $face,
Vector3  $clickVector,
?Player  $player = null,
array &  $returnedItems = [] 
)

Do actions when interacted by Item. Returns if it has done anything

Parameters
Vector3$clickVectorExact position where the click occurred, relative to the block's integer position
Item[]&$returnedItemsItems to be added to the target's inventory (or dropped, if the inventory is full)

Reimplemented from pocketmine\block\Block.

Definition at line 166 of file BaseSign.php.

◆ onNearbyBlockChange()

pocketmine\block\BaseSign::onNearbyBlockChange ( )

Called when this block or a block immediately adjacent to it changes state.

Reimplemented from pocketmine\block\Block.

Definition at line 111 of file BaseSign.php.

◆ onPostPlace()

pocketmine\block\BaseSign::onPostPlace ( )

Called immediately after the block has been placed in the world. Since placement uses a block transaction, some things may not be possible until after the transaction has been executed.

Reimplemented from pocketmine\block\Block.

Definition at line 124 of file BaseSign.php.

◆ onProjectileHit()

pocketmine\block\Block::onProjectileHit ( Projectile  $projectile,
RayTraceResult  $hitResult 
)
inherited

Called when a projectile collides with one of this block's collision boxes.

Reimplemented in pocketmine\block\Bell, pocketmine\block\BigDripleafHead, pocketmine\block\ChorusFlower, and pocketmine\block\TNT.

Definition at line 895 of file Block.php.

◆ onRandomTick()

◆ onScheduledUpdate()

◆ place()

pocketmine\block\BaseSign::place ( BlockTransaction  $tx,
Item  $item,
Block  $blockReplace,
Block  $blockClicked,
int  $face,
Vector3  $clickVector,
?Player  $player = null 
)

Generates a block transaction to set all blocks affected by placing this block. Usually this is just the block itself, but may be multiple blocks in some cases (such as doors).

Parameters
BlockTransaction$txBlocks to be set should be added to this transaction (do not modify thr world directly)
Item$itemItem used to place the block
Block$blockReplaceBlock expected to be replaced
Block$blockClickedBlock that was clicked using the item
int$faceFace of the clicked block which was clicked
Vector3$clickVectorExact position inside the clicked block where the click occurred, relative to the block's position
Player | null$playerPlayer who placed the block, or null if it was not a player
Returns
bool whether the placement should go ahead

Reimplemented from pocketmine\block\Block.

Reimplemented in pocketmine\block\FloorSign, and pocketmine\block\WallSign.

Definition at line 117 of file BaseSign.php.

◆ position()

pocketmine\block\Block::position ( World  $world,
int  $x,
int  $y,
int  $z 
)
finalinherited

Definition at line 616 of file Block.php.

◆ readStateFromWorld()

pocketmine\block\BaseSign::readStateFromWorld ( )

Called when this block is created, set, or has a neighbouring block update, to re-detect dynamic properties which are not saved in the blockstate ID. If any such properties are updated, don't forget to clear things like AABB caches if necessary.

A replacement block may be returned. This is useful if the block type changed due to reading of world data (e.g. data from a block entity).

Reimplemented from pocketmine\block\Block.

Definition at line 69 of file BaseSign.php.

◆ recalculateCollisionBoxes()

pocketmine\block\BaseSign::recalculateCollisionBoxes ( )
protected
Returns
AxisAlignedBB[]

Reimplemented from pocketmine\block\Block.

Definition at line 101 of file BaseSign.php.

◆ setEditorEntityRuntimeId()

pocketmine\block\BaseSign::setEditorEntityRuntimeId ( ?int  $editorEntityRuntimeId)
Returns
$this

Definition at line 235 of file BaseSign.php.

◆ setText()

pocketmine\block\BaseSign::setText ( SignText  $text)
Returns
$this

Definition at line 211 of file BaseSign.php.

◆ setWaxed()

pocketmine\block\BaseSign::setWaxed ( bool  $waxed)
Returns
$this

Definition at line 222 of file BaseSign.php.

◆ ticksRandomly()

◆ updateText()

pocketmine\block\BaseSign::updateText ( Player  $author,
SignText  $text 
)

Called by the player controller (network session) to update the sign text, firing events as appropriate.

Returns
bool if the sign update was successful.
Exceptions

UnexpectedValueException if the text payload is too large

Definition at line 246 of file BaseSign.php.

◆ writeStateToWorld()

pocketmine\block\BaseSign::writeStateToWorld ( )

Writes information about the block into the world. This writes the blockstate ID into the chunk, and creates and/or removes tiles as necessary.

Note: Do not call this directly. Pass the block to World::setBlock() instead.

Reimplemented from pocketmine\block\Block.

Definition at line 81 of file BaseSign.php.

Member Data Documentation

◆ $collisionBoxes

array pocketmine\block\Block::$collisionBoxes = null
protectedinherited

Definition at line 79 of file Block.php.

◆ $editorEntityRuntimeId

int pocketmine\block\BaseSign::$editorEntityRuntimeId = null
protected

Definition at line 54 of file BaseSign.php.

◆ $fallbackName

string pocketmine\block\Block::$fallbackName
protectedinherited

Definition at line 74 of file Block.php.

◆ $idInfo

BlockIdentifier pocketmine\block\Block::$idInfo
protectedinherited

Definition at line 73 of file Block.php.

◆ $position

Position pocketmine\block\Block::$position
protectedinherited

Definition at line 76 of file Block.php.

◆ $text

SignText pocketmine\block\BaseSign::$text
protected

Definition at line 51 of file BaseSign.php.

◆ $typeInfo

BlockTypeInfo pocketmine\block\Block::$typeInfo
protectedinherited

Definition at line 75 of file Block.php.

◆ EMPTY_STATE_ID

const pocketmine\block\Block::EMPTY_STATE_ID = (BlockTypeIds::AIR << self::INTERNAL_STATE_DATA_BITS) | (-7482769108513497636 & self::INTERNAL_STATE_DATA_MASK)
inherited

Definition at line 71 of file Block.php.

◆ INTERNAL_STATE_DATA_BITS

const pocketmine\block\Block::INTERNAL_STATE_DATA_BITS = 11
inherited

Definition at line 63 of file Block.php.

◆ INTERNAL_STATE_DATA_MASK

const pocketmine\block\Block::INTERNAL_STATE_DATA_MASK = ~(~0 << self::INTERNAL_STATE_DATA_BITS)
inherited

Definition at line 64 of file Block.php.


The documentation for this class was generated from the following file: