use of org.spongepowered.math.vector.Vector3i 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.math.vector.Vector3i 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);
}
use of org.spongepowered.math.vector.Vector3i in project SpongeCommon by SpongePowered.
the class MutableMapBlockEntityArchetypeBuffer method removeBlockEntity.
@Override
public void removeBlockEntity(final int x, final int y, final int z) {
this.checkRange(x, y, z);
this.blockEntities.remove(new Vector3i(x, y, z));
}
use of org.spongepowered.math.vector.Vector3i in project SpongeCommon by SpongePowered.
the class MutableMapBlockEntityArchetypeBuffer method addBlockEntity.
@Override
public void addBlockEntity(final int x, final int y, final int z, final BlockEntity blockEntity) {
this.checkRange(x, y, z);
this.blockEntities.put(new Vector3i(x, y, z), Objects.requireNonNull(blockEntity, "BlockEntity cannot be null").createArchetype());
}
use of org.spongepowered.math.vector.Vector3i in project SpongeCommon by SpongePowered.
the class ReferentSchematicVolume method setRawData.
@Override
public void setRawData(final int x, final int y, final int z, final DataView container) throws InvalidDataException {
final Vector3i transformed = this.inverseTransform(x, y, z);
this.consumeReference(a -> a.setRawData(transformed, container));
}
Aggregations