2021-02-28 18:48:39 +00:00
|
|
|
package net.shadowfacts.phycon.block
|
2019-10-28 21:48:10 +00:00
|
|
|
|
|
|
|
import net.minecraft.block.BlockState
|
|
|
|
import net.minecraft.entity.player.PlayerEntity
|
|
|
|
import net.minecraft.util.math.BlockPos
|
2021-02-14 02:28:44 +00:00
|
|
|
import net.minecraft.util.math.Direction
|
2019-10-28 21:48:10 +00:00
|
|
|
import net.minecraft.world.World
|
2021-02-18 03:29:18 +00:00
|
|
|
import net.minecraft.world.WorldAccess
|
2021-02-14 02:28:44 +00:00
|
|
|
import net.shadowfacts.phycon.api.Interface
|
2021-02-13 23:24:36 +00:00
|
|
|
import net.shadowfacts.phycon.api.NetworkComponentBlock
|
2019-10-28 21:48:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author shadowfacts
|
|
|
|
*/
|
2021-02-13 23:24:36 +00:00
|
|
|
abstract class DeviceBlock<T: DeviceBlockEntity>(settings: Settings): BlockWithEntity<T>(settings), NetworkComponentBlock {
|
2019-10-28 21:48:10 +00:00
|
|
|
|
2021-02-18 03:29:18 +00:00
|
|
|
abstract override fun getNetworkConnectedSides(state: BlockState, world: WorldAccess, pos: BlockPos): Collection<Direction>
|
2021-02-14 21:03:40 +00:00
|
|
|
|
2021-02-18 03:29:18 +00:00
|
|
|
override fun getNetworkInterfaceForSide(side: Direction, state: BlockState, world: WorldAccess, pos: BlockPos): Interface? {
|
2021-02-14 02:28:44 +00:00
|
|
|
return getBlockEntity(world, pos)!!
|
|
|
|
}
|
|
|
|
|
2019-10-28 21:48:10 +00:00
|
|
|
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity) {
|
|
|
|
super.onBreak(world, pos, state, player)
|
|
|
|
getBlockEntity(world, pos)!!.onBreak()
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|