mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-29 13:20:32 +00:00
add probability collection vector methods
This commit is contained in:
+15
@@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.util.collection;
|
package com.dfsek.terra.api.util.collection;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3;
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -52,6 +55,18 @@ public class ProbabilityCollection<E> implements Collection<E> {
|
|||||||
return (E) array[MathUtil.normalizeIndex(n.noise(seed, x, y, z), array.length)];
|
return (E) array[MathUtil.normalizeIndex(n.noise(seed, x, y, z), array.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public E get(NoiseSampler n, Vector3Int vector3Int, long seed) {
|
||||||
|
if(array.length == 0) return null;
|
||||||
|
return (E) array[MathUtil.normalizeIndex(n.noise(seed, vector3Int.getX(), vector3Int.getY(), vector3Int.getZ()), array.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public E get(NoiseSampler n, Vector3 vector3Int, long seed) {
|
||||||
|
if(array.length == 0) return null;
|
||||||
|
return (E) array[MathUtil.normalizeIndex(n.noise(seed, vector3Int.getX(), vector3Int.getY(), vector3Int.getZ()), array.length)];
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public E get(NoiseSampler n, double x, double z, long seed) {
|
public E get(NoiseSampler n, double x, double z, long seed) {
|
||||||
if(array.length == 0) return null;
|
if(array.length == 0) return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user