mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-04 00:46:08 +00:00
f
This commit is contained in:
parent
fa99b967ed
commit
14029aa60f
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,3 +13,4 @@ lint/out.jar
|
|||||||
lint/mapping.txt
|
lint/mapping.txt
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.idea/
|
||||||
|
@ -42,6 +42,8 @@ public class IrisComplex implements DataProvider
|
|||||||
private ProceduralStream<RNG> chunkRngStream;
|
private ProceduralStream<RNG> chunkRngStream;
|
||||||
private ProceduralStream<IrisDecorator> terrainSurfaceDecoration;
|
private ProceduralStream<IrisDecorator> terrainSurfaceDecoration;
|
||||||
private ProceduralStream<IrisDecorator> terrainCeilingDecoration;
|
private ProceduralStream<IrisDecorator> terrainCeilingDecoration;
|
||||||
|
private ProceduralStream<IrisDecorator> terrainCaveSurfaceDecoration;
|
||||||
|
private ProceduralStream<IrisDecorator> terrainCaveCeilingDecoration;
|
||||||
private ProceduralStream<IrisDecorator> seaSurfaceDecoration;
|
private ProceduralStream<IrisDecorator> seaSurfaceDecoration;
|
||||||
private ProceduralStream<IrisDecorator> shoreSurfaceDecoration;
|
private ProceduralStream<IrisDecorator> shoreSurfaceDecoration;
|
||||||
private ProceduralStream<BlockData> rockStream;
|
private ProceduralStream<BlockData> rockStream;
|
||||||
@ -152,6 +154,10 @@ public class IrisComplex implements DataProvider
|
|||||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.NONE));
|
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.NONE));
|
||||||
terrainCeilingDecoration = trueBiomeStream
|
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
|
shoreSurfaceDecoration = trueBiomeStream
|
||||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SHORE_LINE));
|
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SHORE_LINE));
|
||||||
seaSurfaceDecoration = trueBiomeStream
|
seaSurfaceDecoration = trueBiomeStream
|
||||||
|
@ -41,7 +41,6 @@ public class IrisEngine implements Engine
|
|||||||
() -> getFramework().getEngineParallax().generateParallaxArea(x, z),
|
() -> getFramework().getEngineParallax().generateParallaxArea(x, z),
|
||||||
() -> Hunk.computeDual2D(getParallelism(), blocks, biomes, (xx,yy,zz,ha,hb) -> {
|
() -> Hunk.computeDual2D(getParallelism(), blocks, biomes, (xx,yy,zz,ha,hb) -> {
|
||||||
getFramework().getTerrainActuator().actuate(x+xx, z+zz, ha);
|
getFramework().getTerrainActuator().actuate(x+xx, z+zz, ha);
|
||||||
getFramework().getCaveModifier().modify(x, z, ha);
|
|
||||||
getFramework().getDecorantActuator().actuate(x+xx, z+zz, ha);
|
getFramework().getDecorantActuator().actuate(x+xx, z+zz, ha);
|
||||||
getFramework().getBiomeActuator().actuate(x+xx, z+zz, hb);
|
getFramework().getBiomeActuator().actuate(x+xx, z+zz, hb);
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.volmit.iris.v2.generator.actuator;
|
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.Engine;
|
||||||
import com.volmit.iris.v2.scaffold.engine.EngineAssignedActuator;
|
import com.volmit.iris.v2.scaffold.engine.EngineAssignedActuator;
|
||||||
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
||||||
@ -85,6 +86,8 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(surface)
|
||||||
|
{
|
||||||
IrisDecorator deco = getComplex().getTerrainSurfaceDecoration().get(realX, realZ);
|
IrisDecorator deco = getComplex().getTerrainSurfaceDecoration().get(realX, realZ);
|
||||||
|
|
||||||
if(deco != null)
|
if(deco != null)
|
||||||
@ -109,10 +112,52 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData>
|
|||||||
h.set(hunkRelativeX, floor, hunkRelativeZ, deco.getBlockData100(b, rng, realX, realZ, getData()));
|
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)
|
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()));
|
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;
|
package com.volmit.iris.v2.generator.actuator;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.noise.CNG;
|
import com.volmit.iris.noise.CNG;
|
||||||
import com.volmit.iris.object.IrisBiome;
|
import com.volmit.iris.object.*;
|
||||||
import com.volmit.iris.object.IrisCarveLayer;
|
|
||||||
import com.volmit.iris.object.IrisCaveLayer;
|
|
||||||
import com.volmit.iris.object.IrisNoiseGenerator;
|
|
||||||
import com.volmit.iris.util.CaveResult;
|
import com.volmit.iris.util.CaveResult;
|
||||||
import com.volmit.iris.util.KList;
|
import com.volmit.iris.util.KList;
|
||||||
import com.volmit.iris.util.RNG;
|
import com.volmit.iris.util.RNG;
|
||||||
@ -30,14 +28,17 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActuate(int x, int z, Hunk<BlockData> h) {
|
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;
|
IrisBiome biome;
|
||||||
|
boolean firstCarve;
|
||||||
KList<BlockData> blocks;
|
KList<BlockData> blocks;
|
||||||
|
KList<CaveResult> caves;
|
||||||
|
|
||||||
for(int xf = 0; xf < h.getWidth(); xf++)
|
for(int xf = 0; xf < h.getWidth(); xf++)
|
||||||
{
|
{
|
||||||
for(zf = 0; zf < h.getDepth(); zf++)
|
for(zf = 0; zf < h.getDepth(); zf++)
|
||||||
{
|
{
|
||||||
|
firstCarve = true;
|
||||||
realX = xf + x;
|
realX = xf + x;
|
||||||
realZ = zf + z;
|
realZ = zf + z;
|
||||||
b = hasUnder ? (int) Math.round(getDimension().getUndercarriage().get(rng, realX, realZ)) : 0;
|
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));
|
hf = (int) Math.round(Math.max(Math.min(h.getHeight(), getDimension().getFluidHeight()), he));
|
||||||
biome = getComplex().getTrueBiomeStream().get(realX, realZ);
|
biome = getComplex().getTrueBiomeStream().get(realX, realZ);
|
||||||
blocks = null;
|
blocks = null;
|
||||||
|
ch = he;
|
||||||
|
|
||||||
if(hf < b)
|
if(hf < b)
|
||||||
{
|
{
|
||||||
@ -61,9 +63,19 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
|
|||||||
|
|
||||||
if(getDimension().isCarved(realX, i, realZ, rng, he))
|
if(getDimension().isCarved(realX, i, realZ, rng, he))
|
||||||
{
|
{
|
||||||
|
if(firstCarve)
|
||||||
|
{
|
||||||
|
ch = i - 1;
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
firstCarve = false;
|
||||||
|
}
|
||||||
|
|
||||||
if(i > he && i <= hf)
|
if(i > he && i <= hf)
|
||||||
{
|
{
|
||||||
h.set(xf, i, zf, getComplex().getFluidStream().get(realX, +realZ));
|
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));
|
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 java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import com.volmit.iris.gen.scaffold.TerrainChunk;
|
import com.volmit.iris.gen.scaffold.TerrainChunk;
|
||||||
import com.volmit.iris.v2.generator.nms.v1X.DummyWorld;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
@ -42,18 +41,6 @@ public class EngineCompositeGenerator extends ChunkGenerator implements Hotloada
|
|||||||
initialized = new AtomicBoolean(false);
|
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()
|
public void hotload()
|
||||||
{
|
{
|
||||||
Iris.globaldata.dump();
|
Iris.globaldata.dump();
|
||||||
|
@ -38,12 +38,22 @@ public class SelectionStream<T> extends BasicStream<T>
|
|||||||
@Override
|
@Override
|
||||||
public T get(double x, double z)
|
public T get(double x, double z)
|
||||||
{
|
{
|
||||||
|
if(options.length == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return options[stream.get(x, z)];
|
return options[stream.get(x, z)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T get(double x, double y, double z)
|
public T get(double x, double y, double z)
|
||||||
{
|
{
|
||||||
|
if(options.length == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return options[stream.get(x, y, z)];
|
return options[stream.get(x, y, z)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user