    001    package net.minecraft.src;
    002
    003    import java.util.Arrays;
    004    import java.util.List;
    005    import java.util.Random;
    006
    007    public class MapGenScatteredFeature extends MapGenStructure
    008    {
    009        private static List biomelist = Arrays.asList(new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desertHills, BiomeGenBase.jungle});
    010
    011        protected boolean canSpawnStructureAtCoords(int par1, int par2)
    012        {
    013            byte var3 = 32;
    014            byte var4 = 8;
    015            int var5 = par1;
    016            int var6 = par2;
    017
    018            if (par1 < 0)
    019            {
    020                par1 -= var3 - 1;
    021            }
    022
    023            if (par2 < 0)
    024            {
    025                par2 -= var3 - 1;
    026            }
    027
    028            int var7 = par1 / var3;
    029            int var8 = par2 / var3;
    030            Random var9 = this.worldObj.setRandomSeed(var7, var8, 14357617);
    031            var7 *= var3;
    032            var8 *= var3;
    033            var7 += var9.nextInt(var3 - var4);
    034            var8 += var9.nextInt(var3 - var4);
    035
    036            if (var5 == var7 && var6 == var8)
    037            {
    038                boolean var10 = this.worldObj.getWorldChunkManager().areBiomesViable(var5 * 16 + 8, var6 * 16 + 8, 0, biomelist);
    039
    040                if (var10)
    041                {
    042                    return true;
    043                }
    044            }
    045
    046            return false;
    047        }
    048
    049        protected StructureStart getStructureStart(int par1, int par2)
    050        {
    051            return new StructureScatteredFeatureStart(this.worldObj, this.rand, par1, par2);
    052        }
    053    }