mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
Added some missing block properties
This commit is contained in:
parent
8f1bc5d497
commit
6fe366e1ac
@ -27,6 +27,21 @@ use pocketmine\item\Item;
|
|||||||
|
|
||||||
class Bedrock extends Solid{
|
class Bedrock extends Solid{
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $burnsForever = false;
|
||||||
|
|
||||||
|
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||||
|
$this->burnsForever = $stateMeta !== 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function writeStateToMeta() : int{
|
||||||
|
return $this->burnsForever ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStateBitmask() : int{
|
||||||
|
return 0b1;
|
||||||
|
}
|
||||||
|
|
||||||
public function getHardness() : float{
|
public function getHardness() : float{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -38,4 +53,8 @@ class Bedrock extends Solid{
|
|||||||
public function isBreakable(Item $item) : bool{
|
public function isBreakable(Item $item) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function burnsForever() : bool{
|
||||||
|
return $this->burnsForever;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,10 +40,33 @@ use const M_PI;
|
|||||||
|
|
||||||
class TNT extends Solid{
|
class TNT extends Solid{
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
protected $unstable = false; //TODO: Usage unclear, seems to be a weird hack in vanilla
|
||||||
|
|
||||||
|
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||||
|
$this->unstable = $stateMeta !== 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function writeStateToMeta() : int{
|
||||||
|
return $this->unstable ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStateBitmask() : int{
|
||||||
|
return 0b1;
|
||||||
|
}
|
||||||
|
|
||||||
public function getHardness() : float{
|
public function getHardness() : float{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onBreak(Item $item, ?Player $player = null) : bool{
|
||||||
|
if($this->unstable){
|
||||||
|
$this->ignite();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::onBreak($item, $player);
|
||||||
|
}
|
||||||
|
|
||||||
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||||
if($item instanceof FlintSteel or $item->hasEnchantment(Enchantment::FIRE_ASPECT())){
|
if($item instanceof FlintSteel or $item->hasEnchantment(Enchantment::FIRE_ASPECT())){
|
||||||
if($item instanceof Durable){
|
if($item instanceof Durable){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user