Add Furnace->getType() : FurnaceType method (#5425)

closes #4761 

this targets next-major due to BC-breaking changes to Furnace::__construct()
This commit is contained in:
zSALLAZAR
2022-11-23 13:32:15 +01:00
committed by GitHub
parent 1bc5e225ab
commit 23ae0c7cac
2 changed files with 16 additions and 3 deletions

View File

@ -26,6 +26,7 @@ namespace pocketmine\block;
use pocketmine\block\tile\Furnace as TileFurnace;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\crafting\FurnaceType;
use pocketmine\data\runtime\RuntimeDataReader;
use pocketmine\data\runtime\RuntimeDataWriter;
use pocketmine\item\Item;
@ -37,8 +38,15 @@ class Furnace extends Opaque{
use FacesOppositePlacingPlayerTrait;
use HorizontalFacingTrait;
protected FurnaceType $furnaceType;
protected bool $lit = false;
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, FurnaceType $furnaceType){
$this->furnaceType = $furnaceType;
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredStateDataBits() : int{ return 3; }
protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{
@ -46,6 +54,10 @@ class Furnace extends Opaque{
$w->bool($this->lit);
}
public function getFurnaceType() : FurnaceType{
return $this->furnaceType;
}
public function getLightLevel() : int{
return $this->lit ? 13 : 0;
}