mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-27 11:09:06 +00:00
Mantle & Engine Mantle & Engine changes
This commit is contained in:
@@ -29,6 +29,7 @@ import com.volmit.iris.engine.actuator.IrisTerrainIslandActuator;
|
||||
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
|
||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.framework.*;
|
||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
import com.volmit.iris.engine.modifier.IrisCaveModifier;
|
||||
import com.volmit.iris.engine.modifier.IrisDepositModifier;
|
||||
import com.volmit.iris.engine.modifier.IrisPostModifier;
|
||||
@@ -83,6 +84,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
private final EngineTarget target;
|
||||
private final IrisContext context;
|
||||
private final EngineEffects effects;
|
||||
private final EngineMantle mantle;
|
||||
private final ChronoLatch perSecondLatch;
|
||||
private final EngineExecutionEnvironment execution;
|
||||
private final EngineWorldManager worldManager;
|
||||
@@ -99,7 +101,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
private double maxBiomeLayerDensity;
|
||||
private double maxBiomeDecoratorDensity;
|
||||
private final IrisComplex complex;
|
||||
private final EngineParallaxManager engineParallax;
|
||||
private final EngineActuator<BlockData> terrainNormalActuator;
|
||||
private final EngineActuator<BlockData> terrainIslandActuator;
|
||||
private final EngineActuator<BlockData> decorantActuator;
|
||||
@@ -121,6 +122,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
lastGPS = new AtomicLong(M.ms());
|
||||
generated = new AtomicInteger(0);
|
||||
execution = new IrisExecutionEnvironment(this);
|
||||
mantle = new IrisEngineMantle(this);
|
||||
// TODO: HEIGHT ------------------------------------------------------------------------------------------------------>
|
||||
Iris.info("Initializing Engine: " + target.getWorld().name() + "/" + target.getDimension().getLoadKey() + " (" + 256+ " height)");
|
||||
metrics = new EngineMetrics(32);
|
||||
@@ -138,7 +140,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
context = new IrisContext(this);
|
||||
context.touch();
|
||||
this.complex = new IrisComplex(this);
|
||||
this.engineParallax = new IrisEngineParallax(this);
|
||||
this.terrainNormalActuator = new IrisTerrainNormalActuator(this);
|
||||
this.terrainIslandActuator = new IrisTerrainIslandActuator(this);
|
||||
this.decorantActuator = new IrisDecorantActuator(this);
|
||||
@@ -340,7 +341,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
cleaning.lazySet(false);
|
||||
}
|
||||
|
||||
|
||||
public EngineActuator<BlockData> getTerrainActuator() {
|
||||
return switch (getDimension().getTerrainMode()) {
|
||||
case NORMAL -> getTerrainNormalActuator();
|
||||
@@ -371,14 +371,14 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
|
||||
switch (getDimension().getTerrainMode()) {
|
||||
case NORMAL -> {
|
||||
getEngineParallax().generateParallaxArea(x >> 4, z >> 4);
|
||||
getMantle().generateMatter(x>>4, z>>4);
|
||||
getTerrainActuator().actuate(x, z, vblocks, multicore);
|
||||
getBiomeActuator().actuate(x, z, vbiomes, multicore);
|
||||
getCaveModifier().modify(x, z, vblocks, multicore);
|
||||
getRavineModifier().modify(x, z, vblocks, multicore);
|
||||
getPostModifier().modify(x, z, vblocks, multicore);
|
||||
getDecorantActuator().actuate(x, z, blocks, multicore);
|
||||
getEngineParallax().insertParallax(x >> 4, z >> 4, blocks);
|
||||
getMantle().insertMatter(x>>4, z>>4, blocks);
|
||||
getDepositModifier().modify(x, z, blocks, multicore);
|
||||
}
|
||||
case ISLANDS -> {
|
||||
|
||||
@@ -20,18 +20,37 @@ package com.volmit.iris.engine;
|
||||
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||
import com.volmit.iris.engine.mantle.MantleComponent;
|
||||
import com.volmit.iris.engine.mantle.components.MantleFeatureComponent;
|
||||
import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
|
||||
import com.volmit.iris.engine.mantle.components.MantleVacuumComponent;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Data
|
||||
public class IrisEngineMantle implements EngineMantle {
|
||||
private final Engine engine;
|
||||
private final Mantle mantle;
|
||||
private final KList<MantleComponent> components;
|
||||
private final CompletableFuture<Integer> radius;
|
||||
|
||||
public IrisEngineMantle(Engine engine) {
|
||||
this.engine = engine;
|
||||
this.mantle = new Mantle(new File(engine.getWorld().worldFolder(), "mantle"), engine.getTarget().getHeight());
|
||||
radius = CompletableFuture.completedFuture(0); // TODO
|
||||
components = new KList<>();
|
||||
registerComponent(new MantleFeatureComponent(this));
|
||||
registerComponent(new MantleJigsawComponent(this));
|
||||
registerComponent(new MantleVacuumComponent(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerComponent(MantleComponent c) {
|
||||
components.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,17 +21,35 @@ package com.volmit.iris.engine.mantle;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.IrisComplex;
|
||||
import com.volmit.iris.engine.data.cache.Cache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.EngineParallaxManager;
|
||||
import com.volmit.iris.engine.framework.EngineTarget;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
|
||||
import com.volmit.iris.engine.object.feature.IrisFeaturePotential;
|
||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
||||
import com.volmit.iris.engine.object.tile.TileData;
|
||||
import com.volmit.iris.engine.parallax.ParallaxAccess;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.data.B;
|
||||
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.MantleFlag;
|
||||
import com.volmit.iris.util.mantle.TectonicPlate;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
// TODO: MOVE PLACER OUT OF MATTER INTO ITS OWN THING
|
||||
public interface EngineMantle extends IObjectPlacer {
|
||||
BlockData AIR = B.get("AIR");
|
||||
|
||||
@@ -39,6 +57,12 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
|
||||
Engine getEngine();
|
||||
|
||||
CompletableFuture<Integer> getRadius();
|
||||
|
||||
KList<MantleComponent> getComponents();
|
||||
|
||||
void registerComponent(MantleComponent c);
|
||||
|
||||
default int getHighest(int x, int z) {
|
||||
return getHighest(x, z, getData());
|
||||
}
|
||||
@@ -116,10 +140,6 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
return getEngine().getData();
|
||||
}
|
||||
|
||||
default ParallaxAccess getParallax() {
|
||||
return getEngine().getParallax();
|
||||
}
|
||||
|
||||
default EngineTarget getTarget() {
|
||||
return getEngine().getTarget();
|
||||
}
|
||||
@@ -135,4 +155,53 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
default void close() {
|
||||
getMantle().close();
|
||||
}
|
||||
|
||||
default void saveAllNow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
default void save()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
default void trim()
|
||||
{
|
||||
getMantle().trim(60000);
|
||||
}
|
||||
|
||||
default int getRealRadius()
|
||||
{
|
||||
getMantle().set(0, 34, 292393, Bukkit.getPlayer("cyberpwn"));
|
||||
try {
|
||||
return (int) Math.ceil(getRadius().get() / 2D);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ChunkCoordinates
|
||||
default void generateMatter(int x, int z)
|
||||
{
|
||||
if (!getEngine().getDimension().isUseMantle()) {
|
||||
return;
|
||||
}
|
||||
|
||||
KList<Runnable> post = new KList<>();
|
||||
Consumer<Runnable> c = post::add;
|
||||
getComponents().forEach((i) -> getMantle().raiseFlag(x, z, i.getFlag(), () -> i.generateLayer(x, z, c)));
|
||||
post.forEach(Runnable::run);
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
default void insertMatter(int x, int z, Hunk<BlockData> blocks)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user