Documentation

GrassPath extends Transparent
in package

Table of Contents

INTERNAL_METADATA_BITS  = 4
INTERNAL_METADATA_MASK  = ~(~0 << self::INTERNAL_METADATA_BITS)
$breakInfo  : BlockBreakInfo
$collisionBoxes  : array<string|int, mixed>|null
$fallbackName  : string
$idInfo  : BlockIdentifier
$position  : Position
__clone()  : mixed
__construct()  : mixed
__toString()  : string
addVelocityToEntity()  : Vector3|null
asItem()  : Item
blocksDirectSkyLight()  : bool
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.
burnsForever()  : bool
Returns whether fire lit on this block will burn indefinitely.
calculateIntercept()  : RayTraceResult|null
canBeFlowedInto()  : bool
AKA: Block->isFlowable
canBePlaced()  : bool
AKA: Block->isPlaceable
canBePlacedAt()  : bool
canBeReplaced()  : bool
canClimb()  : bool
Returns whether entities can climb up this block.
collidesWithBB()  : bool
Checks for collision against an AxisAlignedBB
getAffectedBlocks()  : array<string|int, Block>
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.
getAllSides()  : array<string|int, Block>|Generator
Returns the six blocks around this block.
getBreakInfo()  : BlockBreakInfo
Returns an object containing information about the destruction requirements of this block.
getCollisionBoxes()  : array<string|int, AxisAlignedBB>
getDrops()  : array<string|int, Item>
Returns an array of Item objects to be dropped
getDropsForCompatibleTool()  : array<string|int, mixed>
getDropsForIncompatibleTool()  : array<string|int, Item>
Returns the items dropped by this block when broken with an incorrect tool type (or tool with a too-low tier).
getFlameEncouragement()  : int
Returns the chance that the block will catch fire from nearby fire sources. Higher values lead to faster catching fire.
getFlammability()  : int
Returns the base flammability of this block. Higher values lead to the block burning away more quickly.
getFrictionFactor()  : float
getFuelTime()  : int
Returns the time in ticks which the block will fuel a furnace for.
getHorizontalSides()  : array<string|int, Block>|Generator
Returns the 4 blocks on the horizontal axes around the block (north, south, east, west)
getId()  : int
getIdInfo()  : BlockIdentifier
getLightFilter()  : int
Returns the amount of light this block will filter out when light passes through this block.
getLightLevel()  : int
getMaxStackSize()  : int
Returns the maximum number of this block that can fit into a single item stack.
getMeta()  : int
getModelPositionOffset()  : Vector3|null
Returns an additional fractional vector to shift the block model's position by based on the current position.
getName()  : string
getPickedItem()  : Item
Returns the item that players will equip when middle-clicking on this block.
getPosition()  : Position
getSide()  : Block
Returns the Block on the side $side, works like Vector3::getSide()
getSilkTouchDrops()  : array<string|int, Item>
Returns an array of Items to be dropped when the block is broken using a compatible Silk Touch-enchanted tool.
getStateBitmask()  : int
Returns a bitmask used to extract state bits from block metadata.
getXpDropForTool()  : int
Returns how much XP will be dropped by breaking this block with the given item.
hasEntityCollision()  : bool
isAffectedBySilkTouch()  : bool
isFlammable()  : bool
Returns whether this block can catch fire.
isFullCube()  : bool
isSameState()  : bool
Returns whether the given block has the same type and properties as this block.
isSameType()  : bool
Returns whether the given block has an equivalent type to this one. This compares base legacy ID and variant.
isSolid()  : bool
isTransparent()  : bool
onAttack()  : bool
Called when this block is attacked (left-clicked). This is called when a player left-clicks the block to try and start to break it in survival mode.
onBreak()  : bool
Do the actions needed so the block is broken with the Item
onEntityInside()  : bool
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.
onEntityLand()  : float|null
Called when an entity lands on this block (usually due to falling).
onIncinerate()  : void
Called when this block is burned away by being on fire.
onInteract()  : bool
Do actions when interacted by Item. Returns if it has done anything
onNearbyBlockChange()  : void
onPostPlace()  : void
onRandomTick()  : void
Called when this block is randomly updated due to chunk ticking.
onScheduledUpdate()  : void
Called when this block is updated by the delayed blockupdate scheduler in the world.
place()  : bool
Places the Block, using block space and block target, and side. Returns if the block has been placed.
readStateFromData()  : void
readStateFromWorld()  : void
Called when this block is created, set, or has a neighbouring block update, to re-detect dynamic properties which are not saved on the world.
ticksRandomly()  : bool
Returns whether random block updates will be done on this block.
writeStateToWorld()  : void
getXpDropAmount()  : int
Returns how much XP this block will drop when broken with an appropriate tool.
recalculateCollisionBoxes()  : array<string|int, AxisAlignedBB>
writeStateToItemMeta()  : int
writeStateToMeta()  : int

