Jump to content

Custom WorldChunkManager Crash


Thor597

Recommended Posts

I've been trying to make a WorldChunkManager for a long time now but every time I enter the dimension I get this error

 

java.lang.NullPointerException
at net.minecraft.src.AC_ChunkProvider.generateTerrain(AC_ChunkProvider.java:92)
at net.minecraft.src.AC_ChunkProvider.provideChunk(AC_ChunkProvider.java:277)
at net.minecraft.src.ChunkProvider.loadChunk(ChunkProvider.java:102)
at net.minecraft.src.ChunkProvider.provideChunk(ChunkProvider.java:128)
at net.minecraft.src.World.getChunkFromChunkCoords(World.java:648)
at net.minecraft.src.World.getBlockId(World.java:563)
at net.minecraft.client.Minecraft.preloadWorld(Minecraft.java:2199)
at net.minecraft.client.Minecraft.changeWorld(Minecraft.java:2085)
at net.minecraft.client.Minecraft.usePortal(Minecraft.java:1996)
at net.minecraft.src.AC_Fruit.onItemRightClick(AC_Fruit.java:56)
at net.minecraft.src.ItemStack.useItemRightClick(ItemStack.java:139)
at net.minecraft.src.PlayerController.sendUseItem(PlayerController.java:77)
at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1383)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1800)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:822)
at net.minecraft.client.Minecraft.run(Minecraft.java:750)
at java.lang.Thread.run(Unknown Source)
2012-07-31 12:44:47 [sEVERE] A critical error has occurred.
java.lang.NullPointerException
at net.minecraft.src.AC_ChunkProvider.generateTerrain(AC_ChunkProvider.java:92)
at net.minecraft.src.AC_ChunkProvider.provideChunk(AC_ChunkProvider.java:277)
at net.minecraft.src.ChunkProvider.loadChunk(ChunkProvider.java:102)
at net.minecraft.src.ChunkProvider.provideChunk(ChunkProvider.java:128)
at net.minecraft.src.World.getChunkFromChunkCoords(World.java:648)
at net.minecraft.src.World.getBlockId(World.java:563)
at net.minecraft.client.Minecraft.preloadWorld(Minecraft.java:2199)
at net.minecraft.client.Minecraft.changeWorld(Minecraft.java:2085)
at net.minecraft.client.Minecraft.usePortal(Minecraft.java:1996)
at net.minecraft.src.AC_Fruit.onItemRightClick(AC_Fruit.java:56)
at net.minecraft.src.ItemStack.useItemRightClick(ItemStack.java:139)
at net.minecraft.src.PlayerController.sendUseItem(PlayerController.java:77)
at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1383)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1800)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:822)
at net.minecraft.client.Minecraft.run(Minecraft.java:750)
at java.lang.Thread.run(Unknown Source)

 

AC_WorldChunkManager

 

package net.minecraft.src;

import java.util.*;

public class AC_WorldChunkManager
{
        private GenLayer genBiomes;

        /** A GenLayer containing the indices into AC_BiomeGenBase.biomeList[] */
        private GenLayer biomeIndexLayer;

        /** The AC_BiomeCache object for this world. */
        private AC_BiomeCache biomeCache;

        /** A list of biomes that the player can spawn in. */
        private List biomesToSpawnIn;

        protected AC_WorldChunkManager()
        {
                biomeCache = new AC_BiomeCache(this);
                biomesToSpawnIn = new ArrayList();
      
                biomesToSpawnIn.add(AC_BiomeGenBase.FrostForest);
                biomesToSpawnIn.add(AC_BiomeGenBase.FrostMountains);
        }

        public AC_WorldChunkManager(long par1, WorldType par3WorldType)
        {
                this();
                GenLayer agenlayer[] = GenLayer.func_48425_a(par1, par3WorldType);
                genBiomes = agenlayer[0];
                biomeIndexLayer = agenlayer[1];
        }

        public AC_WorldChunkManager(World par1World)
        {
                this(par1World.getSeed(), par1World.getWorldInfo().getTerrainType());
        }

        /**
         * Gets the list of valid biomes for the player to spawn in.
         */
        public List getBiomesToSpawnIn()
        {
                return biomesToSpawnIn;
        }

        /**
         * Returns the AC_BiomeGenBase related to the x, z position on the world.
         */
        public AC_BiomeGenBase getBiomeGenAt(int par1, int par2)
        {
                return biomeCache.getBiomeGenAt(par1, par2);
        }

        /**
         * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length.
         */
        public float[] getRainfall(float par1ArrayOfFloat[], int par2, int par3, int par4, int par5)
        {
                IntCache.resetIntCache();

                if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
                {
                        par1ArrayOfFloat = new float[par4 * par5];
                }

                int ai[] = biomeIndexLayer.getInts(par2, par3, par4, par5);

                for (int i = 0; i < par4 * par5; i++)
                {
                        float f = (float)AC_BiomeGenBase.biomeList[ai[i]].getIntRainfall() / 65536F;

                        if (f > 1.0F)
                        {
                                f = 1.0F;
                        }

                        par1ArrayOfFloat[i] = f;
                }

                return par1ArrayOfFloat;
        }

        /**
         * Return an adjusted version of a given temperature based on the y height
         */
        public float getTemperatureAtHeight(float par1, int par2)
        {
                return par1;
        }

        /**
         * Returns a list of temperatures to use for the specified blocks.  Args: listToReuse, x, y, width, length
         */
        public float[] getTemperatures(float par1ArrayOfFloat[], int par2, int par3, int par4, int par5)
        {
                IntCache.resetIntCache();

                if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
                {
                        par1ArrayOfFloat = new float[par4 * par5];
                }

                int ai[] = biomeIndexLayer.getInts(par2, par3, par4, par5);

                for (int i = 0; i < par4 * par5; i++)
                {
                        float f = (float)AC_BiomeGenBase.biomeList[ai[i]].getIntTemperature() / 65536F;

                        if (f > 1.0F)
                        {
                                f = 1.0F;
                        }

                        par1ArrayOfFloat[i] = f;
                }

                return par1ArrayOfFloat;
        }

        /**
         * Returns an array of biomes for the location input.
         */
        public AC_BiomeGenBase[] getBiomesForGeneration(AC_BiomeGenBase par1ArrayOfAC_BiomeGenBase[], int par2, int par3, int par4, int par5)
        {
                IntCache.resetIntCache();

                if (par1ArrayOfAC_BiomeGenBase == null || par1ArrayOfAC_BiomeGenBase.length < par4 * par5)
                {
                        par1ArrayOfAC_BiomeGenBase = new AC_BiomeGenBase[par4 * par5];
                }

                int ai[] = genBiomes.getInts(par2, par3, par4, par5);

                for (int i = 0; i < par4 * par5; i++)
                {
                        par1ArrayOfAC_BiomeGenBase[i] = AC_BiomeGenBase.biomeList[ai[i]];
                }

                return par1ArrayOfAC_BiomeGenBase;
        }

        /**
         * Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the
         * WorldChunkManager Args: oldBiomeList, x, z, width, depth
         */
        public AC_BiomeGenBase[] loadBlockGeneratorData(AC_BiomeGenBase par1ArrayOfAC_BiomeGenBase[], int par2, int par3, int par4, int par5)
        {
                return getBiomeGenAt(par1ArrayOfAC_BiomeGenBase, par2, par3, par4, par5, true);
        }

