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:
Dylan K. Taylor
2023-05-16 14:07:06 +01:00
parent ccb22ceb3f
commit 015c668885
95 changed files with 178 additions and 171 deletions

View File

@ -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);
}