Skip to content

DaisukeDaisukeTeam/CustomEntityLoader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CustomEntityLoader

A plugin that simplifies the sending of AvailableActorIdentifiersPacket by Rush2929

download

Please note that the phar build of poggit ci is broken.
https://github.com/DaisukeDaisukeTeam/CustomEntityLoader/releases

Example(and difference)

when using CustomEntityLoader

use Rush2929\CustomEntityLoader\CustomEntityLoader;
use Rush2929\CustomEntityLoader\EntityRegistryEntry;
CustomEntityLoader::getEntityRegistry()->add(new EntityRegistryEntry(
	"Test:sample_entity", // Entity identifier
	//"minecraft:..." // behaviorId(option)
));

when not using CustomEntityLoader

public function onsend(DataPacketSendEvent $event): void{
    foreach($event->getPackets() as $packet){
        if(!$packet instanceof AvailableActorIdentifiersPacket) continue;
        $add = new CompoundTag();
        $add->setString("bid", "");
        $add->setByte("hasspawnegg", (int) false);
        $add->setString("id", "Test:sample_entity");
        $add->setInt("rid", 200);
        $add->setByte("summonable", (int) true);
        /** @var CompoundTag $base */
        $base = $packet->identifiers->getRoot();
        $nbt = $base->getListTag("idlist");
        if($nbt === null) throw new AssumptionFailedError("\$nbt === null");
        $nbt->push($add);
    }
}
/*
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\network\mcpe\cache\StaticPacketCache;
*/
public function onEnable(): void{
	$add = CompoundTag::create();
	$add->setString("bid", "");
	$add->setByte("hasspawnegg", (int) false);
	$add->setString("id", "test:test_entity");//entity identifier
	//$add->setInt("rid", 200);
	$add->setByte("summonable", (int) true);

	/** @var CompoundTag $nbt */
	$nbt = StaticPacketCache::getInstance()->getAvailableActorIdentifiers()->identifiers->getRoot();
	/** @var ListTag $tag */
	$tag = $nbt->getListTag("idlist");
	$tag->push($add);
}

credit

This repository is a fork of https://github.com/Rush2929/CustomEntityLoader.

Notes

  • No behavior pack is required.
  • This plugin does not register entities with pmmp.
  • Please note that the client ignores entities registered from global resources

vs

Customies

A PocketMine-MP plugin that implements support for custom blocks, items and entities.
https://github.com/CustomiesDevs/Customies