Jump to content

[1.7.10] custom flowers are not spawning in custom biome


slugslug

Recommended Posts

I am trying to make a custom biome and i got my custom tree to spawn but not as frequent as i would like and i cant seem to figure out how to make it spawn more. I add my flowers with the addFlowers method in the constructor  and only one spawns when i bonemeal the ground.  I cant seem to find a away that works to make my flowers randmly spawn in the biome.

 

Here is my class:

 

 

/**
* This class was created by <Professorvennie>. It's distributed as
* part of the Machinery Craft Mod. Get the Source Code in github:
* https://github.com/Professorvennie/MachineryCraft
*
* Machinery Craft is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
* */
package com.professorvennie.core.world.biome;

import com.professorvennie.core.block.ModBlocks;
import com.professorvennie.core.lib.Names;
import com.professorvennie.core.world.tree.WorldGenPlasticTree;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;

import java.util.Random;

public class BiomePlastic extends BiomeGenBase {

    public BiomePlastic(int id) {
        super(id);
        setDisableRain();
        for(int i = 0; i < Names.Blocks.BLOCK_PLASTIC_FLOWERS.length; i++){
            addFlower(ModBlocks.plasticFlower, i, 20);
        }
        topBlock = ModBlocks.plasticGrass;
        fillerBlock = ModBlocks.plasticDirt;
    }

    @Override
    public int getBiomeGrassColor(int p_150558_1_, int p_150558_2_, int p_150558_3_) {
        return 0xFFFFFF;
    }

    @Override
    public int getModdedBiomeGrassColor(int original) {
        return 0xFFFFFF;
    }

    public WorldGenAbstractTree func_150567_a(Random random){
        return random.nextInt(2) == 0 ? new WorldGenPlasticTree(false) : new WorldGenPlasticTree(false);
    }

    @Override
    public void decorate(World world, Random random, int chunkX, int chunkZ) {
        super.decorate(world, random, chunkX, chunkZ);
        int x = chunkX + random.nextInt(16);
        int y = random.nextInt(28) + 4;
        int z = chunkZ + random.nextInt(16);
        plantFlower(world, random, x, y, z);
    }
}

 

 

Link to comment
Share on other sites

What are the addFlower and plantFlower functions? Are they in BiomeGenBase? If so, just use WorldGenFlowers to generate your flowers. And maybe move your world gen code to a class that implements IWorldGenerator.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

Make your own WorldGenFlowers class that accepts metadata as a parameter. Here is one you can copy and paste:

 

public class ModWorldGenFlowers extends WorldGenerator
{
    private Block flower;
    private int meta;

    public ModWorldGenFlowers(Block flower, int metadata)
    {
        this.flower = flower;
        this.meta = metadata;
    }

    public boolean generate(World world, Random rand, int i, int j, int k)
    {
        for (int var6 = 0; var6 < 64; ++var6)
        {
            int var7 = i + rand.nextInt( - rand.nextInt(;
            int var8 = j + rand.nextInt(4) - rand.nextInt(4);
            int var9 = k + rand.nextInt( - rand.nextInt(;

            if (world.isAirBlock(var7, var8, var9) && (!world.provider.hasNoSky || var8 < 255) && this.flower.canBlockStay(world, var7, var8, var9))
            {
                world.setBlock(var7, var8, var9, this.flower, this.meta, 2);
            }
        }

        return true;
    }
}

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.