2

Let me first explain what I want to achieve:
I want to randomly spawn shulkers on the outer end islands, whilst obeying the mobcap. My idea to do this, was to convert random endermen into shulkers, using some form of chance and randomisation. after each cycle, all endermen would get a tag, indicating that they have already been addressed by the commands, so that not all endermen end up as shulkers.

The first step for this, would be to find all the endermen on the outer end islands. This is where things go wrong(already).

My first find was that command blocks in the overworld can't address any mobs in the end. To solve this, I made my command into a function and subscribed my function to the GameLoopFunction gamerule. In this function, I was able to address all the endermen in the end using the following command:

execute as @e[type=enderman,nbt={Dimension:1}] run say @s

Now in order to only address the endermen on the outer islands, I have to execute my command at location 0 0 0 and then address all the endermen that are over 256 blocks away from this point. I ran following command to test if my command still worked if I used this offset:

execute offset 0 0 0 as @e[type=enderman,nbt={Dimension:1}] run say @s

This was also working fine. To finish the command, I added a distance parameter to the target selector like this:

execute offset 0 0 0 as @e[type=enderman,nbt={Dimension:1},distance=256..] run say @s

Unfortunately, no enderman was addressed at all. I expected to get no result on the main Island, but I expected my chat to overload as soon as I arrived at the outer end islands. The chat remained empty.

NOTE: All previous commands were executed while I was at the outer end islands.

To Ensure that the distance parameter worked, I did a test in the overworld:

/execute offset 0 0 0 as @e[distance=256..] run say @s

This command should print my name in the chat if I am 256 blocks away from 0 0, which it did, so the distance parameter worked just fine. The question is: How do I address the endermen on the outer end islands in minecraft 1.13?

  • Maybe 0 0 and also the outer area have to be loaded for this to do anything? It certainly worked in earlier versions, I definitely remember a really old SethBling invention where he used a really high point and a really high radius to simulate what can now be done with x y z dx dy dz, before that was possible. But maybe it changed? Or it is because you used offset instead of x y z in the selector. Does it work if you use them instead? – Fabian Röling Dec 5 '17 at 18:11
  • @Fabian thank you for your suggestion. If what you are saying is true, I would expect the second command to fail as well, which it didn't. Still I could surely try your suggestion as well. I couldn't quite figure out how to use x y and z in 1.13 though. I'll have to do some more research on that. – D-Inventor Dec 5 '17 at 18:17
  • 1
    Oh, I just remembered that, while commands that are run in any dimension will affect any dimension, they will be locked to their own dimension if any of the following parameters are used: x/y/z/dx/dy/dz/r/rm. The gameLoopFunction runs through the overworld, so your distance=256.. will prevent it from working in the End. You'd have to station an anchor entity in the End and execute off of that first without any of the world-binding args. At least, that's the way it is in 1.12. I haven't messed around with 1.13 enough to know of any changes in that regard. – Skylinerw Dec 5 '17 at 18:38
  • 1
    That would be better, yes. However, after messing around with this in 1.13, it seems the default dimension isn't changed to that of /execute's target, which was indeed the case in 1.12. I've created a bug report here to get that fixed: bugs.mojang.com/browse/MC-122893 – Skylinerw Dec 5 '17 at 19:47
  • 1
    @Skylinerw Can you write an answer containing all that information? Then it can get marked as accepted for now and when the bug is fixed, someone can write a new answer and that can then get marked as accepted instead. – Fabian Röling Dec 5 '17 at 20:38
0

When you use a selector that includes dimension-binding parameters (x/y/z/dx/dy/dz/distance), the dimension of execution will be restricted to the command sender's dimension. The gameLoopFunction function will run commands with the Overworld as the dimension of execution.

For example, the following command says the names of all entities in all loaded dimensions because no dimension-binding parameter is used:

say All entities: @e

Once one of the parameters is included, the command will only say the names of entities in the command sender's dimension. If the command were run in a command block in the Overworld, it will only say the names of entities in the Overworld. If the command block were in the End, it will only say the names of entities in the End:

say Entities in the current dimension: @e[x=0]

Since your command is running via gameLoopFunction and includes distance=256.., it will be restricted to selecting endermen in the Overworld (of which none will have their Dimension tag naturally set to 1).


In 1.12, you would work around this by using /execute to change the command sender to one that is known to be in the desired dimension, who will then run the command you wish to affect only that dimension. For example, assuming that an entity with the tag "end" exists only in the End, the following will say the names of all entities in the End dimension even if the command block (or gameLoopFunction) running this command is not in the End:

execute @e[tag=end] ~ ~ ~ say Entities in the End: @e[x=0]

Unfortunately for 1.13, there is currently a bug preventing the dimension of execution from changing to the relevant target in /execute: https://bugs.mojang.com/browse/MC-122893

That bug must be fixed in order to use this method. Otherwise you will have to have physical command blocks in the End, though that does not help if they are not loaded.

  • This bug has been fixed in the latest snapshot(18w02a)!! – D-Inventor Jan 10 '18 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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