BaseBanner
extends Transparent
in package
Uses
ColoredTrait
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
- $patterns : array<string|int, mixed>
- $position : Position
- $color : DyeColor
- __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>
- getColor() : DyeColor
- 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
- 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
- getPatterns() : array<string|int, BannerPatternLayer>
- getPickedItem() : Item
- 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
- Returns whether Silk Touch enchanted tools will cause this block to drop as itself.
- 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
- readStateFromData() : void
- readStateFromWorld() : void
- setColor() : $this
- setPatterns() : $this
- ticksRandomly() : bool
- Returns whether random block updates will be done on this block.
- writeStateToWorld() : void
- getSupportingFace() : int
- 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
$breakInfo
protected
BlockBreakInfo
$breakInfo
$collisionBoxes
protected
array<string|int, mixed>|null
$collisionBoxes
= null
$fallbackName
protected
string
$fallbackName
$idInfo
protected
BlockIdentifier
$idInfo
$patterns
protected
array<string|int, mixed>
$patterns
= []
Tags
$position
protected
Position
$position
$color
private
DyeColor
$color
Methods
__clone()
public
__clone() : mixed
Return values
mixed —__construct()
public
__construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo) : mixed
Parameters
- $idInfo : BlockIdentifier
- $name : string
- $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 —getCollisionBoxes()
public
final getCollisionBoxes() : array<string|int, AxisAlignedBB>
Return values
array<string|int, AxisAlignedBB> —getColor()
public
getColor() : DyeColor
Return values
DyeColor —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
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 —0-15
getMaxStackSize()
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 —getPatterns()
public
getPatterns() : array<string|int, BannerPatternLayer>
Tags
Return values
array<string|int, BannerPatternLayer> —getPickedItem()
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 —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 —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
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()
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
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 —place()
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()
public
readStateFromWorld() : void
Return values
void —setColor()
public
setColor(DyeColor $color) : $this
Parameters
- $color : DyeColor
Return values
$this —setPatterns()
public
setPatterns(array<string|int, BannerPatternLayer> $patterns) : $this
Parameters
- $patterns : array<string|int, BannerPatternLayer>
Tags
Return values
$this —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 —getSupportingFace()
protected
abstract getSupportingFace() : int
Return values
int —getXpDropAmount()
Returns how much XP this block will drop when broken with an appropriate tool.
protected
getXpDropAmount() : int
Return values
int —recalculateCollisionBoxes()
protected
recalculateCollisionBoxes() : array<string|int, AxisAlignedBB>
Return values
array<string|int, AxisAlignedBB> —writeStateToItemMeta()
protected
writeStateToItemMeta() : int
Return values
int —writeStateToMeta()
protected
writeStateToMeta() : int