use of org.spongepowered.common.world.volume.SpongeVolumeStream in project SpongeCommon by SpongePowered.
the class SpongeArchetypeVolume method entityArchetypeStream.
@Override
public VolumeStream<ArchetypeVolume, EntityArchetype> entityArchetypeStream(final Vector3i min, final Vector3i max, final StreamOptions options) {
final Vector3i blockMin = this.min();
final Vector3i blockMax = this.max();
VolumeStreamUtils.validateStreamArgs(min, max, blockMin, blockMax, options);
final Stream<VolumeElement<ArchetypeVolume, EntityArchetype>> stateStream = this.entities.entityArchetypeStream(min, max, options).toStream().map(element -> VolumeElement.of(this, element::type, element.position()));
return new SpongeVolumeStream<>(stateStream, () -> this);
}
use of org.spongepowered.common.world.volume.SpongeVolumeStream in project SpongeCommon by SpongePowered.
the class SpongeArchetypeVolume method blockStateStream.
@Override
public VolumeStream<ArchetypeVolume, BlockState> blockStateStream(final Vector3i min, final Vector3i max, final StreamOptions options) {
final Vector3i blockMin = this.min();
final Vector3i blockMax = this.max();
VolumeStreamUtils.validateStreamArgs(min, max, blockMin, blockMax, options);
final ArrayMutableBlockBuffer buffer;
if (options.carbonCopy()) {
buffer = this.blocks.copy();
} else {
buffer = this.blocks;
}
final Stream<VolumeElement<ArchetypeVolume, BlockState>> stateStream = IntStream.range(min.x(), max.x() + 1).mapToObj(x -> IntStream.range(min.z(), max.z() + 1).mapToObj(z -> IntStream.range(min.y(), max.y() + 1).mapToObj(y -> VolumeElement.of((ArchetypeVolume) this, () -> buffer.block(x, y, z), new Vector3d(x, y, z)))).flatMap(Function.identity())).flatMap(Function.identity());
return new SpongeVolumeStream<>(stateStream, () -> this);
}
use of org.spongepowered.common.world.volume.SpongeVolumeStream in project SpongeCommon by SpongePowered.
the class SpongeArchetypeVolume method biomeStream.
@Override
public VolumeStream<ArchetypeVolume, Biome> biomeStream(final Vector3i min, final Vector3i max, final StreamOptions options) {
final Vector3i blockMin = this.min();
final Vector3i blockMax = this.max();
VolumeStreamUtils.validateStreamArgs(min, max, blockMin, blockMax, options);
final Stream<VolumeElement<ArchetypeVolume, Biome>> stateStream = this.biomes.biomeStream(min, max, options).toStream().map(element -> VolumeElement.of(this, element::type, element.position()));
return new SpongeVolumeStream<>(stateStream, () -> this);
}
Aggregations