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

@ -16,6 +16,7 @@ import org.zeroturnaround.zip.commons.FileUtils;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
import java.util.UUID; import java.util.UUID;
@Data @Data
@ -308,16 +309,16 @@ public class ProjectManager
return cacheListing; return cacheListing;
} }
JSONArray a = new JSONArray(); JSONArray a;
if(cached) if(cached)
{ {
a = new JSONArray(Iris.getCached("cachedlisting", LISTING)); a = new JSONArray(Objects.requireNonNull(Iris.getCached("cachedlisting", LISTING)));
} }
else else
{ {
a = new JSONArray(Iris.getNonCached(!cached + "listing", LISTING)); a = new JSONArray(Iris.getNonCached(true + "listing", LISTING));
} }
KMap<String, String> l = new KMap<>(); KMap<String, String> l = new KMap<>();
@ -331,7 +332,7 @@ public class ProjectManager
l.put(v[0], v[1]); l.put(v[0], v[1]);
} }
catch(Throwable e) catch(Throwable ignored)
{ {
} }

View File

@ -150,7 +150,7 @@ public class WandManager implements Listener
{ {
try try
{ {
if(e.getHand().equals(EquipmentSlot.HAND) && isWand(e.getPlayer().getInventory().getItemInMainHand())) if(Objects.equals(e.getHand(), EquipmentSlot.HAND) && isWand(e.getPlayer().getInventory().getItemInMainHand()))
{ {
if(e.getAction().equals(Action.LEFT_CLICK_BLOCK)) if(e.getAction().equals(Action.LEFT_CLICK_BLOCK))
{ {

View File

@ -1,5 +1,6 @@
package com.volmit.iris.scaffold.stream; package com.volmit.iris.scaffold.stream;
import com.volmit.iris.Iris;
import com.volmit.iris.scaffold.hunk.Hunk; import com.volmit.iris.scaffold.hunk.Hunk;
import com.volmit.iris.scaffold.stream.arithmetic.*; import com.volmit.iris.scaffold.stream.arithmetic.*;
import com.volmit.iris.scaffold.stream.convert.*; 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) 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) 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 interface Interpolated<T>
{ {
public static final Interpolated<BlockData> BLOCK_DATA = of((t) -> 0D, (t) -> null); Interpolated<BlockData> BLOCK_DATA = of((t) -> 0D, (t) -> null);
public static final Interpolated<KList<CaveResult>> CAVE_RESULTS = of((t) -> 0D, (t) -> null); Interpolated<KList<CaveResult>> CAVE_RESULTS = of((t) -> 0D, (t) -> null);
public static final Interpolated<RNG> RNG = of((t) -> 0D, (t) -> null); Interpolated<RNG> RNG = of((t) -> 0D, (t) -> null);
public static final Interpolated<Double> DOUBLE = of((t) -> t, (t) -> t); Interpolated<Double> DOUBLE = of((t) -> t, (t) -> t);
public static final Interpolated<Integer> INT = of(Double::valueOf, Double::intValue); Interpolated<Integer> INT = of(Double::valueOf, Double::intValue);
public static final Interpolated<Long> LONG = of(Double::valueOf, Double::longValue); 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() default InterpolatorFactory<T> interpolate()
{ {
@ -31,7 +31,7 @@ public interface Interpolated<T>
return null; 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>() return new Interpolated<T>()
{ {