diff --git a/src/main/java/com/atsuishio/superbwarfare/block/SuperbItemInterfaceBlock.java b/src/main/java/com/atsuishio/superbwarfare/block/SuperbItemInterfaceBlock.java index b81ed4090..6f019fa34 100644 --- a/src/main/java/com/atsuishio/superbwarfare/block/SuperbItemInterfaceBlock.java +++ b/src/main/java/com/atsuishio/superbwarfare/block/SuperbItemInterfaceBlock.java @@ -2,13 +2,16 @@ package com.atsuishio.superbwarfare.block; import com.atsuishio.superbwarfare.block.entity.SuperbItemInterfaceBlockEntity; import com.atsuishio.superbwarfare.init.ModBlockEntities; +import com.atsuishio.superbwarfare.init.ModItems; import com.mojang.serialization.MapCodec; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.world.Containers; +import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.item.Item; @@ -75,6 +78,17 @@ public class SuperbItemInterfaceBlock extends BaseEntityBlock { } } + @Override + @ParametersAreNonnullByDefault + protected @NotNull ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) { + if (stack.is(ModItems.CROWBAR.get())) { + var facing = hitResult.getDirection(); + level.setBlockAndUpdate(pos, state.setValue(FACING, facing)); + return ItemInteractionResult.SUCCESS; + } + return super.useItemOn(stack, state, level, pos, player, hand, hitResult); + } + @Override @ParametersAreNonnullByDefault protected @NotNull InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) {