0

I'm making a find the button map on Minecraft. I've made one level where you press a button on the previous level, and on the next level it puts the button on your head. Is it possible to make the button (still on the player's head) be placed on a particular block? (eg. can be placed on redstone ore)?

2
  • By "still on player head", do you mean you want the player to be able to take the button off their head and place it? Is the player currently in adventure mode?
    – SirBenet
    Oct 9, 2016 at 21:08
  • The question implies that you already know how to put the button on the user's head.
    – pppery
    Jul 19, 2019 at 1:47

1 Answer 1

1

Yep! Absolutely! Use this command here:

/replaceitem entity @p slot.armor.head minecraft:stone_button 1 0 {CanPlaceOn:["minecraft:stone"]}

Replace @p with the target selector of your choice, stone_button with wooden_button, lever, whatever you want, and stone with the name of the block you want them to be able to place the button on. You can also replace slot.armor.head with something else if you want to.

Try looking stuff up on the wiki first:

Here you can read about replaceitem, which lets you put the item on the player's head: Commands - Official Minecraft Wiki

This is a page about item NBT data: Player.dat format - Official Minecraft Wiki

Have fun!

1
  • I guess it's a bit too late to say "Welcome to Arqade", but nevermind, welcome to Arqade and thanks for contributing the great answer.
    – user143228
    Oct 16, 2016 at 16:16

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