        /**
         * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
         * don't check biomeCache to avoid infinite loop in AC_BiomeCacheBlock)
         */
        public AC_BiomeGenBase[] getBiomeGenAt(AC_BiomeGenBase par1ArrayOfAC_BiomeGenBase[], int par2, int par3, int par4, int par5, boolean par6)
        {
                IntCache.resetIntCache();

                if (par1ArrayOfAC_BiomeGenBase == null || par1ArrayOfAC_BiomeGenBase.length < par4 * par5)
                {
                        par1ArrayOfAC_BiomeGenBase = new AC_BiomeGenBase[par4 * par5];
                }

                if (par6 && par4 == 16 && par5 == 16 && (par2 & 0xf) == 0 && (par3 & 0xf) == 0)
                {
                        AC_BiomeGenBase aAC_BiomeGenBase[] = biomeCache.getCachedBiomes(par2, par3);
                        System.arraycopy(aAC_BiomeGenBase, 0, par1ArrayOfAC_BiomeGenBase, 0, par4 * par5);
                        return par1ArrayOfAC_BiomeGenBase;
                }

                int ai[] = biomeIndexLayer.getInts(par2, par3, par4, par5);

                for (int i = 0; i < par4 * par5; i++)
                {
                        par1ArrayOfAC_BiomeGenBase[i] = AC_BiomeGenBase.biomeList[ai[i]];
                }

                return par1ArrayOfAC_BiomeGenBase;
        }

        /**
         * checks given Chunk's Biomes against List of allowed ones
         */
        public boolean areBiomesViable(int par1, int par2, int par3, List par4List)
        {
                int i = par1 - par3 >> 2;
                int j = par2 - par3 >> 2;
                int k = par1 + par3 >> 2;
                int l = par2 + par3 >> 2;
                int i1 = (k - i) + 1;
                int j1 = (l - j) + 1;
                int ai[] = genBiomes.getInts(i, j, i1, j1);

                for (int k1 = 0; k1 < i1 * j1; k1++)
                {
                        AC_BiomeGenBase var18 = AC_BiomeGenBase.biomeList[ai[k1]];

                        if (!par4List.contains(var18))
                        {
                                return false;
                        }
                }

                return true;
        }

        /**
         * Finds a valid position within a range, that is once of the listed biomes.
         */
        public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random)
        {
                int i = par1 - par3 >> 2;
                int j = par2 - par3 >> 2;
                int k = par1 + par3 >> 2;
                int l = par2 + par3 >> 2;
                int i1 = (k - i) + 1;
                int j1 = (l - j) + 1;
                int ai[] = genBiomes.getInts(i, j, i1, j1);
                ChunkPosition chunkposition = null;
                int k1 = 0;

                for (int l1 = 0; l1 < ai.length; l1++)
                {
                        int i2 = i + l1 % i1 << 2;
                        int j2 = j + l1 / i1 << 2;
                        AC_BiomeGenBase var18 = AC_BiomeGenBase.biomeList[ai[l1]];

                        if (par4List.contains(var18) && (chunkposition == null || par5Random.nextInt(k1 + 1) == 0))
                        {
                                chunkposition = new ChunkPosition(i2, 0, j2);
                                k1++;
                        }
                }

                return chunkposition;
        }

        /**
         * Calls the WorldChunkManager's biomeCache.cleanupCache()
         */
        public void cleanupCache()
        {
                biomeCache.cleanupCache();
        }
}

 

 

AC_ChunkProvider

 

package net.minecraft.src;

import java.util.List;
import java.util.Random;

public class AC_ChunkProvider implements IChunkProvider
{
    /** RNG. */
    private Random rand;

    /** A NoiseGeneratorOctaves used in generating terrain */
    private NoiseGeneratorOctaves noiseGen1;

    /** A NoiseGeneratorOctaves used in generating terrain */
    private NoiseGeneratorOctaves noiseGen2;

    /** A NoiseGeneratorOctaves used in generating terrain */
    private NoiseGeneratorOctaves noiseGen3;

    /** A NoiseGeneratorOctaves used in generating terrain */
    private NoiseGeneratorOctaves noiseGen4;

    /** A NoiseGeneratorOctaves used in generating terrain */
    public NoiseGeneratorOctaves noiseGen5;

    /** A NoiseGeneratorOctaves used in generating terrain */
    public NoiseGeneratorOctaves noiseGen6;
    public NoiseGeneratorOctaves mobSpawnerNoise;

    /** Reference to the World object. */
    private World worldObj;

    /** are map structures going to be generated (e.g. strongholds) */
    private final boolean mapFeaturesEnabled;
    private double noiseArray[];
    private double stoneNoise[];
    private MapGenBase caveGenerator;

    /** Holds Stronghold Generator */
    private MapGenStronghold strongholdGenerator;

    /** Holds Village Generator */
    private MapGenVillage villageGenerator;

    /** Holds Mineshaft Generator */
    private MapGenMineshaft mineshaftGenerator;

    /** Holds ravine generator */
    private MapGenBase ravineGenerator;
    private BiomeGenBase biomesForGeneration[];
    double noise3[];
    double noise1[];
    double noise2[];
    double noise5[];
    double noise6[];
    float field_35388_l[];
    int field_914_i[][];

