Minecraft – How to make a lever invulnerable/unbreakable in minecraft

minecraft-commandsminecraft-java-edition

I wanna know how can I make a lever invulnerable so that lava can't burn it and a player can't remove it.

I tried the following but it didn't work :

/scoreboard players tag @e[item=lever,r=10] add iMarker
/entitydata @e[tag=iMarker] {Invulnerable:1}

This processes something and no errors are shown but still the lever is burned by lava.

Best Answer

Method 1: place signs or simmilar blocks around the lever. For the lever not to be destroyed by Players give then Adventure mode (/gamemode @a a)

Method 2: Use this all-version-usable Command block & Redstone syntax:

SUPER STUFF!!

Where the lever is at positive X from the Redstone. The right Command block has this command:

/testforblock ~+2 ~ ~ minecraft:lever

And the left one has this:

/fill ~+7 ~ ~ ~+7 ~ ~ minecraft:lever N

Instead of N use the lever rotation value. List of possible rotations:

N | Rotation

0: Lever on block bottom points east when off.
1: Lever on block side facing east
2: Lever on block side facing west
3: Lever on block side facing south
4: Lever on block side facing north
5: Lever on block top points south when off.
6: Lever on block top points east when off.
7: Lever on block bottom points south when off.
  • The lever can get destroyed, but immediatley replaced

  • I think you can remove the Repeater :-)

  • You can have the command blocks really far away, it works the samr, just the coordinates will be different.

  • You can update this to use the 1.9 Command block stuff

  • It's easy-to-build! Go do it yourself!