Cleanup old compat

This commit is contained in:
Daniel Mills
2021-07-20 11:33:02 -04:00
parent 326bddad2a
commit 18195b778a
16 changed files with 61 additions and 710 deletions

View File

@@ -20,6 +20,7 @@ package com.volmit.iris.engine;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisDataManager;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.EngineCompound;
import com.volmit.iris.engine.framework.EngineData;
@@ -98,7 +99,7 @@ public class IrisEngineCompound implements EngineCompound {
} else {
double totalWeight = 0D;
engines = new Engine[rootDimension.getDimensionalComposite().size()];
burster = engines.length > 1 ? new MultiBurst(engines.length) : null;
burster = engines.length > 1 ? new MultiBurst("Iris Compound " + rootDimension.getName(), IrisSettings.get().getConcurrency().getEngineThreadPriority(), engines.length) : null;
int threadDist = (Math.max(2, maximumThreads - engines.length)) / engines.length;
if ((threadDist * engines.length) + engines.length > maximumThreads) {

View File

@@ -357,8 +357,13 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
return getCompound().isStudio();
}
default MultiBurst burst()
{
return getTarget().getBurster();
}
default void clean() {
MultiBurst.burst.lazy(() -> getParallax().cleanup());
burst().lazy(() -> getParallax().cleanup());
}
default IrisBiome getBiome(Location l) {

View File

@@ -302,7 +302,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
initialized.set(true);
IrisDimension dim = getDimension(world);
IrisDataManager data = production ? new IrisDataManager(getDataFolder(world)) : dim.getLoader().copy();
compound.set(new IrisEngineCompound(world, dim, data, IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getThreadCount())));
compound.set(new IrisEngineCompound(world, dim, data, IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getEngineThreadCount())));
compound.get().setStudio(!production);
populators.clear();
populators.addAll(compound.get().getPopulators());

View File

@@ -19,6 +19,7 @@
package com.volmit.iris.engine.framework;
import com.volmit.iris.core.IrisDataManager;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.common.IrisWorld;
import com.volmit.iris.engine.parallax.ParallaxWorld;
@@ -43,7 +44,7 @@ public class EngineTarget {
this.dimension = dimension;
this.data = data;
this.inverted = inverted;
this.burster = new MultiBurst("Iris Engine " + dimension.getName(), threads, 6);
this.burster = new MultiBurst("Iris Engine " + dimension.getName(), IrisSettings.get().getConcurrency().getEngineThreadPriority(), threads);
this.parallaxWorld = new ParallaxWorld(burster, 256, new File(world.worldFolder(), "iris/" + dimension.getLoadKey() + "/parallax"));
}

View File

@@ -262,7 +262,7 @@ public class LightingTaskBatch implements LightingTask {
LightingChunk nextChunk = null;
CompletableFuture<Void> nextChunkFuture = null;
synchronized (chunks_lock) {
for (; i < chunks.length && numBeingLoaded < IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getThreadCount()); i++) {
for (; i < chunks.length && numBeingLoaded < IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getEngineThreadCount()); i++) {
LightingChunk lc = chunks[i];
if (lc.loadingStarted) {
continue; // Already (being) loaded

View File

@@ -279,7 +279,7 @@ public class IrisEntity extends IrisRegistrant {
}, 1);
}
if (Iris.awareEntities && e instanceof Mob) {
if (e instanceof Mob) {
Mob m = (Mob) e;
m.setAware(isAware());
}

View File

@@ -142,10 +142,15 @@ public class IrisLoot {
i.apply(rng, m);
}
if (Iris.customModels) {
try
{
m.setCustomModelData(getCustomModel());
}
catch(Throwable e)
{
Iris.reportError(e);
}
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
m.setUnbreakable(isUnbreakable());
@@ -226,10 +231,16 @@ public class IrisLoot {
i.apply(rng, m);
}
if (Iris.customModels) {
try
{
m.setCustomModelData(getCustomModel());
}
catch(Throwable e)
{
Iris.reportError(e);
}
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
m.setUnbreakable(isUnbreakable());

View File

@@ -257,7 +257,7 @@ public class ParallaxWorld implements ParallaxAccess {
@Override
public void saveAll() {
MultiBurst.burst.lazy(this::saveAllNOW);
burst.lazy(this::saveAllNOW);
}
@Override

View File

@@ -19,17 +19,17 @@
package com.volmit.iris.engine.parallel;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.util.collection.KList;
import java.util.concurrent.*;
public class MultiBurst {
public static final MultiBurst burst = new MultiBurst("Iris", 6, Runtime.getRuntime().availableProcessors());
public static final MultiBurst burst = new MultiBurst("Iris", IrisSettings.get().getConcurrency().getMiscThreadPriority(), IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getMiscThreadCount()));
private final ExecutorService service;
private ExecutorService syncService;
private int tid;
public MultiBurst(int tc) {
this("Iris", 6, tc);
}