2019-10-28 21:48:10 +00:00
|
|
|
package net.shadowfacts.phycon.network
|
|
|
|
|
|
|
|
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-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
|
|
|
import net.shadowfacts.phycon.block.BlockWithEntity
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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-14 02:28:44 +00:00
|
|
|
override fun getNetworkInterfaceForSide(side: Direction, state: BlockState, world: World, pos: BlockPos): Interface? {
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|