painting wont be placed if there is a painting already

This commit is contained in:
GameHerobrine 2024-11-28 04:41:55 +03:00
parent d1121e862e
commit 0963f09ea1
5 changed files with 35 additions and 16 deletions

View file

@ -56,8 +56,15 @@ class PaintingItem extends Item{
"yPos" => $target->y,
"zPos" => $target->z,
);
$e = $server->api->entity->add($level, ENTITY_OBJECT, OBJECT_PAINTING, $data);
$server->api->entity->spawnToAll($e);
$painting = new Painting($level, 0, ENTITY_OBJECT, OBJECT_PAINTING, $data);
if(!$painting->isValid){
$player->sendInventory(); //force resync
return false;
}
$painting->eid = $server->api->entity->getNextEID();
$server->api->entity->addRaw($painting);
$server->api->entity->spawnToAll($painting);
if(($player->gamemode & 0x01) === 0x00){
$player->removeItem($this->getID(), $this->getMetadata(), 1, false);
}