Search in sources :

Example 16 with Structure

use of ivorius.reccomplex.world.gen.feature.structure.Structure 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

Structure (ivorius.reccomplex.world.gen.feature.structure.Structure)16 RCConfig (ivorius.reccomplex.RCConfig)7 StructureRegistry (ivorius.reccomplex.world.gen.feature.structure.StructureRegistry)7 BlockPos (net.minecraft.util.math.BlockPos)7 BlockSurfacePos (ivorius.ivtoolkit.blocks.BlockSurfacePos)5 RecurrentComplex (ivorius.reccomplex.RecurrentComplex)5 Nullable (javax.annotation.Nullable)5 WorldServer (net.minecraft.world.WorldServer)5 Parameters (ivorius.mcopts.commands.parameters.Parameters)4 Collectors (java.util.stream.Collectors)4 ChunkPos (net.minecraft.util.math.ChunkPos)4 World (net.minecraft.world.World)4 Pair (org.apache.commons.lang3.tuple.Pair)4 AxisAlignedTransform2D (ivorius.ivtoolkit.math.AxisAlignedTransform2D)3 CommandExpecting (ivorius.mcopts.commands.CommandExpecting)3 Expect (ivorius.mcopts.commands.parameters.expect.Expect)3 RCP (ivorius.reccomplex.commands.parameters.RCP)3 GenericStructure (ivorius.reccomplex.world.gen.feature.structure.generic.GenericStructure)3 Nonnull (javax.annotation.Nonnull)3 CommandException (net.minecraft.command.CommandException)3