Search in sources :

Example 1 with Border3D

use of org.terasology.engine.world.generation.Border3D in project Terasology by MovingBlocks.

the class LayeredZoneRegionFunctionTest method setup.

@BeforeEach
public void setup() {
    parent.addZone(new Zone("Medium sky", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), MEDIUM_SKY))).addZone(new Zone("Low sky", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), LOW_SKY))).addZone(new Zone("Above ground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), ABOVE_GROUND))).addZone(new Zone("Ground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), GROUND))).addZone(new Zone("Shallow underground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), SHALLOW_UNDERGROUND))).addZone(new Zone("Medium underground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), MEDIUM_UNDERGROUND)));
    parent.setSeed(12345);
    parent.initialize();
    ListMultimap<Class<? extends WorldFacet>, FacetProvider> facetProviderChains = ArrayListMultimap.create();
    facetProviderChains.put(ElevationFacet.class, (generatingRegion) -> {
        ElevationFacet facet = new ElevationFacet(generatingRegion.getRegion(), generatingRegion.getBorderForFacet(ElevationFacet.class));
        for (Vector2ic pos : facet.getRelativeArea()) {
            facet.set(pos, 100);
        }
        generatingRegion.setRegionFacet(ElevationFacet.class, facet);
    });
    Map<Class<? extends WorldFacet>, Border3D> borders = new HashMap<>();
    borders.put(ElevationFacet.class, new Border3D(0, 0, 0));
    region = new RegionImpl(new BlockRegion(0, 0, 0).expand(4, 4, 4), facetProviderChains, borders, 1);
}
Also used : HashMap(java.util.HashMap) Zone(org.terasology.engine.world.zones.Zone) FacetProvider(org.terasology.engine.world.generation.FacetProvider) Border3D(org.terasology.engine.world.generation.Border3D) MinMaxLayerThickness(org.terasology.engine.world.zones.MinMaxLayerThickness) LayeredZoneRegionFunction(org.terasology.engine.world.zones.LayeredZoneRegionFunction) ElevationFacet(org.terasology.engine.world.generation.facets.ElevationFacet) WorldFacet(org.terasology.engine.world.generation.WorldFacet) Vector2ic(org.joml.Vector2ic) BlockRegion(org.terasology.engine.world.block.BlockRegion) RegionImpl(org.terasology.engine.world.generation.RegionImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with Border3D

use of org.terasology.engine.world.generation.Border3D in project Terasology by MovingBlocks.

the class BooleanFacetTest method setup.

@BeforeEach
public void setup() {
    Border3D border = new Border3D(0, 0, 0).extendBy(0, 15, 10);
    Vector3i min = new Vector3i(10, 20, 30);
    Vector3i size = new Vector3i(40, 50, 60);
    BlockRegion region = new BlockRegion(min).setSize(size);
    facet = createFacet(region, border);
// facet = [worldMin=(0, 5, 20), relativeMin=(-10, -15, -10), size=(60, 65, 80)]
}
Also used : Border3D(org.terasology.engine.world.generation.Border3D) Vector3i(org.joml.Vector3i) BlockRegion(org.terasology.engine.world.block.BlockRegion) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with Border3D

use of org.terasology.engine.world.generation.Border3D in project Terasology by MovingBlocks.

the class ObjectFacetTest method setup.

@BeforeEach
public void setup() {
    Border3D border = new Border3D(0, 0, 0).extendBy(0, 15, 10);
    Vector3i min = new Vector3i(10, 20, 30);
    Vector3i size = new Vector3i(40, 50, 60);
    BlockRegion region = new BlockRegion(min).setSize(size);
    facet = createFacet(region, border);
// facet = [worldMin=(0, 5, 20), relativeMin=(-10, -15, -10), size=(60, 65, 80)]
}
Also used : Border3D(org.terasology.engine.world.generation.Border3D) Vector3i(org.joml.Vector3i) BlockRegion(org.terasology.engine.world.block.BlockRegion) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with Border3D

use of org.terasology.engine.world.generation.Border3D in project Terasology by MovingBlocks.

the class FieldFacetTest method setup.

@BeforeEach
public void setup() {
    Border3D border = new Border3D(0, 0, 0).extendBy(0, 15, 10);
    Vector3i min = new Vector3i(10, 20, 30);
    Vector3i size = new Vector3i(40, 50, 60);
    BlockRegion region = new BlockRegion(min).setSize(size);
    facet = createFacet(region, border);
// facet = [worldMin=(0, 5, 20), relativeMin=(-10, -15, -10), size=(60, 65, 80)]
}
Also used : Border3D(org.terasology.engine.world.generation.Border3D) Vector3i(org.joml.Vector3i) BlockRegion(org.terasology.engine.world.block.BlockRegion) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

BeforeEach (org.junit.jupiter.api.BeforeEach)4 BlockRegion (org.terasology.engine.world.block.BlockRegion)4 Border3D (org.terasology.engine.world.generation.Border3D)4 Vector3i (org.joml.Vector3i)3 HashMap (java.util.HashMap)1 Vector2ic (org.joml.Vector2ic)1 FacetProvider (org.terasology.engine.world.generation.FacetProvider)1 RegionImpl (org.terasology.engine.world.generation.RegionImpl)1 WorldFacet (org.terasology.engine.world.generation.WorldFacet)1 ElevationFacet (org.terasology.engine.world.generation.facets.ElevationFacet)1 LayeredZoneRegionFunction (org.terasology.engine.world.zones.LayeredZoneRegionFunction)1 MinMaxLayerThickness (org.terasology.engine.world.zones.MinMaxLayerThickness)1 Zone (org.terasology.engine.world.zones.Zone)1