Hello, I created a human entity with a custom skin but I created the entity in the pluginbase so it creates the entity whenever I execute a command like /human. Is there any way to apply a custom behavior to the entity? I found a code that makes an entity behave like an enemy where it follows a player and attacks but I have no idea on how to combine the custom entity and the boss behavior PHP: class myEntity extends myBehavior{ public function getName(): string { return "Bomber"; } public function initEntity(): void { $image = imagecreatefrompng(Main::getInstance()->getDataFolder() . "bomber.png");$data = '';for ($y = 0, $height = imagesy($image); $y < $height; $y++) { for ($x = 0, $width = imagesx($image); $x < $width; $x++) { $color = imagecolorat($image, $x, $y); $data .= pack("c", ($color >> 16) & 0xFF) //red . pack("c", ($color >> 8) & 0xFF) //green . pack("c", $color & 0xFF) //blue . pack("c", 255 - (($color & 0x7F000000) >> 23)); //alpha }}$skin = new Skin("Bomber", $data);$this->setSkin($skin); } I tried separating the custom entity onto the main plugin and just extend it onto the boss behavior but no matter where I place the setSkin, whether it's on the pluginbase or the custom entity file, it just throws an error that it needs a valin skin id. I have already tried setting the entity skin in the pluginbase and it works just fine.
You can combine these two functions for the movement: PHP: $entity->setRotation($yaw, $pitch); // Rotate the entity's head towards player$entity->move($x, $y, $z); // Move the entity to a specific coordinat I can think of two methods for attacking but the first one is simple, yet deprecated, so I don't recommend it. Second one is too long to explain and I don't want to sit here explaining everything by text, so you might want to check out other people's work for it. Cheers!
Oh that's cool, alright imma try the movement and I think I found my answer of entity attacking as well, thanks!