Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

World Generator Help

Comments in 'Plugin Development' started by jasonwynn10, Nov 17, 2016.

  1. jasonwynn10
    Offline

    jasonwynn10 Active Member

    Joined:
    Dec 20, 2015
    Posts:
    87
    Minecraft User:
    jasonwynn10
    I have a custom generator that I am planning to use for my Plots server and I have a function that I need to edit to make the generated terrain look like this: http://imgur.com/a/uKiZW
    Using the given info in the function, how can I generate the world to look like I want?
    PHP:
    public function generateChunk($chunkX$chunkZ) {
            
    $shape $this->getShape($chunkX << 4$chunkZ << 4);
            
    $chunk $this->level->getChunk($chunkX$chunkZ);
            
    $chunk->setGenerated();
            
    $c Biome::getBiome(1)->getColor();
            
    $R $c >> 16;
            
    $G = ($c >> 8) & 0xff;
            
    $B $c 0xff;
            
    $bottomBlockId $this->bottomBlock->getId();
            
    $bottomBlockMeta $this->bottomBlock->getDamage();
            
    $plotFillBlockId $this->plotFillBlock->getId();
            
    $plotFillBlockMeta $this->plotFillBlock->getDamage();
            
    $plotFloorBlockId $this->plotFloorBlock->getId();
            
    $plotFloorBlockMeta $this->plotFloorBlock->getDamage();
            
    $roadBlockId $this->roadBlock->getId();
            
    $roadBlockMeta $this->roadBlock->getDamage();
            
    $debugBlockId $this->debugBlock->getId();
            
    $debugBlockMeta $this->debugBlock->getDamage();
            
    $groundHeight $this->groundHeight;
            for (
    $Z 0$Z 16; ++$Z) {
                for (
    $X 0$X 16; ++$X) {
                    
    $chunk->setBiomeId($X$Z1);
                    
    $chunk->setBiomeColor($X$Z$R$G$B);
                    
    $chunk->setBlock($X0$Z$bottomBlockId$bottomBlockMeta);
                    for (
    $Y 1$Y $groundHeight-3; ++$Y) {
                        
    $chunk->setBlock($X$Y$ZBlock::AIR$plotFillBlockMeta);
                    }
                    for (
    $Y $groundHeight-3$Y $groundHeight; ++$Y) {
                        
    $chunk->setBlock($X$Y$Z$plotFillBlockId$plotFillBlockMeta);
                    }
                    
    $type $shape[($Z << 4) | $X];
                    if (
    $type === self::PLOT) {

                        
    $chunk->setBlock($X$groundHeight$Z$plotFloorBlockId$plotFloorBlockMeta);
                    } elseif (
    $type === self::ROAD) {
                        
    $chunk->setBlock($X$groundHeight$Z$roadBlockId$roadBlockMeta);
                    } else {
                        
    //$chunk->setBlock($X, $groundHeight, $Z, $debugBlockId, $debugBlockMeta);
                        
    $chunk->setBlock($X$groundHeight 1$Z$debugBlockId$debugBlockMeta);
                    }
                }
            }
            
    $chunk->setX($chunkX);
            
    $chunk->setZ($chunkZ);
            
    $this->level->setChunk($chunkX$chunkZ$chunk);
        }
    https://forums.pmmp.gq/threads/world-generator-help.67/
    Last edited: Nov 17, 2016
  2. EdwardAllington
    Offline

    EdwardAllington Active Member

    Joined:
    Jan 29, 2015
    Posts:
    78
    Minecraft User:
    Edwardthedog2
    To be honest, I don't really develop in PHP anymore, just HTML. I would recommend that you ask at the new PocketMine forums. There more active then these old ones, and people other than Shogi have admin access to them.
    archie426 and HimbeersaftLP like this.
  3. archie426
    Offline

    archie426 Active Member

    Joined:
    Apr 26, 2015
    Posts:
    193
    Minecraft User:
    archie426
    Also, as a message to everyone, include a link to the new ones in your signature for SEO and information purposes

Share This Page

Advertisement