net.minecraft.world.gen.layer.IntCache Java Examples

The following examples show how to use net.minecraft.world.gen.layer.IntCache. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenLayerBiomeEdge.java    From TofuCraftReload with MIT License 6 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int[] aint = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2);
    int[] aint1 = IntCache.getIntCache(par3 * par4);

    for (int i1 = 0; i1 < par4; ++i1)
    {
        for (int j1 = 0; j1 < par3; ++j1)
        {
            this.initChunkSeed((long)(j1 + par1), (long)(i1 + par2));
            int k1 = aint[j1 + 1 + (i1 + 1) * (par3 + 2)];

            if (!this.func_151636_a(aint, aint1, j1, i1, par3, k1, Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS), Biome.getIdForBiome(TofuBiomes.TOFU_HILLS_EDGE)))
            {
                aint1[j1 + i1 * par3] = k1;
            }
        }
    }

    return aint1;
}
 
Example #2
Source File: GenLayerRiverInit.java    From TofuCraftReload with MIT License 6 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int[] aint = this.parent.getInts(par1, par2, par3, par4);
    int[] aint1 = IntCache.getIntCache(par3 * par4);

    for (int i1 = 0; i1 < par4; ++i1)
    {
        for (int j1 = 0; j1 < par3; ++j1)
        {
            this.initChunkSeed((long)(j1 + par1), (long)(i1 + par2));
            aint1[j1 + i1 * par3] = aint[j1 + i1 * par3] > 0 ? this.nextInt(299999) + 2 : 0;
        }
    }

    return aint1;
}
 
Example #3
Source File: GenLayerRiverMix.java    From TofuCraftReload with MIT License 6 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int[] aint = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4);
    int[] aint1 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4);
    int[] aint2 = IntCache.getIntCache(par3 * par4);

    for (int i1 = 0; i1 < par3 * par4; ++i1)
    {
        if (aint1[i1] == Biome.getIdForBiome(TofuBiomes.TOFU_RIVER))
        {
            aint2[i1] = aint1[i1] & 255;
        }
        else
        {
            aint2[i1] = aint[i1];
        }
    }

    return aint2;
}
 
Example #4
Source File: GenLayerIsland.java    From TofuCraftReload with MIT License 6 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int[] aint = IntCache.getIntCache(par3 * par4);

    for (int i1 = 0; i1 < par4; ++i1)
    {
        for (int j1 = 0; j1 < par3; ++j1)
        {
            this.initChunkSeed((long)(par1 + j1), (long)(par2 + i1));
            aint[j1 + i1 * par3] = this.nextInt(10) == 0 ? 1 : 0;
        }
    }

    if (par1 > -par3 && par1 <= 0 && par2 > -par4 && par2 <= 0)
    {
        aint[-par1 + -par2 * par3] = 1;
    }

    return aint;
}
 
Example #5
Source File: GenLayerBiomePlanet.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 * @param properties 
 */
@Override
public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_)
{
	//int[] aint = this.parent.getInts(p_75904_1_, p_75904_2_, p_75904_3_, p_75904_4_);
	int[] aint1 = IntCache.getIntCache(p_75904_3_ * p_75904_4_);
	
	for (int i1 = 0; i1 < p_75904_4_; ++i1)
	{
		for (int j1 = 0; j1 < p_75904_3_; ++j1)
		{
			this.initChunkSeed((long)(j1 + p_75904_1_), (long)(i1 + p_75904_2_));
			
			aint1[j1 + i1 * p_75904_3_] = Biome.getIdForBiome(getWeightedBiomeEntry().biome);
		
		}
	}

	//TODO: DEBUG:
	//Arrays.fill(aint1, BiomeGenBase.desert.biomeID);
	
	return aint1;
}
 
