Implemented an InventoryEventProcessor, fixes #1986 (#2176)

* Implemented InventoryEventProcessor, fixes #1986
Event processors can now be registered and unregistered at will. Entity inventory/armor change events are now handled by event processors instead of the inventories themselves, which allows enabling/disabling the calling of these events at will.
This now avoids stupid things happening when initializing inventory contents, since the callers for those events are now registered _after_ the contents are initialized.
This commit is contained in:
Dylan K. Taylor
2018-06-09 17:37:10 +01:00
committed by GitHub
parent 8e5aca70b4
commit f6481eab8f
11 changed files with 159 additions and 43 deletions

View File

@ -102,10 +102,4 @@ class FurnaceInventory extends ContainerInventory{
public function setSmelting(Item $item) : bool{
return $this->setItem(0, $item);
}
public function onSlotChange(int $index, Item $before, bool $send) : void{
parent::onSlotChange($index, $before, $send);
$this->getHolder()->scheduleUpdate();
}
}