mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-19 07:11:14 +00:00
hold PluginConfig instance in Terra plugin instance
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ java {
|
|||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
val versionObj = Version("2", "0", "2", true)
|
val versionObj = Version("2", "1", "0", true)
|
||||||
|
|
||||||
version = versionObj
|
version = versionObj
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public class Terra extends GaeaPlugin {
|
|||||||
private final Map<World, TerraWorld> worldMap = new HashMap<>();
|
private final Map<World, TerraWorld> worldMap = new HashMap<>();
|
||||||
private final Map<String, ConfigPack> worlds = new HashMap<>();
|
private final Map<String, ConfigPack> worlds = new HashMap<>();
|
||||||
private final ConfigRegistry registry = new ConfigRegistry();
|
private final ConfigRegistry registry = new ConfigRegistry();
|
||||||
|
private final PluginConfig config = new PluginConfig();
|
||||||
|
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
worldMap.clear();
|
worldMap.clear();
|
||||||
@@ -90,8 +91,9 @@ public class Terra extends GaeaPlugin {
|
|||||||
Metrics metrics = new Metrics(this, 9017); // Set up bStats.
|
Metrics metrics = new Metrics(this, 9017); // Set up bStats.
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("worlds", worldMap::size)); // World number chart.
|
metrics.addCustomChart(new Metrics.SingleLineChart("worlds", worldMap::size)); // World number chart.
|
||||||
|
|
||||||
PluginConfig.load(this); // Load master config.yml
|
config.load(this); // Load master config.yml
|
||||||
LangUtil.load(PluginConfig.getLanguage(), this); // Load language.
|
LangUtil.load(config.getLanguage(), this); // Load language.
|
||||||
|
Debug.setDebug(isDebug());
|
||||||
|
|
||||||
registry.loadAll(this); // Load all config packs.
|
registry.loadAll(this); // Load all config packs.
|
||||||
|
|
||||||
@@ -106,7 +108,7 @@ public class Terra extends GaeaPlugin {
|
|||||||
locatePl.setTabCompleter(locate);
|
locatePl.setTabCompleter(locate);
|
||||||
|
|
||||||
|
|
||||||
long save = PluginConfig.getDataSaveInterval();
|
long save = config.getDataSaveInterval();
|
||||||
Bukkit.getScheduler().runTaskTimerAsynchronously(this, TerraChunkGenerator::saveAll, save, save); // Schedule population data saving
|
Bukkit.getScheduler().runTaskTimerAsynchronously(this, TerraChunkGenerator::saveAll, save, save); // Schedule population data saving
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(new EventListener(this), this); // Register master event listener
|
Bukkit.getPluginManager().registerEvents(new EventListener(this), this); // Register master event listener
|
||||||
@@ -126,7 +128,7 @@ public class Terra extends GaeaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDebug() {
|
public boolean isDebug() {
|
||||||
return PluginConfig.isDebug();
|
return config.isDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -171,6 +173,16 @@ public class Terra extends GaeaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TerraWorld getWorld(World w) {
|
public TerraWorld getWorld(World w) {
|
||||||
|
if(!(w.getGenerator() instanceof TerraChunkGenerator)) throw new IllegalArgumentException("Not a Terra world!");
|
||||||
|
if(!worlds.containsKey(w.getName())) {
|
||||||
|
getLogger().warning("Unexpected world load detected: \"" + w.getName() + "\"");
|
||||||
|
return new TerraWorld(w, ((TerraChunkGenerator) w.getGenerator()).getConfigPack());
|
||||||
|
}
|
||||||
return worldMap.computeIfAbsent(w, world -> new TerraWorld(w, worlds.get(w.getName())));
|
return worldMap.computeIfAbsent(w, world -> new TerraWorld(w, worlds.get(w.getName())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public PluginConfig getTerraConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.dfsek.terra.async;
|
|||||||
|
|
||||||
import com.dfsek.terra.Terra;
|
import com.dfsek.terra.Terra;
|
||||||
import com.dfsek.terra.biome.grid.master.TerraBiomeGrid;
|
import com.dfsek.terra.biome.grid.master.TerraBiomeGrid;
|
||||||
import com.dfsek.terra.config.base.PluginConfig;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -29,12 +28,12 @@ public class AsyncBiomeFinder extends AsyncFeatureFinder<Biome> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(int x, int z, Biome target) {
|
public boolean isValid(int x, int z, Biome target) {
|
||||||
int res = PluginConfig.getBiomeSearchResolution();
|
int res = main.getTerraConfig().getBiomeSearchResolution();
|
||||||
return getGrid().getBiome(x * res, z * res, GenerationPhase.POST_GEN).equals(target);
|
return getGrid().getBiome(x * res, z * res, GenerationPhase.POST_GEN).equals(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vector finalizeVector(Vector orig) {
|
public Vector finalizeVector(Vector orig) {
|
||||||
return orig.multiply(PluginConfig.getBiomeSearchResolution());
|
return orig.multiply(main.getTerraConfig().getBiomeSearchResolution());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.dfsek.terra.carving;
|
|||||||
import com.dfsek.terra.Terra;
|
import com.dfsek.terra.Terra;
|
||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
import com.dfsek.terra.biome.grid.master.TerraBiomeGrid;
|
import com.dfsek.terra.biome.grid.master.TerraBiomeGrid;
|
||||||
import com.dfsek.terra.config.base.PluginConfig;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.polydev.gaea.biome.Biome;
|
import org.polydev.gaea.biome.Biome;
|
||||||
@@ -30,7 +29,7 @@ public class CarverCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Worm.WormPoint> getPoints(int chunkX, int chunkZ, UserDefinedCarver carver) {
|
public List<Worm.WormPoint> getPoints(int chunkX, int chunkZ, UserDefinedCarver carver) {
|
||||||
if(carvers.size() > PluginConfig.getCacheSize() * 2) carvers.clear();
|
if(carvers.size() > main.getTerraConfig().getCacheSize() * 2) carvers.clear();
|
||||||
return carvers.computeIfAbsent((((long) chunkX) << 32) | (chunkZ & 0xffffffffL), key -> {
|
return carvers.computeIfAbsent((((long) chunkX) << 32) | (chunkZ & 0xffffffffL), key -> {
|
||||||
TerraBiomeGrid grid = main.getWorld(w).getGrid();
|
TerraBiomeGrid grid = main.getWorld(w).getGrid();
|
||||||
if(carver.isChunkCarved(w, chunkX, chunkZ, new FastRandom(MathUtil.getCarverChunkSeed(chunkX, chunkZ, w.getSeed() + carver.hashCode())))) {
|
if(carver.isChunkCarved(w, chunkX, chunkZ, new FastRandom(MathUtil.getCarverChunkSeed(chunkX, chunkZ, w.getSeed() + carver.hashCode())))) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.dfsek.terra.command;
|
package com.dfsek.terra.command;
|
||||||
|
|
||||||
import com.dfsek.terra.Terra;
|
import com.dfsek.terra.Terra;
|
||||||
import com.dfsek.terra.config.base.PluginConfig;
|
|
||||||
import com.dfsek.terra.config.lang.LangUtil;
|
import com.dfsek.terra.config.lang.LangUtil;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -28,8 +27,8 @@ public class ReloadCommand extends Command implements DebugCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(@NotNull CommandSender sender, org.bukkit.command.@NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
public boolean execute(@NotNull CommandSender sender, org.bukkit.command.@NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
PluginConfig.load(getMain());
|
((Terra) getMain()).getTerraConfig().load(getMain());
|
||||||
LangUtil.load(PluginConfig.getLanguage(), getMain()); // Load language.
|
LangUtil.load(((Terra) getMain()).getTerraConfig().getLanguage(), getMain()); // Load language.
|
||||||
if(!((Terra) getMain()).getRegistry().loadAll((Terra) getMain())) LangUtil.send("command.reload-error", sender);
|
if(!((Terra) getMain()).getRegistry().loadAll((Terra) getMain())) LangUtil.send("command.reload-error", sender);
|
||||||
((Terra) getMain()).invalidate();
|
((Terra) getMain()).invalidate();
|
||||||
LangUtil.send("command.reload", sender);
|
LangUtil.send("command.reload", sender);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.dfsek.terra.command.biome;
|
|||||||
import com.dfsek.terra.Terra;
|
import com.dfsek.terra.Terra;
|
||||||
import com.dfsek.terra.async.AsyncBiomeFinder;
|
import com.dfsek.terra.async.AsyncBiomeFinder;
|
||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
import com.dfsek.terra.config.base.PluginConfig;
|
|
||||||
import com.dfsek.terra.config.lang.LangUtil;
|
import com.dfsek.terra.config.lang.LangUtil;
|
||||||
import com.dfsek.terra.generation.TerraChunkGenerator;
|
import com.dfsek.terra.generation.TerraChunkGenerator;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -44,7 +43,7 @@ public class BiomeLocateCommand extends WorldCommand {
|
|||||||
LangUtil.send("command.biome.invalid", sender, id);
|
LangUtil.send("command.biome.invalid", sender, id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(getMain(), new AsyncBiomeFinder(((Terra) getMain()).getWorld(world).getGrid(), b, sender.getLocation().clone().multiply((1D / PluginConfig.getBiomeSearchResolution())), 0, maxRadius, location -> {
|
Bukkit.getScheduler().runTaskAsynchronously(getMain(), new AsyncBiomeFinder(((Terra) getMain()).getWorld(world).getGrid(), b, sender.getLocation().clone().multiply((1D / ((Terra) getMain()).getTerraConfig().getBiomeSearchResolution())), 0, maxRadius, location -> {
|
||||||
if(location != null) {
|
if(location != null) {
|
||||||
LangUtil.send("command.biome.biome-found", sender, String.valueOf(location.getBlockX()), String.valueOf(location.getBlockZ()));
|
LangUtil.send("command.biome.biome-found", sender, String.valueOf(location.getBlockX()), String.valueOf(location.getBlockZ()));
|
||||||
if(tp) {
|
if(tp) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.dfsek.terra.command.image.gui;
|
package com.dfsek.terra.command.image.gui;
|
||||||
|
|
||||||
import com.dfsek.terra.Terra;
|
import com.dfsek.terra.Terra;
|
||||||
import com.dfsek.terra.config.base.PluginConfig;
|
|
||||||
import com.dfsek.terra.config.lang.LangUtil;
|
import com.dfsek.terra.config.lang.LangUtil;
|
||||||
import com.dfsek.terra.image.ImageLoader;
|
import com.dfsek.terra.image.ImageLoader;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -21,7 +20,7 @@ public class RawGUICommand extends WorldCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||||
if(!PluginConfig.isDebug()) {
|
if(!getMain().isDebug()) {
|
||||||
LangUtil.send("command.image.gui.debug", sender);
|
LangUtil.send("command.image.gui.debug", sender);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.dfsek.terra.command.image.gui;
|
package com.dfsek.terra.command.image.gui;
|
||||||
|
|
||||||
import com.dfsek.terra.Terra;
|
import com.dfsek.terra.Terra;
|
||||||
import com.dfsek.terra.config.base.PluginConfig;
|
|
||||||
import com.dfsek.terra.config.lang.LangUtil;
|
import com.dfsek.terra.config.lang.LangUtil;
|
||||||
import com.dfsek.terra.image.ImageLoader;
|
import com.dfsek.terra.image.ImageLoader;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -21,7 +20,7 @@ public class StepGUICommand extends WorldCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||||
if(!PluginConfig.isDebug()) {
|
if(!getMain().isDebug()) {
|
||||||
LangUtil.send("command.image.gui.debug", sender);
|
LangUtil.send("command.image.gui.debug", sender);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
@SuppressWarnings("FieldMayBeFinal")
|
@SuppressWarnings("FieldMayBeFinal")
|
||||||
public class PluginConfig implements ConfigTemplate {
|
public class PluginConfig implements ConfigTemplate {
|
||||||
private static final PluginConfig singleton = new PluginConfig();
|
|
||||||
private static boolean loaded = false;
|
|
||||||
|
|
||||||
@Value("debug")
|
@Value("debug")
|
||||||
@Default
|
@Default
|
||||||
private boolean debug = false;
|
private boolean debug = false;
|
||||||
@@ -47,16 +44,13 @@ public class PluginConfig implements ConfigTemplate {
|
|||||||
@Default
|
@Default
|
||||||
private boolean dumpDefaultConfig = true;
|
private boolean dumpDefaultConfig = true;
|
||||||
|
|
||||||
private PluginConfig() {
|
public void load(GaeaPlugin main) {
|
||||||
}
|
|
||||||
|
|
||||||
public static void load(GaeaPlugin main) {
|
|
||||||
Logger logger = main.getLogger();
|
Logger logger = main.getLogger();
|
||||||
logger.info("Loading config values");
|
logger.info("Loading config values");
|
||||||
try(FileInputStream file = new FileInputStream(new File(main.getDataFolder(), "config.yml"))) {
|
try(FileInputStream file = new FileInputStream(new File(main.getDataFolder(), "config.yml"))) {
|
||||||
ConfigLoader loader = new ConfigLoader();
|
ConfigLoader loader = new ConfigLoader();
|
||||||
loader.load(singleton, file);
|
loader.load(this, file);
|
||||||
if(singleton.dumpDefaultConfig && !loaded) { // Don't dump default config if already loaded.
|
if(dumpDefaultConfig) { // Don't dump default config if already loaded.
|
||||||
try(JarFile jar = new JarFile(new File(Terra.class.getProtectionDomain().getCodeSource().getLocation().toURI()))) {
|
try(JarFile jar = new JarFile(new File(Terra.class.getProtectionDomain().getCodeSource().getLocation().toURI()))) {
|
||||||
JarUtil.copyResourcesToDirectory(jar, "packs", new File(main.getDataFolder(), "packs").toString());
|
JarUtil.copyResourcesToDirectory(jar, "packs", new File(main.getDataFolder(), "packs").toString());
|
||||||
} catch(IOException | URISyntaxException e) {
|
} catch(IOException | URISyntaxException e) {
|
||||||
@@ -65,30 +59,29 @@ public class PluginConfig implements ConfigTemplate {
|
|||||||
Debug.error("Report this to Terra!");
|
Debug.error("Report this to Terra!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loaded = true;
|
|
||||||
} catch(ConfigException | IOException e) {
|
} catch(ConfigException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.info("Debug: " + isDebug());
|
logger.info("Debug: " + isDebug());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLanguage() {
|
public String getLanguage() {
|
||||||
return singleton.language;
|
return language;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDebug() {
|
public boolean isDebug() {
|
||||||
return singleton.debug;
|
return debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getDataSaveInterval() {
|
public long getDataSaveInterval() {
|
||||||
return singleton.dataSave.toMillis() / 20L;
|
return dataSave.toMillis() / 20L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getBiomeSearchResolution() {
|
public int getBiomeSearchResolution() {
|
||||||
return singleton.biomeSearch;
|
return biomeSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCacheSize() {
|
public int getCacheSize() {
|
||||||
return singleton.cacheSize;
|
return cacheSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,36 @@
|
|||||||
package com.dfsek.terra.debug;
|
package com.dfsek.terra.debug;
|
||||||
|
|
||||||
import com.dfsek.terra.config.base.PluginConfig;
|
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class Debug {
|
public class Debug {
|
||||||
public static Logger logger;
|
private static Logger logger;
|
||||||
|
private static boolean debug = false;
|
||||||
|
|
||||||
|
public static boolean isDebug() {
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDebug(boolean debug) {
|
||||||
|
Debug.debug = debug;
|
||||||
|
}
|
||||||
|
|
||||||
public static void setLogger(Logger logger) {
|
public static void setLogger(Logger logger) {
|
||||||
Debug.logger = logger;
|
Debug.logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(String message) {
|
public static void info(String message) {
|
||||||
if(PluginConfig.isDebug()) logger.info(message);
|
if(debug) logger.info(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(String message) {
|
public static void warn(String message) {
|
||||||
if(PluginConfig.isDebug()) logger.warning(message);
|
if(debug) logger.warning(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(String message) {
|
public static void error(String message) {
|
||||||
if(PluginConfig.isDebug()) logger.severe(message);
|
if(debug) logger.severe(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void stack(Exception e) {
|
public static void stack(Exception e) {
|
||||||
if(PluginConfig.isDebug()) e.printStackTrace();
|
if(debug) e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
private boolean needsLoad = true;
|
private boolean needsLoad = true;
|
||||||
private final Terra main;
|
private final Terra main;
|
||||||
|
|
||||||
|
public ConfigPack getConfigPack() {
|
||||||
|
return configPack;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public TerraChunkGenerator(ConfigPack c, Terra main) {
|
public TerraChunkGenerator(ConfigPack c, Terra main) {
|
||||||
super(ChunkInterpolator.InterpolationType.TRILINEAR);
|
super(ChunkInterpolator.InterpolationType.TRILINEAR);
|
||||||
popMan = new PopulationManager(main);
|
popMan = new PopulationManager(main);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.dfsek.terra.image;
|
|||||||
import com.dfsek.terra.Terra;
|
import com.dfsek.terra.Terra;
|
||||||
import com.dfsek.terra.biome.BiomeZone;
|
import com.dfsek.terra.biome.BiomeZone;
|
||||||
import com.dfsek.terra.biome.grid.master.TerraBiomeGrid;
|
import com.dfsek.terra.biome.grid.master.TerraBiomeGrid;
|
||||||
import com.dfsek.terra.config.base.PluginConfig;
|
|
||||||
import com.dfsek.terra.debug.gui.DebugGUI;
|
import com.dfsek.terra.debug.gui.DebugGUI;
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -26,7 +25,7 @@ public class ImageLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void debugWorld(boolean genStep, World w, Terra main) {
|
public static void debugWorld(boolean genStep, World w, Terra main) {
|
||||||
if(!PluginConfig.isDebug()) return;
|
if(!main.isDebug()) return;
|
||||||
BufferedImage newImg = new WorldImageGenerator(w, 1024, 1024, main).drawWorld(0, 0).getDraw();
|
BufferedImage newImg = new WorldImageGenerator(w, 1024, 1024, main).drawWorld(0, 0).getDraw();
|
||||||
if(genStep) newImg = redrawStepped(newImg, w, Align.CENTER, main);
|
if(genStep) newImg = redrawStepped(newImg, w, Align.CENTER, main);
|
||||||
DebugGUI debugGUI = new DebugGUI(newImg, main);
|
DebugGUI debugGUI = new DebugGUI(newImg, main);
|
||||||
@@ -61,7 +60,7 @@ public class ImageLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void debug(boolean genStep, World w, Terra main) {
|
public void debug(boolean genStep, World w, Terra main) {
|
||||||
if(!PluginConfig.isDebug()) return;
|
if(!main.isDebug()) return;
|
||||||
BufferedImage newImg = copyImage(image);
|
BufferedImage newImg = copyImage(image);
|
||||||
if(genStep) {
|
if(genStep) {
|
||||||
newImg = redrawStepped(image, w, align, main);
|
newImg = redrawStepped(image, w, align, main);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.dfsek.terra.math;
|
package com.dfsek.terra.math;
|
||||||
|
|
||||||
import com.dfsek.terra.config.base.PluginConfig;
|
|
||||||
import com.dfsek.terra.generation.config.NoiseBuilder;
|
import com.dfsek.terra.generation.config.NoiseBuilder;
|
||||||
import com.dfsek.terra.util.hash.HashMapDoubleDouble;
|
import com.dfsek.terra.util.hash.HashMapDoubleDouble;
|
||||||
import org.polydev.gaea.math.FastNoiseLite;
|
import org.polydev.gaea.math.FastNoiseLite;
|
||||||
@@ -43,7 +42,7 @@ public class NoiseFunction2 implements NoiseFunction {
|
|||||||
|
|
||||||
private static class Cache extends HashMapDoubleDouble {
|
private static class Cache extends HashMapDoubleDouble {
|
||||||
private static final long serialVersionUID = 8915092734723467010L;
|
private static final long serialVersionUID = 8915092734723467010L;
|
||||||
private static final int cacheSize = PluginConfig.getCacheSize();
|
private static final int cacheSize = 384;
|
||||||
|
|
||||||
public double get(FastNoiseLite noise, double x, double z) {
|
public double get(FastNoiseLite noise, double x, double z) {
|
||||||
double xx = x >= 0 ? x * 2 : x * -2 - 1;
|
double xx = x >= 0 ? x * 2 : x * -2 - 1;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
Reference in New Issue
Block a user