Package com.khorn.terraincontrol

Examples of com.khorn.terraincontrol.LocalMaterialData


            // Check position
            if (!world.isEmpty(cactusX, cactusBaseY, cactusZ))
                continue;

            // Check foundation
            LocalMaterialData foundationMaterial = world.getMaterial(cactusX, cactusBaseY - 1, cactusZ);
            if (!sourceBlocks.contains(foundationMaterial))
                continue;

            // Check neighbors
            if (!world.isEmpty(cactusX - 1, cactusBaseY, cactusZ))
View Full Code Here


                {
                    for (int local_y = i2 + 1; (!waterFound) && (local_y >= i1 - 1); local_y--)
                    {
                        if (local_y >= 0 && local_y < this.worldSettings.worldHeightCap)
                        {
                            LocalMaterialData material = generatingChunkBuffer.getBlock(local_x, local_y, local_z);
                            if (material.isMaterial(DefaultMaterial.WATER)
                                    || material.isMaterial(DefaultMaterial.STATIONARY_WATER))
                            {
                                waterFound = true;
                            }
                            if ((local_y != i1 - 1) && (local_x != m) && (local_x != n - 1) && (local_z != i3) && (local_z != i4 - 1))
                                local_y = i1;
                        }
                    }
                }
            }
            if (waterFound)
                continue;

            // Generate cave
            for (int local_x = m; local_x < n; local_x++)
            {
                double d9 = (local_x + generatingChunk.getBlockX() + 0.5D - x) / d3;
                for (int local_z = i3; local_z < i4; local_z++)
                {
                    LocalBiome biome = this.world.getBiome(local_x + generatingChunk.getBlockX(), local_z + generatingChunk.getBlockZ());
                    double d10 = (local_z + generatingChunk.getBlockZ() + 0.5D - z) / d3;

                    boolean grassFound = false;
                    if (d9 * d9 + d10 * d10 < 1.0D)
                    {
                        for (int local_y = i2; local_y > i1; local_y--)
                        {
                            double d11 = ((local_y - 1) + 0.5D - y) / d4;
                            if ((d11 > -0.7D) && (d9 * d9 + d11 * d11 + d10 * d10 < 1.0D))
                            {
                                LocalMaterialData material = generatingChunkBuffer.getBlock(local_x, local_y, local_z);
                                LocalMaterialData materialAbove = generatingChunkBuffer.getBlock(local_x, local_y + 1, local_z);
                                if (material.isMaterial(DefaultMaterial.GRASS) || material.isMaterial(DefaultMaterial.MYCEL))
                                    grassFound = true;
                                if (this.isSuitableBlock(material, materialAbove, biome))
                                {
                                    if (local_y - 1 < 10)
                                    {
                                        generatingChunkBuffer.setBlock(local_x, local_y, local_z, lava);
                                    } else
                                    {
                                        generatingChunkBuffer.setBlock(local_x, local_y, local_z, air);

                                        // Replace supporting sand with
                                        // sandstone. TODO: support red
                                        // sand(stone) in Minecraft 1.8
                                        if (materialAbove.isMaterial(DefaultMaterial.SAND) && materialAbove.getBlockData() == 0)
                                        {
                                            generatingChunkBuffer.setBlock(local_x, local_y + 1, local_z, sandstone);
                                        }

                                        // If grass was just deleted, try to
View Full Code Here

            return;

        int i = 0;
        int j = 0;

        LocalMaterialData tempBlock = world.getMaterial(x - 1, y, z);

        i = (sourceBlocks.contains(tempBlock)) ? i + 1 : i;
        j = (tempBlock.isAir()) ? j + 1 : j;

        tempBlock = world.getMaterial(x + 1, y, z);

        i = (sourceBlocks.contains(tempBlock)) ? i + 1 : i;
        j = (tempBlock.isAir()) ? j + 1 : j;

        tempBlock = world.getMaterial(x, y, z - 1);

        i = (sourceBlocks.contains(tempBlock)) ? i + 1 : i;
        j = (tempBlock.isAir()) ? j + 1 : j;

        tempBlock = world.getMaterial(x, y, z + 1);

        i = (sourceBlocks.contains(tempBlock)) ? i + 1 : i;
        j = (tempBlock.isAir()) ? j + 1 : j;

        if ((i == 3) && (j == 1))
        {
            world.setBlock(x, y, z, material);
        }
View Full Code Here

                    {
                        if (localY < 0)
                            continue;
                        if (localY < worldSettings.worldHeightCap)
                        {
                            LocalMaterialData materialAtPosition = generatingChunkBuffer.getBlock(localX, localY, localZ);
                            if (materialAtPosition.isMaterial(DefaultMaterial.WATER)
                                    || materialAtPosition.isMaterial(DefaultMaterial.STATIONARY_WATER))
                            {
                                i4 = 1;
                            }
                            if ((localY != maxY - 1) && (localZ != k) && (localZ != m - 1) && (localX != i2) && (localX != i3 - 1))
                                localY = maxY;
                        }
                    }
                }
            }
            if (i4 != 0)
            {
                continue;
            }
            for (int localZ = k; localZ < m; localZ++)
            {
                double d9 = (localZ + generatingChunk.getBlockX() + 0.5D - paramDouble1) / d3;
                for (int localX = i2; localX < i3; localX++)
                {
                    LocalBiome biome = world.getBiome(localX + generatingChunk.getBlockX(), localZ + generatingChunk.getBlockZ());
                    BiomeConfig biomeConfig = biome.getBiomeConfig();
                    double d10 = (localX + generatingChunk.getBlockZ() + 0.5D - paramDouble3) / d3;
                    boolean grassFound = false;
                    if (d9 * d9 + d10 * d10 < 1.0D)
                    {
                        for (int localY = minY; localY >= maxY; localY--)
                        {
                            double d11 = ((localY - 1) + 0.5D - paramDouble2) / d4;
                            if ((d9 * d9 + d10 * d10) * this.a[localY - 1] + d11 * d11 / 6.0D < 1.0D)
                            {
                                LocalMaterialData material = generatingChunkBuffer.getBlock(localX, localY, localZ);
                                if (material.isMaterial(DefaultMaterial.GRASS))
                                    grassFound = true;
                                if (material.equals(biomeConfig.stoneBlock) || material.isMaterial(DefaultMaterial.DIRT)
                                        || material.isMaterial(DefaultMaterial.GRASS))
                                {
                                    if (localY - 1 < 10)
                                    {
                                        generatingChunkBuffer.setBlock(localX, localY, localZ, lava);
                                    } else
View Full Code Here

    }

    public boolean canPlace(LocalWorld world, int x, int y, int z, int paramInt4)
    {
        LocalMaterialData sourceBlock;
        switch (paramInt4)
        {
            default:
                return false;
            case 1:
                sourceBlock = world.getMaterial(x, y + 1, z);
                break;
            case 2:
                sourceBlock = world.getMaterial(x, y, z + 1);
                break;
            case 3:
                sourceBlock = world.getMaterial(x, y, z - 1);
                break;
            case 5:
                sourceBlock = world.getMaterial(x - 1, y, z);
                break;
            case 4:
                sourceBlock = world.getMaterial(x + 1, y, z);
                break;
        }
        return sourceBlock.isSolid();
    }
View Full Code Here

            for (int xLake = (int) (xAdjusted - horizontalSize / 2.0D); xLake <= (int) (xAdjusted + horizontalSize / 2.0D); xLake++)
                for (int yLake = (int) (yAdjusted - verticalSize / 2.0D); yLake <= (int) (yAdjusted + verticalSize / 2.0D); yLake++)
                    for (int zLake = (int) (zAdjusted - horizontalSize / 2.0D); zLake <= (int) (zAdjusted + horizontalSize / 2.0D); zLake++)
                    {
                        LocalMaterialData material = world.getMaterial(xLake, yLake, zLake);
                        if (material.isAir() || material.isMaterial(DefaultMaterial.BEDROCK))
                        {
                            // Don't replace air or bedrock
                            continue;
                        }

                        double xBounds = (xLake + 0.5D - xAdjusted) / (horizontalSize / 2.0D);
                        double yBounds = (yLake + 0.5D - yAdjusted) / (verticalSize / 2.0D);
                        double zBounds = (zLake + 0.5D - zAdjusted) / (horizontalSize / 2.0D);
                        if (xBounds * xBounds + yBounds * yBounds + zBounds * zBounds >= 1.0D)
                            continue;
                        LocalMaterialData materialBelow = world.getMaterial(xLake, yLake - 1, zLake);
                        if (materialBelow.isAir())
                        {
                            // Air block, also set position above to air
                            world.setBlock(xLake, yLake, zLake, materialBelow);
                        } else
                        {
View Full Code Here

                int deltaZ = actualZ - z;
                if (deltaX * deltaX + deltaZ * deltaZ <= radius * radius)
                {
                    for (int deltaY = y - one; deltaY <= y + one; deltaY++)
                    {
                        LocalMaterialData localBlock = world.getMaterial(actualX, deltaY, actualZ);
                        if (this.sourceBlocks.contains(localBlock))
                        {
                            world.setBlock(actualX, deltaY, actualZ, this.material);
                        }
                    }
View Full Code Here

                {
                    float var14 = MathHelper.abs(var13) - 0.25F;

                    if ((var11 == 0 && var13 == 0 || var12 * var12 + var14 * var14 <= var9 * var9) && (var11 != -var10 && var11 != var10 && var13 != -var10 && var13 != var10 || random.nextFloat() <= 0.75F))
                    {
                        LocalMaterialData sourceBlock = par1World.getMaterial(x + var11, y + var8, z + var13);

                        if (sourceBlock.isAir() || sourceBlocks.contains(sourceBlock))
                        {
                            par1World.setBlock(x + var11, y + var8, z + var13, this.material);
                        }

                        if (var8 != 0 && var10 > 1)
                        {
                            sourceBlock = par1World.getMaterial(x + var11, y - var8, z + var13);

                            if (sourceBlock.isAir() || sourceBlocks.contains(sourceBlock))
                            {
                                par1World.setBlock(x + var11, y - var8, z + var13, this.material);
                            }
                        }
                    }
                }
            }
        }

        var8 = var7 - 1;

        if (var8 < 0)
        {
            var8 = 0;
        } else if (var8 > 1)
        {
            var8 = 1;
        }

        for (int var16 = -var8; var16 <= var8; ++var16)
        {
            var10 = -var8;

            while (var10 <= var8)
            {
                var11 = y - 1;
                int var17 = 50;

                if (Math.abs(var16) == 1 && Math.abs(var10) == 1)
                {
                    var17 = random.nextInt(5);
                }

                while (true)
                {
                    if (var11 > 50)
                    {
                        LocalMaterialData var18 = par1World.getMaterial(x + var16, var11, z + var10);

                        if (var18.isAir() || sourceBlocks.contains(var18) || var18.equals(this.material))
                        {
                            par1World.setBlock(x + var16, var11, z + var10, this.material);
                            --var11;
                            --var17;

View Full Code Here

    {
        // Basic checks
        if (world.isEmpty(x, y - 5, z) && (needsFoundation))
            return false;

        LocalMaterialData checkBlock = world.getMaterial(x, y + 2, z);
        if (!spawnWater)
        {
            if (checkBlock.equals(DefaultMaterial.WATER) || checkBlock.equals(DefaultMaterial.STATIONARY_WATER))
                return false;
        }
        if (!spawnLava)
        {
            if (checkBlock.equals(DefaultMaterial.LAVA) || checkBlock.equals(DefaultMaterial.STATIONARY_LAVA))
                return false;
        }

        int checkLight = world.getLightLevel(x, y + 2, z);
        if (!spawnSunlight)
View Full Code Here

        while (world.isEmpty(x, y, z) && y > minAltitude)
        {
            --y;
        }

        LocalMaterialData sourceBlock = world.getMaterial(x, y, z);

        if (!sourceBlocks.contains(sourceBlock))
        {
            return;
        }
View Full Code Here

TOP

Related Classes of com.khorn.terraincontrol.LocalMaterialData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.