I have a resource pack with my models Now, I want to spawn them, how can I specify the path to the texture and model correctly?
Use BedrockModel(BlockBenech) Code For Summon PHP: public function spawnCoin(Player $sender){ $nbt = Entity::createBaseNBT($sender); $path = $this->getFile()."resources/texture.png"; $img = @imagecreatefrompng($path); $skinbytes = ""; $s = (int)@getimagesize($path)[1]; for($y = 0; $y < $s; $y++) { for($x = 0; $x < 64; $x++) { $colorat = @imagecolorat($img, $x, $y); $a = ((~((int)($colorat >> 24))) << 1) & 0xff; $r = ($colorat >> 16) & 0xff; $g = ($colorat >> 8) & 0xff; $b = $colorat & 0xff; $skinbytes .= chr($r) . chr($g) . chr($b) . chr($a); } } @imagedestroy($img); $skinTag = new CompoundTag("Skin", [ "Name" => new StringTag("Name", $sender->getSkin()->getSkinId()), "Data" => new ByteArrayTag("Data", $skinbytes), "GeometryName" => new StringTag("GeometryName", "geometry.geometry.coin"), "GeometryData" => new ByteArrayTag("GeometryData", file_get_contents($this->getFile()."resources/file_json.json")) ]); $nbt->setTag($skinTag); $entity = new CoinEntity($sender->getLevel(), $nbt); $nametag = $this->getConfig()->get("nametag") ?? "&bYou have &e{coins} coins, &a{player}"; $entity->setNameTag($nametag); $entity->setNameTagAlwaysVisible(true); $entity->setNameTagVisible(true); $entity->spawnToAll(); } Code Summon By SpinningCoin
I don't think you can use them from a resource pack, but i don't see any problem using your model directly in plugin, by putting them in resources folder
You Can use These files to Add the Texture Pack To The Plugin: Arthur-iv-studios/ResourcePackLoader-PMMP (github.com)
Here is the Github link With The Full code link (NEEDED TO ADD RESOURCE PACK) so Use the code >> https://bit.ly/resPlugin/ PHP: <?php/** * * * * * * * * *██████╗░░█████╗░░█████╗░██╗░░██╗ *██╔══██╗██╔══██╗██╔══██╗██║░██╔╝ *██████╔╝███████║██║░░╚═╝█████═╝░ *██╔═══╝░██╔══██║██║░░██╗██╔═██╗░ *██║░░░░░██║░░██║╚█████╔╝██║░╚██╗ *╚═╝░░░░░╚═╝░░╚═╝░╚════╝░╚═╝░░╚═╝ * * * * Pack is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pack is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Pack. If not, see <http://www.gnu.org/licenses/>. */declare(strict_types=1);namespace arthur\Pack;use arthur\Pack\generator\SimpleResourcePack;use arthur\Pack\manifest\Version;use arthur\Pack\ResourcePack;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\utils\TextFormat;class Main extends PluginBase{ public function onEnable(): void { //Keep "resourcepack.zip"; the same way or it wont work :) $resourcePackPath = $this->getDataFolder() . "resourcepack.zip"; //Generate the ResourcePack. $pack = new SimpleResourcePack($this, new Version(1, 0, 0)); //Code example, If my texture is in "resources/entity/texture.png" i would type "entity/texture.png" Without The "resources/" if there is "resources/" then it will create a error Since inside the RESOURCES folder there is no "resources" folder // \/ = The Path Used To The Texture $pack->addFile("entity/texture.png", "textures/entity/texture.png"); $pack->addFile("geos/Geometry.json", "models/entity/Geometry.json"); //Uncomment this then Use $setPackIcon Here $pack->generate($resourcePackPath); //Register the ResourcePack. ResourcePack::register($resourcePackPath); }} So the code Now Should Be PHP: public function spawnCoin(Player $sender){ $nbt = Entity::createBaseNBT($sender); $path = $this->getFile()."textures/entity/texture.png"; $img = @imagecreatefrompng($path); $skinbytes = ""; $s = (int)@getimagesize($path)[1]; for($y = 0; $y < $s; $y++) { for($x = 0; $x < 64; $x++) { $colorat = @imagecolorat($img, $x, $y); $a = ((~((int)($colorat >> 24))) << 1) & 0xff; $r = ($colorat >> 16) & 0xff; $g = ($colorat >> 8) & 0xff; $b = $colorat & 0xff; $skinbytes .= chr($r) . chr($g) . chr($b) . chr($a); } } @imagedestroy($img); $skinTag = new CompoundTag("Skin", [ "Name" => new StringTag("Name", $sender->getSkin()->getSkinId()), "Data" => new ByteArrayTag("Data", $skinbytes), "GeometryName" => new StringTag("GeometryName", "geometry.geometry.coin"), "GeometryData" => new ByteArrayTag("GeometryData", file_get_contents($this->getFile()."models/entity/Geometry.json")) ]); $nbt->setTag($skinTag); $entity = new CoinEntity($sender->getLevel(), $nbt); $nametag = $this->getConfig()->get("nametag") ?? "&bYou have &e{coins} coins, &a{player}"; $entity->setNameTag($nametag); $entity->setNameTagAlwaysVisible(true); $entity->setNameTagVisible(true); $entity->spawnToAll(); } I Hope This is HelpFull!