Cleanup and prevent crash error

This commit is contained in:
CocoTheOwner
2021-03-09 20:36:05 +01:00
parent d15228656f
commit 34919ec961
4 changed files with 23 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
package com.volmit.iris.scaffold.stream;
import com.volmit.iris.Iris;
import com.volmit.iris.scaffold.hunk.Hunk;
import com.volmit.iris.scaffold.stream.arithmetic.*;
import com.volmit.iris.scaffold.stream.convert.*;
@@ -15,7 +16,13 @@ public interface ProceduralStream<T> extends ProceduralLayer, Interpolated<T>
{
public static ProceduralStream<Double> ofDouble(Function2<Double, Double, Double> f)
{
return of(f, Interpolated.DOUBLE);
try {
return of(f, Interpolated.DOUBLE);
} catch (IncompatibleClassChangeError e){
Iris.warn(f.toString());
e.printStackTrace();
return null;
}
}
public static ProceduralStream<Double> ofDouble(Function3<Double, Double, Double, Double> f)

View File

@@ -10,16 +10,16 @@ import java.util.function.Function;
public interface Interpolated<T>
{
public static final Interpolated<BlockData> BLOCK_DATA = of((t) -> 0D, (t) -> null);
public static final Interpolated<KList<CaveResult>> CAVE_RESULTS = of((t) -> 0D, (t) -> null);
public static final Interpolated<RNG> RNG = of((t) -> 0D, (t) -> null);
public static final Interpolated<Double> DOUBLE = of((t) -> t, (t) -> t);
public static final Interpolated<Integer> INT = of(Double::valueOf, Double::intValue);
public static final Interpolated<Long> LONG = of(Double::valueOf, Double::longValue);
Interpolated<BlockData> BLOCK_DATA = of((t) -> 0D, (t) -> null);
Interpolated<KList<CaveResult>> CAVE_RESULTS = of((t) -> 0D, (t) -> null);
Interpolated<RNG> RNG = of((t) -> 0D, (t) -> null);
Interpolated<Double> DOUBLE = of((t) -> t, (t) -> t);
Interpolated<Integer> INT = of(Double::valueOf, Double::intValue);
Interpolated<Long> LONG = of(Double::valueOf, Double::longValue);
public double toDouble(T t);
double toDouble(T t);
public T fromDouble(double d);
T fromDouble(double d);
default InterpolatorFactory<T> interpolate()
{
@@ -31,7 +31,7 @@ public interface Interpolated<T>
return null;
}
public static <T> Interpolated<T> of(Function<T, Double> a, Function<Double, T> b)
static <T> Interpolated<T> of(Function<T, Double> a, Function<Double, T> b)
{
return new Interpolated<T>()
{