Constants

INTERNAL_METADATA_BITS

public mixed INTERNAL_METADATA_BITS = 4

INTERNAL_METADATA_MASK

public mixed INTERNAL_METADATA_MASK = ~(~0 << self::INTERNAL_METADATA_BITS)

Properties

$collisionBoxes

protected array<string|int, mixed>|null $collisionBoxes = null

$fallbackName

protected string $fallbackName

Methods

__clone()

public __clone() : mixed
Return values
mixed

__toString()

public __toString() : string
Return values
string

blocksDirectSkyLight()

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.

public blocksDirectSkyLight() : bool

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.

Return values
bool

burnsForever()

Returns whether fire lit on this block will burn indefinitely.

public burnsForever() : bool
Return values
bool

canBeFlowedInto()

AKA: Block->isFlowable

public canBeFlowedInto() : bool
Return values
bool

canBePlaced()

AKA: Block->isPlaceable

public canBePlaced() : bool
Return values
bool

canBePlacedAt()

public canBePlacedAt(Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock) : bool
Parameters
$blockReplace : Block
$clickVector : Vector3
$face : int
$isClickedBlock : bool
Return values
bool

canBeReplaced()

public canBeReplaced() : bool
Return values
bool

canClimb()

Returns whether entities can climb up this block.

public canClimb() : bool
Return values
bool

collidesWithBB()

Checks for collision against an AxisAlignedBB

public collidesWithBB(AxisAlignedBB $bb) : bool
Parameters
$bb : AxisAlignedBB
Return values
bool

getAffectedBlocks()

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.

public getAffectedBlocks() : array<string|int, Block>
Return values
array<string|int, Block>

getAllSides()

Returns the six blocks around this block.

public getAllSides() : array<string|int, Block>|Generator
Tags
phpstan-return

\Generator<int, Block, void, void>

Return values
array<string|int, Block>|Generator

getBreakInfo()

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

public getBreakInfo() : BlockBreakInfo
Return values
BlockBreakInfo

getDrops()

Returns an array of Item objects to be dropped

public getDrops(Item $item) : array<string|int, Item>
Parameters
$item : Item
Return values
array<string|int, Item>

getDropsForCompatibleTool()

public getDropsForCompatibleTool(Item $item) : array<string|int, mixed>
Parameters
$item : Item
Return values
array<string|int, mixed>

getDropsForIncompatibleTool()

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

public getDropsForIncompatibleTool(Item $item) : array<string|int, Item>
Parameters
$item : Item
Return values
array<string|int, Item>

getFlameEncouragement()

Returns the chance that the block will catch fire from nearby fire sources. Higher values lead to faster catching fire.

public getFlameEncouragement() : int
Return values
int

getFlammability()

Returns the base flammability of this block. Higher values lead to the block burning away more quickly.

public getFlammability() : int
Return values
int

getFrictionFactor()

public getFrictionFactor() : float
Return values
float

getFuelTime()

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

public getFuelTime() : int
Return values
int

getHorizontalSides()

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

public getHorizontalSides() : array<string|int, Block>|Generator
Tags
phpstan-return

\Generator<int, Block, void, void>

Return values
array<string|int, Block>|Generator

getId()

public getId() : int
Return values
int

getLightFilter()

Returns the amount of light this block will filter out when light passes through this block.

public getLightFilter() : int

This value is used in light spread calculation.

Return values
int

0-15

getLightLevel()

public getLightLevel() : int
Return values
int

0-15

getMaxStackSize()

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

public getMaxStackSize() : int
Return values
int

getMeta()

public getMeta() : int
Return values
int

getModelPositionOffset()

