I was wondering if there is a way to make a block such as bedrock or obsidian unplaceable in a certain area, because I wanted to give players creative mode for a game, but I don't want them to use bedrock or obsidian in their creations. Is there any way to make a block unplaceable using commands?

2 Answers 2


You could testfor anyone with obsidian or bedrock in there inventory and if they have it then remove it. /testfor @a[r=10] {Inventory:[{id:"minecraft:obsidian"}]}

/clear @a[r=10] minecraft:obsidian

Or another method is, you could testfor the player holding the obsidian and bedrock in there hand with a command like this:

/testfor @a[r=10] {Inventory:[{Slot:0b,id:"minecraft:obsidian"}]} If you wanted to use this method you would have to testfor slots 0-8, just change the zero.

then if you didn't want to remove the item you could change there gamemode to adventure

/gamemode a @a[r=10]

increasing the radius will increase the area you wish them not to place those blocks.

For the second method I suggest having a clock hooked up to the testfor command that triggers a sticky piston with a redstone block on the end. When the testfor activates true then the sticky piston will extend activating the gamemode change. When they leave the radius the sticky piston will deactivate pulling the redstone block into another gamemode command returning them to there previous gamemode. It would look somthing like this:enter image description here I think method one would be more useful in your case.

  • The only thing with this is that it would clear the inventory of all players if one player is holding obsidian. Is there any way to fix this so that it only targets the player holding it? Mar 16, 2016 at 14:15

I just realized that the easiest way to do this is to have a fill clock setting off two command blocks that replace all bedrock/obsidian with air.

You must log in to answer this question.

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