Example #6
Source File: GenLayerEdge.java    From TofuCraftReload with MIT License 6 votes vote down vote up
private int[] getIntsSpecial(int p_151625_1_, int p_151625_2_, int p_151625_3_, int p_151625_4_)
{
    int[] aint = this.parent.getInts(p_151625_1_, p_151625_2_, p_151625_3_, p_151625_4_);
    int[] aint1 = IntCache.getIntCache(p_151625_3_ * p_151625_4_);

    for (int i1 = 0; i1 < p_151625_4_; ++i1)
    {
        for (int j1 = 0; j1 < p_151625_3_; ++j1)
        {
            this.initChunkSeed((long)(j1 + p_151625_1_), (long)(i1 + p_151625_2_));
            int k1 = aint[j1 + i1 * p_151625_3_];

            if (k1 != 0 && this.nextInt(13) == 0)
            {
                k1 |= 1 + this.nextInt(15) << 8 & 3840;
            }

            aint1[j1 + i1 * p_151625_3_] = k1;
        }
    }

    return aint1;
}
 
Example #7
Source File: GenLayerBiome.java    From TofuCraftReload with MIT License 6 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
    this.parent.getInts(par1, par2, par3, par4);
    int[] aint1 = IntCache.getIntCache(par3 * par4);

    for (int i1 = 0; i1 < par4; ++i1)
    {
        for (int j1 = 0; j1 < par3; ++j1)
        {
            this.initChunkSeed((j1 + par1), (i1 + par2));
            int idx = this.nextInt(this.allowedBiomes.length);
            aint1[j1 + i1 * par3] = Biome.getIdForBiome(this.allowedBiomes[idx]);
        }
    }

    return aint1;
}
 
Example #8
Source File: BiomeGeneratorImplementation.java    From malmo with MIT License 5 votes vote down vote up
@Override
public int[] getInts(int par1, int par2, int par3, int par4) {
	int[] aint2 = IntCache.getIntCache(par3 * par4);

	for (int i = 0; i < aint2.length; i++) {
		aint2[i] = value;
	}

	return aint2;
}
 
Example #9
Source File: BiomeProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * checks given Chunk's Biomes against List of allowed ones
 */
@Override
public boolean areBiomesViable(int x, int z, int radius, List<Biome> allowed) {
    IntCache.resetIntCache();
    int i = x - radius >> 2;
    int j = z - radius >> 2;
    int k = x + radius >> 2;
    int l = z + radius >> 2;
    int i1 = k - i + 1;
    int j1 = l - j + 1;
    int[] aint = this.genBiomes.getInts(i, j, i1, j1);

    try
    {
        for (int k1 = 0; k1 < i1 * j1; ++k1)
        {
            Biome biome = Biome.getBiome(aint[k1]);

            if (!allowed.contains(biome))
            {
                return false;
            }
        }

        return true;
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Layer");
        crashreportcategory.addCrashSection("Layer", this.genBiomes.toString());
        crashreportcategory.addCrashSection("x", Integer.valueOf(x));
        crashreportcategory.addCrashSection("z", Integer.valueOf(z));
        crashreportcategory.addCrashSection("radius", Integer.valueOf(radius));
        crashreportcategory.addCrashSection("allowed", allowed);
        throw new ReportedException(crashreport);
    }
}
 
Example #10
Source File: BiomeProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Gets a list of biomes for the specified blocks.
 */
@Override
public Biome[] getBiomes(@Nullable Biome[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) {
    IntCache.resetIntCache();

    if (listToReuse == null || listToReuse.length < width * length)
    {
        listToReuse = new Biome[width * length];
    }

    if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0)
    {
        Biome[] abiome = this.biomeCache.getCachedBiomes(x, z);
        System.arraycopy(abiome, 0, listToReuse, 0, width * length);
        return listToReuse;
    }
    else
    {
        int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);

        for (int i = 0; i < width * length; ++i)
        {
            listToReuse[i] = Biome.getBiome(aint[i], TofuBiomes.TOFU_RIVER);
        }

        return listToReuse;
    }
}
 
