Merge branch 'next-minor' into next-major

This commit is contained in:
Dylan K. Taylor
2022-12-18 21:05:26 +00:00
6 changed files with 118 additions and 45 deletions

View File

@ -131,6 +131,7 @@ use pocketmine\world\sound\Sound;
use pocketmine\world\World;
use Ramsey\Uuid\UuidInterface;
use function abs;
use function array_filter;
use function array_map;
use function array_shift;
use function assert;
@ -2280,10 +2281,11 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
$this->getWorld()->dropItem($this->location, $item);
}
$clearInventory = fn(Inventory $inventory) => $inventory->setContents(array_filter($inventory->getContents(), fn(Item $item) => $item->keepOnDeath()));
$this->inventory->setHeldItemIndex(0);
$this->inventory->clearAll();
$this->armorInventory->clearAll();
$this->offHandInventory->clearAll();
$clearInventory($this->inventory);
$clearInventory($this->armorInventory);
$clearInventory($this->offHandInventory);
}
if(!$ev->getKeepXp()){