Все добрый добрый, или ночи у кого как, помогите решить ошибку в коде
ОШИБКА
2024-11-27 [04:53:58] [Server thread/CRITICAL]: ArgumentCountError: “Too few arguments to function pocketmine\entity\Entity::createBaseNBT(), 1 passed in /home/container/plugins/SetNpcPlugin/src/SetNpcPlugin/Main.php on line 36 and exactly 4 expected” (EXCEPTION) in “src/pocketmine/entity/Entity” at line 527
КОД ПЛАГИНА
<?php
namespace NpcCreate;
use pocketmine\plugin\PluginBase;
use pocketmine\event\Listener;
use pocketmine\command\CommandSender;
use pocketmine\command\Command;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\event\entity\EntityDamageByEntityEvent;
use pocketmine\entity\Entity;
use pocketmine\entity\Human;
use pocketmine\nbt\tag\DoubleTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmime\nbt\tag\ListTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\ShortTag;
use pocketmine\nbt\NBT;
use pocketmine\utils\Config;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\Server;
class Main extends PluginBase implements Listener {
public function onEnable(){
$this->getLogger()->info("Плагин был успешно включён, (ПРИЯТНОЙ ВАМ РАБОТЫ)");
$this->getServer()->getPluginManager()->registerEvents($this, $this);
}
public function onCommand(CommandSender $sender, Command $command, $label, array $args): bool {
if ($command->getName() === "setnpc") {
if ($sender instanceof Player) {
$this->npcspawn($sender);
$sender->sendMessage("§aNPC успешно создан!");
return true;
} else {
$sender->sendMessage("§cЭту команду можно использовать только в игре!");
return false;
}
}
return false;
}
public function npcspawn(Player $player) {
$nbt = new CompoundTag("", [
"Pos" => new ListTag([
new DoubleTag($player->getX()),
new DoubleTag($player->getY()),
new DoubleTag($player->getZ()),
]),
"Motion" => new ListTag([
new DoubleTag(0),
new DoubleTag(0),
new DoubleTag(0),
]),
"Rotation" => new ListTag([
new FloatTag($player->getYaw()),
new FloatTag($player->getPitch()),
]),
"Skin" => new CompoundTag("Skin", [
"Data" => new StringTag("Data", $player->getSkinData()),
"Name" => new StringTag("Name", $player->getSkinId()),
])
]);
$level = $player->getLevel();
$npc = new Human($level, $nbt);
$npc->setNameTag("§l§eЖИТЕЛЬ");
$npc->setNameTagVisible(true);
$npc->setNameTagAlwaysVisible(true);
$npc->spawnToAll();
}
}
Буду рад если вы мне поможете!