mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-02 07:55:28 +00:00
calculate locator positions before application
This commit is contained in:
parent
b99085b49f
commit
f13d66d095
@ -9,6 +9,7 @@ package com.dfsek.terra.api.structure.feature;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.IntConsumer;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
import com.dfsek.terra.api.util.function.IntToBooleanFunction;
|
||||
@ -63,13 +64,15 @@ public class BinaryColumn {
|
||||
* @param consumer Action to perform
|
||||
*/
|
||||
public void forEach(IntConsumer consumer) {
|
||||
for(int y = minY; y < maxY; y++) {
|
||||
if(get(y)) {
|
||||
consumer.accept(y);
|
||||
}
|
||||
for(int y : matching()) {
|
||||
consumer.accept(y);
|
||||
}
|
||||
}
|
||||
|
||||
public int[] matching() {
|
||||
return IntStream.range(minY, maxY).filter(this::get).toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link BinaryColumn} of equal height with a boolean AND operation applied to each height.
|
||||
* @param that Other binary column, must match this column's height.
|
||||
|
Loading…
x
Reference in New Issue
Block a user