    public AC_ChunkProvider(World par1World, long par2, boolean par4)
    {
        stoneNoise = new double[256];
        caveGenerator = new MapGenCaves();
        strongholdGenerator = new MapGenStronghold();
        villageGenerator = new MapGenVillage(0);
        mineshaftGenerator = new MapGenMineshaft();
        ravineGenerator = new MapGenRavine();
        field_914_i = new int[32][32];
        worldObj = par1World;
        mapFeaturesEnabled = par4;
        rand = new Random(par2);
        noiseGen1 = new NoiseGeneratorOctaves(rand, 16);
        noiseGen2 = new NoiseGeneratorOctaves(rand, 16);
        noiseGen3 = new NoiseGeneratorOctaves(rand, ;
        noiseGen4 = new NoiseGeneratorOctaves(rand, 4);
        noiseGen5 = new NoiseGeneratorOctaves(rand, 10);
        noiseGen6 = new NoiseGeneratorOctaves(rand, 16);
        mobSpawnerNoise = new NoiseGeneratorOctaves(rand, ;
    }

    /**
     * Generates the shape of the terrain for the chunk though its all stone though the water is frozen if the
     * temperature is low enough
     */
    public void generateTerrain(int par1, int par2, byte par3ArrayOfByte[])
    {
        byte byte0 = 4;
        byte byte1 = 16;
        byte byte2 = 63;
        int i = byte0 + 1;
        byte byte3 = 17;
        int j = byte0 + 1;
        biomesForGeneration = worldObj.getWorldChunkManager().getBiomesForGeneration(biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, i + 5, j + 5);
        noiseArray = initializeNoiseField(noiseArray, par1 * byte0, 0, par2 * byte0, i, byte3, j);

        for (int k = 0; k < byte0; k++)
        {
            for (int l = 0; l < byte0; l++)
            {
                for (int i1 = 0; i1 < byte1; i1++)
                {
                    double d = 0.125D;
                    double d1 = noiseArray[((k + 0) * j + (l + 0)) * byte3 + (i1 + 0)];
                    double d2 = noiseArray[((k + 0) * j + (l + 1)) * byte3 + (i1 + 0)];
                    double d3 = noiseArray[((k + 1) * j + (l + 0)) * byte3 + (i1 + 0)];
                    double d4 = noiseArray[((k + 1) * j + (l + 1)) * byte3 + (i1 + 0)];
                    double d5 = (noiseArray[((k + 0) * j + (l + 0)) * byte3 + (i1 + 1)] - d1) * d;
                    double d6 = (noiseArray[((k + 0) * j + (l + 1)) * byte3 + (i1 + 1)] - d2) * d;
                    double d7 = (noiseArray[((k + 1) * j + (l + 0)) * byte3 + (i1 + 1)] - d3) * d;
                    double d8 = (noiseArray[((k + 1) * j + (l + 1)) * byte3 + (i1 + 1)] - d4) * d;

                    for (int j1 = 0; j1 < 8; j1++)
                    {
                        double d9 = 0.25D;
                        double d10 = d1;
                        double d11 = d2;
                        double d12 = (d3 - d1) * d9;
                        double d13 = (d4 - d2) * d9;

                        for (int k1 = 0; k1 < 4; k1++)
                        {
                            int l1 = k1 + k * 4 << 11 | 0 + l * 4 << 7 | i1 * 8 + j1;
                            char c = '\200';
                            l1 -= c;
                            double d14 = 0.25D;
                            double d15 = d10;
                            double d16 = (d11 - d10) * d14;
                            d15 -= d16;

                            for (int i2 = 0; i2 < 4; i2++)
                            {
                                if ((d15 += d16) > 0.0D)
                                {
                                    par3ArrayOfByte[l1 += c] = (byte)mod_ArcticCraft.FrostStone.blockID;
                                    continue;
                                }

                                if (i1 * 8 + j1 < byte2)
                                {
                                    par3ArrayOfByte[l1 += c] = (byte)Block.waterStill.blockID;
                                }
                                else
                                {
                                    par3ArrayOfByte[l1 += c] = 0;
                                }
                            }

                            d10 += d12;
                            d11 += d13;
                        }

                        d1 += d5;
                        d2 += d6;
                        d3 += d7;
                        d4 += d8;
                    }
                }
            }
        }
    }

    /**
     * Replaces the stone that was placed in with blocks that match the biome
     */
    public void replaceBlocksForBiome(int par1, int par2, byte par3ArrayOfByte[], BiomeGenBase par4ArrayOfBiomeGenBase[])
    {
        byte byte0 = 63;
        double d = 0.03125D;
        stoneNoise = noiseGen4.generateNoiseOctaves(stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d * 2D, d * 2D, d * 2D);

        for (int i = 0; i < 16; i++)
        {
            for (int j = 0; j < 16; j++)
            {
                BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[j + i * 16];
                float f = biomegenbase.getFloatTemperature();
                int k = (int)(stoneNoise[i + j * 16] / 3D + 3D + rand.nextDouble() * 0.25D);
                int l = -1;
                byte byte1 = biomegenbase.topBlock;
                byte byte2 = biomegenbase.fillerBlock;

                for (int i1 = 127; i1 >= 0; i1--)
                {
                    int j1 = (j * 16 + i) * 128 + i1;

                    if (i1 <= 0 + rand.nextInt(5))
                    {
                        par3ArrayOfByte[j1] = (byte)Block.bedrock.blockID;
                        continue;
                    }

                    byte byte3 = par3ArrayOfByte[j1];

                    if (byte3 == 0)
                    {
                        l = -1;
                        continue;
                    }

                    if (byte3 != (byte)mod_ArcticCraft.FrostStone.blockID)
                    {
                        continue;
                    }

                    if (l == -1)
                    {
                        if (k <= 0)
                        {
                            byte1 = 0;
                            byte2 = (byte)mod_ArcticCraft.FrostStone.blockID;
                        }
                        else if (i1 >= byte0 - 4 && i1 <= byte0 + 1)
                        {
                            byte1 = biomegenbase.topBlock;
                            byte2 = biomegenbase.fillerBlock;
                        }

                        if (i1 < byte0 && byte1 == 0)
                        {
                            if (f < 0.15F)
                            {
                                byte1 = (byte)Block.ice.blockID;
                            }
                            else
                            {
                                byte1 = (byte)Block.waterStill.blockID;
                            }
                        }

                        l = k;

                        if (i1 >= byte0 - 1)
                        {
                            par3ArrayOfByte[j1] = byte1;
                        }
                        else
                        {
                            par3ArrayOfByte[j1] = byte2;
                        }

                        continue;
                    }

                    if (l <= 0)
                    {
                        continue;
                    }

                    l--;
                    par3ArrayOfByte[j1] = byte2;

                    if (l == 0 && byte2 == Block.sand.blockID)
                    {
                        l = rand.nextInt(4);
                        byte2 = (byte)Block.sandStone.blockID;
                    }
                }
            }
        }
    }

    /**
     * loads or generates the chunk at the chunk location specified
     */
    public Chunk loadChunk(int par1, int par2)
    {
        return provideChunk(par1, par2);
    }

    /**
     * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
     * specified chunk from the map seed and chunk seed
     */
    public Chunk provideChunk(int par1, int par2)
    {
        rand.setSeed((long)par1 * 0x4f9939f508L + (long)par2 * 0x1ef1565bd5L);
        byte abyte0[] = new byte[32768];
        generateTerrain(par1, par2, abyte0);
        biomesForGeneration = worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
        replaceBlocksForBiome(par1, par2, abyte0, biomesForGeneration);
        caveGenerator.generate(this, worldObj, par1, par2, abyte0);
        ravineGenerator.generate(this, worldObj, par1, par2, abyte0);

        if (mapFeaturesEnabled)
        {
            mineshaftGenerator.generate(this, worldObj, par1, par2, abyte0);
            villageGenerator.generate(this, worldObj, par1, par2, abyte0);
            strongholdGenerator.generate(this, worldObj, par1, par2, abyte0);
        }

        Chunk chunk = new Chunk(worldObj, abyte0, par1, par2);
        byte abyte1[] = chunk.getBiomeArray();

        for (int i = 0; i < abyte1.length; i++)
        {
            abyte1[i] = (byte)biomesForGeneration[i].biomeID;
        }

        chunk.generateSkylightMap();
        return chunk;
    }

    /**
     * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the
     * size.
     */
    private double[] initializeNoiseField(double par1ArrayOfDouble[], int par2, int par3, int par4, int par5, int par6, int par7)
    {
        if (par1ArrayOfDouble == null)
        {
            par1ArrayOfDouble = new double[par5 * par6 * par7];
        }

        if (field_35388_l == null)
        {
            field_35388_l = new float[25];

            for (int i = -2; i <= 2; i++)
            {
                for (int j = -2; j <= 2; j++)
                {
                    float f = 10F / MathHelper.sqrt_float((float)(i * i + j * j) + 0.2F);
                    field_35388_l[i + 2 + (j + 2) * 5] = f;
                }
            }
        }

        double d = 684.41200000000003D;
        double d1 = 684.41200000000003D;
        noise5 = noiseGen5.generateNoiseOctaves(noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D);
        noise6 = noiseGen6.generateNoiseOctaves(noise6, par2, par4, par5, par7, 200D, 200D, 0.5D);
        noise3 = noiseGen3.generateNoiseOctaves(noise3, par2, par3, par4, par5, par6, par7, d / 80D, d1 / 160D, d / 80D);
        noise1 = noiseGen1.generateNoiseOctaves(noise1, par2, par3, par4, par5, par6, par7, d, d1, d);
        noise2 = noiseGen2.generateNoiseOctaves(noise2, par2, par3, par4, par5, par6, par7, d, d1, d);
        par2 = par4 = 0;
        int k = 0;
        int l = 0;

        for (int i1 = 0; i1 < par5; i1++)
        {
            for (int j1 = 0; j1 < par7; j1++)
            {
                float f1 = 0.0F;
                float f2 = 0.0F;
                float f3 = 0.0F;
                byte byte0 = 2;
                BiomeGenBase biomegenbase = biomesForGeneration[i1 + 2 + (j1 + 2) * (par5 + 5)];

                for (int k1 = -byte0; k1 <= byte0; k1++)
                {
                    for (int l1 = -byte0; l1 <= byte0; l1++)
                    {
                        BiomeGenBase biomegenbase1 = biomesForGeneration[i1 + k1 + 2 + (j1 + l1 + 2) * (par5 + 5)];
                        float f4 = field_35388_l[k1 + 2 + (l1 + 2) * 5] / (biomegenbase1.minHeight + 2.0F);

                        if (biomegenbase1.minHeight > biomegenbase.minHeight)
                        {
                            f4 /= 2.0F;
                        }

                        f1 += biomegenbase1.maxHeight * f4;
                        f2 += biomegenbase1.minHeight * f4;
                        f3 += f4;
                    }
                }

                f1 /= f3;
                f2 /= f3;
                f1 = f1 * 0.9F + 0.1F;
                f2 = (f2 * 4F - 1.0F) / 8F;
                double d2 = noise6[l] / 8000D;

                if (d2 < 0.0D)
                {
                    d2 = -d2 * 0.29999999999999999D;
                }

                d2 = d2 * 3D - 2D;

                if (d2 < 0.0D)
                {
                    d2 /= 2D;

                    if (d2 < -1D)
                    {
                        d2 = -1D;
                    }

                    d2 /= 1.3999999999999999D;
                    d2 /= 2D;
                }
                else
                {
                    if (d2 > 1.0D)
                    {
                        d2 = 1.0D;
                    }

                    d2 /= 8D;
                }

                l++;

                for (int i2 = 0; i2 < par6; i2++)
                {
                    double d3 = f2;
                    double d4 = f1;
                    d3 += d2 * 0.20000000000000001D;
                    d3 = (d3 * (double)par6) / 16D;
                    double d5 = (double)par6 / 2D + d3 * 4D;
                    double d6 = 0.0D;
                    double d7 = (((double)i2 - d5) * 12D * 128D) / 128D / d4;

                    if (d7 < 0.0D)
                    {
                        d7 *= 4D;
                    }

                    double d8 = noise1[k] / 512D;
                    double d9 = noise2[k] / 512D;
                    double d10 = (noise3[k] / 10D + 1.0D) / 2D;

                    if (d10 < 0.0D)
                    {
                        d6 = d8;
                    }
                    else if (d10 > 1.0D)
                    {
                        d6 = d9;
                    }
                    else
                    {
                        d6 = d8 + (d9 - d8) * d10;
                    }

                    d6 -= d7;

                    if (i2 > par6 - 4)
                    {
                        double d11 = (float)(i2 - (par6 - 4)) / 3F;
                        d6 = d6 * (1.0D - d11) + -10D * d11;
                    }

                    par1ArrayOfDouble[k] = d6;
                    k++;
                }
            }
        }

        return par1ArrayOfDouble;
    }

    /**
     * Checks to see if a chunk exists at x, y
     */
    public boolean chunkExists(int par1, int par2)
    {
        return true;
    }

    /**
     * Populates chunk with ores etc etc
     */
    public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
    {
        BlockSand.fallInstantly = true;
        int i = par2 * 16;
        int j = par3 * 16;
        BiomeGenBase biomegenbase = worldObj.getBiomeGenForCoords(i + 16, j + 16);
        rand.setSeed(worldObj.getSeed());
        long l = (rand.nextLong() / 2L) * 2L + 1L;
        long l1 = (rand.nextLong() / 2L) * 2L + 1L;
        rand.setSeed((long)par2 * l + (long)par3 * l1 ^ worldObj.getSeed());
        boolean flag = false;

        if (mapFeaturesEnabled)
        {
            mineshaftGenerator.generateStructuresInChunk(worldObj, rand, par2, par3);
            flag = villageGenerator.generateStructuresInChunk(worldObj, rand, par2, par3);
            strongholdGenerator.generateStructuresInChunk(worldObj, rand, par2, par3);
        }

        if (!flag && rand.nextInt(4) == 0)
        {
            int k = i + rand.nextInt(16) + 8;
            int i2 = rand.nextInt(128);
            int i3 = j + rand.nextInt(16) + 8;
            (new WorldGenLakes(Block.waterStill.blockID)).generate(worldObj, rand, k, i2, i3);
        }

        /*if (!flag && rand.nextInt( == 0)
        {
            int i1 = i + rand.nextInt(16) + 8;
            int j2 = rand.nextInt(rand.nextInt(120) + ;
            int j3 = j + rand.nextInt(16) + 8;

            if (j2 < 63 || rand.nextInt(10) == 0)
            {
                (new WorldGenLakes(Block.lavaStill.blockID)).generate(worldObj, rand, i1, j2, j3);
            }
        }*/

        for (int j1 = 0; j1 < 8; j1++)
        {
            int k2 = i + rand.nextInt(16) + 8;
            int k3 = rand.nextInt(128);
            int i4 = j + rand.nextInt(16) + 8;

            if (!(new WorldGenDungeons()).generate(worldObj, rand, k2, k3, i4));
        }

        biomegenbase.decorate(worldObj, rand, i, j);
        SpawnerAnimals.performWorldGenSpawning(worldObj, biomegenbase, i + 8, j + 8, 16, 16, rand);
        i += 8;
        j += 8;

        for (int k1 = 0; k1 < 16; k1++)
        {
            for (int l2 = 0; l2 < 16; l2++)
            {
                int l3 = worldObj.getPrecipitationHeight(i + k1, j + l2);

                if (worldObj.isBlockFreezable(k1 + i, l3 - 1, l2 + j))
                {
                    worldObj.setBlockWithNotify(k1 + i, l3 - 1, l2 + j, Block.ice.blockID);
                }

                if (worldObj.canSnowAt(k1 + i, l3, l2 + j))
                {
                    worldObj.setBlockWithNotify(k1 + i, l3, l2 + j, Block.snow.blockID);
                }
            }
        }

        BlockSand.fallInstantly = false;
    }

    /**
     * Two modes of operation: if passed true, save all Chunks in one go.  If passed false, save up to two chunks.
     * Return true if all chunks have been saved.
     */
    public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
    {
        return true;
    }

    /**
     * Unloads the 100 oldest chunks from memory, due to a bug with chunkSet.add() never being called it thinks the list
     * is always empty and will not remove any chunks.
     */
    public boolean unload100OldestChunks()
    {
        return false;
    }

    /**
     * Returns if the IChunkProvider supports saving.
     */
    public boolean canSave()
    {
        return true;
    }

    /**
     * Converts the instance data to a readable string.
     */
    public String makeString()
    {
        return "RandomLevelSourceTaetonjo";
    }

    /**
     * Returns a list of creatures of the specified type that can spawn at the given location.
     */
    public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
    {
        BiomeGenBase biomegenbase = worldObj.getBiomeGenForCoords(par2, par4);

        if (biomegenbase == null)
        {
            return null;
        }
        else
        {
            return biomegenbase.getSpawnableList(par1EnumCreatureType);
        }
    }

    /**
     * Returns the location of the closest structure of the specified type. If not found returns null.
     */
    public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5)
    {
        if ("Stronghold".equals(par2Str) && strongholdGenerator != null)
        {
            return strongholdGenerator.getNearestInstance(par1World, par3, par4, par5);
        }
        else
        {
            return null;
        }
    }
}

 

 

AC_WorldProvider

 

package net.minecraft.src;
import java.util.Random;

public class AC_WorldProvider extends WorldProvider
{
public AC_WorldProvider()
{

}

/** World chunk manager being used to generate chunks */
    public AC_WorldChunkManager AC_worldChunkMgr;

@Override
public String getSaveFolder() {
	return "ARCTIC";
}

public Vec3D getFogColor(float par1, float par2)
{
	return Vec3D.createVector(0.75, 127.5, 255);
}

public void registerWorldChunkManager()
{
	AC_worldChunkMgr = new AC_WorldChunkManager(worldObj);
}

public IChunkProvider getChunkProvider()
{
	return new AC_ChunkProvider(worldObj, worldObj.getSeed(), true);
}


public boolean canRespawnHere()
{
	return false;

}

public float calculateCelestialAngle(long par1, float par3)
{
	return 3.7F;
}


public String getWelcomeMessage() {
	return "Entering An Icy Wasteland";
}


public String getDepartMessage() {
	return "Exiting The Freezing Arctic!";
}





}

 

 

AC_BiomeGenBase

 

package net.minecraft.src;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public abstract class AC_BiomeGenBase
{
    /** An array of all the biomes, indexed by biome id. */
    public static final AC_BiomeGenBase[] biomeList = new AC_BiomeGenBase[256];
    
    public static final AC_BiomeGenBase FrostForest = (new AC_BiomeFrostForest(0)).setBiomeName("Arctic Forest").func_4124_a(5159473);
    public static final AC_BiomeGenBase FrostMountains = (new AC_BiomeFrostForest(1)).func_4124_a(5159473).setBiomeName("Arctic Mountains");

    public String biomeName;
    public int color;

    /** The block expected to be on the top of this biome */
    public byte topBlock;

    /** The block to fill spots in when not on the top */
    public byte fillerBlock;
    public int field_6502_q;

    /** The minimum height of this biome. Default 0.1. */
    public float minHeight;

    /** The maximum height of this biome. Default 0.3. */
    public float maxHeight;

    /** The temperature of this biome. */
    public float temperature;

    /** The rainfall in this biome. */
    public float rainfall;

    /** Color tint applied to water depending on biome */
    public int waterColorMultiplier;
    public AC_BiomeDecorator biomeDecorator;

    /**
     * Holds the classes of IMobs (hostile mobs) that can be spawned in the biome.
     */
    protected List spawnableMonsterList;

    /**
     * Holds the classes of any creature that can be spawned in the biome as friendly creature.
     */
    protected List spawnableCreatureList;

    /**
     * Holds the classes of any aquatic creature that can be spawned in the water of the biome.
     */
    protected List spawnableWaterCreatureList;

    /** Set to true if snow is enabled for this biome. */
    private boolean enableSnow;

    /**
     * Is true (default) if the biome support rain (desert and nether can't have rain)
     */
    private boolean enableRain;

    /** The id number to this biome, and its index in the biomeList array. */
    public final int biomeID;
    protected WorldGenTrees worldGenTrees;
    protected WorldGenBigTree worldGenBigTree;
    protected WorldGenForest worldGenForest;
    protected WorldGenSwamp worldGenSwamp;

    protected AC_BiomeGenBase(int par1)
    {
        this.topBlock = (byte)Block.grass.blockID;
        this.fillerBlock = (byte)Block.dirt.blockID;
        this.field_6502_q = 5169201;
        this.minHeight = 0.1F;
        this.maxHeight = 0.3F;
        this.temperature = 0.5F;
        this.rainfall = 0.5F;
        this.waterColorMultiplier = 16777215;
        this.spawnableMonsterList = new ArrayList();
        this.spawnableCreatureList = new ArrayList();
        this.spawnableWaterCreatureList = new ArrayList();
        this.enableRain = true;
        this.worldGenTrees = new WorldGenTrees(false);
        this.worldGenBigTree = new WorldGenBigTree(false);
        this.worldGenForest = new WorldGenForest(false);
        this.worldGenSwamp = new WorldGenSwamp();
        this.biomeID = par1;
        biomeList[par1] = this;
        this.biomeDecorator = this.createBiomeDecorator();
        this.spawnableCreatureList.add(new SpawnListEntry(EntitySheep.class, 12, 4, 4));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityPig.class, 10, 4, 4));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 10, 4, 4));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 8, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityCreeper.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 1, 1, 4));
        this.spawnableWaterCreatureList.add(new SpawnListEntry(EntitySquid.class, 10, 4, 4));
    }

    /**
     * Allocate a new BiomeDecorator for this BiomeGenBase
     */
    protected AC_BiomeDecorator createBiomeDecorator()
    {
        return new AC_BiomeDecorator(this);
    }

    /**
     * Sets the temperature and rainfall of this biome.
     */
    private AC_BiomeGenBase setTemperatureRainfall(float par1, float par2)
    {
        if (par1 > 0.1F && par1 < 0.2F)
        {
            throw new IllegalArgumentException("Please avoid temperatures in the range 0.1 - 0.2 because of snow");
        }
        else
        {
            this.temperature = par1;
            this.rainfall = par2;
            return this;
        }
    }

    /**
     * Sets the minimum and maximum height of this biome. Seems to go from -2.0 to 2.0.
     */
    private AC_BiomeGenBase setMinMaxHeight(float par1, float par2)
    {
        this.minHeight = par1;
        this.maxHeight = par2;
        return this;
    }

    /**
     * Disable the rain for the biome.
     */
    private AC_BiomeGenBase setDisableRain()
    {
        this.enableRain = false;
        return this;
    }

    /**
     * Gets a WorldGen appropriate for this biome.
     */
    public WorldGenerator getRandomWorldGenForTrees(Random par1Random)
    {
        return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGenBigTree : this.worldGenTrees);
    }

    /**
     * Gets a WorldGen appropriate for this biome.
     */
    public WorldGenerator getRandomWorldGenForGrass(Random par1Random)
    {
        return new WorldGenTallGrass(Block.tallGrass.blockID, 1);
    }

    /**
     * sets enableSnow to true during biome initialization. returns BiomeGenBase.
     */
    protected AC_BiomeGenBase setEnableSnow()
    {
        this.enableSnow = true;
        return this;
    }

    protected AC_BiomeGenBase setBiomeName(String par1Str)
    {
        this.biomeName = par1Str;
        return this;
    }

    protected AC_BiomeGenBase func_4124_a(int par1)
    {
        this.field_6502_q = par1;
        return this;
    }

    protected AC_BiomeGenBase setColor(int par1)
    {
        this.color = par1;
        return this;
    }

    /**
     * takes temperature, returns color
     */
    public int getSkyColorByTemp(float par1)
    {
        par1 /= 3.0F;

        if (par1 < -1.0F)
        {
            par1 = -1.0F;
        }

        if (par1 > 1.0F)
        {
            par1 = 1.0F;
        }

        return Color.getHSBColor(0.62222224F - par1 * 0.05F, 0.5F + par1 * 0.1F, 1.0F).getRGB();
    }

    /**
     * Returns the correspondent list of the EnumCreatureType informed.
     */
    public List getSpawnableList(EnumCreatureType par1EnumCreatureType)
    {
        return par1EnumCreatureType == EnumCreatureType.monster ? this.spawnableMonsterList : (par1EnumCreatureType == EnumCreatureType.creature ? this.spawnableCreatureList : (par1EnumCreatureType == EnumCreatureType.waterCreature ? this.spawnableWaterCreatureList : null));
    }

    /**
     * Returns true if the biome have snowfall instead a normal rain.
     */
    public boolean getEnableSnow()
    {
        return this.enableSnow;
    }

    /**
     * Return true if the biome supports lightning bolt spawn, either by have the bolts enabled and have rain enabled.
     */
    public boolean canSpawnLightningBolt()
    {
        return this.enableSnow ? false : this.enableRain;
    }

    /**
     * Checks to see if the rainfall level of the biome is extremely high
     */
    public boolean isHighHumidity()
    {
        return this.rainfall > 0.85F;
    }

    /**
     * returns the chance a creature has to spawn.
     */
    public float getSpawningChance()
    {
        return 0.1F;
    }

    /**
     * Gets an integer representation of this biome's rainfall
     */
    public final int getIntRainfall()
    {
        return (int)(this.rainfall * 65536.0F);
    }

    /**
     * Gets an integer representation of this biome's temperature
     */
    public final int getIntTemperature()
    {
        return (int)(this.temperature * 65536.0F);
    }

    /**
     * Gets a floating point representation of this biome's rainfall
     */
    public final float getFloatRainfall()
    {
        return this.rainfall;
    }

    /**
     * Gets a floating point representation of this biome's temperature
     */
    public final float getFloatTemperature()
    {
        return this.temperature;
    }

    public void decorate(World par1World, Random par2Random, int par3, int par4)
    {
        this.biomeDecorator.decorate(par1World, par2Random, par3, par4);
    }

    /**
     * Provides the basic grass color based on the biome temperature and rainfall
     */
    public int getBiomeGrassColor()
    {
        double var1 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F);
        double var3 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F);
        return ColorizerGrass.getGrassColor(var1, var3);
    }

    /**
     * Provides the basic foliage color based on the biome temperature and rainfall
     */
    public int getBiomeFoliageColor()
    {
        double var1 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F);
        double var3 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F);
        return ColorizerFoliage.getFoliageColor(var1, var3);
    }

}

 

 

