Block: added a bunch of state manipulation APIs

This commit is contained in:
Dylan K. Taylor
2020-11-03 19:13:32 +00:00
parent 0a8dc3edd3
commit 32929925aa
30 changed files with 374 additions and 0 deletions

View File

@ -74,6 +74,17 @@ class Sugarcane extends Flowable{
$this->pos->getWorld()->setBlock($this->pos, $this);
}
public function getAge() : int{ return $this->age; }
/** @return $this */
public function setAge(int $age) : self{
if($age < 0 || $age > 15){
throw new \InvalidArgumentException("Age must be in range 0-15");
}
$this->age = $age;
return $this;
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($item instanceof Fertilizer){
if(!$this->getSide(Facing::DOWN)->isSameType($this)){