mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
painting wont be placed if there is a painting already
This commit is contained in:
parent
d1121e862e
commit
0963f09ea1
5 changed files with 35 additions and 16 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue