mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Working item frames
This commit is contained in:
@ -133,6 +133,7 @@ use pocketmine\network\SourceInterface;
|
||||
use pocketmine\permission\PermissibleBase;
|
||||
use pocketmine\permission\PermissionAttachment;
|
||||
use pocketmine\plugin\Plugin;
|
||||
use pocketmine\tile\ItemFrame;
|
||||
use pocketmine\tile\Sign;
|
||||
use pocketmine\tile\Spawnable;
|
||||
use pocketmine\tile\Tile;
|
||||
@ -2930,6 +2931,25 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$this->dataPacket($pk);
|
||||
$this->sendSettings();
|
||||
}
|
||||
break;
|
||||
case ProtocolInfo::ITEM_FRAME_DROP_ITEM_PACKET:
|
||||
if($this->spawned === false or $this->blocked === true or !$this->isAlive()){
|
||||
break;
|
||||
}
|
||||
|
||||
if(($tile = $this->level->getTile($this->temporalVector->setComponents($packet->x, $packet->y, $packet->z))) instanceof ItemFrame){
|
||||
if(!$tile->getItem()->equals($packet->item) and !$this->isCreative(true)){
|
||||
$tile->spawnTo($this);
|
||||
break;
|
||||
}
|
||||
|
||||
if(lcg_value() <= $tile->getItemDropChance() and $packet->item->getId() !== Item::AIR){
|
||||
$this->level->dropItem($tile->getBlock(), $packet->item); //Use the packet item to handle creative drops correctly
|
||||
}
|
||||
$tile->setItem(null);
|
||||
$tile->setItemRotation(0);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -3025,7 +3045,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$pk->message = $message;
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sender
|
||||
* @param string $message
|
||||
|
Reference in New Issue
Block a user