Example #11
Source File: BiomeProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Returns an array of biomes for the location input.
 */
@Override
public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, int height) {
    IntCache.resetIntCache();

    if (biomes == null || biomes.length < width * height)
    {
        biomes = new Biome[width * height];
    }

    int[] aint = this.genBiomes.getInts(x, z, width, height);

    try
    {
        for (int i = 0; i < width * height; ++i)
        {
            biomes[i] = Biome.getBiome(aint[i], TofuBiomes.TOFU_RIVER);
        }

        return biomes;
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock");
        crashreportcategory.addCrashSection("biomes[] size", Integer.valueOf(biomes.length));
        crashreportcategory.addCrashSection("x", Integer.valueOf(x));
        crashreportcategory.addCrashSection("z", Integer.valueOf(z));
        crashreportcategory.addCrashSection("w", Integer.valueOf(width));
        crashreportcategory.addCrashSection("h", Integer.valueOf(height));
        throw new ReportedException(crashreport);
    }
}
 
Example #12
Source File: GenLayerRiver.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int i1 = par1 - 1;
    int j1 = par2 - 1;
    int k1 = par3 + 2;
    int l1 = par4 + 2;
    int[] aint = this.parent.getInts(i1, j1, k1, l1);
    int[] aint1 = IntCache.getIntCache(par3 * par4);

    for (int i2 = 0; i2 < par4; ++i2)
    {
        for (int j2 = 0; j2 < par3; ++j2)
        {
            int k2 = this.func_151630_c(aint[j2 + 0 + (i2 + 1) * k1]);
            int l2 = this.func_151630_c(aint[j2 + 2 + (i2 + 1) * k1]);
            int i3 = this.func_151630_c(aint[j2 + 1 + (i2 + 0) * k1]);
            int j3 = this.func_151630_c(aint[j2 + 1 + (i2 + 2) * k1]);
            int k3 = this.func_151630_c(aint[j2 + 1 + (i2 + 1) * k1]);

            if (k3 == k2 && k3 == i3 && k3 == l2 && k3 == j3)
            {
                aint1[j2 + i2 * par3] = -1;
            }
            else
            {
                aint1[j2 + i2 * par3] = Biome.getIdForBiome(TofuBiomes.TOFU_RIVER);
            }
        }
    }

    return aint1;
}
 
Example #13
Source File: GenLayerEdge.java    From TofuCraftReload with MIT License 5 votes vote down vote up
private int[] getIntsHeatIce(int p_151624_1_, int p_151624_2_, int p_151624_3_, int p_151624_4_)
{
    int i1 = p_151624_1_ - 1;
    int j1 = p_151624_2_ - 1;
    int k1 = 1 + p_151624_3_ + 1;
    int l1 = 1 + p_151624_4_ + 1;
    int[] aint = this.parent.getInts(i1, j1, k1, l1);
    int[] aint1 = IntCache.getIntCache(p_151624_3_ * p_151624_4_);

    for (int i2 = 0; i2 < p_151624_4_; ++i2)
    {
        for (int j2 = 0; j2 < p_151624_3_; ++j2)
        {
            int k2 = aint[j2 + 1 + (i2 + 1) * k1];

            if (k2 == 4)
            {
                int l2 = aint[j2 + 1 + (i2 + 1 - 1) * k1];
                int i3 = aint[j2 + 1 + 1 + (i2 + 1) * k1];
                int j3 = aint[j2 + 1 - 1 + (i2 + 1) * k1];
                int k3 = aint[j2 + 1 + (i2 + 1 + 1) * k1];
                boolean flag = l2 == 2 || i3 == 2 || j3 == 2 || k3 == 2;
                boolean flag1 = l2 == 1 || i3 == 1 || j3 == 1 || k3 == 1;

                if (flag1 || flag)
                {
                    k2 = 3;
                }
            }

            aint1[j2 + i2 * p_151624_3_] = k2;
        }
    }

    return aint1;
}
 
