I'm trying to figure out how to get blocks by breaking them using commands. Say I'm breaking a diamond ore block and tile drops are turned off so other players can't steal your blocks.

Is there a command to give me that diamond ore block when I break it?


You could turn on gamerule doTileDrops whenever the player is near that block.

You could use /loot to give yourself the block, but that only works before it is mined:

loot give @s mine <coordinates>

You could just simply /give the block to the player, if you already know what it is.

You could /kill the drop whenever a different player is nearby.

You could /clear the item out of other players' inventories.

You could use spawn protection on a server and /op yourself so that you can still place and mine inside the spawn protection area.

You could put other players into Adventure mode when they are nearby.



If you have a list of ores/other blocks you want this to work on use these 4 commands:

/scoreboard objectives add DiamondOre minecraft.mined:minecraft.diamond_ore

Then have a repeating command block with:

execute if score DiamondOre matches 1 run scoreboard players remove (YourNameHereI) DiamondOre 1

Then place a chain command block set to conditional with the line:

give (YourNameHere) diamond

Then you need to turn of tile drops using:

/gamerule doTileDrops false

  • Why doesn't it work in Creative Mode? – ExpertCoder14 Aug 15 '20 at 23:21
  • In creative, I suspect that breaking blocks does not count as mining the block – Name_Hr3 Sep 4 '20 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.