mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Nuke Block->meta, split into variant and state properties, lots of cleanup
This is a major change to the way block metadata is handled within the PM core. This separates variant metadata (which really ought to be part of the ID) from state metadata, and in a couple of cases flattens separate states of blocks together. The result of this is that invalid variants can be much more easily detected, and additionally state handling is much cleaner since meta is only needed at the serialize layer instead of throughout the code.
This commit is contained in:
@ -25,13 +25,28 @@ namespace pocketmine\block;
|
||||
|
||||
class RedstoneTorch extends Torch{
|
||||
|
||||
protected $id = self::LIT_REDSTONE_TORCH;
|
||||
protected $itemId = self::REDSTONE_TORCH;
|
||||
|
||||
/** @var bool */
|
||||
protected $lit = true;
|
||||
|
||||
public function getId() : int{
|
||||
return $this->lit ? self::REDSTONE_TORCH : self::UNLIT_REDSTONE_TORCH;
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
return "Redstone Torch";
|
||||
}
|
||||
|
||||
public function isLit() : bool{
|
||||
return $this->lit;
|
||||
}
|
||||
|
||||
public function setLit(bool $lit = true) : void{
|
||||
$this->lit = $lit;
|
||||
}
|
||||
|
||||
public function getLightLevel() : int{
|
||||
return 7;
|
||||
return $this->lit ? 7 : 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user