16

Since Minecraft's release (and I believe since its creation), there was a bug that allowed you a to repeatedly input a command. I've seen it called the "afk bug", "F11 bug", or "alt tab bug".

Basically, you held down some key(s) and pressed f11 to toggle between windowed and full screen. Then the command would continue to be input. This command would persist to be input even after you alt tab to something else. Honestly, I almost thought it was a feature.

But 1.13 fixed my "feature" that I used mainly for fishing and cobblestone.

How can I AFK click in Minecraft post 1.13 (Java Edition)?

6
  • 1
    Are you open to solutions external to the game (autohotkey, etc.)? And if so, which platform are you using?
    – Bilkokuya
    Dec 12, 2018 at 13:09
  • 1
    @Bilkokuya platform updated to PC (Java Edition). I would be open to any simple and effective solution.
    – goodguy5
    Dec 12, 2018 at 13:19
  • The fact that all of the top three answers start with "this solution is not minecraft-specific" indicates that the question is actually not game-specific, but instead "how do I auto-click on a PC" and therefore off-topic on Arqade.
    – pppery
    Aug 2, 2019 at 2:37
  • 1
    @pppery I don't think we should judge this question's "on-topic"-ness based on its answers. OP's issue is specifically for Minecraft. General "auto-click" solutions might not work for Minecraft specifically or might not work optimally with it. It just so happens that many general solutions do work. Aug 2, 2019 at 7:27
  • @pppery It's in that sense similar to this question: the answer happens to have a game-unspecific answer, but the OP does not ask for it. Editing some of the game files could yield a similar result.
    – Joachim
    Aug 2, 2019 at 8:54

9 Answers 9

18

In 1.14, there is a way to afk fish that means you can alt-tab out. You point and press with the mouse, and then unplug the mouse. This provides an autoclick that will work as an afk fisher. However, if you want to then leave Minecraft, you can reload the texture packs, (fn + F3 + T for Windows, cmd + fn + F3 + T for Mac) and then, while the packs are reloading, alt-tab out. Then, you can alt-tab in and out, no issues. Minecraft will still believe you are clicking, when in reality, you can be playing another game, or watching YouTube, or really anything else. In fact, I just did this while typing out this answer.

4
  • Thank you, I think this is the best working AND easiest solution, requiring no external software. I was tampering with AHK's ControlClick and it does work but even without window focus, when I move the mouse I moved in the game. And when you do the f3+t variation you don't have to unplug the mouse for anyone wondering. Jun 30, 2019 at 21:43
  • Does this still work for you in 1.15.1? Which operating system are you using? I just tried basically the same on Debian: Using xdotool to send a keydown or mousedown event to Minecraft, then switching to a different window and sending the corresponding keyup or mouseup event to that other window. Minecraft stops using the click action as soon as it's no longer the focused window. Dec 31, 2019 at 8:41
  • UPDATED FOR MAC USERS The method with using FN+F3+T works you just have to bind your use (right click) button to your left click, hold that down and do the above command and it works.
    – Daniel
    Apr 7, 2020 at 22:16
  • Has anyone else had this stop working recently? Minecraft did a download update recently (my version still shows 1.17 though) and now F3 + T no longer keeps the menu auto-clicking
    – kobowo
    Jul 6, 2021 at 15:00
22

As Henry Statitovski has pretty much already said, the best way to do this is to:

  1. Hold down right-click on the mouse.
  2. Press F3+T (FN+F3+T for some users)
  3. Before it finishes loading, Alt+Tab out of the window and let go of the right mouse button. Once it has loaded then you can tab in and out freely.

One crucial bit of information is that "pauseOnLostFocus" must be "false" to prevent the game from pausing when Alt+Tabing. This can be toggled in-game by doing F3+P (FN+F3+P for some users)

2
  • Finally a Minecraft specific answer! :D Note that currently (1.15.1) there's a resource leak bug when reloading resource packs, meaning that your performance will be considerably worse than when playing regularly. Dec 31, 2019 at 8:46
  • This is the best answer in my opinion. It still works in Java 1.16+, you acknowledged that some users don't need the FN key, and the pauseOnLostFocus setting was the last tidbit of info I needed to get it working.
    – Johonn
    Jan 22, 2021 at 17:19
16

This solution is not Minecraft specific; it uses the external tool "Auto Hotkey" to emulate clicks

For any auto-clicking, or any keyboard emulation behaviour - I'd recommend looking at AutoHotkey (AHK).

This is a 3rd party program for Windows, which allows you to emulate any number of keyboards and mice, and programmatically control them. Due to it's prevelance, most tasks you wish to accomplish have already been solved and shared online.

There is a usage guide on their official site, for how to install AHK and how to create the auto-clicking scripts you need: https://autohotkey.com/docs/Tutorial.htm

Please note, as with any 3rd party software - usage is at your own risk.


For the autoclicking script itself, here is a simple example:

toggle = 0
#MaxThreadsPerHotkey 2

F8::
    Toggle := !Toggle
    While Toggle{
        Click
        sleep 100
    }
return

