mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-17 22:32:04 +00:00
Fix vacuum
This commit is contained in:
@@ -52,7 +52,7 @@ public class CommandIrisWhatFeatures extends MortarCommand {
|
|||||||
|
|
||||||
if (IrisToolbelt.isIrisWorld(c.getWorld())) {
|
if (IrisToolbelt.isIrisWorld(c.getWorld())) {
|
||||||
int m = 1;
|
int m = 1;
|
||||||
for (IrisFeaturePositional i : IrisToolbelt.access(c.getWorld()).getEngine().getMantle().getFeaturesInChunk(c)) {
|
for (IrisFeaturePositional i : IrisToolbelt.access(c.getWorld()).getEngine().getMantle().forEachFeature(c)) {
|
||||||
sender.sendMessage("#" + m++ + " " + new JSONObject(new Gson().toJson(i)).toString(4));
|
sender.sendMessage("#" + m++ + " " + new JSONObject(new Gson().toJson(i)).toString(4));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
private ProceduralStream<Double> overlayStream;
|
private ProceduralStream<Double> overlayStream;
|
||||||
private ProceduralStream<Double> heightFluidStream;
|
private ProceduralStream<Double> heightFluidStream;
|
||||||
private ProceduralStream<Integer> trueHeightStream;
|
private ProceduralStream<Integer> trueHeightStream;
|
||||||
|
private ProceduralStream<Integer> trueHeightStreamNoFeatures;
|
||||||
private ProceduralStream<Double> slopeStream;
|
private ProceduralStream<Double> slopeStream;
|
||||||
private ProceduralStream<Integer> topSurfaceStream;
|
private ProceduralStream<Integer> topSurfaceStream;
|
||||||
private ProceduralStream<RNG> rngStream;
|
private ProceduralStream<RNG> rngStream;
|
||||||
@@ -217,16 +218,12 @@ public class IrisComplex implements DataProvider {
|
|||||||
}, Interpolated.DOUBLE).clamp(0, engine.getHeight()).cache2D(cacheSize);
|
}, Interpolated.DOUBLE).clamp(0, engine.getHeight()).cache2D(cacheSize);
|
||||||
slopeStream = heightStream.slope(3).cache2D(cacheSize);
|
slopeStream = heightStream.slope(3).cache2D(cacheSize);
|
||||||
objectChanceStream = ProceduralStream.ofDouble((x, z) -> {
|
objectChanceStream = ProceduralStream.ofDouble((x, z) -> {
|
||||||
if (engine.getDimension().hasFeatures(engine)) {
|
|
||||||
AtomicDouble str = new AtomicDouble(1D);
|
AtomicDouble str = new AtomicDouble(1D);
|
||||||
for (IrisFeaturePositional i : engine.getMantle().forEachFeature(x, z)) {
|
for (IrisFeaturePositional i : engine.getMantle().forEachFeature(x, z)) {
|
||||||
str.set(Math.min(str.get(), i.getObjectChanceModifier(x, z, rng, getData())));
|
str.set(Math.min(str.get(), i.getObjectChanceModifier(x, z, rng, getData())));
|
||||||
}
|
}
|
||||||
|
|
||||||
return str.get();
|
return str.get();
|
||||||
}
|
|
||||||
|
|
||||||
return 1D;
|
|
||||||
});
|
});
|
||||||
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
||||||
b -> focus)).convertAware2D((b, x, z) -> {
|
b -> focus)).convertAware2D((b, x, z) -> {
|
||||||
@@ -343,6 +340,38 @@ public class IrisComplex implements DataProvider {
|
|||||||
|
|
||||||
return m;
|
return m;
|
||||||
}, Interpolated.INT).cache2D(cacheSize);
|
}, Interpolated.INT).cache2D(cacheSize);
|
||||||
|
|
||||||
|
trueHeightStreamNoFeatures = ProceduralStream.of((x, z) -> {
|
||||||
|
int rx = (int) Math.round(engine.modifyX(x));
|
||||||
|
int rz = (int) Math.round(engine.modifyZ(z));
|
||||||
|
int heightf = (int) Math.round(getHeightStreamNoFeatures().get(rx, rz));
|
||||||
|
int m = heightf;
|
||||||
|
|
||||||
|
if (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getTerrainActuator()).getRng(), heightf)) {
|
||||||
|
m--;
|
||||||
|
|
||||||
|
while (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getTerrainActuator()).getRng(), heightf)) {
|
||||||
|
m--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (engine.getDimension().isCaves()) {
|
||||||
|
KList<CaveResult> caves = ((IrisCaveModifier) engine.getCaveModifier()).genCaves(rx, rz, 0, 0, null);
|
||||||
|
boolean again = true;
|
||||||
|
|
||||||
|
while (again) {
|
||||||
|
again = false;
|
||||||
|
for (CaveResult i : caves) {
|
||||||
|
if (i.getCeiling() > m && i.getFloor() < m) {
|
||||||
|
m = i.getFloor();
|
||||||
|
again = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}, Interpolated.INT).cache2D(cacheSize);
|
||||||
baseBiomeIDStream = trueBiomeStream.convertAware2D((b, x, z) -> {
|
baseBiomeIDStream = trueBiomeStream.convertAware2D((b, x, z) -> {
|
||||||
UUID d = regionIDStream.get(x, z);
|
UUID d = regionIDStream.get(x, z);
|
||||||
return new UUID(b.getLoadKey().hashCode() * 818223L,
|
return new UUID(b.getLoadKey().hashCode() * 818223L,
|
||||||
@@ -427,9 +456,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
AtomicDouble noise = new AtomicDouble(h + fluidHeight + overlayStream.get(x, z));
|
AtomicDouble noise = new AtomicDouble(h + fluidHeight + overlayStream.get(x, z));
|
||||||
|
|
||||||
if (features) {
|
if (features) {
|
||||||
List<IrisFeaturePositional> p = engine.getMantle().forEachFeature(x, z);
|
for (IrisFeaturePositional i : engine.getMantle().forEachFeature(x, z)) {
|
||||||
|
|
||||||
for (IrisFeaturePositional i : p) {
|
|
||||||
noise.set(i.filter(x, z, noise.get(), rng, getData()));
|
noise.set(i.filter(x, z, noise.get(), rng, getData()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -417,10 +417,8 @@ public class IrisEngine implements Engine {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getMantle().generateMatter(x >> 4, z >> 4, multicore);
|
getMantle().generateMatter(x >> 4, z >> 4, multicore);
|
||||||
burst().burst(multicore,
|
getTerrainActuator().actuate(x, z, vblocks, multicore);
|
||||||
() -> getTerrainActuator().actuate(x, z, vblocks, multicore),
|
getBiomeActuator().actuate(x, z, vbiomes, multicore);
|
||||||
() -> getBiomeActuator().actuate(x, z, vbiomes, multicore)
|
|
||||||
);
|
|
||||||
burst().burst(multicore,
|
burst().burst(multicore,
|
||||||
() -> getCaveModifier().modify(x, z, vblocks, multicore),
|
() -> getCaveModifier().modify(x, z, vblocks, multicore),
|
||||||
() -> getDecorantActuator().actuate(x, z, blocks, multicore),
|
() -> getDecorantActuator().actuate(x, z, blocks, multicore),
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import com.volmit.iris.util.documentation.ChunkCoordinates;
|
|||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
import com.volmit.iris.util.mantle.MantleChunk;
|
import com.volmit.iris.util.mantle.MantleChunk;
|
||||||
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@@ -206,6 +207,8 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
post.clear();
|
post.clear();
|
||||||
burst().burst(multicore, px);
|
burst().burst(multicore, px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getMantle().flag(x, z, MantleFlag.REAL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void generateMantleComponent(MantleWriter writer, int x, int z, MantleComponent c, Consumer<Runnable> post, MantleChunk mc) {
|
default void generateMantleComponent(MantleWriter writer, int x, int z, MantleComponent c, Consumer<Runnable> post, MantleChunk mc) {
|
||||||
@@ -246,10 +249,6 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
default KList<IrisFeaturePositional> forEachFeature(double x, double z) {
|
default KList<IrisFeaturePositional> forEachFeature(double x, double z) {
|
||||||
KList<IrisFeaturePositional> pos = new KList<>();
|
KList<IrisFeaturePositional> pos = new KList<>();
|
||||||
|
|
||||||
if (!getEngine().getDimension().hasFeatures(getEngine())) {
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisFeaturePositional i : getEngine().getDimension().getSpecificFeatures()) {
|
for (IrisFeaturePositional i : getEngine().getDimension().getSpecificFeatures()) {
|
||||||
if (i.shouldFilter(x, z, getEngine().getComplex().getRng(), getData())) {
|
if (i.shouldFilter(x, z, getEngine().getComplex().getRng(), getData())) {
|
||||||
pos.add(i);
|
pos.add(i);
|
||||||
|
|||||||
@@ -64,10 +64,13 @@ public class MantleFeatureComponent extends IrisMantleComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void placeZone(MantleWriter writer, RNG rng, int cx, int cz, IrisFeaturePotential i) {
|
private void placeZone(MantleWriter writer, RNG rng, int cx, int cz, IrisFeaturePotential i) {
|
||||||
|
if(i.hasZone(rng, cx, cz))
|
||||||
|
{
|
||||||
int x = (cx << 4) + rng.nextInt(16);
|
int x = (cx << 4) + rng.nextInt(16);
|
||||||
int z = (cz << 4) + rng.nextInt(16);
|
int z = (cz << 4) + rng.nextInt(16);
|
||||||
writer.setData(x, 0, z, new IrisFeaturePositional(x, z, i.getZone()));
|
writer.setData(x, 0, z, new IrisFeaturePositional(x, z, i.getZone()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private KList<IrisFeaturePotential> getFeatures() {
|
private KList<IrisFeaturePotential> getFeatures() {
|
||||||
return getEngineMantle().getEngine().getDimension().getFeatures();
|
return getEngineMantle().getEngine().getDimension().getFeatures();
|
||||||
|
|||||||
@@ -118,6 +118,6 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
|||||||
new IrisFeaturePositional(position.getX(), position.getZ(), structure.getFeature()));
|
new IrisFeaturePositional(position.getX(), position.getZ(), structure.getFeature()));
|
||||||
}
|
}
|
||||||
|
|
||||||
post.accept(() -> new PlannedStructure(structure, position, rng).place(writer, getMantle(), post));
|
new PlannedStructure(structure, position, rng).place(writer, getMantle(), post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,21 +90,19 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
if (v == null) {
|
if (v == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int xx = rng.i(x, x + 16);
|
int xx = rng.i(x, x + 15);
|
||||||
int zz = rng.i(z, z + 16);
|
int zz = rng.i(z, z + 15);
|
||||||
int id = rng.i(0, Integer.MAX_VALUE);
|
int id = rng.i(0, Integer.MAX_VALUE);
|
||||||
|
|
||||||
Runnable r = () -> {
|
|
||||||
int h = v.place(xx, -1, zz, writer, objectPlacement, rng,
|
int h = v.place(xx, -1, zz, writer, objectPlacement, rng,
|
||||||
(b) -> writer.setData(b.getX(), b.getY(), b.getZ(),
|
(b) -> writer.setData(b.getX(), b.getY(), b.getZ(),
|
||||||
v.getLoadKey() + "@" + id), null, getData());
|
v.getLoadKey() + "@" + id), null, getData());
|
||||||
|
if (objectPlacement.usesFeatures() && h >= 0) {
|
||||||
if (objectPlacement.usesFeatures()) {
|
|
||||||
if (objectPlacement.isVacuum()) {
|
if (objectPlacement.isVacuum()) {
|
||||||
|
|
||||||
double a = Math.max(v.getW(), v.getD());
|
double a = Math.max(v.getW(), v.getD());
|
||||||
IrisFeature f = new IrisFeature();
|
IrisFeature f = new IrisFeature();
|
||||||
f.setConvergeToHeight(h - (v.getH() >> 1));
|
f.setConvergeToHeight(h);
|
||||||
f.setBlockRadius(a);
|
f.setBlockRadius(a);
|
||||||
f.setInterpolationRadius(objectPlacement.getVacuumInterpolationRadius());
|
f.setInterpolationRadius(objectPlacement.getVacuumInterpolationRadius());
|
||||||
f.setInterpolator(objectPlacement.getVacuumInterpolationMethod());
|
f.setInterpolator(objectPlacement.getVacuumInterpolationMethod());
|
||||||
@@ -118,13 +116,6 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (objectPlacement.usesFeatures()) {
|
|
||||||
r.run();
|
|
||||||
} else {
|
|
||||||
post.accept(r);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -519,41 +519,6 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasFeatures(DataProvider data) {
|
|
||||||
return featuresUsed.aquire(() -> {
|
|
||||||
if (getFeatures().isNotEmpty() || getSpecificFeatures().isNotEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisRegion i : getAllRegions(data)) {
|
|
||||||
if (i.getFeatures().isNotEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisObjectPlacement j : i.getObjects()) {
|
|
||||||
if (j.isVacuum()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisBiome j : i.getAllBiomes(data)) {
|
|
||||||
if (j.getFeatures().isNotEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisObjectPlacement k : i.getObjects()) {
|
|
||||||
if (k.isVacuum()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.verbose("Not using parallax noise features (they arent used in this dimension)");
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFolderName() {
|
public String getFolderName() {
|
||||||
return "dimensions";
|
return "dimensions";
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ public enum MantleFlag {
|
|||||||
UPDATE,
|
UPDATE,
|
||||||
JIGSAW,
|
JIGSAW,
|
||||||
FEATURE,
|
FEATURE,
|
||||||
INITIAL_SPAWNED;
|
INITIAL_SPAWNED,
|
||||||
|
REAL;
|
||||||
|
|
||||||
static StateList getStateList() {
|
static StateList getStateList() {
|
||||||
return new StateList(MantleFlag.values());
|
return new StateList(MantleFlag.values());
|
||||||
|
|||||||
Reference in New Issue
Block a user