AC_BiomeCache

 

package net.minecraft.src;

import java.util.ArrayList;
import java.util.List;

public class AC_BiomeCache
{
    /** Reference to the AC_WorldChunkManager */
    private final AC_WorldChunkManager chunkManager;

    /** The last time this BiomeCache was cleaned, in milliseconds. */
    private long lastCleanupTime = 0L;

    /**
     * The map of keys to AC_BiomeCacheBlocks. Keys are based on the chunk x, z coordinates as (x | z << 32).
     */
    private LongHashMap cacheMap = new LongHashMap();

    /** The list of cached AC_BiomeCacheBlocks */
    private List cache = new ArrayList();

    public AC_BiomeCache(AC_WorldChunkManager par1AC_WorldChunkManager)
    {
        this.chunkManager = par1AC_WorldChunkManager;
    }

    /**
     * Returns a biome cache block at location specified.
     */
    public AC_BiomeCacheBlock getAC_BiomeCacheBlock(int par1, int par2)
    {
        par1 >>= 4;
        par2 >>= 4;
        long var3 = (long)par1 & 4294967295L | ((long)par2 & 4294967295L) << 32;
        AC_BiomeCacheBlock var5 = (AC_BiomeCacheBlock)this.cacheMap.getValueByKey(var3);

        if (var5 == null)
        {
            var5 = new AC_BiomeCacheBlock(this, par1, par2);
            this.cacheMap.add(var3, var5);
            this.cache.add(var5);
        }

        var5.lastAccessTime = System.currentTimeMillis();
        return var5;
    }

