how can i set 2 blocks in an area

Discussion in 'Spigot Plugin Development' started by exglez, Jun 3, 2018.

  1. I have a cuboid area. I want to set blocks inside the area with 50% stone and 50% coal. How?
  2. I am not a professionell. Maybe there is this 1 answer that solves your problem at once but I am curious what exactly you tried yes. How does your code look so far?
  3. Do you want a perfect checker pattern or just 50% random pattern?

    In both cases you would have to iterate through every block of your area and decide what material it shall become.

    For the checker pattern you would turn every 2nd block (in your case) into the 2nd material and leave the other blocks to be the 1st material.
    For the random pattern you would implement a random variable and check if it's greater / less than the given chance and depending on that select the material.

    If you don't mind using external dependencies - WorldEdit does exactly what you're looking for and as far as I'm informed has a very extensive API for every function.