Added Hopper::setFacing() and Hopper::getFacing() (#4030)

This commit is contained in:
Govdim 2021-02-09 19:04:05 +03:00 committed by GitHub
parent e80c1a0ce9
commit e061028b69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,17 @@ class Hopper extends Transparent{
return 0b1111;
}
public function getFacing() : int{ return $this->facing; }
/** @return $this */
public function setFacing(int $facing) : self{
if($facing === Facing::UP){
throw new \InvalidArgumentException("Hopper may not face upward");
}
$this->facing = $facing;
return $this;
}
protected function recalculateCollisionBoxes() : array{
$result = [
AxisAlignedBB::one()->trim(Facing::UP, 6 / 16) //the empty area around the bottom is currently considered solid