Package com.khorn.terraincontrol

Examples of com.khorn.terraincontrol.LocalMaterialData


        {
            this.allSolidMaterials = true;
            return;
        }

        LocalMaterialData material = TerrainControl.readMaterial(input);

        boolean checkIncludesBlockData = StringHelper.specifiesBlockData(input);

        // Add to set
        add(new MaterialSetEntry(material, checkIncludesBlockData));
View Full Code Here


        }
    }

    protected void freezeChunk(ChunkCoordinate chunkCoord)
    {
        LocalMaterialData snowMaterial = TerrainControl.toLocalMaterialData(DefaultMaterial.SNOW, 0);
        int x = chunkCoord.getChunkX() * 16 + 8;
        int z = chunkCoord.getChunkZ() * 16 + 8;
        for (int i = 0; i < 16; i++)
        {
            for (int j = 0; j < 16; j++)
View Full Code Here

                            final double d17 = (d12 - d11) * oneFourth;
                            for (int piece_z = 0; piece_z < 4; piece_z++)
                            {
                                final BiomeConfig biomeConfig = toBiomeConfig(this.biomeArray[(z * 4 + piece_z) * 16 + (piece_x + x * 4)]);
                                final int waterLevelMax = this.waterLevel[(z * 4 + piece_z) * 16 + (piece_x + x * 4)] & 0xFF;
                                LocalMaterialData block = air;
                                if (y * 8 + piece_y < waterLevelMax && y * 8 + piece_y > biomeConfig.waterLevelMin)
                                {
                                    block = biomeConfig.waterBlock;
                                }

View Full Code Here

                    chunkBuffer.setBlock(x, this.heightCap - 2, z, worldConfig.bedrockBlock);
                }

                // Loop from map height to zero to place bedrock and surface
                // blocks
                LocalMaterialData currentSurfaceBlock = biomeConfig.surfaceBlock;
                LocalMaterialData currentGroundBlock = biomeConfig.groundBlock;
                int surfaceBlocksCount = -1;
                final int currentWaterLevel = this.waterLevel[z + x * 16];
                for (int y = CHUNK_Y_SIZE - 1; y >= 0; y--)
                {
                    if (y < 5 && (worldConfig.createAdminium(y)) && y <= this.random.nextInt(5))
                    {
                        // Place bottom bedrock
                        chunkBuffer.setBlock(x, y, z, worldConfig.bedrockBlock);
                    } else
                    {
                        // Surface blocks logic (grass, dirt, sand, sandstone)
                        final LocalMaterialData blockOnCurrentPos = chunkBuffer.getBlock(x, y, z);

                        if (blockOnCurrentPos.isAir())
                        {
                            // Reset when air is found
                            surfaceBlocksCount = -1;
                        } else if (blockOnCurrentPos.equals(biomeConfig.stoneBlock))
                        {
                            if (surfaceBlocksCount == -1)
                            {
                                // Set when variable was reset
                                if (surfaceBlocksNoise <= 0 && !worldConfig.removeSurfaceStone)
View Full Code Here

        for (ReplacedBlocksInstruction instruction : instructions)
        {
            int fromBlockId = instruction.getFrom().getBlockId();
            int minHeight = instruction.getMinHeight();
            int maxHeight = instruction.getMaxHeight();
            LocalMaterialData toBlock = instruction.getTo();

            if (compiledInstructions[fromBlockId] == null)
            {
                compiledInstructions[fromBlockId] = new LocalMaterialData[this.maxHeight + 1];
            }
View Full Code Here

        if (this.blockDataValuesArray == null)
        {
            this.initializeSmallByteArray(world.getSeed());
        }

        LocalMaterialData biomeSurfaceBlock = biomeConfig.surfaceBlock;
        LocalMaterialData biomeGroundBlock = biomeConfig.groundBlock;
        // The following line prevents grass growing on dirt, but still allows
        // the user to change the ground block to something else without us
        // changing the block data
        int biomeGroundBlockData = biomeGroundBlock.isMaterial(DefaultMaterial.DIRT) ? 1 : 0;

        // Check for river water
        boolean foundWater = false;
        int highestBlockY = world.getHighestBlockYAt(x, z) - 1;
        if (highestBlockY <= biomeConfig.riverWaterLevel)
        {
            foundWater = true;
        }

        // Bryce spike calculations
        double bryceHeight = 0.0D;
        if (this.isBryceMesa && !foundWater)
        {
            if (this.noiseGenBryce1 == null || this.noiseGenBryce2 == null)
            {
                Random newRandom = new Random(world.getSeed());

                this.noiseGenBryce1 = new NoiseGeneratorNewOctaves(newRandom, 4);
                this.noiseGenBryce2 = new NoiseGeneratorNewOctaves(newRandom, 1);
            }

            double bryceNoiseValue = Math.min(Math.abs(noise), this.noiseGenBryce1.a(x * 0.25D, z * 0.25D));

            if (bryceNoiseValue > 0.0D)
            {
                double d3 = 0.001953125D;
                double d4 = Math.abs(this.noiseGenBryce2.a(x * d3, z * d3));

                bryceHeight = bryceNoiseValue * bryceNoiseValue * 2.5D;
                double d5 = Math.ceil(d4 * 50.0D) + 14.0D;

                if (bryceHeight > d5)
                {
                    bryceHeight = d5;
                }

                bryceHeight += 64.0D;
            }
        }

        int waterLevel = biomeConfig.waterLevelMax;
        LocalMaterialData currentGroundBlock = whiteStainedClay;
        int noisePlusRandomFactor = (int) (noise / 3.0D + 3.0D + random.nextDouble() * 0.25D);
        boolean cosNoiseIsLargerThanZero = MathHelper.cos((float) (noise / 3.0D * Math.PI)) > 0.0D;
        int j1 = -1;
        boolean belowSand = false;

        int maxHeight = world.getSolidHeight(x, z) - 1;
        int minHeight = Math.min(maxHeight - 6, waterLevel - 4);

        // Max height needs to be increased for the bryce spikes
        if (this.isBryceMesa && !foundWater)
        {
            maxHeight = Math.max((int) bryceHeight, maxHeight);
        }

        for (int y = maxHeight; y >= minHeight; y--)
        {
            LocalMaterialData blockAtPosition = world.getMaterial(x, y, z);

            if (!blockAtPosition.isSolid() && y < bryceHeight)
            {
                // Lie about the current block to generate the Bryce spikes
                blockAtPosition = TerrainControl.toLocalMaterialData(DefaultMaterial.STONE, 0);
            }

            if (blockAtPosition.isAir())
            {
                j1 = -1;
            } else if (blockAtPosition.isSolid())
            {
                byte blockData;

                if (j1 == -1)
                {
View Full Code Here

        {
            // Passed Rarity test, place about Frequency grass in this chunk
            int centerX = chunkCoord.getBlockXCenter() + random.nextInt(ChunkCoordinate.CHUNK_X_SIZE);
            int centerZ = chunkCoord.getBlockZCenter() + random.nextInt(ChunkCoordinate.CHUNK_Z_SIZE);
            int centerY = world.getHighestBlockYAt(centerX, centerZ);
            LocalMaterialData id;

            // Fix y position
            while (((id = world.getMaterial(centerX, centerY, centerZ)).isAir() || id.isMaterial(DefaultMaterial.LEAVES) || id
                    .isMaterial(DefaultMaterial.LEAVES_2)) && (centerY > 0))
            {
                centerY--;
            }
            centerY++;
View Full Code Here

                continue;
            int x = chunkCoord.getBlockXCenter() + random.nextInt(ChunkCoordinate.CHUNK_X_SIZE);
            int z = chunkCoord.getBlockZCenter() + random.nextInt(ChunkCoordinate.CHUNK_Z_SIZE);
            int y = world.getHighestBlockYAt(x, z);

            LocalMaterialData material;
            while (((material = world.getMaterial(x, y, z)).isAir() || material.isMaterial(DefaultMaterial.LEAVES) || material
                    .isMaterial(DefaultMaterial.LEAVES_2)) && (y > 0))
                y--;

            if ((!world.isEmpty(x, y + 1, z)) || (!sourceBlocks.contains(world.getMaterial(x, y, z))))
                continue;
View Full Code Here

            for (String replacedBlock : values)
            {
                try
                {
                    LocalMaterialData fromId = TerrainControl.readMaterial(replacedBlock.split("=")[0]);
                    String rest = replacedBlock.split("=")[1];
                    LocalMaterialData to;
                    int minHeight = 0;
                    int maxHeight = worldConfig.worldHeightCap;

                    int start = rest.indexOf('(');
                    int end = rest.indexOf(')');
View Full Code Here

        }
       
        layerChoices = new ArrayList<LayerChoice>();
        for (int i = 0; i < args.length - 2; i += 3)
        {
            LocalMaterialData surfaceBlock = TerrainControl.readMaterial(args[i]);
            LocalMaterialData groundBlock = TerrainControl.readMaterial(args[i+1]);
            float maxNoise = (float) StringHelper.readDouble(args[i + 2], -20, 20);
            layerChoices.add(new LayerChoice(surfaceBlock, groundBlock, maxNoise));
        }
        Collections.sort(layerChoices);
    }
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.