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 !
Asked
Active
Viewed 115 times
1 Answers
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:
- Getting a random number: What sources of randomness can be made with commands in Minecraft?
- Teleporting an entity to a number in a scoreboard: https://gaming.stackexchange.com/a/339010/172377
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
asthe entity (once it's in unloaded chunks it won't be found by@eanymore). - You aren't able to clone to an unloaded area. You can alleviate that by using
/forceloadto load the area and checking withexecute 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.
- You'll loose the entity if you didn't use functions
- 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