mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Item: added getStateId(), removed state data from public API
state data was only used for indexing stuff along with state ID anyway, so it makes more sense to lock it away in here instead.
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->computeStateData()][$alias] = true;
|
||||
$this->reverseMap[$item->getStateId()][$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->computeStateData()] ?? [];
|
||||
$aliases = $this->reverseMap[$item->getStateId()] ?? [];
|
||||
return array_keys($aliases);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user