public function onUpdate($type, $fromBlock = NULL)
{
if ($type == Level::BLOCK_UPDATE_NORMAL) {
if ($fromBlock != NULL) {
$this->onUpdateRecieve(self::TYPE_BLOCK_OBJECT, $fromBlock);
}
}
if ($type === Level::BLOCK_UPDATE_SCHEDULED) {
if ($this->currentStatus != self::STATUS_IS_DEACTIVATED) {
if ($this->currentStatus == self::STATUS_IS_ACTIVATED) {
$this->getLevel()->setRedstoneUpdate($this->getOutputBlock(), Block::REDSTONEDELAY, Level::REDSTONE_UPDATE_BLOCK, Block::REDSTONESOURCEPOWER);
$this->currentStatus = self::STATUS_QUED_FOR_DEACTIVATION;
$this->getLevel()->scheduleUpdate($this, 2);
} elseif ($this->currentStatus == self::STATUS_QUED_FOR_DEACTIVATION) {
$this->currentStatus = self::STATUS_IS_DEACTIVATED;
$this->getLevel()->setRedstoneUpdate($this->getOutputBlock(), Block::REDSTONEDELAY, Level::REDSTONE_UPDATE_BLOCK, 0);
}
}
}
}