0

I'm in 1.19.2 of Java edition. I would like to clone something in random coordinates so I searched for plugins or answers but I don't found anything. I don't realy know how to do something like that so I need some help, thanks in advance !

1
  • 2
    Randomise scoreboard values (Google helps with that), put those values into Pos NBT of an entity, clone to that entity. If you want source AND destination to be variable, you need two entities, clone from first to something fixed (0 0 0 or so) and from there to second. Chunks need to be loaded, of course, otherwise it gets a bit complicated with forceload and checking when that is actually finished with execute if loaded (new in 1.19.4 snapshots) or with some trickery (Google helps with that, I think execute if block might do it). Someone with more spare time can write a proper answer. Feb 14 at 13:13

1 Answer 1

1

Because you cannot use variables in commands, the way to do it is to execute from an entity that you positioned randomly.

Here are relevant answers to various parts of this question:

Now that you've teleported that entity to the random location, you can now use /clone to clone something that is positioned at a fixed location to the entity.

/execute at <the entity> run clone <coordinates of area to clone> ~ ~ ~

Potential pitfalls

Depending on your situation, there are a bunch of things you need to keep in mind:

  • Is the area where you want to clone to loaded? If not, you'll run into multiple issues:
    • You'll loose the entity if you didn't use functions as the entity (once it's in unloaded chunks it won't be found by @e anymore).
    • You aren't able to clone to an unloaded area. You can alleviate that by using /forceload to load the area and checking with execute if block (or if you're in 1.19.4+ execute if loaded) if it has finished loading. Make sure to unload the area again afterwards.
  • Having source and destination be variable. If you want to have two random positions to clone from and to, you'll need to take a step in between: Cloning it from the first entity to a known fixed position, then cloning it from there to the second entity. Same limitations on loaded world apply as above.

You must log in to answer this question.

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