2021-02-13 23:24:36 +00:00
|
|
|
package net.shadowfacts.phycon.network.block.test
|
|
|
|
|
|
|
|
import net.minecraft.block.BlockState
|
|
|
|
import net.minecraft.block.Material
|
|
|
|
import net.minecraft.entity.player.PlayerEntity
|
|
|
|
import net.minecraft.util.ActionResult
|
|
|
|
import net.minecraft.util.Hand
|
|
|
|
import net.minecraft.util.Identifier
|
|
|
|
import net.minecraft.util.hit.BlockHitResult
|
|
|
|
import net.minecraft.util.math.BlockPos
|
|
|
|
import net.minecraft.util.math.Direction
|
|
|
|
import net.minecraft.world.BlockView
|
|
|
|
import net.minecraft.world.World
|
2021-02-18 03:29:18 +00:00
|
|
|
import net.minecraft.world.WorldAccess
|
2021-02-13 23:24:36 +00:00
|
|
|
import net.shadowfacts.phycon.PhysicalConnectivity
|
|
|
|
import net.shadowfacts.phycon.network.DeviceBlock
|
|
|
|
import java.util.*
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author shadowfacts
|
|
|
|
*/
|
|
|
|
class DestBlock: DeviceBlock<DestBlockEntity>(Settings.of(Material.METAL)) {
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
val ID = Identifier(PhysicalConnectivity.MODID, "dest")
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun createBlockEntity(world: BlockView): DestBlockEntity {
|
|
|
|
return DestBlockEntity()
|
|
|
|
}
|
|
|
|
|
2021-02-18 03:29:18 +00:00
|
|
|
override fun getNetworkConnectedSides(state: BlockState, world: WorldAccess, pos: BlockPos): MutableCollection<Direction> {
|
2021-02-13 23:24:36 +00:00
|
|
|
return EnumSet.allOf(Direction::class.java)
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onUse(
|
|
|
|
blockState: BlockState?,
|
|
|
|
world: World,
|
|
|
|
pos: BlockPos,
|
|
|
|
playerEntity: PlayerEntity?,
|
|
|
|
hand: Hand?,
|
|
|
|
blockHitResult: BlockHitResult?
|
|
|
|
): ActionResult {
|
|
|
|
println("dest IP: ${getBlockEntity(world, pos)!!.ipAddress}")
|
|
|
|
return ActionResult.SUCCESS
|
|
|
|
}
|
|
|
|
}
|