fix(ecs-gestalt): Migrate Components to gestalt's Components. (#42)
Ref: MovingBlocks/Terasology#4753 Co-authored-by: Michael Pollind <mpollind@gmail.com> Co-authored-by: Tobias Nett <skaldarnar@googlemail.com>develop
parent
82c3bb2597
commit
52dbef90b7
|
@ -1,18 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 MovingBlocks
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2021 The Terasology Foundation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
package org.terasology.polyworld.flora;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
@ -24,7 +11,6 @@ import org.terasology.core.world.generator.facetProviders.PositionFilters;
|
|||
import org.terasology.core.world.generator.facetProviders.SurfaceObjectProvider;
|
||||
import org.terasology.core.world.generator.facets.FloraFacet;
|
||||
import org.terasology.core.world.generator.rasterizers.FloraType;
|
||||
import org.terasology.engine.entitySystem.Component;
|
||||
import org.terasology.engine.utilities.procedural.Noise;
|
||||
import org.terasology.engine.utilities.procedural.WhiteNoise;
|
||||
import org.terasology.engine.world.generation.ConfigurableFacetProvider;
|
||||
|
@ -35,6 +21,7 @@ import org.terasology.engine.world.generation.Produces;
|
|||
import org.terasology.engine.world.generation.Requires;
|
||||
import org.terasology.engine.world.generation.facets.SeaLevelFacet;
|
||||
import org.terasology.engine.world.generation.facets.SurfacesFacet;
|
||||
import org.terasology.gestalt.entitysystem.component.Component;
|
||||
import org.terasology.nui.properties.Range;
|
||||
import org.terasology.polyworld.biome.WhittakerBiome;
|
||||
import org.terasology.polyworld.biome.WhittakerBiomeFacet;
|
||||
|
@ -127,9 +114,13 @@ public class FloraProvider extends SurfaceObjectProvider<Biome, FloraType> imple
|
|||
this.configuration = (DensityConfiguration) configuration;
|
||||
}
|
||||
|
||||
private static class DensityConfiguration implements Component {
|
||||
private static class DensityConfiguration implements Component<DensityConfiguration> {
|
||||
@Range(min = 0, max = 1.0f, increment = 0.05f, precision = 2, description = "Define the overall flora density")
|
||||
private float density = 0.4f;
|
||||
|
||||
@Override
|
||||
public void copyFrom(DensityConfiguration other) {
|
||||
this.density = other.density;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 MovingBlocks
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2021 The Terasology Foundation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
package org.terasology.polyworld.flora;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
@ -23,7 +10,6 @@ import org.terasology.core.world.generator.facetProviders.SurfaceObjectProvider;
|
|||
import org.terasology.core.world.generator.facets.TreeFacet;
|
||||
import org.terasology.core.world.generator.trees.TreeGenerator;
|
||||
import org.terasology.core.world.generator.trees.Trees;
|
||||
import org.terasology.engine.entitySystem.Component;
|
||||
import org.terasology.engine.utilities.procedural.Noise;
|
||||
import org.terasology.engine.utilities.procedural.WhiteNoise;
|
||||
import org.terasology.engine.world.generation.Border3D;
|
||||
|
@ -35,6 +21,7 @@ import org.terasology.engine.world.generation.Produces;
|
|||
import org.terasology.engine.world.generation.Requires;
|
||||
import org.terasology.engine.world.generation.facets.SeaLevelFacet;
|
||||
import org.terasology.engine.world.generation.facets.SurfacesFacet;
|
||||
import org.terasology.gestalt.entitysystem.component.Component;
|
||||
import org.terasology.nui.properties.Range;
|
||||
import org.terasology.polyworld.biome.WhittakerBiome;
|
||||
import org.terasology.polyworld.biome.WhittakerBiomeFacet;
|
||||
|
@ -130,9 +117,13 @@ public class TreeProvider extends SurfaceObjectProvider<WhittakerBiome, TreeGene
|
|||
this.configuration = (TreeProviderConfiguration) configuration;
|
||||
}
|
||||
|
||||
private static class TreeProviderConfiguration implements Component {
|
||||
private static class TreeProviderConfiguration implements Component<TreeProviderConfiguration> {
|
||||
@Range(min = 0, max = 1.0f, increment = 0.05f, precision = 2, description = "Define the overall tree density")
|
||||
private float density = 0.4f;
|
||||
|
||||
@Override
|
||||
public void copyFrom(TreeProviderConfiguration other) {
|
||||
this.density = other.density;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
/*
|
||||
* Copyright 2014 MovingBlocks
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2021 The Terasology Foundation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package org.terasology.polyworld.graph;
|
||||
|
||||
|
@ -24,7 +11,6 @@ import com.google.common.math.DoubleMath;
|
|||
import org.joml.Vector2fc;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.terasology.engine.entitySystem.Component;
|
||||
import org.terasology.engine.utilities.random.FastRandom;
|
||||
import org.terasology.engine.utilities.random.Random;
|
||||
import org.terasology.engine.world.block.BlockArea;
|
||||
|
@ -35,6 +21,7 @@ import org.terasology.engine.world.generation.Facet;
|
|||
import org.terasology.engine.world.generation.GeneratingRegion;
|
||||
import org.terasology.engine.world.generation.Produces;
|
||||
import org.terasology.engine.world.generation.Requires;
|
||||
import org.terasology.gestalt.entitysystem.component.Component;
|
||||
import org.terasology.joml.geom.Rectanglef;
|
||||
import org.terasology.math.delaunay.Voronoi;
|
||||
import org.terasology.nui.properties.Range;
|
||||
|
@ -211,9 +198,14 @@ public class GraphFacetProvider implements ConfigurableFacetProvider {
|
|||
}
|
||||
}
|
||||
|
||||
private static class GraphProviderConfiguration implements Component {
|
||||
private static class GraphProviderConfiguration implements Component<GraphProviderConfiguration> {
|
||||
@Range(min = 0.1f, max = 10f, increment = 0.1f, precision = 1, description = "Define the density for graph " +
|
||||
"cells")
|
||||
private float graphDensity = 2f;
|
||||
|
||||
@Override
|
||||
public void copyFrom(GraphProviderConfiguration other) {
|
||||
this.graphDensity = other.graphDensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 MovingBlocks
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2021 The Terasology Foundation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package org.terasology.polyworld.rp;
|
||||
|
||||
|
@ -21,7 +8,6 @@ import com.google.common.cache.CacheLoader;
|
|||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.joml.Vector3i;
|
||||
import org.terasology.engine.entitySystem.Component;
|
||||
import org.terasology.engine.utilities.procedural.Noise;
|
||||
import org.terasology.engine.utilities.procedural.WhiteNoise;
|
||||
import org.terasology.engine.world.block.BlockArea;
|
||||
|
@ -32,6 +18,7 @@ import org.terasology.engine.world.generation.Border3D;
|
|||
import org.terasology.engine.world.generation.ConfigurableFacetProvider;
|
||||
import org.terasology.engine.world.generation.GeneratingRegion;
|
||||
import org.terasology.engine.world.generation.Produces;
|
||||
import org.terasology.gestalt.entitysystem.component.Component;
|
||||
import org.terasology.nui.properties.Range;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -163,12 +150,18 @@ public class WorldRegionFacetProvider implements ConfigurableFacetProvider {
|
|||
}
|
||||
}
|
||||
|
||||
private static class Configuration implements Component {
|
||||
private static class Configuration implements Component<Configuration> {
|
||||
|
||||
@Range(min = 50, max = 500f, increment = 10f, precision = 0, description = "Minimum size of a region")
|
||||
private int minSize = 100;
|
||||
|
||||
@Range(min = 0.1f, max = 1.0f, increment = 0.1f, precision = 1, description = "Define the ratio islands/water")
|
||||
private float islandDensity = 0.7f;
|
||||
|
||||
@Override
|
||||
public void copyFrom(Configuration other) {
|
||||
this.minSize = other.minSize;
|
||||
this.islandDensity = other.islandDensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue