@@ -6,13 +6,18 @@ import com.simibubi.create.foundation.block.IBE
66import com.simibubi.create.foundation.utility.Iterate
77import net.minecraft.core.BlockPos
88import net.minecraft.core.Direction
9+ import net.minecraft.world.InteractionHand
10+ import net.minecraft.world.InteractionResult
11+ import net.minecraft.world.entity.player.Player
12+ import net.minecraft.world.item.ItemStack
913import net.minecraft.world.item.context.BlockPlaceContext
1014import net.minecraft.world.level.Level
1115import net.minecraft.world.level.block.Block
1216import net.minecraft.world.level.block.DirectionalBlock
1317import net.minecraft.world.level.block.entity.BlockEntityType
1418import net.minecraft.world.level.block.state.BlockState
1519import net.minecraft.world.level.block.state.StateDefinition
20+ import net.minecraft.world.phys.BlockHitResult
1621import org.valkyrienskies.clockwork.ClockworkBlockEntities
1722import org.valkyrienskies.clockwork.content.logistics.gas.INodeBlock
1823
@@ -85,4 +90,19 @@ class ExtendonBlock(properties: Properties) : DirectionalBlock(properties), IBE<
8590 override fun getBlockEntityType (): BlockEntityType <out ExtendonBlockEntity > {
8691 return ClockworkBlockEntities .EXTENDON .get()
8792 }
93+
94+ override fun use (
95+ state : BlockState ,
96+ level : Level ,
97+ pos : BlockPos ,
98+ player : Player ,
99+ hand : InteractionHand ,
100+ hit : BlockHitResult
101+ ): InteractionResult {
102+
103+ val be = level.getBlockEntity(pos) as ? ExtendonBlockEntity ? ? : return super .use(state, level, pos, player, hand, hit)
104+ if (player.getItemInHand(hand) == ItemStack .EMPTY ) be.disconnect()
105+
106+ return super .use(state, level, pos, player, hand, hit)
107+ }
88108}
0 commit comments