    /**
     * Returns the AC_BiomeGenBase related to the x, z position from the cache.
     */
    public AC_BiomeGenBase getBiomeGenAt(int par1, int par2)
    {
        return this.getAC_BiomeCacheBlock(par1, par2).getBiomeGenAt(par1, par2);
    }

    /**
     * Removes AC_BiomeCacheBlocks from this cache that haven't been accessed in at least 30 seconds.
     */
    public void cleanupCache()
    {
        long var1 = System.currentTimeMillis();
        long var3 = var1 - this.lastCleanupTime;

        if (var3 > 7500L || var3 < 0L)
        {
            this.lastCleanupTime = var1;

            for (int var5 = 0; var5 < this.cache.size(); ++var5)
            {
                AC_BiomeCacheBlock var6 = (AC_BiomeCacheBlock)this.cache.get(var5);
                long var7 = var1 - var6.lastAccessTime;

                if (var7 > 30000L || var7 < 0L)
                {
                    this.cache.remove(var5--);
                    long var9 = (long)var6.xPosition & 4294967295L | ((long)var6.zPosition & 4294967295L) << 32;
                    this.cacheMap.remove(var9);
                }
            }
        }
    }

    /**
     * Returns the array of cached biome types in the AC_BiomeCacheBlock at the given location.
     */
    public AC_BiomeGenBase[] getCachedBiomes(int par1, int par2)
    {
        return this.getAC_BiomeCacheBlock(par1, par2).biomes;
    }

