mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-09 09:16:12 +00:00
Fix vacuum
This commit is contained in:
@@ -34,6 +34,7 @@ import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
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.MultiBurst;
|
||||
import org.bukkit.Chunk;
|
||||
@@ -206,6 +207,8 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
post.clear();
|
||||
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) {
|
||||
@@ -246,10 +249,6 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
default KList<IrisFeaturePositional> forEachFeature(double x, double z) {
|
||||
KList<IrisFeaturePositional> pos = new KList<>();
|
||||
|
||||
if (!getEngine().getDimension().hasFeatures(getEngine())) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
for (IrisFeaturePositional i : getEngine().getDimension().getSpecificFeatures()) {
|
||||
if (i.shouldFilter(x, z, getEngine().getComplex().getRng(), getData())) {
|
||||
pos.add(i);
|
||||
|
||||
@@ -64,9 +64,12 @@ public class MantleFeatureComponent extends IrisMantleComponent {
|
||||
}
|
||||
|
||||
private void placeZone(MantleWriter writer, RNG rng, int cx, int cz, IrisFeaturePotential i) {
|
||||
int x = (cx << 4) + rng.nextInt(16);
|
||||
int z = (cz << 4) + rng.nextInt(16);
|
||||
writer.setData(x, 0, z, new IrisFeaturePositional(x, z, i.getZone()));
|
||||
if(i.hasZone(rng, cx, cz))
|
||||
{
|
||||
int x = (cx << 4) + rng.nextInt(16);
|
||||
int z = (cz << 4) + rng.nextInt(16);
|
||||
writer.setData(x, 0, z, new IrisFeaturePositional(x, z, i.getZone()));
|
||||
}
|
||||
}
|
||||
|
||||
private KList<IrisFeaturePotential> getFeatures() {
|
||||
|
||||
@@ -118,6 +118,6 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
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,40 +90,31 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
||||
if (v == null) {
|
||||
return;
|
||||
}
|
||||
int xx = rng.i(x, x + 16);
|
||||
int zz = rng.i(z, z + 16);
|
||||
int xx = rng.i(x, x + 15);
|
||||
int zz = rng.i(z, z + 15);
|
||||
int id = rng.i(0, Integer.MAX_VALUE);
|
||||
|
||||
Runnable r = () -> {
|
||||
int h = v.place(xx, -1, zz, writer, objectPlacement, rng,
|
||||
(b) -> writer.setData(b.getX(), b.getY(), b.getZ(),
|
||||
v.getLoadKey() + "@" + id), null, getData());
|
||||
|
||||
if (objectPlacement.usesFeatures()) {
|
||||
if (objectPlacement.isVacuum()) {
|
||||
int h = v.place(xx, -1, zz, writer, objectPlacement, rng,
|
||||
(b) -> writer.setData(b.getX(), b.getY(), b.getZ(),
|
||||
v.getLoadKey() + "@" + id), null, getData());
|
||||
if (objectPlacement.usesFeatures() && h >= 0) {
|
||||
if (objectPlacement.isVacuum()) {
|
||||
double a = Math.max(v.getW(), v.getD());
|
||||
IrisFeature f = new IrisFeature();
|
||||
f.setConvergeToHeight(h);
|
||||
f.setBlockRadius(a);
|
||||
f.setInterpolationRadius(objectPlacement.getVacuumInterpolationRadius());
|
||||
f.setInterpolator(objectPlacement.getVacuumInterpolationMethod());
|
||||
f.setStrength(1D);
|
||||
writer.setData(xx, 0, zz, new IrisFeaturePositional(xx, zz, f));
|
||||
}
|
||||
|
||||
double a = Math.max(v.getW(), v.getD());
|
||||
IrisFeature f = new IrisFeature();
|
||||
f.setConvergeToHeight(h - (v.getH() >> 1));
|
||||
f.setBlockRadius(a);
|
||||
f.setInterpolationRadius(objectPlacement.getVacuumInterpolationRadius());
|
||||
f.setInterpolator(objectPlacement.getVacuumInterpolationMethod());
|
||||
f.setStrength(1D);
|
||||
writer.setData(xx, 0, zz, new IrisFeaturePositional(xx, zz, f));
|
||||
}
|
||||
|
||||
for (IrisFeaturePotential j : objectPlacement.getAddFeatures()) {
|
||||
if (j.hasZone(rng, xx >> 4, zz >> 4)) {
|
||||
writer.setData(xx, 0, zz, new IrisFeaturePositional(xx, zz, j.getZone()));
|
||||
}
|
||||
for (IrisFeaturePotential j : objectPlacement.getAddFeatures()) {
|
||||
if (j.hasZone(rng, xx >> 4, zz >> 4)) {
|
||||
writer.setData(xx, 0, zz, new IrisFeaturePositional(xx, zz, j.getZone()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (objectPlacement.usesFeatures()) {
|
||||
r.run();
|
||||
} else {
|
||||
post.accept(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user