mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-02 16:07:06 +00:00
f
This commit is contained in:
parent
fa99b967ed
commit
14029aa60f
3
.gitignore
vendored
3
.gitignore
vendored
@ -12,4 +12,5 @@ lint/out.jar
|
||||
|
||||
lint/mapping.txt
|
||||
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
.idea/
|
||||
|
@ -42,6 +42,8 @@ public class IrisComplex implements DataProvider
|
||||
private ProceduralStream<RNG> chunkRngStream;
|
||||
private ProceduralStream<IrisDecorator> terrainSurfaceDecoration;
|
||||
private ProceduralStream<IrisDecorator> terrainCeilingDecoration;
|
||||
private ProceduralStream<IrisDecorator> terrainCaveSurfaceDecoration;
|
||||
private ProceduralStream<IrisDecorator> terrainCaveCeilingDecoration;
|
||||
private ProceduralStream<IrisDecorator> seaSurfaceDecoration;
|
||||
private ProceduralStream<IrisDecorator> shoreSurfaceDecoration;
|
||||
private ProceduralStream<BlockData> rockStream;
|
||||
@ -149,9 +151,13 @@ public class IrisComplex implements DataProvider
|
||||
heightFluidStream = heightStream.max(fluidHeight).cache2D(cacheSize);
|
||||
maxHeightStream = ProceduralStream.ofDouble((x, z) -> height);
|
||||
terrainSurfaceDecoration = trueBiomeStream
|
||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.NONE));
|
||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.NONE));
|
||||
terrainCeilingDecoration = trueBiomeStream
|
||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.CEILING));
|
||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.CEILING));
|
||||
terrainCaveSurfaceDecoration = caveBiomeStream
|
||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.NONE));
|
||||
terrainCaveCeilingDecoration = caveBiomeStream
|
||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.CEILING));
|
||||
shoreSurfaceDecoration = trueBiomeStream
|
||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SHORE_LINE));
|
||||
seaSurfaceDecoration = trueBiomeStream
|
||||
|
@ -41,7 +41,6 @@ public class IrisEngine implements Engine
|
||||
() -> getFramework().getEngineParallax().generateParallaxArea(x, z),
|
||||
() -> Hunk.computeDual2D(getParallelism(), blocks, biomes, (xx,yy,zz,ha,hb) -> {
|
||||
getFramework().getTerrainActuator().actuate(x+xx, z+zz, ha);
|
||||
getFramework().getCaveModifier().modify(x, z, ha);
|
||||
getFramework().getDecorantActuator().actuate(x+xx, z+zz, ha);
|
||||
getFramework().getBiomeActuator().actuate(x+xx, z+zz, hb);
|
||||
})
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.volmit.iris.v2.generator.actuator;
|
||||
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.v2.scaffold.engine.Engine;
|
||||
import com.volmit.iris.v2.scaffold.engine.EngineAssignedActuator;
|
||||
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
||||
@ -85,34 +86,78 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData>
|
||||
return;
|
||||
}
|
||||
|
||||
IrisDecorator deco = getComplex().getTerrainSurfaceDecoration().get(realX, realZ);
|
||||
|
||||
if(deco != null)
|
||||
if(surface)
|
||||
{
|
||||
if(deco.isStacking())
|
||||
{
|
||||
int stack = Math.min(g.i(deco.getStackMin(), deco.getStackMax()), height);
|
||||
IrisDecorator deco = getComplex().getTerrainSurfaceDecoration().get(realX, realZ);
|
||||
|
||||
for(int i = 0; i < stack; i++)
|
||||
if(deco != null)
|
||||
{
|
||||
if(deco.isStacking())
|
||||
{
|
||||
h.set(hunkRelativeX, i + floor, hunkRelativeZ, deco.getBlockData100(b, rng, realX - i, realZ + i, getData()));
|
||||
int stack = Math.min(g.i(deco.getStackMin(), deco.getStackMax()), height);
|
||||
|
||||
for(int i = 0; i < stack; i++)
|
||||
{
|
||||
h.set(hunkRelativeX, i + floor, hunkRelativeZ, deco.getBlockData100(b, rng, realX - i, realZ + i, getData()));
|
||||
}
|
||||
|
||||
if(deco.getTopPalette().isNotEmpty())
|
||||
{
|
||||
h.set(hunkRelativeX, stack + floor - 1, hunkRelativeZ, deco.getBlockDataForTop(b, rng, realX - stack, realZ + stack, getData()));
|
||||
}
|
||||
}
|
||||
|
||||
if(deco.getTopPalette().isNotEmpty())
|
||||
else
|
||||
{
|
||||
h.set(hunkRelativeX, stack + floor - 1, hunkRelativeZ, deco.getBlockDataForTop(b, rng, realX - stack, realZ + stack, getData()));
|
||||
h.set(hunkRelativeX, floor, hunkRelativeZ, deco.getBlockData100(b, rng, realX, realZ, getData()));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
h.set(hunkRelativeX, floor, hunkRelativeZ, deco.getBlockData100(b, rng, realX, realZ, getData()));
|
||||
}
|
||||
}
|
||||
|
||||
if(!surface)
|
||||
else
|
||||
{
|
||||
IrisDecorator cdeco = getComplex().getTerrainCeilingDecoration().get(realX, realZ);
|
||||
IrisBiome cave = getComplex().getCaveBiomeStream().get(realX, realZ);
|
||||
IrisDecorator deco = getComplex().getTerrainCaveSurfaceDecoration().get(realX, realZ);
|
||||
|
||||
if(deco != null)
|
||||
{
|
||||
if(deco.isStacking())
|
||||
{
|
||||
int stack = Math.min(g.i(deco.getStackMin(), deco.getStackMax()), height);
|
||||
|
||||
for(int i = 0; i < stack; i++)
|
||||
{
|
||||
h.set(hunkRelativeX, i + floor, hunkRelativeZ, deco.getBlockData100(b, rng, realX - i, realZ + i, getData()));
|
||||
}
|
||||
|
||||
if(deco.getTopPalette().isNotEmpty())
|
||||
{
|
||||
h.set(hunkRelativeX, stack + floor - 1, hunkRelativeZ, deco.getBlockDataForTop(b, rng, realX - stack, realZ + stack, getData()));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
h.set(hunkRelativeX, floor, hunkRelativeZ, deco.getBlockData100(b, rng, realX, realZ, getData()));
|
||||
}
|
||||
}
|
||||
|
||||
int maxCeiling = lastBottom - top - 1;
|
||||
|
||||
if(maxCeiling > 0)
|
||||
{
|
||||
KList<BlockData> v = cave.generateLayers(realX, realZ, rng, maxCeiling, top, getData());
|
||||
|
||||
if(!v.isEmpty())
|
||||
{
|
||||
for(int i = 0; i < v.size(); i++)
|
||||
{
|
||||
h.set(hunkRelativeX, top+i, hunkRelativeZ, v.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IrisDecorator cdeco = getComplex().getTerrainCaveCeilingDecoration().get(realX, realZ);
|
||||
|
||||
if(cdeco != null)
|
||||
{
|
||||
@ -136,6 +181,33 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData>
|
||||
h.set(hunkRelativeX, ceiling, hunkRelativeZ, cdeco.getBlockData100(b, rng, realX, realZ, getData()));
|
||||
}
|
||||
}
|
||||
|
||||
int maxFloor = Math.min(8, bottom-1);
|
||||
|
||||
KList<BlockData> v = cave.generateLayers(realX, realZ, rng, maxFloor, bottom, getData());
|
||||
|
||||
if(!v.isEmpty())
|
||||
{
|
||||
for(int i = 0; i < v.size(); i++)
|
||||
{
|
||||
if(bottom-i < 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
BlockData bk = h.get(hunkRelativeX, bottom-i, hunkRelativeZ);
|
||||
|
||||
if(PREDICATE_SOLID.test(bk))
|
||||
{
|
||||
h.set(hunkRelativeX, bottom-i, hunkRelativeZ, v.get(i));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.volmit.iris.v2.generator.actuator;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.noise.CNG;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisCarveLayer;
|
||||
import com.volmit.iris.object.IrisCaveLayer;
|
||||
import com.volmit.iris.object.IrisNoiseGenerator;
|
||||
import com.volmit.iris.object.*;
|
||||
import com.volmit.iris.util.CaveResult;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.RNG;
|
||||
@ -30,14 +28,17 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
|
||||
|
||||
@Override
|
||||
public void onActuate(int x, int z, Hunk<BlockData> h) {
|
||||
int i,zf, depth, realX, realZ,hf, he, b;
|
||||
int i,zf, depth, realX, realZ,hf, he, b, ch;
|
||||
IrisBiome biome;
|
||||
boolean firstCarve;
|
||||
KList<BlockData> blocks;
|
||||
KList<CaveResult> caves;
|
||||
|
||||
for(int xf = 0; xf < h.getWidth(); xf++)
|
||||
{
|
||||
for(zf = 0; zf < h.getDepth(); zf++)
|
||||
{
|
||||
firstCarve = true;
|
||||
realX = xf + x;
|
||||
realZ = zf + z;
|
||||
b = hasUnder ? (int) Math.round(getDimension().getUndercarriage().get(rng, realX, realZ)) : 0;
|
||||
@ -45,6 +46,7 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
|
||||
hf = (int) Math.round(Math.max(Math.min(h.getHeight(), getDimension().getFluidHeight()), he));
|
||||
biome = getComplex().getTrueBiomeStream().get(realX, realZ);
|
||||
blocks = null;
|
||||
ch = he;
|
||||
|
||||
if(hf < b)
|
||||
{
|
||||
@ -61,9 +63,19 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
|
||||
|
||||
if(getDimension().isCarved(realX, i, realZ, rng, he))
|
||||
{
|
||||
if(firstCarve)
|
||||
{
|
||||
ch = i - 1;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
firstCarve = false;
|
||||
}
|
||||
|
||||
if(i > he && i <= hf)
|
||||
{
|
||||
h.set(xf, i, zf, getComplex().getFluidStream().get(realX, +realZ));
|
||||
@ -87,6 +99,44 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
|
||||
h.set(xf, i, zf, getComplex().getRockStream().get(realX, realZ));
|
||||
}
|
||||
}
|
||||
|
||||
caves = getDimension().isCaves() ? getFramework().getCaveModifier().genCaves(realX, realZ, realX & 15, realZ & 15, h) : null;
|
||||
|
||||
if(caves != null && caves.isNotEmpty())
|
||||
{
|
||||
IrisBiome cave = getComplex().getCaveBiomeStream().get(realX, realZ);
|
||||
|
||||
if(cave == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for(CaveResult cl : caves)
|
||||
{
|
||||
if(cl.getFloor() < 0 || cl.getFloor() > 255 || cl.getCeiling() > 255 || 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;
|
||||
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));
|
||||
}
|
||||
|
||||
for(int j = ceiling.size() - 1; j > 0; j--)
|
||||
{
|
||||
h.set(xf, cl.getCeiling() + j, zf, ceiling.get(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import com.volmit.iris.gen.scaffold.TerrainChunk;
|
||||
import com.volmit.iris.v2.generator.nms.v1X.DummyWorld;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
@ -42,18 +41,6 @@ public class EngineCompositeGenerator extends ChunkGenerator implements Hotloada
|
||||
initialized = new AtomicBoolean(false);
|
||||
}
|
||||
|
||||
public EngineCompositeGenerator initDummy(WorldCreator wc)
|
||||
{
|
||||
return initDummy(new DummyWorld(wc.name(), wc.seed()));
|
||||
}
|
||||
|
||||
public EngineCompositeGenerator initDummy(World world)
|
||||
{
|
||||
initialize(world);
|
||||
initialized.lazySet(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void hotload()
|
||||
{
|
||||
Iris.globaldata.dump();
|
||||
|
@ -38,12 +38,22 @@ public class SelectionStream<T> extends BasicStream<T>
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
if(options.length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return options[stream.get(x, z)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
if(options.length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return options[stream.get(x, y, z)];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user