mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-19 23:00:19 +00:00
WIP Caching Hints and Caching Sampler
This commit is contained in:
@@ -51,7 +51,13 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
|
||||
private final TerraBukkitPlugin plugin;
|
||||
|
||||
private int generationThreads;
|
||||
|
||||
public PlatformImpl(TerraBukkitPlugin plugin) {
|
||||
generationThreads = getGenerationThreadsWithReflection("ca.spottedleaf.moonrise.common.util.MoonriseCommon", "WORKER_THREADS", "Moonrise");
|
||||
if (generationThreads == 0) {
|
||||
generationThreads = 1;
|
||||
}
|
||||
this.plugin = plugin;
|
||||
load();
|
||||
}
|
||||
@@ -108,6 +114,11 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
return itemHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGenerationThreads() {
|
||||
return generationThreads;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(TypeRegistry registry) {
|
||||
super.register(registry);
|
||||
|
||||
@@ -22,6 +22,8 @@ public class CLIPlatform extends AbstractPlatform {
|
||||
private final CLIWorldHandle worldHandle = new CLIWorldHandle();
|
||||
private final CLIItemHandle itemHandle = new CLIItemHandle();
|
||||
|
||||
private final int generationThreads = Runtime.getRuntime().availableProcessors() - 1;
|
||||
|
||||
public CLIPlatform() {
|
||||
LOGGER.info("Root directory: {}", getDataFolder().getAbsoluteFile());
|
||||
load();
|
||||
@@ -58,4 +60,9 @@ public class CLIPlatform extends AbstractPlatform {
|
||||
super.register(registry);
|
||||
registry.registerLoader(PlatformBiome.class, (TypeLoader<PlatformBiome>) (annotatedType, o, configLoader, depthTracker) -> () -> o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGenerationThreads() {
|
||||
return generationThreads;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.dfsek.terra.lifecycle;
|
||||
import ca.solostudios.strata.Versions;
|
||||
import ca.solostudios.strata.parser.tokenizer.ParseException;
|
||||
import ca.solostudios.strata.version.Version;
|
||||
|
||||
import com.dfsek.terra.api.util.reflection.ReflectionUtil;
|
||||
|
||||
import net.minecraft.MinecraftVersion;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.registry.Registry;
|
||||
@@ -37,8 +40,15 @@ public abstract class LifecyclePlatform extends ModPlatform {
|
||||
private static final AtomicReference<Registry<MultiNoiseBiomeSourceParameterList>> NOISE = new AtomicReference<>();
|
||||
private static final AtomicReference<Registry<Enchantment>> ENCHANTMENT = new AtomicReference<>();
|
||||
private static MinecraftServer server;
|
||||
private int generationThreads;
|
||||
|
||||
public LifecyclePlatform() {
|
||||
generationThreads = getGenerationThreadsWithReflection("com.ishland.c2me.base.common.GlobalExecutors", "GLOBAL_EXECUTOR_PARALLELISM", "C2ME");
|
||||
if (generationThreads == 0) {
|
||||
generationThreads = getGenerationThreadsWithReflection("ca.spottedleaf.moonrise.common.util.MoonriseCommon", "WORKER_THREADS", "Moonrise");
|
||||
} if (generationThreads == 0) {
|
||||
generationThreads = 1;
|
||||
}
|
||||
CommonPlatform.initialize(this);
|
||||
load();
|
||||
}
|
||||
@@ -55,6 +65,8 @@ public abstract class LifecyclePlatform extends ModPlatform {
|
||||
ENCHANTMENT.set(enchantmentRegistry);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public MinecraftServer getServer() {
|
||||
return server;
|
||||
|
||||
Reference in New Issue
Block a user