HitResult result = entity.pick(4.0f, 0.0f, false);

        if(result.getType() == HitResult.Type.BLOCK) {
            BlockPos pos = ((BlockHitResult) result).getBlockPos();

            List<Lockable> match = LocksUtil.intersecting(level, pos).collect(Collectors.toList());

            if (!match.isEmpty()) {
                int openedLocks = 0;
                int blockedLocks = 0;
                boolean playedSound = false;

                for (Lockable lkb : match) {
                    int complexityLevel = getComplexityLevel(lkb);

                    if (complexityLevel > 0) {
                        blockedLocks++;

                        // Проигрываем другой звук для заблокированных замков
                        if (!level.isClientSide() && !playedSound) {
                            level.playSound(null, pos, LocksSoundEvents.LOCK_OPEN.get(),
                                    SoundSource.BLOCKS, 1.0f, 1.0f);
                            playedSound = true;
                        }
                        continue;
                    }
                    if (!level.isClientSide()) {
                        level.playSound(null, pos,
                                melonslise.locks.common.init.LocksSoundEvents.LOCK_OPEN.get(),
                                SoundSource.BLOCKS, 1f, 1f);
                        lkb.lock.setLocked(!lkb.lock.isLocked());
                        openedLocks++;
                    }
                }
                if (!level.isClientSide() && entity != null) {
                    if (blockedLocks > 0) {
                        entity.sendSystemMessage(
                                Component.translatable("ui.dnmmod.knock.complexity_blocked", blockedLocks)
                                        .withStyle(ChatFormatting.RED)
                        );
                    }
                    if (openedLocks > 0) {
                        entity.sendSystemMessage(
                                Component.translatable("ui.dnmmod.knock.opened", openedLocks)
                                        .withStyle(ChatFormatting.GREEN)
                        );
                    }
                    else if (openedLocks == 0 && blockedLocks > 0) {
                        entity.sendSystemMessage(
                                Component.translatable("ui.dnmmod.knock.all_blocked")
                                        .withStyle(ChatFormatting.DARK_RED)
                        );
                    }
                }
            }
        }