Search in sources :

Example 1 with StructureRegistry

use of ivorius.reccomplex.world.gen.feature.structure.StructureRegistry in project RecurrentComplex by Ivorforce.

the class StaticGeneration method structuresAt.

public static Stream<Triple<Structure<?>, StaticGeneration, BlockSurfacePos>> structuresAt(StructureRegistry registry, ChunkPos chunkPos, final World world, final BlockPos spawnPos) {
    final Predicate<Pair<Structure<?>, StaticGeneration>> predicate = input -> {
        StaticGeneration info = input.getRight();
        return info.dimensionExpression.test(world.provider) && (info.pattern != null || Chunks.contains(chunkPos, info.getPos(spawnPos)));
    };
    Stream<Pair<Structure<?>, StaticGeneration>> statics = registry.getGenerationTypes(StaticGeneration.class).stream().filter(predicate);
    return statics.flatMap(pair -> {
        StaticGeneration info = pair.getRight();
        // noinspection ConstantConditions
        return info.hasPattern() ? Chunks.repeatIntersections(chunkPos, info.getPos(spawnPos), info.pattern.repeatX, info.pattern.repeatZ).map(pos -> Triple.of(pair.getLeft(), info, pos)) : Stream.of(Triple.of(pair.getLeft(), info, info.getPos(spawnPos)));
    });
}
Also used : IvTranslations(ivorius.ivtoolkit.tools.IvTranslations) Structure(ivorius.reccomplex.world.gen.feature.structure.Structure) DimensionExpression(ivorius.reccomplex.utils.expression.DimensionExpression) StructureRegistry(ivorius.reccomplex.world.gen.feature.structure.StructureRegistry) TableDataSource(ivorius.reccomplex.gui.table.datasource.TableDataSource) Chunks(ivorius.ivtoolkit.world.chunk.Chunks) MazeVisualizationContext(ivorius.reccomplex.client.rendering.MazeVisualizationContext) Pair(org.apache.commons.lang3.tuple.Pair) GenericPlacer(ivorius.reccomplex.world.gen.feature.structure.generic.placement.GenericPlacer) Side(net.minecraftforge.fml.relauncher.Side) Placer(ivorius.reccomplex.world.gen.feature.structure.Placer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Triple(org.apache.commons.lang3.tuple.Triple) Nonnull(javax.annotation.Nonnull) JsonUtils(ivorius.reccomplex.json.JsonUtils) Nullable(javax.annotation.Nullable) ExpressionCache(ivorius.reccomplex.utils.algebra.ExpressionCache) BlockSurfacePos(ivorius.ivtoolkit.blocks.BlockSurfacePos) World(net.minecraft.world.World) Predicate(java.util.function.Predicate) ChunkPos(net.minecraft.util.math.ChunkPos) BlockPos(net.minecraft.util.math.BlockPos) SerializedName(com.google.gson.annotations.SerializedName) TableDataSourceStaticGeneration(ivorius.reccomplex.gui.editstructure.gentypes.TableDataSourceStaticGeneration) SelectivePlacer(ivorius.reccomplex.world.gen.feature.structure.generic.placement.SelectivePlacer) TableNavigator(ivorius.reccomplex.gui.table.TableNavigator) Stream(java.util.stream.Stream) Type(java.lang.reflect.Type) TableDelegate(ivorius.reccomplex.gui.table.TableDelegate) com.google.gson(com.google.gson) TableDataSourceStaticGeneration(ivorius.reccomplex.gui.editstructure.gentypes.TableDataSourceStaticGeneration) Pair(org.apache.commons.lang3.tuple.Pair)

Aggregations

com.google.gson (com.google.gson)1 SerializedName (com.google.gson.annotations.SerializedName)1 BlockSurfacePos (ivorius.ivtoolkit.blocks.BlockSurfacePos)1 IvTranslations (ivorius.ivtoolkit.tools.IvTranslations)1 Chunks (ivorius.ivtoolkit.world.chunk.Chunks)1 MazeVisualizationContext (ivorius.reccomplex.client.rendering.MazeVisualizationContext)1 TableDataSourceStaticGeneration (ivorius.reccomplex.gui.editstructure.gentypes.TableDataSourceStaticGeneration)1 TableDelegate (ivorius.reccomplex.gui.table.TableDelegate)1 TableNavigator (ivorius.reccomplex.gui.table.TableNavigator)1 TableDataSource (ivorius.reccomplex.gui.table.datasource.TableDataSource)1 JsonUtils (ivorius.reccomplex.json.JsonUtils)1 ExpressionCache (ivorius.reccomplex.utils.algebra.ExpressionCache)1 DimensionExpression (ivorius.reccomplex.utils.expression.DimensionExpression)1 Placer (ivorius.reccomplex.world.gen.feature.structure.Placer)1 Structure (ivorius.reccomplex.world.gen.feature.structure.Structure)1 StructureRegistry (ivorius.reccomplex.world.gen.feature.structure.StructureRegistry)1 GenericPlacer (ivorius.reccomplex.world.gen.feature.structure.generic.placement.GenericPlacer)1 SelectivePlacer (ivorius.reccomplex.world.gen.feature.structure.generic.placement.SelectivePlacer)1 Type (java.lang.reflect.Type)1 Predicate (java.util.function.Predicate)1