2

I want to make sure players cant break any blocks but wheat, while they have the mining fatigue effect. Is there a way to detect if they are trying to break the wheat or is there a way to only allow wheat?

1
  • 2
    You could try giving him a tool that allows him to break wheat while he has Mining Fatigue, and then remove that tool when Mining Fatigue is removed. (Presuming the player is in Adventure Mode)
    – aytimothy
    Commented Nov 11, 2014 at 13:18

1 Answer 1

4

Detecting if a player is breaking wheat is (as far as i know) not possible.
However if you only want people to be able to break wheat, you first have to put everyone into adventure mode with:

/gamemode 2 @a

Now, no one can break blocks anymore. Give the people you want to be able to break wheat a tool you can obtain by typing:

/give @p minecraft:diamond_hoe 1 0 {CanDestroy:["minecraft:wheat"]}

That will give you a diamond hoe that is able to break wheat. If you want a different tool just replace diamond_hoe with a different item name. You can find those item names in the minecraft wiki by looking into the box on the right.

3
  • This only works in 1.8 and above Commented Jun 15, 2015 at 13:54
  • 1.13 syntax for first command: /gamemode adventure @a
    – pppery
    Commented Jul 9, 2019 at 18:11
  • 1.13 syntax for second command /give @p minecraft:diamond_hoe{CanDestroy:["minecraft:wheat"]}
    – pppery
    Commented Jul 9, 2019 at 18:11

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