Example #14
Source File: GenLayerEdge.java    From TofuCraftReload with MIT License 5 votes vote down vote up
private int[] getIntsCoolWarm(int p_151626_1_, int p_151626_2_, int p_151626_3_, int p_151626_4_)
{
    int i1 = p_151626_1_ - 1;
    int j1 = p_151626_2_ - 1;
    int k1 = 1 + p_151626_3_ + 1;
    int l1 = 1 + p_151626_4_ + 1;
    int[] aint = this.parent.getInts(i1, j1, k1, l1);
    int[] aint1 = IntCache.getIntCache(p_151626_3_ * p_151626_4_);

    for (int i2 = 0; i2 < p_151626_4_; ++i2)
    {
        for (int j2 = 0; j2 < p_151626_3_; ++j2)
        {
            this.initChunkSeed((long)(j2 + p_151626_1_), (long)(i2 + p_151626_2_));
            int k2 = aint[j2 + 1 + (i2 + 1) * k1];

            if (k2 == 1)
            {
                int l2 = aint[j2 + 1 + (i2 + 1 - 1) * k1];
                int i3 = aint[j2 + 1 + 1 + (i2 + 1) * k1];
                int j3 = aint[j2 + 1 - 1 + (i2 + 1) * k1];
                int k3 = aint[j2 + 1 + (i2 + 1 + 1) * k1];
                boolean flag = l2 == 3 || i3 == 3 || j3 == 3 || k3 == 3;
                boolean flag1 = l2 == 4 || i3 == 4 || j3 == 4 || k3 == 4;

                if (flag || flag1)
                {
                    k2 = 2;
                }
            }

            aint1[j2 + i2 * p_151626_3_] = k2;
        }
    }

    return aint1;
}
 
Example #15
Source File: GenLayerBiomesTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public int[] getInts(int x, int z, int width, int depth) {
    int[] dest = IntCache.getIntCache(width * depth);

    for (int dz = 0; dz < depth; dz++) {
        for (int dx = 0; dx < width; dx++) {
            this.initChunkSeed(dx + x, dz + z);
            dest[(dx + dz * width)] = Biome.getIdForBiome(this.allowedBiomes[nextInt(this.allowedBiomes.length)]);
        }
    }
    return dest;
}
 
Example #16
Source File: MutableGenLayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) {
    int[] biomes = IntCache.getIntCache(areaWidth * areaHeight);
    Arrays.fill(biomes, biome);
    return biomes;
}
 
Example #17
Source File: MutableGenLayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) {
    int[] biomes = IntCache.getIntCache(areaWidth * areaHeight);
    Arrays.fill(biomes, biome);
    return biomes;
}
 
Example #18
Source File: MutableGenLayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) {
    int[] biomes = IntCache.getIntCache(areaWidth * areaHeight);
    Arrays.fill(biomes, biome);
    return biomes;
}
 
Example #19
Source File: MutableGenLayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) {
    int[] biomes = IntCache.getIntCache(areaWidth * areaHeight);
    Arrays.fill(biomes, biome);
    return biomes;
}
 
