public function onUpdate($type)
{
if ($type === Level::BLOCK_UPDATE_NORMAL) {
$below = $this->getSide(0);
$side = $this->getDamage();
$faces = [1 => 4, 2 => 5, 3 => 2, 4 => 3, 5 => 0, 6 => 0, 0 => 0];
if ($this->getSide($faces[$side])->isTransparent() === true and !($side === 0 and ($below instanceof Fence or $below->getId() === self::COBBLE_WALL or $below->getId() === self::GLASS || $below instanceof Slab && ($below->meta & 0x8) === 0x8 || $below instanceof WoodSlab && ($below->meta & 0x8) === 0x8 || $below instanceof Stair && ($below->meta & 0x4) === 0x4))) {
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
}
}