Block: get rid of getNonPersistentStateBitmask(), add writeStateToItemMeta()

this is more flexible and less confusing.
This commit is contained in:
Dylan K. Taylor
2021-08-02 19:17:24 +01:00
parent 01b48a21d9
commit bdac98beaf
13 changed files with 50 additions and 53 deletions

View File

@ -98,7 +98,7 @@ class Block{
public function asItem() : Item{
return ItemFactory::getInstance()->get(
$this->idInfo->getItemId(),
$this->idInfo->getVariant() | ($this->writeStateToMeta() & ~$this->getNonPersistentStateBitmask())
$this->idInfo->getVariant() | $this->writeStateToItemMeta()
);
}
@ -108,6 +108,10 @@ class Block{
return $this->idInfo->getVariant() | $stateMeta;
}
protected function writeStateToItemMeta() : int{
return 0;
}
/**
* Returns a bitmask used to extract state bits from block metadata.
*/
@ -115,10 +119,6 @@ class Block{
return 0;
}
public function getNonPersistentStateBitmask() : int{
return $this->getStateBitmask();
}
protected function writeStateToMeta() : int{
return 0;
}