The effect is, once the key "F8" is pressed; AHK will begin looping the Click action. Once the F8 key is pressed again, the value of "Toggle" is reset, and the loop ends. It allows you to turn on and off the clicking. There are of course, much more complex auto-clicking techniques you can employ using AHK.

Using online tutorials and searching, I'm sure you will be able to tailor this to your needs. Otherwise, specific AHK scripting questions can be answered on StackOverflow.SE

4
  • 1
    Way too complicated. You don't need scripting, you can just set an autoclicker to a very slow speed. Dec 12, 2018 at 14:10
  • 14
    @FabianRöling I agree there are definitely simpler auto-clicking tools. However, AHK is a widely adopted tool with a good reputation for being safe and compatible (that is, it has a reputation for not containing malware, and is open source - if any future users wish to inspect it). Moreover, while it may seem overkill in the first instance, it is flexible and allows OP to do a lot more in future if they wish. I would be reluctant to recommend any other specific auto-clicker due to the prevelance of malware in 3rd party software from sources without a reputation.
    – Bilkokuya
    Dec 12, 2018 at 14:17
  • Does this tool allow one to alt tab or does the screen have to be on the thing being clicked?
    – goodguy5
    Dec 12, 2018 at 17:04
  • 3
    @goodguy5 The script above will require the window to be open (it will just click whatever is under the cursor). However, AHK does have support for clicking specific windows while they are unfocused. See Control Click: autohotkey.com/docs/commands/ControlClick.htm (it's also likely you'll find a script you can just "use" from online searching)
    – Bilkokuya
    Dec 12, 2018 at 17:08
7

This solution is not Minecraft specific; it uses the external tool "xdotool" to emulate clicks

If you're on Linux, there's a very nice automation tool called xdotool, usually available in the default package sources, so it should be in Synaptic, Ubuntu software center, etc.

With it, you can not only write scripts to automate mouse and keyboard, but you can also just enter simple commands into the command line, including single key/mouse down/up events. So to permanently hold left click, just enter this into a command line after installing xdotool:

xdotool mousedown 1

For right click:

xdotool mousedown 3

To stop it, just click that mouse button.

To wait a bit before holding the button, write "sleep 10 &&" before the command (or any other number of seconds).

1
  • 2
    Nice answer, but note that xdotool is an X11 specific thing that won't work on Wayland. So if you're using Fedora for example, you'll have to change your system configuration to make it work.
    – undercat
    Dec 12, 2018 at 21:56
5

This solution is not Minecraft specific; it uses the built-in options of Windows to do this

If you are using Windows, it has something built-in for this.

Go to the accessibility settings and turn on mouse keys.

This gives you access to using the numpad section of the keyboard to control the mouse. One of the important features we need is the "press mouse" action.

  1. Enable mouse keys in the accessibility settings of Windows (or press left Alt + left Shift + Num Lock)
  2. Go into Minecraft
  3. Select either the left (/) or the right (-) mouse button using those buttons on the numpad section
  4. Look in the direction you want to execute the mouse action in (yes you could also use the numpad to move the mouse, but this is harder for most people)
  5. Press 0 on the numpad to do a "press mouse" action
  6. Once you are done, press . on the numpad to release the mouse again
4
  • will that continually "press mouse"?
    – goodguy5
    Dec 12, 2018 at 16:05
  • Yes, the 0 function is designed to basically do the pressing part of a drag & drop interaction, and for this, you need to hold the mouse, and that is what you need to do in Minecraft for fishing and mining
    – Ferrybig
    Dec 12, 2018 at 16:07
  • That will hold the mouse button down, not click multiple times. Dec 12, 2018 at 21:02
  • @IsmaelMiguel If you read the question, the OP mentions that he used the trick of holding a mouse button while changing f11 state. This also holds a mouse button, instead of pressing it multiple times, and holding it is used for mining and AFK fishing machines
    – Ferrybig
    Dec 12, 2018 at 21:11
4

This solution is not Minecraft specific.

If you're just trying to hold down the mouse button forever, you really don't need more than a rock. Or some heavy object. Tape works too. Just secure the mouse button down with something.

Yes, this is the dumbest, least intelligent solution, but it does ensure the mouse stays pressed. It also means you cannot do anything else with the machine while you're "automatically" clicking, but that may be true of the more intelligent (AutoHotKey, xdotool) responses as well (I am not entirely sure myself.)

It does have the upside of being completely platform-agnostic and doesn't require you to install any software or change any settings.

1
  • c-x-berger has made the advancement [Stone age] Dec 31, 2019 at 8:48
1

This works on Windows with any USB mouse and depending on where your PC is and where its USB sockets are may be the easiest method.

  • Press the mouse button you want.
  • While having the mouse button depressed, unplug the mouse from the USB socket.
  • Release the button and plug the mouse back in again.

You can still move, use other keys/buttons etc. Pressing (and releasing) that specific button again removes the 'pressed' state.

Tested as working in 1.13.x and 1.14.x on Win7 and Win10.

1

You can use the autoclicker/holder uploaded by a Reddit user here in the background. I hope it makes your life easier.

-1

Put a fence post down, right click the fence, then unplug the mouse. Problem solved.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .