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 !

JustAzm
  • 41
  • 3

1 Answers1

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.
Plagiatus
  • 1,961
  • 8
  • 21