9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 20:39:21 +00:00

Works, but somehow i broke parallax

This commit is contained in:
Daniel Mills
2020-11-11 20:58:47 -05:00
parent 4c44957764
commit bf9c4c602b
29 changed files with 413 additions and 640 deletions

View File

@@ -1,6 +1,6 @@
package com.volmit.iris.scaffold;
import com.volmit.iris.Iris;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.object.IrisDimension;
import com.volmit.iris.scaffold.engine.EngineCompositeGenerator;
import org.bukkit.World;
@@ -71,7 +71,7 @@ public class IrisWorldCreator
return World.Environment.NORMAL;
}
IrisDimension dim = Iris.globaldata.getDimensionLoader().load(dimensionName);
IrisDimension dim = IrisDataManager.loadAnyDimension(dimensionName);
if(dim != null)
{

View File

@@ -58,7 +58,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
public void hotload()
{
Iris.globaldata.dump();
getData().dump();
initialized.lazySet(false);
}
@@ -78,7 +78,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
for (File j : i.listFiles()) {
if (j.isFile() && j.getName().endsWith(".json")) {
hint = j.getName().replaceAll("\\Q.json\\E", "");
break searching;
Iris.error("Found v1 install. Please create a new world, this will cause chunks to change in your existing iris worlds!");
throw new RuntimeException();
}
}
}
@@ -97,14 +98,14 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
throw new RuntimeException("Cannot find iris dimension data for world: " + world.getName() + "! FAILED");
}
dim = Iris.globaldata.preferFolder(hint).getDimensionLoader().load(hint);
dim = IrisDataManager.loadAnyDimension(hint);
if (dim == null) {
throw new RuntimeException("Cannot find dimension: " + hint);
}
if (production) {
dim = new IrisDataManager(getDataFolder(world), true).preferFolder(dim.getLoadKey()).getDimensionLoader().load(dim.getLoadKey());
dim = new IrisDataManager(getDataFolder(world)).getDimensionLoader().load(dim.getLoadKey());
if (dim == null) {
throw new RuntimeException("Cannot find dimension: " + hint);
@@ -119,9 +120,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
return;
}
IrisDataManager data = production ? new IrisDataManager(getDataFolder(world)) : Iris.globaldata.copy();
IrisDimension dim = getDimension(world);
data.preferFolder(dim.getLoadKey());
IrisDataManager data = production ? new IrisDataManager(getDataFolder(world)) : dim.getLoader().copy();
compound = new IrisEngineCompound(world, dim, data, Iris.getThreadCount());
initialized.set(true);
populators.clear();

View File

@@ -137,7 +137,7 @@ public interface IrisAccess extends Hotloadable, DataProvider {
public default Location lookForRegion(IrisRegion reg, long timeout, Consumer<Integer> triesc)
{
ChronoLatch cl = new ChronoLatch(250, false);
ChronoLatch cl = new ChronoLatch(3000, false);
long s = M.ms();
int cpus = 2+(Runtime.getRuntime().availableProcessors()/2);
KList<Engine> engines = new KList<>();

View File

@@ -1,16 +1,37 @@
package com.volmit.iris.scaffold.parallel;
import com.volmit.iris.Iris;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
public class MultiBurst
{
public static MultiBurst burst = new MultiBurst(Runtime.getRuntime().availableProcessors());
private ExecutorService service;
private int tid;
public MultiBurst(int tc)
{
service = Executors.newWorkStealingPool(tc);
service = Executors.newFixedThreadPool(tc, new ThreadFactory()
{
@Override
public Thread newThread(Runnable r)
{
tid++;
Thread t = new Thread(r);
t.setName("Iris Generator " + tid);
t.setPriority(Thread.MAX_PRIORITY);
t.setUncaughtExceptionHandler((et, e) ->
{
Iris.info("Exception encountered in " + et.getName());
e.printStackTrace();
});
return t;
}
});
}
public void burst(Runnable... r)