mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-12 02:36:18 +00:00
create Noise3DLocator
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.dfsek.terra.addons.feature.locator.locators;
|
||||
|
||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||
import com.dfsek.terra.api.structure.feature.BinaryColumn;
|
||||
import com.dfsek.terra.api.structure.feature.Locator;
|
||||
import com.dfsek.terra.api.world.Column;
|
||||
|
||||
|
||||
public class Noise3DLocator implements Locator {
|
||||
private final NoiseSampler sampler;
|
||||
|
||||
public Noise3DLocator(NoiseSampler sampler) {
|
||||
this.sampler = sampler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryColumn getSuitableCoordinates(Column column) {
|
||||
BinaryColumn results = column.newBinaryColumn();
|
||||
long seed = column.getWorld().getSeed();
|
||||
int x = column.getX();
|
||||
int z = column.getZ();
|
||||
column.forEach(y -> {
|
||||
if(sampler.getNoiseSeeded(seed, x, y, z) > 0) results.set(y);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user