Example #20
Source File: GenLayerVoronoiExtended.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_)
{
    p_75904_1_ -= 2;
    p_75904_2_ -= 2;
    int i1 = p_75904_1_ >> 2;
    int j1 = p_75904_2_ >> 2;
    int k1 = (p_75904_3_ >> 2) + 2;
    int l1 = (p_75904_4_ >> 2) + 2;
    int[] aint = this.parent.getInts(i1, j1, k1, l1);
    int i2 = k1 - 1 << 2;
    int j2 = l1 - 1 << 2;
    int[] aint1 = IntCache.getIntCache(i2 * j2);
    int l2;

    for (int k2 = 0; k2 < l1 - 1; ++k2)
    {
        l2 = 0;
        int i3 = aint[l2 + 0 + (k2 + 0) * k1];

        for (int j3 = aint[l2 + 0 + (k2 + 1) * k1]; l2 < k1 - 1; ++l2)
        {
            double d0 = 3.6D;
            this.initChunkSeed((long)(l2 + i1 << 2), (long)(k2 + j1 << 2));
            double d1 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
            double d2 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
            this.initChunkSeed((long)(l2 + i1 + 1 << 2), (long)(k2 + j1 << 2));
            double d3 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
            double d4 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
            this.initChunkSeed((long)(l2 + i1 << 2), (long)(k2 + j1 + 1 << 2));
            double d5 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
            double d6 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
            this.initChunkSeed((long)(l2 + i1 + 1 << 2), (long)(k2 + j1 + 1 << 2));
            double d7 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
            double d8 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
            int k3 = aint[l2 + 1 + (k2 + 0) * k1];
            int l3 = aint[l2 + 1 + (k2 + 1) * k1];

            for (int i4 = 0; i4 < 4; ++i4)
            {
                int j4 = ((k2 << 2) + i4) * i2 + (l2 << 2);

                for (int k4 = 0; k4 < 4; ++k4)
                {
                    double d9 = ((double)i4 - d2) * ((double)i4 - d2) + ((double)k4 - d1) * ((double)k4 - d1);
                    double d10 = ((double)i4 - d4) * ((double)i4 - d4) + ((double)k4 - d3) * ((double)k4 - d3);
                    double d11 = ((double)i4 - d6) * ((double)i4 - d6) + ((double)k4 - d5) * ((double)k4 - d5);
                    double d12 = ((double)i4 - d8) * ((double)i4 - d8) + ((double)k4 - d7) * ((double)k4 - d7);

                    if (d9 < d10 && d9 < d11 && d9 < d12)
                    {
                        aint1[j4++] = i3;
                    }
                    else if (d10 < d9 && d10 < d11 && d10 < d12)
                    {
                        aint1[j4++] = k3;
                    }
                    else if (d11 < d9 && d11 < d10 && d11 < d12)
                    {
                        aint1[j4++] = j3;
                    }
                    else
                    {
                        aint1[j4++] = l3;
                    }
                }
            }

            i3 = k3;
            j3 = l3;
        }
    }

    int[] aint2 = IntCache.getIntCache(p_75904_3_ * p_75904_4_);

    for (l2 = 0; l2 < p_75904_4_; ++l2)
    {
        System.arraycopy(aint1, (l2 + (p_75904_2_ & 3)) * i2 + (p_75904_1_ & 3), aint2, l2 * p_75904_3_, p_75904_3_);
    }

    return aint2;
}
 
