Add Quartz to Nether Generator

Discussion in 'Plugin Help' started by Ayzrix, Aug 8, 2019.

  1. Ayzrix

    Ayzrix Witch

    Messages:
    54
    GitHub:
    Ayzrix
    Hello, I wanted to activate the Quartz in the nether by activating the code that was already present, unfortunately it does not work, someone can help me? Here is the code:
    PHP:
    <?php
    /*
     *
     *  ____            _        _   __  __ _                  __  __ ____
     * |  _ \ ___   ___| | _____| |_|  \/  (_)_ __   ___      |  \/  |  _ \
     * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
     * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/
     * |_|   \___/ \___|_|\_\___|\__|_|  |_|_|_| |_|\___|     |_|  |_|_|
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Lesser General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * (at your option) any later version.
     *
     * @author PocketMine Team
     * @link http://www.pocketmine.net/
     *
     *
    */

    declare(strict_types=1);

    namespace 
    pocketmine\level\generator\hell;

    use 
    pocketmine\block\Block;
    use 
    pocketmine\level\biome\Biome;
    use 
    pocketmine\level\ChunkManager;
    use 
    pocketmine\level\generator\Generator;
    use 
    pocketmine\level\generator\object\OreType;
    use 
    pocketmine\level\generator\populator\Ore;
    use 
    pocketmine\level\generator\InvalidGeneratorOptionsException;
    use 
    pocketmine\level\generator\noise\Simplex;
    use 
    pocketmine\level\generator\populator\Populator;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\utils\Random;
    use function 
    abs;
    use 
    pocketmine\block\NetherQuartzOre;
    use 
    pocketmine\block\GoldOre;

    class 
    Nether extends Generator{

        
    /** @var Populator[] */
        
    private $populators = [];
        
    /** @var int */
        
    private $waterHeight 32;
        
    /** @var int */
        
    private $emptyHeight 64;
        
    /** @var int */
        
    private $emptyAmplitude 1;
        
    /** @var float */
        
    private $density 0.5;

        
    /** @var Populator[] */
        
    private $generationPopulators = [];
        
    /** @var Simplex */
        
    private $noiseBase;

        
    /**
         * @param array $options
         *
         * @throws InvalidGeneratorOptionsException
         */
        
    public function __construct(array $options = []){

        }

        public function 
    getName() : string{
            return 
    "nether";
        }

        public function 
    getSettings() : array{
            return [];
        }

        public function 
    init(ChunkManager $levelRandom $random) : void{
            
    parent::init($level$random);
            
    $this->random->setSeed($this->level->getSeed());
            
    $this->noiseBase = new Simplex($this->random4464);
            
    $this->random->setSeed($this->level->getSeed());

            
    $ores = new Ore();
            
    $ores->setOreTypes([
                new 
    OreType(new NetherQuartzOre(), 10001000128),
                new 
    OreType(New GoldOre(), 1000100064)
            ]);
            
    $this->populators[] = $ores;
        }

        public function 
    generateChunk(int $chunkXint $chunkZ) : void{
            
    $this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ $this->level->getSeed());

            
    $noise $this->noiseBase->getFastNoise3D(1612816484$chunkX 160$chunkZ 16);

            
    $chunk $this->level->getChunk($chunkX$chunkZ);

            for(
    $x 0$x 16; ++$x){
                for(
    $z 0$z 16; ++$z){

                    
    $biome Biome::getBiome(Biome::HELL);
                    
    $chunk->setBiomeId($x$z$biome->getId());

                    for(
    $y 0$y 128; ++$y){
                        if(
    $y === or $y === 127){
                            
    $chunk->setBlockId($x$y$zBlock::BEDROCK);
                            continue;
                        }
                        
    $noiseValue = (abs($this->emptyHeight $y) / $this->emptyHeight) * $this->emptyAmplitude $noise[$x][$z][$y];
                        
    $noiseValue -= $this->density;

                        if(
    $noiseValue 0){
                            
    $chunk->setBlockId($x$y$zBlock::NETHERRACK);
                        }elseif(
    $y <= $this->waterHeight){
                            
    $chunk->setBlockId($x$y$zBlock::STILL_LAVA);
                        }
                    }
                }
            }

            foreach(
    $this->generationPopulators as $populator){
                
    $populator->populate($this->level$chunkX$chunkZ$this->random);
            }
        }

        public function 
    populateChunk(int $chunkXint $chunkZ) : void{
            
    $this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ $this->level->getSeed());
            foreach(
    $this->populators as $populator){
                
    $populator->populate($this->level$chunkX$chunkZ$this->random);
            }

            
    $chunk $this->level->getChunk($chunkX$chunkZ);
            
    $biome Biome::getBiome($chunk->getBiomeId(77));
            
    $biome->populateChunk($this->level$chunkX$chunkZ$this->random);
        }

        public function 
    getSpawn() : Vector3{
            return new 
    Vector3(127.5128127.5);
        }
    }
     
  2. Deniel

    Deniel Spider Jockey

    Messages:
    39
    GitHub:
    DenielWorld
    You did not provide an error log
     
  3. Ayzrix

    Ayzrix Witch

    Messages:
    54
    GitHub:
    Ayzrix
    No mistake, it generates the world but without the minerals
     
  4. Deniel

    Deniel Spider Jockey

    Messages:
    39
    GitHub:
    DenielWorld
    what exactly are your changes?
     
  5. Ayzrix

    Ayzrix Witch

    Messages:
    54
    GitHub:
    Ayzrix
    That's

    PHP:
            /*$ores = new Ore();
            $ores->setOreTypes([
                new OreType(new CoalOre(), 20, 16, 0, 128),
                new OreType(New IronOre(), 20, 8, 0, 64),
                new OreType(new RedstoneOre(), 8, 7, 0, 16),
                new OreType(new LapisOre(), 1, 6, 0, 32),
                new OreType(new GoldOre(), 2, 8, 0, 32),
                new OreType(new DiamondOre(), 1, 7, 0, 16),
                new OreType(new Dirt(), 20, 32, 0, 128),
                new OreType(new Gravel(), 10, 16, 0, 128)
            ]);
            $this->populators[] = $ores;*/
        
    }
    to

    PHP:
            $ores = new Ore();
            
    $ores->setOreTypes([
                new 
    OreType(new NetherQuartzOre(), 10001000128),
                new 
    OreType(New GoldOre(), 1000100064)
            ]);
            
    $this->populators[] = $ores;
        }
    With

    PHP:
    use pocketmine\level\generator\object\OreType;
    use 
    pocketmine\level\generator\populator\Ore;
    use 
    pocketmine\block\NetherQuartzOre;
    use 
    pocketmine\block\GoldOre;
     
  6. Deniel

    Deniel Spider Jockey

    Messages:
    39
    GitHub:
    DenielWorld
    Check out the TeaSpoon plugin on github. I believe it registers a better nether world, maybe you will find something helpful there.
     
    HimbeersaftLP likes this.

Share This Page

  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.