This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
moomoomoo3O9's profile picture

How to figure out where a player is looking

Started by moomoomoo3O9, 21 June 2015 - 11:12 PM
moomoomoo3O9 #1
Posted 22 June 2015 - 01:12 AM
So, I've looked high and low for a way to get what block the player is looking at for WorldEdit without using Immibis's adventure map interface. I even posted a ridiculous way it could be done using the command computers and OpenCCSensors or OpenPeripherals sensors.

The idea was that I wanted to see if I could make the program without using Immibis's adventure map interface, instead using Command Computers to do the block operations and a chat box from either peripherals++ or moarperipherals or even terminal glasses to get chat from the user for commands. The only thing I cannot figure out for the life of me is how to get the block the player is looking at. I have command computers and any peripherals aside from Immibis's at my disposal. Does anyone have any ideas or some obscure feature in a peripheral from some mod that I'm missing?
Edited on 21 June 2015 - 11:13 PM
Bomb Bloke #2
Posted 22 June 2015 - 10:49 AM
The only method I'm aware of is using sensors to track the player's head location/facing, just as you're thinking. Even that wouldn't be easy, though, as not all blocks are the same shape; if the cursor is near a torch, for example, then it wouldn't be easy to tell if you're looking at or past it.

Methinks you might be best off pinning down the specifics of the features you want, and suggesting them to a peripheral author. Who knows, you might get it!
MKlegoman357 #3
Posted 22 June 2015 - 10:54 AM
Well, it is possible in vanilla Minecraft using command blocks. It should be possible with command computers too :P/>.
Bomb Bloke #4
Posted 22 June 2015 - 11:12 AM
Well, it is possible in vanilla Minecraft using command blocks. It should be possible with command computers too :P/>/>.

RPL is built around MC 1.8's commands. Not sure the techniques can be reproduced with 1.7.10, but it may indeed be worth looking into.
moomoomoo3O9 #5
Posted 22 June 2015 - 06:53 PM
@e doesn't work until 1.8, so I can't use most of the vanilla methods. In fact, command blocks can't really do much of anything with entities beyond summoning them in 1.7.

How unfortunate. I guess I'll have to settle for the moment with using the player's position to determine the selection for now (which while it works, is a bit more tedious.) I saw a thread earlier which explained how to do that, by teleporting the player.