mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-09 11:31:49 +00:00
ÂBlock: added a TODO for getStateId()
This commit is contained in:
parent
24e897f813
commit
cc77f18ff0
@ -141,6 +141,11 @@ class Block{
|
|||||||
*/
|
*/
|
||||||
public function getStateId() : int{
|
public function getStateId() : int{
|
||||||
$typeId = $this->getTypeId();
|
$typeId = $this->getTypeId();
|
||||||
|
//TODO: this XOR mask improves hashtable distribution, but it's only effective if the number of unique block
|
||||||
|
//type IDs is larger than the number of available state data bits. We should probably hash (e.g. using xxhash)
|
||||||
|
//the type ID to create a better mask.
|
||||||
|
//Alternatively, we could hash the whole state ID, but this is currently problematic, since we currently need
|
||||||
|
//to be able to recover the state data from the state ID because of UnknownBlock.
|
||||||
return ($typeId << self::INTERNAL_STATE_DATA_BITS) | ($this->encodeFullState() ^ ($typeId & self::INTERNAL_STATE_DATA_MASK));
|
return ($typeId << self::INTERNAL_STATE_DATA_BITS) | ($this->encodeFullState() ^ ($typeId & self::INTERNAL_STATE_DATA_MASK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user