0

I'm trying to remake/translate a Bedrock Edition command into Java Edition, but it's not working:

/execute @e[type=!armor_stand] ~ ~ ~ tp ^ ^ ^0.10 facing @e[name=blackhole,r=10]

What am I doing wrong?

3
  • What do you want the command to do? Commented Jul 30, 2021 at 20:00
  • 2
    While I'm answering your question, you should explain what you expect your command to do in JE and what, specifically, is not working once translated. It'll improve the quality of your post, and leave less information for inference. Plus, you'll get a faster and more accurate answer. :)
    – Taco
    Commented Jul 30, 2021 at 20:52
  • Your command has been translated in my answer. Enjoy. :)
    – Taco
    Commented Jul 30, 2021 at 21:22

1 Answer 1

5

TL;DR: The short answer: yes and no. Jump to the Your Use-Case section for the translated version of your command.


Direct Translation

I'd like to start with the shortest explanation that there are some commands that cannot be directly converted to Java edition, per the documentation on commands. Here is a sample of the command table that shows a few of the first commands that cannot be directly used in Java edition:

Command Description BE JE
/ability Grants or revokes a player ability. Yes No
/alwaysday An alias of /daylock. Locks and unlocks the day-night cycle. Yes No
/camerashake Used to enable a camera shaking effect. Yes No

Note: Please refer to the aforementioned documentation for the complete table.

However, there are some commands that have very, very similar syntax in both Bedrock edition and Java edition. For example, the fill command is one such candidate for nearly direct translation:

Java Edition

fill <from> <to> <block> [destroy|hollow|keep|outline|replace]

Bedrock Edition

fill <from: x y z> <to: x y z> <tileName: Block> [tileData: int] [oldBlockHandling: FillMode]

As a result, the following command should execute successfully in currently released versions of Bedrock and Java editions:

fill ~ ~ ~ ~5 ~5 ~5 concrete

Indirect Translation (Your Use-Case)

The execute command is one of those commands that is incredibly powerful in Java edition, but limited in Bedrock edition. Based on the command you provided:

/execute @e[type=!armor_stand] ~ ~ ~ tp ^ ^ ^0.10 facing @e[name=blackhole,r=10]

I can infer some guidelines for translation:

All entities that are not of type armor_stand, from their current location, execute a teleport command to their local coordinates plus 0.10 on the z-axis, facing all entities named blackhole within a radius of 10.

In Java edition, your command is a bit more complicated than it seems, and Bedrock edition is notorious for hiding this from us. To get your command to work, you'll need to run the command as the entity, at the entity's location, facing the target:

/execute as x at x facing entity x eyes run tp...

Subsequently, your full command in Java edition is:

/execute as @e[type=!armor_stand] at @s facing entity @e[name=blackhole,r=10] eyes run tp ^ ^ ^0.10

Note: The use of @s after the at is enabled by the fact that the as has already established the entity we need and since we are executing the command as the entity, we can use the self target.

2
  • 1
    Note that (in your last command) after you've done [as @e[...]] you can do [at @s] later on to refer to this very same entity, rather than rewriting the entity selector.
    – BunnyMerz
    Commented Jul 30, 2021 at 23:03
  • 1
    I think it's safer to do tp @s ^ ^ ^0.10 to ensure the correct entity is teleported. I may be wrong on that since it's been a long while since I last played around with commands.
    – MBraedley
    Commented Aug 3, 2021 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.