mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 17:36:12 +00:00
Replace hardcoded block metadata shifts and masks with constants
we might want to make these bigger than 4 bits in the future.
This commit is contained in:
@ -48,6 +48,8 @@ use function dechex;
|
||||
use const PHP_INT_MAX;
|
||||
|
||||
class Block{
|
||||
public const INTERNAL_METADATA_BITS = 4;
|
||||
public const INTERNAL_METADATA_MASK = ~(~0 << self::INTERNAL_METADATA_BITS);
|
||||
|
||||
protected BlockIdentifier $idInfo;
|
||||
protected string $fallbackName;
|
||||
@ -90,7 +92,7 @@ class Block{
|
||||
* @internal
|
||||
*/
|
||||
public function getFullId() : int{
|
||||
return ($this->getId() << 4) | $this->getMeta();
|
||||
return ($this->getId() << self::INTERNAL_METADATA_BITS) | $this->getMeta();
|
||||
}
|
||||
|
||||
public function asItem() : Item{
|
||||
|
Reference in New Issue
Block a user