mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 17:36:12 +00:00
Implemented bamboo (#3762)
This commit is contained in:
@ -547,14 +547,24 @@ class Block{
|
||||
final public function getCollisionBoxes() : array{
|
||||
if($this->collisionBoxes === null){
|
||||
$this->collisionBoxes = $this->recalculateCollisionBoxes();
|
||||
$extraOffset = $this->getPosOffset();
|
||||
$offset = $extraOffset !== null ? $this->pos->addVector($extraOffset) : $this->pos;
|
||||
foreach($this->collisionBoxes as $bb){
|
||||
$bb->offset($this->pos->x, $this->pos->y, $this->pos->z);
|
||||
$bb->offset($offset->x, $offset->y, $offset->z);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collisionBoxes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an additional fractional vector to shift the block's effective position by based on the current position.
|
||||
* Used to randomize position of things like bamboo canes and tall grass.
|
||||
*/
|
||||
public function getPosOffset() : ?Vector3{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AxisAlignedBB[]
|
||||
*/
|
||||
|
Reference in New Issue
Block a user