mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 02:09:42 +00:00
Fixed Chests and Furnaces not droping their contents when broken
This commit is contained in:
parent
c778e0467e
commit
130b2c4910
@ -136,8 +136,8 @@ class Chest extends Transparent{
|
||||
);
|
||||
$t = $this->getLevel()->getTile($this);
|
||||
if($t instanceof TileChest){
|
||||
for($s = 0; $s < $t->getInventory()->getSize(); ++$s){
|
||||
$slot = $t->getInventory()->getItem($s);
|
||||
for($s = 0; $s < $t->getRealInventory()->getSize(); ++$s){
|
||||
$slot = $t->getRealInventory()->getItem($s);
|
||||
if($slot->getID() > Item::AIR and $slot->getCount() > 0){
|
||||
$drops[] = array($slot->getID(), $slot->getDamage(), $slot->getCount());
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ use pocketmine\Server;
|
||||
|
||||
class PlayerInventory extends BaseInventory{
|
||||
|
||||
protected $itemInHandIndex = -1;
|
||||
protected $itemInHandIndex = 0;
|
||||
/** @var int[] */
|
||||
protected $hotbar;
|
||||
|
||||
|
@ -756,6 +756,7 @@ class Level{
|
||||
return false;
|
||||
}
|
||||
|
||||
$drops = $target->getDrops($item); //Fixes tile entities being deleted before getting drops
|
||||
$target->onBreak($item);
|
||||
if($item instanceof Item){
|
||||
$item->useOn($target);
|
||||
@ -765,7 +766,7 @@ class Level{
|
||||
}
|
||||
|
||||
if(!($player instanceof Player) or ($player->getGamemode() & 0x01) === 0){
|
||||
foreach($target->getDrops($item) as $drop){
|
||||
foreach($drops as $drop){
|
||||
if($drop[2] > 0){
|
||||
$this->dropItem($vector->add(0.5, 0.5, 0.5), Item::get($drop[0], $drop[1], $drop[2]), 1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user