mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 14:50:57 +00:00
Schema system
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({PARAMETER, TYPE, FIELD})
|
||||
public @interface ArrayType
|
||||
{
|
||||
Class<?> type();
|
||||
|
||||
int min() default 0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({FIELD})
|
||||
public @interface MaxNumber
|
||||
{
|
||||
double value();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({FIELD})
|
||||
public @interface MinNumber
|
||||
{
|
||||
double value();
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public class RNG extends Random
|
||||
private static final long serialVersionUID = 5222938581174415179L;
|
||||
public static final RNG r = new RNG();
|
||||
private final long sx;
|
||||
|
||||
public RNG()
|
||||
{
|
||||
super();
|
||||
@@ -32,12 +33,12 @@ public class RNG extends Random
|
||||
{
|
||||
this(UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).getLeastSignificantBits() + UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).getMostSignificantBits() + (seed.length() * 32564));
|
||||
}
|
||||
|
||||
|
||||
public RNG nextParallelRNG(int signature)
|
||||
{
|
||||
return new RNG(sx + signature);
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public RNG nextRNG()
|
||||
{
|
||||
@@ -116,7 +117,7 @@ public class RNG extends Random
|
||||
|
||||
public double d(double lowerBound, double upperBound)
|
||||
{
|
||||
return lowerBound + (nextDouble() * ((upperBound - lowerBound)));
|
||||
return M.lerp(lowerBound, upperBound, nextDouble());
|
||||
}
|
||||
|
||||
public double d(double upperBound)
|
||||
@@ -136,7 +137,7 @@ public class RNG extends Random
|
||||
|
||||
public int i(int upperBound)
|
||||
{
|
||||
return i(0, upperBound);
|
||||
return i(Math.min(upperBound, 0), Math.max(0, upperBound));
|
||||
}
|
||||
|
||||
public long l(long lowerBound, long upperBound)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({PARAMETER, TYPE, FIELD})
|
||||
public @interface Required
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user