3

The question is self-explanatory: Can I teleport a certain entity(by using @e[Name=enitiyname]) to the block a certain player(got with @p) targets? Like If I am looking at a block in the distance: can I teleport a PrimedTNT entity at that block?

I don't want something that works on that block, that block and that block only. I want something that is working for every block/player/entity.

4
  • 2
    Good question! Unfortunately, I don't think it's possible at the current time.
    – MBraedley
    Feb 28, 2014 at 1:16
  • @MBraedley I know. I think it can be made with 64800000 command blocks to test every possible rotation and do a sort of a raycast in that direction to find the first block in the direction the player is looking -> m!nd=BL0WN
    – ioanD
    Feb 28, 2014 at 6:18
  • 3
    Possible duplicate of How can I determine that I am looking at the block I need?
    – pppery
    Mar 3, 2022 at 1:29
  • 2
    Further explanation of my close vote: despite the two non-answer answers to the question, the answer is "use raytracing" and the duplicate question explains how to do that. The act of teleporting the TNT (or whatever) afterwards is trivial.
    – pppery
    Mar 3, 2022 at 1:30

2 Answers 2

1

The best way I know Is to use /summon Fireball. The player hits the fire charge and if goes flying. As something to it for costom things:

/summon Fireball ~ ~ ~ {ExplosionPower:0,direction:[0.0,0.0,0.0]}

Don't worry about direction; the player can hit it werever, adding a challenge of aiming correctly.change the integer for ExplosionPower to what ever the highst # you need is. To find out, google minecraft [block name] And click on the minecraft forums link. Under the image of the block you will see "Blast resistance" if the resistance is four set the ExplosionPower to something like 5.

To summon at the player, do (in the snapshot and hopefully the next update)

/execute @p ~ ~ ~ 
/summon Fireball ~ ~ ~ {ExplosionPower:0,direction:[0.0,0.0,0.0]}

ALL ONE COMMAND

Links to refer to: planetminecraft and Minecraft Wiki

Hope this helps and if you don't understand go to the above links, they got me a jump start into commands.

Sorry no TNT but if you find a way you can still use ExplosionPower on the primed TNT tag. Also you can modify how long the TNT exists, ex Time=99999 instead of direction, or it will explode opon summoning.

-1

The closest I've managed is 2 command blocks in series connected with a repeater (latest snapshot). Top view:

L-C
  |
  C

L=lever
-=redstone
C=command block
| = repeater

The firsat command block would have /tp @e[type=Spider] @p and the scecond /tp @e[type=Spider] ~ ~ ~10. This would teleport all spawned spiders to 10 blocks away along the Z axis. I don't think it's possible to use the location the Player is looking at, unfortunately. Although the location of the block the player is looking at is now available on the F3 screen (snapshot 14w08a) so it wouldn't surprise me if this functionality was added in fairly soon.

Edit: obviously to use this with Primed tnt you would use type=PrimedTnt indstead of type=Spider.

2
  • I think you can make this with a loooot of command blocks, one for every orientation. For 100% you'd need 64800000 of them, but for the sake of simplicity, i think 6480 would be enough.
    – ioanD
    Apr 5, 2014 at 18:08
  • @iani I bet someone could write an MCedit filter to place all those command blocks at once without having to place each individual one. May 2, 2014 at 12:28

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