Returns an additional fractional vector to shift the block model's position by based on the current position.

public getModelPositionOffset() : Vector3|null

Used to randomize position of things like bamboo canes and tall grass.

Return values
Vector3|null

getName()

public getName() : string
Return values
string

getPickedItem()

Returns the item that players will equip when middle-clicking on this block.

public getPickedItem([bool $addUserData = false ]) : Item
Parameters
$addUserData : bool = false
Return values
Item

getSide()

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

public getSide(int $side[, int $step = 1 ]) : Block
Parameters
$side : int
$step : int = 1
Return values
Block

getSilkTouchDrops()

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

public getSilkTouchDrops(Item $item) : array<string|int, Item>
Parameters
$item : Item
Return values
array<string|int, Item>

getStateBitmask()

Returns a bitmask used to extract state bits from block metadata.

public getStateBitmask() : int
Return values
int

getXpDropForTool()

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

public getXpDropForTool(Item $item) : int
Parameters
$item : Item
Return values
int

hasEntityCollision()

public hasEntityCollision() : bool
Return values
bool

isAffectedBySilkTouch()

public isAffectedBySilkTouch() : bool
Return values
bool

isFlammable()

Returns whether this block can catch fire.

public isFlammable() : bool
Return values
bool

isFullCube()

public isFullCube() : bool
Return values
bool

isSameState()

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

public isSameState(Block $other) : bool
Parameters
$other : Block
Return values
bool

isSameType()

Returns whether the given block has an equivalent type to this one. This compares base legacy ID and variant.

public isSameType(Block $other) : bool

Note: This ignores additional IDs used to represent additional states. This means that, for example, a lit furnace and unlit furnace are considered the same type.

Parameters
$other : Block
Return values
bool

isSolid()

public isSolid() : bool
Return values
bool

isTransparent()

public isTransparent() : bool
Return values
bool

onAttack()

Called when this block is attacked (left-clicked). This is called when a player left-clicks the block to try and start to break it in survival mode.

public onAttack(Item $item, int $face[, Player|null $player = null ]) : bool
Parameters
$item : Item
$face : int
$player : Player|null = null
Return values
bool

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

onBreak()

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

public onBreak(Item $item[, Player|null $player = null ]) : bool
Parameters
$item : Item
$player : Player|null = null
Return values
bool

onEntityInside()

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.

public onEntityInside(Entity $entity) : bool
Parameters
$entity : Entity
Return values
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.

onEntityLand()

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

public onEntityLand(Entity $entity) : float|null
Parameters
$entity : Entity
Return values
float|null

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

onIncinerate()

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

public onIncinerate() : void
Return values
void

onInteract()

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

public onInteract(Item $item, int $face, Vector3 $clickVector[, Player|null $player = null ]) : bool
Parameters
$item : Item
$face : int
$clickVector : Vector3
$player : Player|null = null
Return values
bool

onNearbyBlockChange()

public onNearbyBlockChange() : void
Return values
void

onPostPlace()

public onPostPlace() : void
Return values
void

onRandomTick()

Called when this block is randomly updated due to chunk ticking.

public onRandomTick() : void

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

Return values
void

onScheduledUpdate()

Called when this block is updated by the delayed blockupdate scheduler in the world.

public onScheduledUpdate() : void
Return values
void

readStateFromData()

public readStateFromData(int $id, int $stateMeta) : void
Parameters
$id : int
$stateMeta : int
Tags
throws
InvalidBlockStateException
Return values
void

readStateFromWorld()

Called when this block is created, set, or has a neighbouring block update, to re-detect dynamic properties which are not saved on the world.

public readStateFromWorld() : void

Clears any cached precomputed objects, such as bounding boxes. Remove any outdated precomputed things such as AABBs and force recalculation.

Return values
void

ticksRandomly()

Returns whether random block updates will be done on this block.

public ticksRandomly() : bool
Return values
bool

writeStateToWorld()

public writeStateToWorld() : void
Return values
void

getXpDropAmount()

Returns how much XP this block will drop when broken with an appropriate tool.

protected getXpDropAmount() : int
Return values
int

writeStateToItemMeta()

protected writeStateToItemMeta() : int
Return values
int

writeStateToMeta()

protected writeStateToMeta() : int
Return values
int

Search results