mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Inventory: remove dropContents(), remove circular dependency
This commit is contained in:
parent
f49d590794
commit
0ac7164b16
@ -26,8 +26,6 @@ namespace pocketmine\inventory;
|
||||
use pocketmine\event\inventory\InventoryOpenEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\InventoryContentPacket;
|
||||
use pocketmine\network\mcpe\protocol\InventorySlotPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ContainerIds;
|
||||
@ -146,21 +144,6 @@ abstract class BaseInventory implements Inventory{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops the contents of the inventory into the specified Level at the specified position and clears the inventory
|
||||
* contents.
|
||||
*
|
||||
* @param Level $level
|
||||
* @param Vector3 $position
|
||||
*/
|
||||
public function dropContents(Level $level, Vector3 $position) : void{
|
||||
foreach($this->getContents() as $item){
|
||||
$level->dropItem($position, $item);
|
||||
}
|
||||
|
||||
$this->clearAll();
|
||||
}
|
||||
|
||||
public function setItem(int $index, Item $item, bool $send = true) : bool{
|
||||
if($item->isNull()){
|
||||
$item = ItemFactory::get(Item::AIR, 0, 0);
|
||||
|
@ -27,8 +27,6 @@ declare(strict_types=1);
|
||||
namespace pocketmine\inventory;
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\Player;
|
||||
|
||||
interface Inventory{
|
||||
@ -122,15 +120,6 @@ interface Inventory{
|
||||
*/
|
||||
public function setContents(array $items, bool $send = true) : void;
|
||||
|
||||
/**
|
||||
* Drops the contents of the inventory into the specified Level at the specified position and clears the inventory
|
||||
* contents.
|
||||
*
|
||||
* @param Level $level
|
||||
* @param Vector3 $position
|
||||
*/
|
||||
public function dropContents(Level $level, Vector3 $position) : void;
|
||||
|
||||
/**
|
||||
* @param Player|Player[] $target
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user