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