Example #21
Source File: GenLayerAddIsland.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int i1 = par1 - 1;
    int j1 = par2 - 1;
    int k1 = par3 + 2;
    int l1 = par4 + 2;
    int[] aint = this.parent.getInts(i1, j1, k1, l1);
    int[] aint1 = IntCache.getIntCache(par3 * par4);

    for (int i2 = 0; i2 < par4; ++i2)
    {
        for (int j2 = 0; j2 < par3; ++j2)
        {
            int k2 = aint[j2 + 0 + (i2 + 0) * k1];
            int l2 = aint[j2 + 2 + (i2 + 0) * k1];
            int i3 = aint[j2 + 0 + (i2 + 2) * k1];
            int j3 = aint[j2 + 2 + (i2 + 2) * k1];
            int k3 = aint[j2 + 1 + (i2 + 1) * k1];
            this.initChunkSeed((j2 + par1), (i2 + par2));

            if (k3 == 0 && (k2 != 0 || l2 != 0 || i3 != 0 || j3 != 0))
            {
                int l3 = 1;
                int i4 = 1;

                if (k2 != 0 && this.nextInt(l3++) == 0)
                {
                    i4 = k2;
                }

                if (l2 != 0 && this.nextInt(l3++) == 0)
                {
                    i4 = l2;
                }

                if (i3 != 0 && this.nextInt(l3++) == 0)
                {
                    i4 = i3;
                }

                if (j3 != 0 && this.nextInt(l3++) == 0)
                {
                    i4 = j3;
                }

                if (this.nextInt(3) == 0)
                {
                    aint1[j2 + i2 * par3] = i4;
                }
                else if (i4 == Biome.getIdForBiome(Biomes.ICE_PLAINS))
                {
                    aint1[j2 + i2 * par3] = Biome.getIdForBiome(Biomes.FROZEN_OCEAN);
                }
                else
                {
                    aint1[j2 + i2 * par3] = 0;
                }
            }
            else if (k3 > 0 && (k2 == 0 || l2 == 0 || i3 == 0 || j3 == 0))
            {
                if (this.nextInt(5) == 0)
                {
                    if (k3 == Biome.getIdForBiome(Biomes.ICE_PLAINS))
                    {
                        aint1[j2 + i2 * par3] = Biome.getIdForBiome(Biomes.FROZEN_OCEAN);
                    }
                    else
                    {
                        aint1[j2 + i2 * par3] = 0;
                    }
                }
                else
                {
                    aint1[j2 + i2 * par3] = k3;
                }
            }
            else
            {
                aint1[j2 + i2 * par3] = k3;
            }
        }
    }

    return aint1;
}
 
Example #22
Source File: GenLayerHills.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int[] aint = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2);
    int[] aint1 = this.genLayer.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2);
    int[] aint2 = IntCache.getIntCache(par3 * par4);

    for (int i1 = 0; i1 < par4; ++i1)
    {
        for (int j1 = 0; j1 < par3; ++j1)
        {
            this.initChunkSeed((j1 + par1), (i1 + par2));
            int k1 = aint[j1 + 1 + (i1 + 1) * (par3 + 2)];
            int l1 = aint1[j1 + 1 + (i1 + 1) * (par3 + 2)];

            if (l1 >= 2 && (l1 - 2) % 29 == 1)
            {
                aint2[j1 + i1 * par3] = k1;
            }
            else if (this.nextInt(3) != 0)
            {
                aint2[j1 + i1 * par3] = k1;
            }
            else
            {
                int i2 = k1;
                int j2;

                if (k1 == Biome.getIdForBiome(TofuBiomes.TOFU_PLAINS))
                {
                    i2 = Biome.getIdForBiome(TofuBiomes.TOFU_PLAIN_HILLS);
                }
                else if (k1 == Biome.getIdForBiome(TofuBiomes.TOFU_FOREST))
                {
                    i2 = Biome.getIdForBiome(TofuBiomes.TOFU_FOREST_HILLS);
                }

                if (i2 == k1)
                {
                    aint2[j1 + i1 * par3] = k1;
                }
                else
                {
                    j2 = aint[j1 + 1 + (i1 + 1 - 1) * (par3 + 2)];
                    int k2 = aint[j1 + 1 + 1 + (i1 + 1) * (par3 + 2)];
                    int l2 = aint[j1 + 1 - 1 + (i1 + 1) * (par3 + 2)];
                    int i3 = aint[j1 + 1 + (i1 + 1 + 1) * (par3 + 2)];
                    int j3 = 0;

                    if (compareBiomesById(j2, k1))
                    {
                        ++j3;
                    }

                    if (compareBiomesById(k2, k1))
                    {
                        ++j3;
                    }

                    if (compareBiomesById(l2, k1))
                    {
                        ++j3;
                    }

                    if (compareBiomesById(i3, k1))
                    {
                        ++j3;
                    }

                    if (j3 >= 3)
                    {
                        aint2[j1 + i1 * par3] = i2;
                    }
                    else
                    {
                        aint2[j1 + i1 * par3] = k1;
                    }
                }
            }
        }
    }

    return aint2;
}
 
