mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Change confusing 'type data' and 'state data' terminology for blocks and items
For blocks, we now use 'block-item state' and 'block-only state', which should be much clearer for people implementing custom stuff. 'block-item state', as the name suggests, sticks to the item when the block is acquired as an item. 'block-only state' applies only to the block and is discarded when the block is acquired as an item. 'type data' for items was also renamed, since 'type' is too ambiguous to be anything but super confusing.
This commit is contained in:
@ -1540,7 +1540,7 @@ final class StringToItemParser extends StringToTParser{
|
||||
public function register(string $alias, \Closure $callback) : void{
|
||||
parent::register($alias, $callback);
|
||||
$item = $callback($alias);
|
||||
$this->reverseMap[$item->getTypeId()][$item->computeTypeData()][$alias] = true;
|
||||
$this->reverseMap[$item->getTypeId()][$item->computeStateData()][$alias] = true;
|
||||
}
|
||||
|
||||
/** @phpstan-param \Closure(string $input) : Block $callback */
|
||||
@ -1559,7 +1559,7 @@ final class StringToItemParser extends StringToTParser{
|
||||
* @phpstan-return list<string>
|
||||
*/
|
||||
public function lookupAliases(Item $item) : array{
|
||||
$aliases = $this->reverseMap[$item->getTypeId()][$item->computeTypeData()] ?? [];
|
||||
$aliases = $this->reverseMap[$item->getTypeId()][$item->computeStateData()] ?? [];
|
||||
return array_keys($aliases);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user