mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 00:39:45 +00:00
EntityFactory: remove requirement for $className as return type on creation funcs
since the removal of EntityFactory::create() this isn't needed anymore, since these creation functions are only used for creating entities loaded from disk.
This commit is contained in:
parent
bf401421fa
commit
40d49b88dd
@ -161,12 +161,11 @@ final class EntityFactory{
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param class-string<Entity> $baseClass
|
||||
* @phpstan-param \Closure(World, CompoundTag) : Entity $creationFunc
|
||||
*/
|
||||
private static function validateCreationFunc(string $baseClass, \Closure $creationFunc) : void{
|
||||
private static function validateCreationFunc(\Closure $creationFunc) : void{
|
||||
$sig = new CallbackType(
|
||||
new ReturnType($baseClass),
|
||||
new ReturnType(Entity::class),
|
||||
new ParameterType("world", World::class),
|
||||
new ParameterType("nbt", CompoundTag::class)
|
||||
);
|
||||
@ -193,7 +192,7 @@ final class EntityFactory{
|
||||
throw new \InvalidArgumentException("At least one save name must be provided");
|
||||
}
|
||||
Utils::testValidInstance($className, Entity::class);
|
||||
self::validateCreationFunc($className, $creationFunc);
|
||||
self::validateCreationFunc($creationFunc);
|
||||
|
||||
foreach($saveNames as $name){
|
||||
$this->creationFuncs[$name] = $creationFunc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user