How to spawn island efficiently

Discussion in 'Plugin Development' started by plisov, Apr 28, 2020.

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

    plisov

    Hi all,

    I'm currently working on a Skyblock plugin and can't figure out the most optimal way of spawning islands. I'd like to spawn the player's islands in a grid-type system however I don't know how to do that. Currently, I'm spawning every island 400 blocks away in the x and z directions from the last island.

    Any help is much appreciated.
     
  2. Offline

    Niv-Mizzet

    @plisov Could you make clearer what you're trying to do? Are you trying to randomly spawn them within the grid?
     
  3. Offline

    plisov

    I'm trying to develop an algorithm that would essentially paste schematics in a grid similar to this:
    ........................... etc.
    ........................... etc.
    ........................... etc.
    ........................... etc.
    etc. etc. etc. etc. etc
    where each dot represents a schematic.
     
  4. Offline

    Niv-Mizzet

    @plisov Would you go column-by-column or row-by-row
     
  5. Offline

    plisov

    I was thinking of going row-by-row however it would technically be unlimited so it wouldn't necessarily matter.
     
  6. Offline

    Niv-Mizzet

    @plisov All a "schematic" would be is an array of Blocks. You can get the array by looping through the blocks in between a corner with the highest x, y, z values and the lowest x, y, and z values.
    Basically, take the array and convert it to an array of Materials (the materials of the blocks), by looping through the array of blocks and getting the materials. Then, get the corner(the lowest x, y, and z point) of where you want your schematic to be pasted, and loop through all the locations within the dimensions of the schematic and set their type to the corresponding one within the array.
     
    Last edited: Apr 28, 2020
  7. Offline

    plisov

    There wouldn't necessarily be any given points, it's more of a place on command where the player types a command and the plugin automatically finds the next available slot in the row and column and if there is no spot, it would start either a new column or new row.
     
  8. Offline

    Niv-Mizzet

    @plisov just grab the corner of the slot then.
     
  9. Offline

    plisov

    @Niv-Mizzet I'm not trying to paste the schematic, that is working just fine. I'm attempting to create a grid field of many schematics. Think of a skyblock plugin, where the islands are all placed evenly away from each other in a grid-type format.
     
Thread Status:
Not open for further replies.

Share This Page