This commit is contained in:
cyberpwn
2021-08-24 08:24:36 -04:00
parent 6dc3e74607
commit 7b6405fba7
11 changed files with 189 additions and 139 deletions

View File

@@ -198,8 +198,8 @@ public class IrisBiome extends IrisRegistrant implements IRare {
private final transient AtomicCache<KMap<String, IrisBiomeGeneratorLink>> genCache = new AtomicCache<>();
private final transient AtomicCache<KMap<String, Integer>> genCacheMax = new AtomicCache<>();
private final transient AtomicCache<KMap<String, Integer>> genCacheMin = new AtomicCache<>();
private final transient AtomicCache<KList<IrisObjectPlacement>> surfaceObjectsCache = new AtomicCache<>(false);
private final transient AtomicCache<KList<IrisObjectPlacement>> carveObjectsCache = new AtomicCache<>(false);
private final transient AtomicCache<KList<IrisObjectPlacement>> surfaceObjectsCache = new AtomicCache<>();
private final transient AtomicCache<KList<IrisObjectPlacement>> carveObjectsCache = new AtomicCache<>();
private final transient AtomicCache<Color> cacheColor = new AtomicCache<>();
private final transient AtomicCache<Color> cacheColorObjectDensity = new AtomicCache<>();
private final transient AtomicCache<Color> cacheColorDecoratorLoad = new AtomicCache<>();

View File

@@ -22,6 +22,7 @@ import com.volmit.iris.Iris;
import com.volmit.iris.core.project.loader.IrisData;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.dimensional.IrisDimension;
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
import com.volmit.iris.engine.platform.HeadlessGenerator;
@@ -65,8 +66,24 @@ public class HeadlessWorld {
}
}
@SuppressWarnings("ConstantConditions")
public HeadlessGenerator generate() {
return new HeadlessGenerator(this);
Engine e = null;
if(getWorld().tryGetRealWorld())
{
if(IrisToolbelt.isIrisWorld(getWorld().realWorld()))
{
e = IrisToolbelt.access(getWorld().realWorld()).getEngine();
}
}
if(e != null)
{
Iris.info("Using Existing Engine " + getWorld().name() + " for Headless Pregeneration.");
}
return e != null ? new HeadlessGenerator(this, e) : new HeadlessGenerator(this);
}
public World load() {
@@ -81,7 +98,8 @@ public class HeadlessWorld {
}
public static HeadlessWorld from(World world) {
return new HeadlessWorld(world.getName(), IrisToolbelt.access(world).getEngine().getTarget().getDimension(), world.getSeed());
return new HeadlessWorld(world.getName(), IrisToolbelt.access(world)
.getEngine().getTarget().getDimension(), world.getSeed());
}
public static HeadlessWorld from(String name, String dimension, long seed) {

View File

@@ -24,6 +24,7 @@ import com.volmit.iris.util.collection.KList;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Accessors;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
@@ -61,6 +62,24 @@ public class IrisWorld {
.environment(world.getEnvironment());
}
public boolean tryGetRealWorld()
{
if(hasRealWorld())
{
return true;
}
World w = Bukkit.getWorld(name);
if(w != null)
{
realWorld = w;
return true;
}
return false;
}
public boolean hasRealWorld() {
return realWorld != null;
}