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)));
});
}
Aggregations