允许使用撬棍调整卓越物品接口方向
This commit is contained in:
parent
2f0866e00b
commit
e757a298f6
1 changed files with 14 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue