public function onUpdate($type)
{
$faces = [1 => 4, 2 => 5, 3 => 2, 4 => 3, 5 => 0, 6 => 0, 0 => 0];
if ($type === Level::BLOCK_UPDATE_NORMAL) {
$below = $this->getSide(0);
$side = $this->getDamage();
if ($this->getSide($faces[$side])->isTransparent() === true and !($side === 0 and ($below->getId() === self::FENCE or $below->getId() === self::COBBLE_WALL))) {
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
$this->activate([$faces[$side]]);
}
if ($type == Level::BLOCK_UPDATE_SCHEDULED) {
if ($this->id == self::UNLIT_REDSTONE_TORCH) {
$this->turnOn($this->ignore);
} else {
$this->turnOff($this->ignore);
}
return Level::BLOCK_UPDATE_SCHEDULED;
}
return false;
}