How do I create multiple regions at once using WorldEdit?

Discussion in 'Plugin Development' started by __FeelinFroggy, Mar 6, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    __FeelinFroggy

    I currently have a 8000x8000 blocks map that I would like to divide into 10,000 80x80 block regions. Is there an easy way i can do this/code this in WorldGuard/WorldEdit?
     
  2. Offline

    Strahan

    Yup, pretty easy. The regions are YML saved in plugins/WorldGuard/worlds/(worldname)/regions.yml. All you needs must do is write a script to generate the YML and export it, then start the server and WG will load regions from it.

    If you don't know how, give me the coord bounds and I can export it for you. By coord bounds I mean like what is the X/Z of the northwest corner and the X/Z of the southeast corner. Oh, and what naming system you want.
     
    __FeelinFroggy likes this.
  3. Offline

    __FeelinFroggy

    Hey, Thanks a lot, I would really appreciate if you could help with this. I'm fairly new to scripting for Minecraft. Would it be possible to maybe share the script too(if you are willing to that is). I Appreciate this! I'm assuming you can just send me a regions.yml that I can replace right?


    The X/Z coordinates of the northwest corner = [-5632 , -4480]
    The X/Z coordinated for the southeast corner = [5759 , 4607]

    Naming System = Territory 1, Territory 2..... Territory 10,000


    (I need 10,000 regions, or the closest number to it depending on the co-ordinates, also added images to illustrate the co-0rdinates using Mineways, thought it might be helpful)
    northwest.png SouthEast Coordinates.png
     
  4. Offline

    CraftCreeper6

    @__FeelinFroggy
    You say you need 10,000 regions but don't specify their sizes.

    Usually when I have a tedious task like this I automate it using a (usually Python) script to print out a correctly formatted file that I can use. For your case, I would make a quick script that emulates the format of regions.yml with the values that you want for your regions. Shouldn't be too difficult.
     
  5. Offline

    __FeelinFroggy

    Hi @CraftCreeper6 , I want them to be 8x80 block regions(expanded vertically up). Is it possible to share the python script as well? Much appreciated :D
     
    Last edited: Mar 7, 2022
  6. Offline

    Strahan

    Exactly, YML is a simple text file, it's stupid simple to just create it with something external like that.

    I'm confused though OP, you said the map is 8000 x 8000 but the region you provided is 11391 x 9087...? 10k 80x80 regions perfectly fits an 8000 x 8000 region but falls over 39M square blocks short of the area of the region you actually posted.
     
  7. Offline

    __FeelinFroggy

    I must have got the numbers wrong.
    You are right about it not being evenly 8000x8000.
    I'm sorry about that. the map size is 11391 x 9087.
    I need 10,000 regions, so I re-did the math and I think each region will need to be 113.91 x 90.87. (Hopefully I did the math right).

    Is this possible? Basically I do not care about each regions size, as long as I'm able to get 10,000 of them(or closest number to it). I just want to "regionize" my world into 10,000 different areas.
     
    Last edited: Mar 8, 2022
  8. Offline

    CraftCreeper6

    @__FeelinFroggy
    I made a little script, it might not be *exactly* what you want but it'll be a good start for you in any case. It generates as many regions as it can between a min and max coordinate, using your input for region sizes, the region sizes have to be integers (I.E. Not 113.91 or 90.87), round them up/down however you feel. In any case, here's the link. It will generate regions.yml for you so you can just hotswap it.

    WorldGuard suggests you make a backup before you change any region.yml files, so keep that in mind.

    It also supports using <region> in the flags so you can name each region quickly. Just use;

    greeting: Welcome to <region>

    And it'll automatically replace <region> with the name of the region.
     
    __FeelinFroggy likes this.
  9. Offline

    __FeelinFroggy

    You're Amazing! Thanks a lot!
     
Thread Status:
Not open for further replies.

Share This Page