Extract Fallable into trait + interface

Traits are inferior to components in pretty much every aspect imaginable :(
This commit is contained in:
Dylan K. Taylor
2019-02-19 09:58:10 +00:00
parent 6174f1e0ae
commit a4c3ee20b2
7 changed files with 95 additions and 24 deletions

View File

@ -24,6 +24,8 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\BlockDataValidator;
use pocketmine\block\utils\Fallable;
use pocketmine\block\utils\FallableTrait;
use pocketmine\inventory\AnvilInventory;
use pocketmine\item\Item;
use pocketmine\item\TieredTool;
@ -33,7 +35,8 @@ use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\Player;
class Anvil extends Fallable{
class Anvil extends Transparent implements Fallable{
use FallableTrait;
public const TYPE_NORMAL = 0;
public const TYPE_SLIGHTLY_DAMAGED = 4;
@ -54,10 +57,6 @@ class Anvil extends Fallable{
return 0b11;
}
public function isTransparent() : bool{
return true;
}
public function getHardness() : float{
return 5;
}
@ -92,4 +91,8 @@ class Anvil extends Fallable{
}
return parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}
public function tickFalling() : ?Block{
return null;
}
}