Examples of PlantFacet


Examples of org.terasology.core.world.generator.facets.PlantFacet

        tallGrass = blockManager.getBlock("core:TallGrass1");
    }

    @Override
    public void generateChunk(CoreChunk chunk, Region chunkRegion) {
        PlantFacet facet = chunkRegion.getFacet(PlantFacet.class);
        SeaLevelFacet seaLevel = chunkRegion.getFacet(SeaLevelFacet.class);
        for (Vector3i pos : ChunkConstants.CHUNK_REGION) {
            if (pos.y + chunk.getChunkWorldOffsetY() > seaLevel.getSeaLevel() && facet.get(pos)) {
                chunk.setBlock(pos, tallGrass);
            }
        }
    }
View Full Code Here

Examples of org.terasology.core.world.generator.facets.PlantFacet

        noiseTable = new NoiseTable(seed);
    }

    @Override
    public void process(GeneratingRegion region) {
        PlantFacet facet = new PlantFacet(region.getRegion(), region.getBorderForFacet(PlantFacet.class));
        SurfaceHeightFacet surface = region.getRegionFacet(SurfaceHeightFacet.class);
        DensityFacet density = region.getRegionFacet(DensityFacet.class);
        BiomeFacet biomeFacet = region.getRegionFacet(BiomeFacet.class);

        int minY = facet.getWorldRegion().minY();
        int maxY = facet.getWorldRegion().maxY();
        for (int z = facet.getRelativeRegion().minZ(); z <= facet.getRelativeRegion().maxZ(); ++z) {
            for (int x = facet.getRelativeRegion().minX(); x <= facet.getRelativeRegion().maxX(); ++x) {
                int height = TeraMath.floorToInt(surface.get(x, z));
                if (height >= minY && height < maxY) {
                    CoreBiome biome = biomeFacet.get(x, z);
                    height = height - minY + facet.getRelativeRegion().minY();

                    if ((biome == CoreBiome.FOREST || biome == CoreBiome.PLAINS) && density.get(x, height, z) > 0
                            && density.get(x, height + 1, z) <= 0 && noiseTable.noise(x, z) < configuration.density) {
                        facet.set(x, height + 1, z, true);
                    }
                }
            }
        }
        region.setRegionFacet(PlantFacet.class, facet);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.