CurseForge and Overwolf are joining forces!
Awesome More Information
  • 0

    posted a message on I need help with creating a valley biome.

    Hey all,

     

    I am trying to create a valley biome, in which the floor level is around y = 45 to 50 on average.  Dead bushes will spawn frequently, along with the occasional tree and water pool.  When generating a biome, the MC generation algorithm says "If there is an air block whose y-coordinate is less than 63, change it to water."  I want this part of the code to be abolished (just for my biome).  I tried overriding the function genTerrainBlocks in BiomeGenBase with my own version, and I thought that would work:

        @Override
    	public void genTerrainBlocks(World p_150573_1_, Random p_150573_2_, Block[] p_150573_3_, byte[] p_150573_4_, int p_150573_5_, int p_150573_6_, double p_150573_7_)
        {
            this.genBiomeTerrainWithoutWater(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_);
        }
    	
    	public void genBiomeTerrainWithoutWater(World p_150560_1_, Random p_150560_2_, Block[] p_150560_3_, byte[] p_150560_4_, int p_150560_5_, int p_150560_6_, double p_150560_7_) {
    		boolean flag = true;
            Block block = this.topBlock;
            byte b0 = (byte)(this.field_150604_aj & 255);
            Block block1 = this.fillerBlock;
            int k = -1;
            int l = (int)(p_150560_7_ / 3.0D + 3.0D + p_150560_2_.nextDouble() * 0.25D);
            int i1 = p_150560_5_ & 15;
            int j1 = p_150560_6_ & 15;
            int k1 = p_150560_3_.length / 256;
    
            for (int l1 = 255; l1 >= 0; --l1)
            {
                int i2 = (j1 * 16 + i1) * k1 + l1;
    
                if (l1 <= 0 + p_150560_2_.nextInt(5))
                {
                    p_150560_3_[i2] = Blocks.bedrock;
                }
                else
                {
                    Block block2 = p_150560_3_[i2];
    
                    if (block2 != null && block2.getMaterial() != Material.air)
                    {
                        if (block2 == Blocks.stone)
                        {
                            if (k == -1)
                            {
                                if (l <= 0)
                                {
                                    block = null;
                                    b0 = 0;
                                    block1 = Blocks.stone;
                                }
                                else if (l1 >= 59 && l1 <= 64)
                                {
                                    block = this.topBlock;
                                    b0 = (byte)(this.field_150604_aj & 255);
                                    block1 = this.fillerBlock;
                                }
                                
                                if (l1 < 63 && (block == null || block.getMaterial() == Material.air))
                                {
                                    b0 = 0;
                                    block = Blocks.air;
                                    p_150560_3_[i2] = Blocks.air;
                                }
                                
                                k = l;
    
                                if (l1 >= 62)
                                {
                                    p_150560_3_[i2] = block;
                                    p_150560_4_[i2] = b0;
                                }
                                else if (l1 < 56 - l)
                                {
                                    block = null;
                                    block1 = Blocks.stone;
                                    p_150560_3_[i2] = Blocks.gravel;
                                }
                                else
                                {
                                    p_150560_3_[i2] = block1;
                                }
                            }
                            else if (k > 0)
                            {
                                --k;
                                p_150560_3_[i2] = block1;
    
                                if (k == 0 && block1 == Blocks.sand)
                                {
                                    k = p_150560_2_.nextInt(4) + Math.max(0, l1 - 63);
                                    block1 = Blocks.sandstone;
                                }
                            }
                        }
                    }
                    else
                    {
                        k = -1;
                    }
                }
            }
    	}

     Notice that this function is the exact same as BiomeGenBase.genBiomeTerrain, except I removed the part where it generates water.  However, it doesn't work!  I still have a huge ocean where my biome is supposed to be.

     

    Constructor: (in case it is useful to anyone)

    public BiomeGenValley(int id) {
    		super(id);
    		topBlock = Blocks.dirt;
    		fillerBlock = Blocks.end_stone;
    		theBiomeDecorator.treesPerChunk = 1;
    		theBiomeDecorator.deadBushPerChunk = 8;
    		theBiomeDecorator.grassPerChunk = -999;
    		theBiomeDecorator.generateLakes = false;
    		rootHeight = -0.9F;
    		heightVariation = 0.03F;
    	}

     Once I get it working, I will change the filler block from end stone to dirt.

     

    Any suggestions?

     

    Posted in: General Discussion
  • To post a comment, please or register a new account.