    /**
     * Get the world chunk manager object for a biome list.
     */
    static AC_WorldChunkManager getChunkManager(AC_BiomeCache par0BiomeCache)
    {
        return par0BiomeCache.chunkManager;
    }
}

 

 

AC_BiomeCacheBlock

 

package net.minecraft.src;

public class AC_BiomeCacheBlock
{
    /** An array of chunk temperatures saved by this cache. */
    public float[] temperatureValues;

    /** An array of chunk rainfall values saved by this cache. */
    public float[] rainfallValues;

    /** The array of biome types stored in this AC_BiomeCacheBlock. */
    public AC_BiomeGenBase[] biomes;

    /** The x coordinate of the AC_BiomeCacheBlock. */
    public int xPosition;

    /** The z coordinate of the AC_BiomeCacheBlock. */
    public int zPosition;

    /** The last time this AC_BiomeCacheBlock was accessed, in milliseconds. */
    public long lastAccessTime;

    /** The AC_BiomeCache objevt that contains this AC_BiomeCacheBlock */
    final AC_BiomeCache AC_BiomeCache;

    public AC_BiomeCacheBlock(AC_BiomeCache par1AC_BiomeCache, int par2, int par3)
    {
        this.AC_BiomeCache = par1AC_BiomeCache;
        this.temperatureValues = new float[256];
        this.rainfallValues = new float[256];
        this.biomes = new AC_BiomeGenBase[256];
        this.xPosition = par2;
        this.zPosition = par3;
        AC_BiomeCache.getChunkManager(par1AC_BiomeCache).getTemperatures(this.temperatureValues, par2 << 4, par3 << 4, 16, 16);
        AC_BiomeCache.getChunkManager(par1AC_BiomeCache).getRainfall(this.rainfallValues, par2 << 4, par3 << 4, 16, 16);
        AC_BiomeCache.getChunkManager(par1AC_BiomeCache).getBiomeGenAt(this.biomes, par2 << 4, par3 << 4, 16, 16, false);
    }

