mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-25 21:40:08 +00:00
calculate locator positions before application
This commit is contained in:
1 parent
b99085b49f
commit
f13d66d095
1 file changed
+7
-4
@@ -9,6 +9,7 @@ package com.dfsek.terra.api.structure.feature;
|
|||||||
|
|
||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
import java.util.function.IntConsumer;
|
import java.util.function.IntConsumer;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import com.dfsek.terra.api.util.Range;
|
import com.dfsek.terra.api.util.Range;
|
||||||
import com.dfsek.terra.api.util.function.IntToBooleanFunction;
|
import com.dfsek.terra.api.util.function.IntToBooleanFunction;
|
||||||
@@ -63,13 +64,15 @@ public class BinaryColumn {
|
|||||||
* @param consumer Action to perform
|
* @param consumer Action to perform
|
||||||
*/
|
*/
|
||||||
public void forEach(IntConsumer consumer) {
|
public void forEach(IntConsumer consumer) {
|
||||||
for(int y = minY; y < maxY; y++) {
|
for(int y : matching()) {
|
||||||
if(get(y)) {
|
consumer.accept(y);
|
||||||
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.
|
* 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.
|
* @param that Other binary column, must match this column's height.
|
||||||
|
|||||||
Reference in new issue
Block a user