mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Block: Separate encoding of type and state data
the terminology of this needs improvement, but... the basic concept here is that 'type' data will persist on an itemstack, while 'state' data will not. Type data consists of things like: - Colour - Coral type - Wet/dry (sponges) - Live/dead (coral) - Wood type State data consists of things like: - Facing - Axis - Powered/unpowered - Open/closed In the past, with the old system, this information was separated by way of getStateBitmask(). This solution was fraught with problems, but achieved the basic goal: removing unwanted block properties from items.
This commit is contained in:
@ -864,7 +864,7 @@ class BlockFactory{
|
||||
|
||||
//TODO: this bruteforce approach to discovering all valid states is very inefficient for larger state data sizes
|
||||
//at some point we'll need to find a better way to do this
|
||||
$bits = $block->getRequiredStateDataBits();
|
||||
$bits = $block->getRequiredTypeDataBits() + $block->getRequiredStateDataBits();
|
||||
if($bits > Block::INTERNAL_STATE_DATA_BITS){
|
||||
throw new \InvalidArgumentException("Block state data cannot use more than " . Block::INTERNAL_STATE_DATA_BITS . " bits");
|
||||
}
|
||||
|
Reference in New Issue
Block a user