    /**
     * Returns the BiomeGenBase related to the x, z position from the cache block.
     */
    public AC_BiomeGenBase getBiomeGenAt(int par1, int par2)
    {
        return this.biomes[par1 & 15 | (par2 & 15) << 4];
    }
}

 

 

AC_BiomeDecorator

 

package net.minecraft.src;

import java.util.Random;

public class AC_BiomeDecorator
{
    /** The world the AC_BiomeDecorator is currently decorating */
    protected World currentWorld;

    /** The Biome Decorator's random number generator. */
    protected Random randomGenerator;

    /** The X-coordinate of the chunk currently being decorated */
    protected int chunk_X;

    /** The Z-coordinate of the chunk currently being decorated */
    protected int chunk_Z;

    /** The biome generator object. */
    protected AC_BiomeGenBase biome;

    /** The clay generator. */
    protected WorldGenerator clayGen = new WorldGenClay(4);

    /** The sand generator. */
    protected WorldGenerator sandGen;

    /** The gravel generator. */
    protected WorldGenerator gravelAsSandGen;

    /** The dirt generator. */
    protected WorldGenerator dirtGen;
    protected WorldGenerator gravelGen;
    protected WorldGenerator coalGen;
    protected WorldGenerator ironGen;

    /** Field that holds gold WorldGenMinable */
    protected WorldGenerator goldGen;

    /** Field that holds redstone WorldGenMinable */
    protected WorldGenerator redstoneGen;

    /** Field that holds diamond WorldGenMinable */
    protected WorldGenerator diamondGen;

    /** Field that holds Lapis WorldGenMinable */
    protected WorldGenerator lapisGen;

    /** Field that holds one of the plantYellow WorldGenFlowers */
    protected WorldGenerator plantYellowGen;

    /** Field that holds one of the plantRed WorldGenFlowers */
    protected WorldGenerator plantRedGen;

    /** Field that holds mushroomBrown WorldGenFlowers */
    protected WorldGenerator mushroomBrownGen;

    /** Field that holds mushroomRed WorldGenFlowers */
    protected WorldGenerator mushroomRedGen;

    /** Field that holds big mushroom generator */
    protected WorldGenerator bigMushroomGen;

    /** Field that holds WorldGenReed */
    protected WorldGenerator reedGen;

    /** Field that holds WorldGenCactus */
    protected WorldGenerator cactusGen;

    /** The water lily generation! */
    protected WorldGenerator waterlilyGen;

    /** Amount of waterlilys per chunk. */
    protected int waterlilyPerChunk;

    /**
     * The number of trees to attempt to generate per chunk. Up to 10 in forests, none in deserts.
     */
    protected int treesPerChunk;

    /**
     * The number of yellow flower patches to generate per chunk. The game generates much less than this number, since
     * it attempts to generate them at a random altitude.
     */
    protected int flowersPerChunk;

    /** The amount of tall grass to generate per chunk. */
    protected int grassPerChunk;

    /**
     * The number of dead bushes to generate per chunk. Used in deserts and swamps.
     */
    protected int deadBushPerChunk;

    /**
     * The number of extra mushroom patches per chunk. It generates 1/4 this number in brown mushroom patches, and 1/8
     * this number in red mushroom patches. These mushrooms go beyond the default base number of mushrooms.
     */
    protected int mushroomsPerChunk;

    /**
     * The number of reeds to generate per chunk. Reeds won't generate if the randomly selected placement is unsuitable.
     */
    protected int reedsPerChunk;

    /**
     * The number of cactus plants to generate per chunk. Cacti only work on sand.
     */
    protected int cactiPerChunk;

    /**
     * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater.
     */
    protected int sandPerChunk;

    /**
     * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. There
     * appear to be two separate fields for this.
     */
    protected int sandPerChunk2;

    /**
     * The number of clay patches to generate per chunk. Only generates when part of it is underwater.
     */
    protected int clayPerChunk;

    /** Amount of big mushrooms per chunk */
    protected int bigMushroomsPerChunk;

    /** True if decorator should generate surface lava & water */
    public boolean generateLakes;

    public AC_BiomeDecorator(AC_BiomeGenBase par1AC_BiomeGenBase)
    {
        this.sandGen = new WorldGenSand(7, Block.sand.blockID);
        this.gravelAsSandGen = new WorldGenSand(6, Block.gravel.blockID);
        this.dirtGen = new WorldGenMinable(Block.dirt.blockID, 32);
        this.gravelGen = new WorldGenMinable(Block.gravel.blockID, 32);
        this.coalGen = new WorldGenMinable(Block.oreCoal.blockID, 16);
        this.ironGen = new WorldGenMinable(Block.oreIron.blockID, ;
        this.goldGen = new WorldGenMinable(Block.oreGold.blockID, ;
        this.redstoneGen = new WorldGenMinable(Block.oreRedstone.blockID, 7);
        this.diamondGen = new WorldGenMinable(Block.oreDiamond.blockID, 7);
        this.lapisGen = new WorldGenMinable(Block.oreLapis.blockID, 6);
        this.plantYellowGen = new WorldGenFlowers(Block.plantYellow.blockID);
        this.plantRedGen = new WorldGenFlowers(Block.plantRed.blockID);
        this.mushroomBrownGen = new WorldGenFlowers(Block.mushroomBrown.blockID);
        this.mushroomRedGen = new WorldGenFlowers(Block.mushroomRed.blockID);
        this.bigMushroomGen = new WorldGenBigMushroom();
        this.reedGen = new WorldGenReed();
        this.cactusGen = new WorldGenCactus();
        this.waterlilyGen = new WorldGenWaterlily();
        this.waterlilyPerChunk = 0;
        this.treesPerChunk = 0;
        this.flowersPerChunk = 2;
        this.grassPerChunk = 1;
        this.deadBushPerChunk = 0;
        this.mushroomsPerChunk = 0;
        this.reedsPerChunk = 0;
        this.cactiPerChunk = 0;
        this.sandPerChunk = 1;
        this.sandPerChunk2 = 3;
        this.clayPerChunk = 1;
        this.bigMushroomsPerChunk = 0;
        this.generateLakes = true;
        this.biome = par1AC_BiomeGenBase;
    }

    /**
     * Decorates the world. Calls code that was formerly (pre-1. in ChunkProviderGenerate.populate
     */
    public void decorate(World par1World, Random par2Random, int par3, int par4)
    {
        if (this.currentWorld != null)
        {
            throw new RuntimeException("Already decorating!!");
        }
        else
        {
            this.currentWorld = par1World;
            this.randomGenerator = par2Random;
            this.chunk_X = par3;
            this.chunk_Z = par4;
            this.decorate();
            this.currentWorld = null;
            this.randomGenerator = null;
        }
    }

    /**
     * The method that does the work of actually decorating chunks
     */
    protected void decorate()
    {
        this.generateOres();
        int var1;
        int var2;
        int var3;

        for (var1 = 0; var1 < this.sandPerChunk2; ++var1)
        {
            var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            this.sandGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3);
        }

        for (var1 = 0; var1 < this.clayPerChunk; ++var1)
        {
            var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            this.clayGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3);
        }

        for (var1 = 0; var1 < this.sandPerChunk; ++var1)
        {
            var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            this.sandGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3);
        }

