    001    package net.minecraft.world.gen.feature;
    002
    003    import java.util.Random;
    004    import net.minecraft.world.World;
    005
    006    public abstract class WorldGenerator
    007    {
    008        /**
    009         * Sets wither or not the generator should notify blocks of blocks it changes. When the world is first generated,
    010         * this is false, when saplings grow, this is true.
    011         */
    012        private final boolean doBlockNotify;
    013        private int field_82631_b = 1;
    014
    015        public WorldGenerator()
    016        {
    017            this.doBlockNotify = false;
    018        }
    019
    020        public WorldGenerator(boolean par1)
    021        {
    022            this.doBlockNotify = par1;
    023        }
    024
    025        public abstract boolean generate(World var1, Random var2, int var3, int var4, int var5);
    026
    027        /**
    028         * Rescales the generator settings, only used in WorldGenBigTree
    029         */
    030        public void setScale(double par1, double par3, double par5) {}
    031
    032        /**
    033         * Sets the block without metadata in the world, notifying neighbors if enabled.
    034         */
    035        protected void setBlock(World par1World, int par2, int par3, int par4, int par5)
    036        {
    037            this.setBlockAndMetadata(par1World, par2, par3, par4, par5, 0);
    038        }
    039
    040        /**
    041         * Sets the block in the world, notifying neighbors if enabled.
    042         */
    043        protected void setBlockAndMetadata(World par1World, int par2, int par3, int par4, int par5, int par6)
    044        {
    045            if (this.doBlockNotify)
    046            {
    047                par1World.setBlockAndMetadataWithNotify(par2, par3, par4, par5, par6);
    048            }
    049            else
    050            {
    051                par1World.setBlockAndMetadata(par2, par3, par4, par5, par6);
    052            }
    053        }
    054    }