允许取反卓越物品接口朝向

This commit is contained in:
Light_Quanta 2025-07-10 15:12:00 +08:00
parent 15b20eb86f
commit 07950ecf6f
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -84,6 +84,9 @@ public class SuperbItemInterfaceBlock extends BaseEntityBlock {
protected @NotNull ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
if (stack.is(ModItems.CROWBAR.get()) || stack.is(ModTags.Items.WRENCHES_TAG) || stack.is(ModTags.Items.WRENCH_TAG)) {
var facing = hitResult.getDirection();
if (state.getValue(FACING) == facing) {
facing = facing.getOpposite();
}
level.setBlockAndUpdate(pos, state.setValue(FACING, facing));
return ItemInteractionResult.SUCCESS;
}