Fixed users of ColorInMetadataTrait having uninitialized default colours

This commit is contained in:
Dylan K. Taylor 2020-11-03 18:42:40 +00:00
parent bcedbc364b
commit 0a8dc3edd3
4 changed files with 8 additions and 0 deletions

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorInMetadataTrait;
use pocketmine\block\utils\DyeColor;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
@ -35,6 +36,7 @@ class Carpet extends Flowable{
use ColorInMetadataTrait;
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.1));
}

View File

@ -24,12 +24,14 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorInMetadataTrait;
use pocketmine\block\utils\DyeColor;
use pocketmine\item\ToolTier;
class Concrete extends Opaque{
use ColorInMetadataTrait;
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.8, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()));
}
}

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorInMetadataTrait;
use pocketmine\block\utils\DyeColor;
use pocketmine\block\utils\Fallable;
use pocketmine\block\utils\FallableTrait;
use pocketmine\math\Facing;
@ -35,6 +36,7 @@ class ConcretePowder extends Opaque implements Fallable{
}
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::SHOVEL));
}

View File

@ -24,12 +24,14 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorInMetadataTrait;
use pocketmine\block\utils\DyeColor;
use pocketmine\item\Item;
class Wool extends Opaque{
use ColorInMetadataTrait;
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo ?? new class(0.8, BlockToolType::SHEARS) extends BlockBreakInfo{
public function getBreakTime(Item $item) : float{
$time = parent::getBreakTime($item);