Example #23
Source File: GenLayerShore.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int[] aint = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2);
    int[] aint1 = IntCache.getIntCache(par3 * par4);

    for (int i1 = 0; i1 < par4; ++i1)
    {
        for (int j1 = 0; j1 < par3; ++j1)
        {
            this.initChunkSeed((j1 + par1), (i1 + par2));
            int k1 = aint[j1 + 1 + (i1 + 1) * (par3 + 2)];
            int l1;
            int i2;
            int j2;
            int k2;

            if (k1 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS))
            {
                l1 = aint[j1 + 1 + (i1 + 1 - 1) * (par3 + 2)];
                i2 = aint[j1 + 1 + 1 + (i1 + 1) * (par3 + 2)];
                j2 = aint[j1 + 1 - 1 + (i1 + 1) * (par3 + 2)];
                k2 = aint[j1 + 1 + (i1 + 1 + 1) * (par3 + 2)];

                if (l1 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS) && i2 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS) && j2 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS) && k2 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS))
                {
                    aint1[j1 + i1 * par3] = k1;
                }
                else
                {
                    aint1[j1 + i1 * par3] = Biome.getIdForBiome(TofuBiomes.TOFU_HILLS_EDGE);
                }
            }
            else
            {
                aint1[j1 + i1 * par3] = k1;
            }
        }
    }

    return aint1;
}
 
Example #24
Source File: GenLayerZoom.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int i1 = par1 >> 1;
    int j1 = par2 >> 1;
    int k1 = (par3 >> 1) + 2;
    int l1 = (par4 >> 1) + 2;
    int[] aint = this.parent.getInts(i1, j1, k1, l1);
    int i2 = k1 - 1 << 1;
    int j2 = l1 - 1 << 1;
    int[] aint1 = IntCache.getIntCache(i2 * j2);
    int l2;

    for (int k2 = 0; k2 < l1 - 1; ++k2)
    {
        l2 = (k2 << 1) * i2;
        int i3 = 0;
        int j3 = aint[i3 + 0 + (k2 + 0) * k1];

        for (int k3 = aint[i3 + 0 + (k2 + 1) * k1]; i3 < k1 - 1; ++i3)
        {
            this.initChunkSeed((long)(i3 + i1 << 1), (long)(k2 + j1 << 1));
            int l3 = aint[i3 + 1 + (k2 + 0) * k1];
            int i4 = aint[i3 + 1 + (k2 + 1) * k1];
            aint1[l2] = j3;
            aint1[l2++ + i2] = this.selectRandom(new int[]{j3, k3});
            aint1[l2] = this.selectRandom(new int[]{j3, l3});
            aint1[l2++ + i2] = this.selectModeOrRandom(j3, l3, k3, i4);
            j3 = l3;
            k3 = i4;
        }
    }

    int[] aint2 = IntCache.getIntCache(par3 * par4);

    for (l2 = 0; l2 < par4; ++l2)
    {
        System.arraycopy(aint1, (l2 + (par2 & 1)) * i2 + (par1 & 1), aint2, l2 * par3, par3);
    }

    return aint2;
}
 
