1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Skyblock island generator

Discussion in 'Development' started by BruhLol, Nov 19, 2017.

  1. BruhLol

    BruhLol Baby Zombie

    Messages:
    122
    What is the code to generate an island like chunk? i only know how to create a box
    Code:
     $chunk = $this->level->getChunk($chunkX, $chunkZ);
            $chunk->setGenerated();
            if ($chunkX % 20 == 0 && $chunkZ % 20 == 0) {
                for ($x = 0; $x < 16; $x++) {
                    for ($z = 0; $z < 16; $z++) {
                        $chunk->setBlock($x, 0, $z, Block::BEDROCK);
                        for ($y = 1; $y <= 3; $y++) {
                            $chunk->setBlock($x, $y, $z, Block::STONE);
                        }
                        $chunk->setBlock($x, 4, $z, Block::DIRT);
                        $chunk->setBlock($x, 5, $z, Block::GRASS);
                    }
                    Tree::growTree($this->level, $chunkX * 16 + 8, 6, $chunkZ * 16 + 8, $this->random, 0);
                }
                $chunk->setX($chunkX);
                $chunk->setZ($chunkZ);
                $this->level->setChunk($chunkX, $chunkZ, $chunk);
            }
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    I assume you want to create an island that looks like this:
    Code:
                           %%%%%
                         %%%%%%%%%
                        %%%%%%%%%%%
                        %%%%%%%%% %
                        %%%%%%%%%%%
                            +-+
                            | |
                            | |
                            | |
                            | |
    +-+---------------------+-+-----+--+
      |                             |
      +--+-----------------------+--+
         |                       |
         |                       |
         +---+---------------+---+
             |               |
             |               |
             +--+---------+--+
                |         |
                +-+-----+-+
                  |     |
                  +-----+
                    +-+
    
    If so, you can make a loop that decreases the size of the square by two on every run and changes the x, y and z start coordinates to fit the new size.
     
    jasonwynn10 and BruhLol like this.
  3. BruhLol

    BruhLol Baby Zombie

    Messages:
    122
    yes like that, but i cant seem to figure out how :/ ill try though, if you figure out how then hmu
     
  4. BruhLol

    BruhLol Baby Zombie

    Messages:
    122
    nvm i got it
     
    HimbeersaftLP likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.