Block: add method isSameState() to allow black-box comparison of blockstates

This commit is contained in:
Dylan K. Taylor 2018-11-25 14:53:57 +00:00
parent 4698c723bd
commit 7399e9036a

View File

@ -193,6 +193,17 @@ class Block extends Position implements BlockIds, Metadatable{
return $this->getId() === $other->getId() and $this->getVariant() === $other->getVariant();
}
/**
* Returns whether the given block has the same type and properties as this block.
*
* @param Block $other
*
* @return bool
*/
public function isSameState(Block $other) : bool{
return $this->isSameType($other) and $this->writeStateToMeta() === $other->writeStateToMeta();
}
/**
* AKA: Block->isPlaceable
* @return bool