Add vanilla-style crafting grid item evacuation server-side when closing the window in case something goes wrong

This commit is contained in:
Dylan K. Taylor 2017-09-15 13:22:53 +01:00
parent 6b34c47c96
commit d941bf8e74

View File

@ -3736,7 +3736,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
public function resetCraftingGridType() : void{
if($this->craftingGrid instanceof BigCraftingGrid){
//TODO: this needs to drop anything left in the crafting grid otherwise our items might get deleted
$drops = $this->inventory->addItem(...$this->craftingGrid->getContents());
foreach($drops as $drop){
$this->dropItem($drop);
}
$this->craftingGrid = new CraftingGrid($this);
$this->craftingType = 0;
}