I am trying to create handheld torches in vanilla minecraft with command blocks. I already have the way to detect a torch in hand and everything, now all i need is a way to get the lighting to that player.

The problem i have here is when i setblock a torch (setblock ~ ~ ~ torch), i have to fill an area around them with air (air 0 replace torch) to prevent them getting free torches. This does not fix that problem, as they can look down and break that torch and get the item. Is there a better way?

(PS. with end rod in 1.9 snapshots, they can't be passed through so you get stopped while walking.)

EDIT: to clarify, I am trying to get this working in a survival scenario, a player is going through a cave mining, so instead of placing torches they just switch to the torch to get light when they need it.


Seeing that you were desperate for a true answer, I built a prototype (Still adding the torch item drop prevention, as the one I made broke due to the execute detect function being really buggy).

This prototype does what you want for the most part. It uses 3 scoreboard objectives: Jump, jumpCool, and Torch.

Jump is basic. If you jumped it sets jumpCool to 5 and then sets itself to 0. jumpCool is the cooldown for when the light can be created. If you jumped it's set to 5, and if there is air below you it is set to 5. Torch is set to 1 if you're holding a torch.

From the prototype some issues do occur, one being that for every block torch's can't be placed on, you need to add a command block to blacklist it.

Here's the prototype setup and commands: http://imgur.com/a/i9Yo2

The command block not talked about in the above link is the broken drop protection. Basic armor stand to block access to the torch, and then have a despawn timer for the armor stand and then delete the torch along with it. Still working on that so when it's done I'll note that it is.

Finished version:

Download: https://www.dropbox.com/s/dn9q5xak462rhq9/Creative%20Mode%2015w32.zip?dl=0


This is a interesting question. Yes, it is possible, but an estimate of the amount of command blocks required would be 6-15.

One solution is placing torches at the players feet if they are holding a torch, and quickly placing and removing it will also continuously toggling the doTileDrops gamerule on and off.

There can be a slight problem with this method though.

  • Ticks. 20 ticks per second. The player can move on any one of these ticks. This means that if on a certain tick the player moves, then the torch may still be where it was placed.
  • Lighting offset is something else. The light will be 1 block below the handheld torch.

(I had some other reasons but after I typed them out I realized that the workaround I had typed was redundant).

I can't really think of a way to make this possible. Tick timings and other factors make this seem impossible at this current time.