Lava
extends Liquid
in package
Table of Contents
- INTERNAL_METADATA_BITS = 4
- INTERNAL_METADATA_MASK = ~(~0 << self::INTERNAL_METADATA_BITS)
- $adjacentSources : int
- $breakInfo : BlockBreakInfo
- $collisionBoxes : array<string|int, mixed>|null
- $decay : int
- $fallbackName : string
- $falling : bool
- $flowVector : Vector3|null
- $idInfo : BlockIdentifier
- $idInfoFlattened : BlockIdentifierFlattened
- $position : Position
- $still : bool
- __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.
- getBucketEmptySound() : Sound
- getBucketFillSound() : Sound
- getCollisionBoxes() : array<string|int, AxisAlignedBB>
- getDecay() : int
- getDrops() : array<string|int, Item>
- Returns an array of Item objects to be dropped
- getDropsForCompatibleTool() : array<string|int, Item>
- Returns an array of Items to be dropped when the block is broken using the correct tool type.
- 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.
- getFlowDecayPerBlock() : int
- Returns how many liquid levels are lost per block flowed horizontally. Affects how far the liquid can flow.
- getFlowingForm() : Block
- getFlowVector() : Vector3
- getFluidHeightPercent() : float
- 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
- getMinAdjacentSourcesToFormSource() : int|null
- Returns the number of source blocks of this liquid that must be horizontally adjacent to this block in order for this block to become a source block itself, or null if the liquid does not exhibit source-forming behaviour.
- 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.
- getStillForm() : Block
- getXpDropForTool() : int
- Returns how much XP will be dropped by breaking this block with the given item.
- hasEntityCollision() : bool
- isAffectedBySilkTouch() : bool
- Returns whether Silk Touch enchanted tools will cause this block to drop as itself.
- isFalling() : 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
- isSource() : bool
- isStill() : 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
- 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
- Called when this block or a block immediately adjacent to it changes state.
- 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.
- setDecay() : $this
- setFalling() : $this
- setStill() : $this
- tickRate() : int
- ticksRandomly() : bool
- Returns whether random block updates will be done on this block.
- writeStateToWorld() : void
- canFlowInto() : bool
- checkForHarden() : bool
- flowIntoBlock() : void
- getEffectiveFlowDecay() : int
- getXpDropAmount() : int
- Returns how much XP this block will drop when broken with an appropriate tool.
- liquidCollide() : bool
- recalculateCollisionBoxes() : array<string|int, AxisAlignedBB>
- writeStateToItemMeta() : int
- writeStateToMeta() : int
- getSmallestFlowDecay() : 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
$adjacentSources
public
int
$adjacentSources
= 0
$breakInfo
protected
BlockBreakInfo
$breakInfo
$collisionBoxes
protected
array<string|int, mixed>|null
$collisionBoxes
= null
$decay
protected
int
$decay
= 0
$fallbackName
protected
string
$fallbackName
$falling
protected
bool
$falling
= false
$flowVector
protected
Vector3|null
$flowVector
= null
$idInfo
protected
BlockIdentifier
$idInfo
$idInfoFlattened
protected
BlockIdentifierFlattened
$idInfoFlattened
$position
protected
Position
$position
$still
protected
bool
$still
= false
Methods
__clone()
public
__clone() : mixed
Return values
mixed —__construct()
public
__construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo) : mixed
Parameters
- $idInfo : BlockIdentifier
- $name : string
-
English name of the block type (TODO: implement translations)
- $breakInfo : BlockBreakInfo
Return values
mixed —__toString()
public
__toString() : string
Return values
string —addVelocityToEntity()
public
addVelocityToEntity(Entity $entity) : Vector3|null
Parameters
- $entity : Entity
Return values
Vector3|null —asItem()
public
asItem() : Item
Return values
Item —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 —calculateIntercept()
public
calculateIntercept(Vector3 $pos1, Vector3 $pos2) : RayTraceResult|null
Parameters
Return values
RayTraceResult|null —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
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
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 —getBucketEmptySound()
public
getBucketEmptySound() : Sound
Return values
Sound —getBucketFillSound()
public
getBucketFillSound() : Sound
Return values
Sound —getCollisionBoxes()
public
final getCollisionBoxes() : array<string|int, AxisAlignedBB>
Return values
array<string|int, AxisAlignedBB> —getDecay()
public
getDecay() : int
Return values
int —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()
Returns an array of Items to be dropped when the block is broken using the correct tool type.
public
getDropsForCompatibleTool(Item $item) : array<string|int, Item>
Parameters
- $item : Item
Return values
array<string|int, Item> —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 —getFlowDecayPerBlock()
Returns how many liquid levels are lost per block flowed horizontally. Affects how far the liquid can flow.
public
getFlowDecayPerBlock() : int
Return values
int —getFlowingForm()
public
getFlowingForm() : Block
Return values
Block —getFlowVector()
public
getFlowVector() : Vector3
Return values
Vector3 —getFluidHeightPercent()
public
getFluidHeightPercent() : float
Return values
float —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
Return values
array<string|int, Block>|Generator —getId()
public
getId() : int
Return values
int —getIdInfo()
public
getIdInfo() : BlockIdentifier
Return values
BlockIdentifier —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 —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 —getMinAdjacentSourcesToFormSource()
Returns the number of source blocks of this liquid that must be horizontally adjacent to this block in order for this block to become a source block itself, or null if the liquid does not exhibit source-forming behaviour.
public
getMinAdjacentSourcesToFormSource() : int|null
Return values
int|null —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 —getPosition()
public
final getPosition() : Position
Return values
Position —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 —getStillForm()
public
getStillForm() : Block
Return values
Block —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()
Returns whether Silk Touch enchanted tools will cause this block to drop as itself.
public
isAffectedBySilkTouch() : bool
Return values
bool —isFalling()
public
isFalling() : 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 —isSource()
public
isSource() : bool
Return values
bool —isStill()
public
isStill() : 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
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
Return values
bool —onEntityInside()
public
onEntityInside(Entity $entity) : bool
Parameters
- $entity : Entity
Return values
bool —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
Return values
bool —onNearbyBlockChange()
Called when this block or a block immediately adjacent to it changes state.
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 —place()
Places the Block, using block space and block target, and side. Returns if the block has been placed.
public
place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector[, Player|null $player = null ]) : bool
Parameters
- $tx : BlockTransaction
- $item : Item
- $blockReplace : Block
- $blockClicked : Block
- $face : int
- $clickVector : Vector3
- $player : Player|null = null
Return values
bool —readStateFromData()
public
readStateFromData(int $id, int $stateMeta) : void
Parameters
- $id : int
- $stateMeta : int
Tags
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 —setDecay()
public
setDecay(int $decay) : $this
Parameters
- $decay : int
Return values
$this —setFalling()
public
setFalling(bool $falling) : $this
Parameters
- $falling : bool
Return values
$this —setStill()
public
setStill([bool $still = true ]) : $this
Parameters
- $still : bool = true
Return values
$this —tickRate()
public
tickRate() : int
Return values
int —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 —canFlowInto()
protected
canFlowInto(Block $block) : bool
Parameters
- $block : Block
Return values
bool —checkForHarden()
protected
checkForHarden() : bool
Return values
bool —flowIntoBlock()
protected
flowIntoBlock(Block $block, int $newFlowDecay, bool $falling) : void
Parameters
- $block : Block
- $newFlowDecay : int
- $falling : bool
Return values
void —getEffectiveFlowDecay()
protected
getEffectiveFlowDecay(Block $block) : int
Parameters
- $block : Block
Return values
int —getXpDropAmount()
Returns how much XP this block will drop when broken with an appropriate tool.
protected
getXpDropAmount() : int
Return values
int —liquidCollide()
protected
liquidCollide(Block $cause, Block $result) : bool
Parameters
Return values
bool —recalculateCollisionBoxes()
protected
recalculateCollisionBoxes() : array<string|int, AxisAlignedBB>
Return values
array<string|int, AxisAlignedBB> —writeStateToItemMeta()
protected
writeStateToItemMeta() : int
Return values
int —writeStateToMeta()
protected
writeStateToMeta() : int
Return values
int —getSmallestFlowDecay()
private
getSmallestFlowDecay(Block $block, int $decay) : int
Parameters
- $block : Block
- $decay : int