        var1 = this.treesPerChunk;

        if (this.randomGenerator.nextInt(10) == 0)
        {
            ++var1;
        }

        int var4;

        for (var2 = 0; var2 < var1; ++var2)
        {
            var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            WorldGenerator var5 = this.biome.getRandomWorldGenForTrees(this.randomGenerator);
            var5.setScale(1.0D, 1.0D, 1.0D);
            var5.generate(this.currentWorld, this.randomGenerator, var3, this.currentWorld.getHeightValue(var3, var4), var4);
        }

        for (var2 = 0; var2 < this.bigMushroomsPerChunk; ++var2)
        {
            var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, var3, this.currentWorld.getHeightValue(var3, var4), var4);
        }

        int var7;

        for (var2 = 0; var2 < this.flowersPerChunk; ++var2)
        {
            var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var4 = this.randomGenerator.nextInt(128);
            var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            this.plantYellowGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7);

            if (this.randomGenerator.nextInt(4) == 0)
            {
                var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
                var4 = this.randomGenerator.nextInt(128);
                var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
                this.plantRedGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7);
            }
        }

        for (var2 = 0; var2 < this.grassPerChunk; ++var2)
        {
            var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var4 = this.randomGenerator.nextInt(128);
            var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            WorldGenerator var6 = this.biome.getRandomWorldGenForGrass(this.randomGenerator);
            var6.generate(this.currentWorld, this.randomGenerator, var3, var4, var7);
        }

        for (var2 = 0; var2 < this.deadBushPerChunk; ++var2)
        {
            var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var4 = this.randomGenerator.nextInt(128);
            var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            (new WorldGenDeadBush(Block.deadBush.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7);
        }

        for (var2 = 0; var2 < this.waterlilyPerChunk; ++var2)
        {
            var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;

            for (var7 = this.randomGenerator.nextInt(128); var7 > 0 && this.currentWorld.getBlockId(var3, var7 - 1, var4) == 0; --var7)
            {
                ;
            }

            this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4);
        }

        for (var2 = 0; var2 < this.mushroomsPerChunk; ++var2)
        {
            if (this.randomGenerator.nextInt(4) == 0)
            {
                var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
                var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
                var7 = this.currentWorld.getHeightValue(var3, var4);
                this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4);
            }

            if (this.randomGenerator.nextInt( == 0)
            {
                var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
                var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
                var7 = this.randomGenerator.nextInt(128);
                this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4);
            }
        }

        if (this.randomGenerator.nextInt(4) == 0)
        {
            var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var3 = this.randomGenerator.nextInt(128);
            var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4);
        }

        if (this.randomGenerator.nextInt( == 0)
        {
            var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var3 = this.randomGenerator.nextInt(128);
            var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4);
        }

        for (var2 = 0; var2 < this.reedsPerChunk; ++var2)
        {
            var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            var7 = this.randomGenerator.nextInt(128);
            this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4);
        }

        for (var2 = 0; var2 < 10; ++var2)
        {
            var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var4 = this.randomGenerator.nextInt(128);
            var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7);
        }

        if (this.randomGenerator.nextInt(32) == 0)
        {
            var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var3 = this.randomGenerator.nextInt(128);
            var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, var2, var3, var4);
        }

        for (var2 = 0; var2 < this.cactiPerChunk; ++var2)
        {
            var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
            var4 = this.randomGenerator.nextInt(128);
            var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
            this.cactusGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7);
        }

        if (this.generateLakes)
        {
            for (var2 = 0; var2 < 50; ++var2)
            {
                var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
                var4 = this.randomGenerator.nextInt(this.randomGenerator.nextInt(120) + ;
                var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
                (new WorldGenLiquids(Block.waterMoving.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7);
            }

            for (var2 = 0; var2 < 20; ++var2)
            {
                var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
                var4 = this.randomGenerator.nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(112) +  + ;
                var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
                (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7);
            }
        }
    }

    /**
     * Standard ore generation helper. Generates most ores.
     */
    protected void genStandardOre1(int par1, WorldGenerator par2WorldGenerator, int par3, int par4)
    {
        for (int var5 = 0; var5 < par1; ++var5)
        {
            int var6 = this.chunk_X + this.randomGenerator.nextInt(16);
            int var7 = this.randomGenerator.nextInt(par4 - par3) + par3;
            int var8 = this.chunk_Z + this.randomGenerator.nextInt(16);
            par2WorldGenerator.generate(this.currentWorld, this.randomGenerator, var6, var7, var8);
        }
    }

    /**
     * Standard ore generation helper. Generates Lapis Lazuli.
     */
    protected void genStandardOre2(int par1, WorldGenerator par2WorldGenerator, int par3, int par4)
    {
        for (int var5 = 0; var5 < par1; ++var5)
        {
            int var6 = this.chunk_X + this.randomGenerator.nextInt(16);
            int var7 = this.randomGenerator.nextInt(par4) + this.randomGenerator.nextInt(par4) + (par3 - par4);
            int var8 = this.chunk_Z + this.randomGenerator.nextInt(16);
            par2WorldGenerator.generate(this.currentWorld, this.randomGenerator, var6, var7, var8);
        }
    }

    /**
     * Generates ores in the current chunk
     */
    protected void generateOres()
    {
        this.genStandardOre1(20, this.dirtGen, 0, 128);
        this.genStandardOre1(10, this.gravelGen, 0, 128);
        this.genStandardOre1(20, this.coalGen, 0, 128);
        this.genStandardOre1(20, this.ironGen, 0, 64);
        this.genStandardOre1(2, this.goldGen, 0, 32);
        this.genStandardOre1(8, this.redstoneGen, 0, 16);
        this.genStandardOre1(1, this.diamondGen, 0, 16);
        this.genStandardOre2(1, this.lapisGen, 16, 16);
    }
}

 

 

The Dimension itself worked fine when we were using WorldChunkManagerHell, its just that we wanted more biomes and ore gen and to do that we needed our own WorldChunkManager. PLEASE HELP!

Link to comment
Share on other sites

New to java-ish here so don't shoot me please but:

Would it be because your AC_BiomeGenBase is not considered a BiomeGenBase for when it is called from AC_ChunkProvider's biomesForGeneration field on line 92?

Which in turn calls AC_WorldChunkManager and returns the array of AC_BiomeGenBase(line 227) containing your two biomes FrostForest and FrostMountains where they are trying to be converted to a BiomeGenBase.

 

Probably a noob question but why couldn't you just add some biomes and set them not to spawn like BiomeGenHell(unless if you are in the nether of course). I'm not too familiar with creating a new biome, but I like messing around with world gen a bit too much.

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.



×
×
  • Create New...

Important Information

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