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 private int field_82631_b = 1; 013 014 public WorldGenerator() 015 { 016 this.doBlockNotify = false; 017 } 018 019 public WorldGenerator(boolean par1) 020 { 021 this.doBlockNotify = par1; 022 } 023 024 public abstract boolean generate(World var1, Random var2, int var3, int var4, int var5); 025 026 /** 027 * Rescales the generator settings, only used in WorldGenBigTree 028 */ 029 public void setScale(double par1, double par3, double par5) {} 030 031 /** 032 * Sets the block without metadata in the world, notifying neighbors if enabled. 033 */ 034 protected void setBlock(World par1World, int par2, int par3, int par4, int par5) 035 { 036 this.setBlockAndMetadata(par1World, par2, par3, par4, par5, 0); 037 } 038 039 /** 040 * Sets the block in the world, notifying neighbors if enabled. 041 */ 042 protected void setBlockAndMetadata(World par1World, int par2, int par3, int par4, int par5, int par6) 043 { 044 if (this.doBlockNotify) 045 { 046 par1World.setBlockAndMetadataWithNotify(par2, par3, par4, par5, par6); 047 } 048 else 049 { 050 par1World.setBlockAndMetadata(par2, par3, par4, par5, par6); 051 } 052 } 053 }