From e757a298f68c2f4f7b2e8b4aa6b9749e57b0190d Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Thu, 10 Jul 2025 00:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=81=E8=AE=B8=E4=BD=BF=E7=94=A8=E6=92=AC?= =?UTF-8?q?=E6=A3=8D=E8=B0=83=E6=95=B4=E5=8D=93=E8=B6=8A=E7=89=A9=E5=93=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=B9=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../block/SuperbItemInterfaceBlock.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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) {