mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Cave decorations
This commit is contained in:
parent
14029aa60f
commit
5e4136d9a1
@ -109,8 +109,16 @@ public class IrisComplex implements DataProvider
|
||||
-> engine.getDimension().getCaveBiomeStyle().create(rng.nextRNG()).stream()
|
||||
.zoom(r.getCaveBiomeZoom())
|
||||
.selectRarity(r.getCaveBiomes())
|
||||
.convertCached((s) -> data.getBiomeLoader().load(s)
|
||||
.setInferredType(InferredType.CAVE))
|
||||
.onNull("")
|
||||
.convertCached((s) -> {
|
||||
if(s.isEmpty())
|
||||
{
|
||||
return new IrisBiome();
|
||||
}
|
||||
|
||||
return data.getBiomeLoader().load(s)
|
||||
.setInferredType(InferredType.CAVE);
|
||||
})
|
||||
).convertAware2D(ProceduralStream::get).cache2D(cacheSize);
|
||||
landBiomeStream = regionStream.convert((r)
|
||||
-> engine.getDimension().getLandBiomeStyle().create(rng.nextRNG()).stream()
|
||||
|
@ -113,21 +113,18 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
|
||||
|
||||
for(CaveResult cl : caves)
|
||||
{
|
||||
if(cl.getFloor() < 0 || cl.getFloor() > 255 || cl.getCeiling() > 255 || cl.getCeiling() < 0)
|
||||
if(cl.getFloor() < 0 || cl.getFloor() > getEngine().getHeight() || cl.getCeiling() > getEngine().getHeight() || cl.getCeiling() < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
KList<BlockData> floor = cave.generateLayers(realX, realZ, rng, cl.getFloor() - 2, cl.getFloor() - 2, getData());
|
||||
KList<BlockData> ceiling = cave.generateLayers(realX + 656, realZ - 656, rng, (ch) - cl.getCeiling() - 2, (ch) - cl.getCeiling() - 2, getData());
|
||||
BlockData blockc = null;
|
||||
KList<BlockData> floor = cave.generateLayers(realX, realZ, rng, cl.getFloor(), cl.getFloor(), getData());
|
||||
KList<BlockData> ceiling = cave.generateLayers(realX + 656, realZ - 656, rng,
|
||||
(he) - cl.getCeiling(),
|
||||
(he) - cl.getCeiling(), getData());
|
||||
|
||||
for(int j = 0; j < floor.size(); j++)
|
||||
{
|
||||
if(j == 0)
|
||||
{
|
||||
blockc = floor.get(j);
|
||||
}
|
||||
|
||||
h.set(xf, cl.getFloor() - j, zf, floor.get(j));
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,7 @@ import com.volmit.iris.v2.scaffold.stream.arithmetic.*;
|
||||
import com.volmit.iris.v2.scaffold.stream.convert.*;
|
||||
import com.volmit.iris.v2.scaffold.stream.interpolation.Interpolated;
|
||||
import com.volmit.iris.v2.scaffold.stream.sources.FunctionStream;
|
||||
import com.volmit.iris.v2.scaffold.stream.utility.CachedStream2D;
|
||||
import com.volmit.iris.v2.scaffold.stream.utility.ProfiledStream;
|
||||
import com.volmit.iris.v2.scaffold.stream.utility.SemaphoreStream;
|
||||
import com.volmit.iris.v2.scaffold.stream.utility.SynchronizedStream;
|
||||
import com.volmit.iris.v2.scaffold.stream.utility.*;
|
||||
import com.volmit.iris.util.Function2;
|
||||
import com.volmit.iris.util.Function3;
|
||||
import com.volmit.iris.util.Function4;
|
||||
@ -55,6 +52,11 @@ public interface ProceduralStream<T> extends ProceduralLayer, Interpolated<T>
|
||||
return new ProfiledStream<>(this, memory);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> onNull(T v)
|
||||
{
|
||||
return new NullSafeStream<>(this, v);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> add(Function3<Double, Double, Double, Double> a)
|
||||
{
|
||||
return new AddingStream<>(this, a);
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.volmit.iris.v2.scaffold.stream.utility;
|
||||
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import com.volmit.iris.v2.scaffold.cache.Cache;
|
||||
import com.volmit.iris.v2.scaffold.stream.BasicStream;
|
||||
import com.volmit.iris.v2.scaffold.stream.ProceduralStream;
|
||||
|
||||
public class NullSafeStream<T> extends BasicStream<T> implements ProceduralStream<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final T ifNull;
|
||||
|
||||
public NullSafeStream(ProceduralStream<T> stream, T ifNull)
|
||||
{
|
||||
super();
|
||||
this.stream = stream;
|
||||
this.ifNull = ifNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
T t = stream.get(x, z);
|
||||
|
||||
if(t == null)
|
||||
{
|
||||
return ifNull;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
T t = stream.get(x, y, z);
|
||||
|
||||
if(t == null)
|
||||
{
|
||||
return ifNull;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user