How to Set Up an AFK Mining Bot in Minecraft
An AFK mining bot is an account that stands in front of a generator and keeps breaking the block that forms there, hour after hour, with nobody at the keyboard. In the game, that means holding left click with the window open and your PC on. A Minecraft bot holds the button for you from the cloud, so it keeps mining after you've switched off.
Here's what the setup needs, and how to build it.
What an AFK mining setup needs
Something that never runs out
The simplest mining bot doesn't go looking for ore. It stands still and mines something that comes back.
A cobblestone generator is the classic. Flowing lava meets water and leaves a block of cobblestone, and a new one forms in the same spot a moment after you break it. Build it so that spot is in reach of where the bot stands, and it never has to move.
Servers often have their own version: mines that refill on a timer on prison servers, or generators players build on SMPs. Anything that puts a block back in the same place works.
A pickaxe that lasts
Every block costs the pickaxe a use, and a bot mining all day gets through thousands. A netherite pickaxe has 2,031 uses and a diamond one 1,561, so the enchantments matter:
- Efficiency speeds up every block.
- Unbreaking III makes the pickaxe last about four times as long.
- Mending repairs it with experience. Cobblestone and stone give none, though, so on a plain generator Mending can't keep up. Plan to swap pickaxes, or have the bot stop before one breaks (see below).
Food
Mining makes a player hungry, slowly but steadily. A bot with an empty food bar stops healing, and on Hard difficulty it can starve. Give it food and turn on auto eat, and it eats from its own inventory when the bar runs low.
Somewhere for the blocks to go
An inventory holds 36 stacks, which is 2,304 blocks. After that, everything the bot mines drops on the floor and disappears five minutes later. There are three ways round it: hoppers that collect what lands on the floor and carry it into chests, the server's sell command if it has one, or a macro that empties the inventory before it fills.
Set up a mining bot on the web client
With the account on your server profile and online:
- Walk it to the generator. Open the POV and walk it there yourself, or send it with Walk to.
- Aim at the block. Turn the bot to face the block that forms, with the Look pad on the Movement page or by looking at it in the POV.
- Hold left click. On the profile's Clicking tab, tick the account in Hold left click and untick Hit entities, so it only breaks blocks and never swings at a mob that wanders past. It chains from one block to the next for as long as the hold is on.
- Turn on auto eat. Back on the Movement page, tick the account in Auto eat, and keep food in its inventory.
The hold and auto eat are both saved on the account, so a reconnect picks them back up by itself. Hold left click needs Tier 3 and physics, which is on by default. Auto eat needs Tier 2 or Tier 3.
Or put it in a macro
A macro on the Join event sets the whole thing up again every time the account connects, so nothing depends on how you left it:
- Look, set to the angles that face the block.
- Hold item, picking the pickaxe.
- Enable auto eat.
- Hold left click, with Hit entities unticked.
A held button stays down between passes, so the macro runs once per join and the bot keeps mining.
Stop before the pickaxe breaks
Left alone, the bot mines until the pickaxe breaks, then carries on with its bare hands, which breaks cobblestone slowly and drops nothing.
A second macro on the Tool durability event fixes that. Set it to watch the main hand, pick how many uses should be left, and give it a Release left click step: the bot lets go before the pickaxe breaks. Add Notify my devices and your phone tells you it's time for a new one. Leave a margin of a few uses, because a fast pickaxe can lose a couple in the moment before the step runs.
The Inventory full event does the same job for storage: give that macro a Chat step with the server's sell command, or a Drop all step that throws out what you don't want.
These events need Tier 3. The macro docs list what each one can watch.
Is AFK mining allowed?
That's the server's call. Some servers don't mind, some ban AFK mining or autoclickers outright, and some that allow AFK still ban accounts that never do anything else. Read the rules of the server you're on, and see Can I get banned for only AFKing?
To keep the account online in the first place, see How to AFK in Minecraft without getting kicked. If you'd rather your bot caught fish and enchanted books, there's a guide to AFK fishing bots too.
Want to AFK 24/7 Without Leaving Your PC On?
