mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
ItemBlock: drop the charade about overriding built-in block types
this allows cleaning up a whole lot of abusable mess from the API, and we never properly supported overriding built-in block types anyway.
This commit is contained in:
@ -151,18 +151,6 @@ class RuntimeBlockStateRegistry{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* Returns the default state of the block type associated with the given type ID.
|
||||
*/
|
||||
public function fromTypeId(int $typeId) : Block{
|
||||
if(isset($this->typeIndex[$typeId])){
|
||||
return clone $this->typeIndex[$typeId];
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException("Block ID $typeId is not registered");
|
||||
}
|
||||
|
||||
public function fromStateId(int $stateId) : Block{
|
||||
if($stateId < 0){
|
||||
throw new \InvalidArgumentException("Block state ID cannot be negative");
|
||||
@ -178,22 +166,6 @@ class RuntimeBlockStateRegistry{
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a specified block state is already registered in the block factory.
|
||||
*/
|
||||
public function isRegistered(int $typeId) : bool{
|
||||
$b = $this->typeIndex[$typeId] ?? null;
|
||||
return $b !== null && !($b instanceof UnknownBlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Block[]
|
||||
* @phpstan-return array<int, Block>
|
||||
*/
|
||||
public function getAllKnownTypes() : array{
|
||||
return $this->typeIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Block[]
|
||||
*/
|
||||
|
Reference in New Issue
Block a user