Handheld Torches in vanilla

Handheld Torches in vanilla - Black and White Dslr Camera on Green Grass

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.



Best Answer

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.




Pictures about "Handheld Torches in vanilla"

Handheld Torches in vanilla - Silhouette of Man Standing in Front of Microphone
Handheld Torches in vanilla - Four Cupcakes Photography
Handheld Torches in vanilla - Man Playing Guitar on Stage



How do you make a torch light up in your hand in Minecraft?

There are two recipes to make a torch. The first recipe uses 1 stick and 1 coal and the second recipe uses 1 stick and 1 charcoal. Both recipes will create 4 torches at a time. In the crafting menu, you should see a crafting area that is made up of a 3x3 crafting grid.

How do you get torch in Minecraft?

Move the torch to your quick slot, select it, and click the ground or wall. A torch can go on any solid, opaque surface, and will burn indefinitely. You can pick up the torch again by "breaking" it, or by breaking the block attached to the torch.



Handheld Torches in Minecraft 100% Vanilla




More answers regarding handheld Torches in vanilla

Answer 2

If there is nothing else in that world, do /gamerule doTileDrops false. If there is something else in the world, you can try to fill up every space in that player's inventory with an item like stone, so they don't have enough space to take it.

Answer 3

You could use command blocks (You said you had a way to test if the player was holding a torch) and have a comparator leading from the testfor command block giving that player night vision, /effect @a[] 16 1 5 (First number is ID, second is length, third is strength) Then all players holding a torch would get night vision.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Tantray Junaid, Kyle Loftus, Julias Torten und Törtchen, Kyle Loftus