Using the WorldEdit API to create prison mines

Discussion in 'Plugin Development' started by BlockBro224, Mar 18, 2020.

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

    BlockBro224

    Hello I am trying to use WorldEdit's powerful API to create a cuboid region and use it as a prison mine. Right now I set it so that when I throw an egg, my world edit selection turns into a region that I can then manipulate with code. The problem is that when I throw the egg, a region is not created from my world edit selection, I just get a message that tells me the mine has been created. Here is the listener's code:
    [​IMG]
    https://gyazo.com/4d7baa98e79e4e73109fd477575e018d
     
  2. Offline

    timtower Moderator Moderator

    @BlockBro224Where should the region be created then? WorldGuard?
     
  3. Offline

    BlockBro224

    The region is created by the player's world edit selection which is "region" in my code.
     
  4. Offline

    timtower Moderator Moderator

    And your code does create a region. But you don't do anything with it.
     
  5. Offline

    BlockBro224

    Alright but every time I throw an egg I get a message saying that I created the mine, even if I didn't create a world edit selection.
     
  6. Offline

    timtower Moderator Moderator

    Have you tried printing out the min and max locations of the region then?
     
  7. Offline

    BlockBro224

    Alright I just printed the selection's height and it was correct, meaning the cuboid is being created. Thanks! I am wanting to fill the selection with random ores but I don't know how to do that...
     
  8. Offline

    timtower Moderator Moderator

    Loop over all blocks in the region.
    Set a random type from a preset list of options.
     
  9. Offline

    BlockBro224

    What do you mean loop over all the blocks in the region? Like create an arraylist with blockvectors and then what?
     
  10. Offline

    timtower Moderator Moderator

    No, you get all the blocks between the minblock and maxblock.
    You set those to random ores.
     
Thread Status:
Not open for further replies.

Share This Page