Example #25
Source File: GenLayerSmooth.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int i1 = par1 - 1;
    int j1 = par2 - 1;
    int k1 = par3 + 2;
    int l1 = par4 + 2;
    int[] aint = this.parent.getInts(i1, j1, k1, l1);
    int[] aint1 = IntCache.getIntCache(par3 * par4);

    for (int i2 = 0; i2 < par4; ++i2)
    {
        for (int j2 = 0; j2 < par3; ++j2)
        {
            int k2 = aint[j2 + 0 + (i2 + 1) * k1];
            int l2 = aint[j2 + 2 + (i2 + 1) * k1];
            int i3 = aint[j2 + 1 + (i2 + 0) * k1];
            int j3 = aint[j2 + 1 + (i2 + 2) * k1];
            int k3 = aint[j2 + 1 + (i2 + 1) * k1];

            if (k2 == l2 && i3 == j3)
            {
                this.initChunkSeed((j2 + par1), (i2 + par2));

                if (this.nextInt(2) == 0)
                {
                    k3 = k2;
                }
                else
                {
                    k3 = i3;
                }
            }
            else
            {
                if (k2 == l2)
                {
                    k3 = k2;
                }

                if (i3 == j3)
                {
                    k3 = i3;
                }
            }

            aint1[j2 + i2 * par3] = k3;
        }
    }

    return aint1;
}
 
Example #26
Source File: GenLayerTofuVoronoiZoom.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or Biome ID's based on the particular GenLayer subclass.
 */
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
{
    areaX = areaX - 2;
    areaY = areaY - 2;
    int i = areaX >> 2;
    int j = areaY >> 2;
    int k = (areaWidth >> 2) + 2;
    int l = (areaHeight >> 2) + 2;
    int[] aint = this.parent.getInts(i, j, k, l);
    int i1 = k - 1 << 2;
    int j1 = l - 1 << 2;
    int[] aint1 = IntCache.getIntCache(i1 * j1);

    for (int k1 = 0; k1 < l - 1; ++k1)
    {
        int l1 = 0;
        int i2 = aint[l1 + 0 + (k1 + 0) * k];

        for (int j2 = aint[l1 + 0 + (k1 + 1) * k]; l1 < k - 1; ++l1)
        {
            this.initChunkSeed((long)(l1 + i << 2), (long)(k1 + j << 2));
            double d1 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
            double d2 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
            this.initChunkSeed((long)(l1 + i + 1 << 2), (long)(k1 + j << 2));
            double d3 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
            double d4 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
            this.initChunkSeed((long)(l1 + i << 2), (long)(k1 + j + 1 << 2));
            double d5 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
            double d6 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
            this.initChunkSeed((long)(l1 + i + 1 << 2), (long)(k1 + j + 1 << 2));
            double d7 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
            double d8 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
            int k2 = aint[l1 + 1 + (k1 + 0) * k] & 255;
            int l2 = aint[l1 + 1 + (k1 + 1) * k] & 255;

            for (int i3 = 0; i3 < 4; ++i3)
            {
                int j3 = ((k1 << 2) + i3) * i1 + (l1 << 2);

                for (int k3 = 0; k3 < 4; ++k3)
                {
                    double d9 = ((double)i3 - d2) * ((double)i3 - d2) + ((double)k3 - d1) * ((double)k3 - d1);
                    double d10 = ((double)i3 - d4) * ((double)i3 - d4) + ((double)k3 - d3) * ((double)k3 - d3);
                    double d11 = ((double)i3 - d6) * ((double)i3 - d6) + ((double)k3 - d5) * ((double)k3 - d5);
                    double d12 = ((double)i3 - d8) * ((double)i3 - d8) + ((double)k3 - d7) * ((double)k3 - d7);

                    if (d9 < d10 && d9 < d11 && d9 < d12)
                    {
                        aint1[j3++] = i2;
                    }
                    else if (d10 < d9 && d10 < d11 && d10 < d12)
                    {
                        aint1[j3++] = k2;
                    }
                    else if (d11 < d9 && d11 < d10 && d11 < d12)
                    {
                        aint1[j3++] = j2;
                    }
                    else
                    {
                        aint1[j3++] = l2;
                    }
                }
            }

            i2 = k2;
            j2 = l2;
        }
    }

    int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight);

    for (int l3 = 0; l3 < areaHeight; ++l3)
    {
        System.arraycopy(aint1, (l3 + (areaY & 3)) * i1 + (areaX & 3), aint2, l3 * areaWidth, areaWidth);
    }

    return aint2;
}