mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-23 09:09:15 +00:00
Clean up
This commit is contained in:
@@ -37,7 +37,6 @@ import com.volmit.iris.util.collection.KMap;
|
|||||||
import com.volmit.iris.util.exceptions.IrisException;
|
import com.volmit.iris.util.exceptions.IrisException;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.format.MemoryMonitor;
|
|
||||||
import com.volmit.iris.util.function.NastyRunnable;
|
import com.volmit.iris.util.function.NastyRunnable;
|
||||||
import com.volmit.iris.util.io.FileWatcher;
|
import com.volmit.iris.util.io.FileWatcher;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import com.volmit.iris.util.json.JSONException;
|
|||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -43,6 +41,7 @@ public class IrisSettings {
|
|||||||
private IrisSettingsConcurrency concurrency = new IrisSettingsConcurrency();
|
private IrisSettingsConcurrency concurrency = new IrisSettingsConcurrency();
|
||||||
private IrisSettingsStudio studio = new IrisSettingsStudio();
|
private IrisSettingsStudio studio = new IrisSettingsStudio();
|
||||||
private IrisSettingsPerformance performance = new IrisSettingsPerformance();
|
private IrisSettingsPerformance performance = new IrisSettingsPerformance();
|
||||||
|
|
||||||
public static int getThreadCount(int c) {
|
public static int getThreadCount(int c) {
|
||||||
return switch (c) {
|
return switch (c) {
|
||||||
case -1, -2, -4 -> Runtime.getRuntime().availableProcessors() / -c;
|
case -1, -2, -4 -> Runtime.getRuntime().availableProcessors() / -c;
|
||||||
|
|||||||
@@ -41,16 +41,13 @@ import java.io.IOException;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class ServerConfigurator {
|
public class ServerConfigurator {
|
||||||
public static void configure()
|
public static void configure() {
|
||||||
{
|
|
||||||
IrisSettings.IrisSettingsAutoconfiguration s = IrisSettings.get().getAutoConfiguration();
|
IrisSettings.IrisSettingsAutoconfiguration s = IrisSettings.get().getAutoConfiguration();
|
||||||
if(s.isConfigureSpigotTimeoutTime())
|
if (s.isConfigureSpigotTimeoutTime()) {
|
||||||
{
|
|
||||||
J.attempt(ServerConfigurator::increaseKeepAliveSpigot);
|
J.attempt(ServerConfigurator::increaseKeepAliveSpigot);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(s.isConfigurePaperWatchdogDelay())
|
if (s.isConfigurePaperWatchdogDelay()) {
|
||||||
{
|
|
||||||
J.attempt(ServerConfigurator::increasePaperWatchdog);
|
J.attempt(ServerConfigurator::increasePaperWatchdog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,8 +60,7 @@ public class ServerConfigurator {
|
|||||||
f.load(spigotConfig);
|
f.load(spigotConfig);
|
||||||
long tt = f.getLong("settings.timeout-time");
|
long tt = f.getLong("settings.timeout-time");
|
||||||
|
|
||||||
if(tt < TimeUnit.MINUTES.toSeconds(5))
|
if (tt < TimeUnit.MINUTES.toSeconds(5)) {
|
||||||
{
|
|
||||||
Iris.warn("Updating spigot.yml timeout-time: " + tt + " -> " + TimeUnit.MINUTES.toSeconds(5) + " (5 minutes)");
|
Iris.warn("Updating spigot.yml timeout-time: " + tt + " -> " + TimeUnit.MINUTES.toSeconds(5) + " (5 minutes)");
|
||||||
Iris.warn("You can disable this change (autoconfigureServer) in Iris settings, then change back the value.");
|
Iris.warn("You can disable this change (autoconfigureServer) in Iris settings, then change back the value.");
|
||||||
f.set("settings.timeout-time", TimeUnit.MINUTES.toSeconds(5));
|
f.set("settings.timeout-time", TimeUnit.MINUTES.toSeconds(5));
|
||||||
@@ -78,8 +74,7 @@ public class ServerConfigurator {
|
|||||||
f.load(spigotConfig);
|
f.load(spigotConfig);
|
||||||
long tt = f.getLong("settings.watchdog.early-warning-delay");
|
long tt = f.getLong("settings.watchdog.early-warning-delay");
|
||||||
|
|
||||||
if(tt < TimeUnit.MINUTES.toMillis(3))
|
if (tt < TimeUnit.MINUTES.toMillis(3)) {
|
||||||
{
|
|
||||||
Iris.warn("Updating paper.yml watchdog early-warning-delay: " + tt + " -> " + TimeUnit.MINUTES.toMillis(3) + " (3 minutes)");
|
Iris.warn("Updating paper.yml watchdog early-warning-delay: " + tt + " -> " + TimeUnit.MINUTES.toMillis(3) + " (3 minutes)");
|
||||||
Iris.warn("You can disable this change (autoconfigureServer) in Iris settings, then change back the value.");
|
Iris.warn("You can disable this change (autoconfigureServer) in Iris settings, then change back the value.");
|
||||||
f.set("settings.watchdog.early-warning-delay", TimeUnit.MINUTES.toMillis(3));
|
f.set("settings.watchdog.early-warning-delay", TimeUnit.MINUTES.toMillis(3));
|
||||||
@@ -112,8 +107,7 @@ public class ServerConfigurator {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void installDataPacks(boolean fullInstall)
|
public static void installDataPacks(boolean fullInstall) {
|
||||||
{
|
|
||||||
Iris.info("Checking Data Packs...");
|
Iris.info("Checking Data Packs...");
|
||||||
boolean reboot = false;
|
boolean reboot = false;
|
||||||
File packs = new File("plugins/Iris/packs");
|
File packs = new File("plugins/Iris/packs");
|
||||||
@@ -153,8 +147,7 @@ public class ServerConfigurator {
|
|||||||
|
|
||||||
Iris.info("Data Packs Setup!");
|
Iris.info("Data Packs Setup!");
|
||||||
|
|
||||||
if(fullInstall)
|
if (fullInstall) {
|
||||||
{
|
|
||||||
verifyDataPacksPost(IrisSettings.get().getAutoConfiguration().isAutoRestartOnCustomBiomeInstall());
|
verifyDataPacksPost(IrisSettings.get().getAutoConfiguration().isAutoRestartOnCustomBiomeInstall());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,14 +189,10 @@ public class ServerConfigurator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bad)
|
if (bad) {
|
||||||
{
|
if (allowRestarting) {
|
||||||
if(allowRestarting)
|
|
||||||
{
|
|
||||||
restart();
|
restart();
|
||||||
}
|
} else if (INMS.get().supportsDataPacks()) {
|
||||||
|
|
||||||
else if (INMS.get().supportsDataPacks()) {
|
|
||||||
Iris.error("============================================================================");
|
Iris.error("============================================================================");
|
||||||
Iris.error(C.ITALIC + "You need to restart your server to properly generate custom biomes.");
|
Iris.error(C.ITALIC + "You need to restart your server to properly generate custom biomes.");
|
||||||
Iris.error(C.ITALIC + "By continuing, Iris will use backup biomes in place of the custom biomes.");
|
Iris.error(C.ITALIC + "By continuing, Iris will use backup biomes in place of the custom biomes.");
|
||||||
|
|||||||
@@ -20,15 +20,12 @@ package com.volmit.iris.core.commands;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.service.PreservationSVC;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.IrisDimension;
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
|
||||||
import com.volmit.iris.util.data.KCache;
|
|
||||||
import com.volmit.iris.util.decree.DecreeContext;
|
import com.volmit.iris.util.decree.DecreeContext;
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ import com.volmit.iris.util.math.RNG;
|
|||||||
import com.volmit.iris.util.math.Spiraler;
|
import com.volmit.iris.util.math.Spiraler;
|
||||||
import com.volmit.iris.util.noise.CNG;
|
import com.volmit.iris.util.noise.CNG;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.plugin.IrisService;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.O;
|
import com.volmit.iris.util.scheduling.O;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
@@ -367,7 +366,7 @@ public class CommandStudio implements DecreeExecutor {
|
|||||||
|
|
||||||
@Decree(description = "Hotload a studio", aliases = "reload")
|
@Decree(description = "Hotload a studio", aliases = "reload")
|
||||||
public void hotload() {
|
public void hotload() {
|
||||||
if (!Iris.service(StudioSVC.class).isProjectOpen()){
|
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||||
sender().sendMessage(C.RED + "No studio world open!");
|
sender().sendMessage(C.RED + "No studio world open!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import com.volmit.iris.core.pregenerator.IrisPregenerator;
|
|||||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
@@ -35,7 +34,6 @@ import com.volmit.iris.util.math.M;
|
|||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.Looper;
|
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
@@ -46,7 +44,6 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.KeyListener;
|
import java.awt.event.KeyListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -72,9 +69,9 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
private JFrame frame;
|
private JFrame frame;
|
||||||
private PregenRenderer renderer;
|
private PregenRenderer renderer;
|
||||||
private int rgc = 0;
|
private int rgc = 0;
|
||||||
private ChronoLatch cl = new ChronoLatch(TimeUnit.MINUTES.toMillis(1));
|
private final ChronoLatch cl = new ChronoLatch(TimeUnit.MINUTES.toMillis(1));
|
||||||
private String[] info;
|
private String[] info;
|
||||||
private Engine engine;
|
private final Engine engine;
|
||||||
|
|
||||||
public PregeneratorJob(PregenTask task, PregeneratorMethod method, Engine engine) {
|
public PregeneratorJob(PregenTask task, PregeneratorMethod method, Engine engine) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
@@ -101,8 +98,7 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
J.a(this.pregenerator::start, 20);
|
J.a(this.pregenerator::start, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mantle getMantle()
|
public Mantle getMantle() {
|
||||||
{
|
|
||||||
return pregenerator.getMantle();
|
return pregenerator.getMantle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,8 +239,7 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkGenerating(int x, int z) {
|
public void onChunkGenerating(int x, int z) {
|
||||||
if(engine != null)
|
if (engine != null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,8 +248,7 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkGenerated(int x, int z) {
|
public void onChunkGenerated(int x, int z) {
|
||||||
if(engine != null)
|
if (engine != null) {
|
||||||
{
|
|
||||||
draw(x, z, engine.draw((x << 4) + 8, (z << 4) + 8));
|
draw(x, z, engine.draw((x << 4) + 8, (z << 4) + 8));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -269,8 +263,7 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void shouldGc() {
|
private void shouldGc() {
|
||||||
if(cl.flip() && rgc > 16)
|
if (cl.flip() && rgc > 16) {
|
||||||
{
|
|
||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -329,8 +322,7 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkExistsInRegionGen(int x, int z) {
|
public void onChunkExistsInRegionGen(int x, int z) {
|
||||||
if(engine != null)
|
if (engine != null) {
|
||||||
{
|
|
||||||
draw(x, z, engine.draw((x << 4) + 8, (z << 4) + 8));
|
draw(x, z, engine.draw((x << 4) + 8, (z << 4) + 8));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ import com.volmit.iris.util.collection.KMap;
|
|||||||
import com.volmit.iris.util.context.IrisContext;
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.IrisMatter;
|
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -22,14 +22,8 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.engine.object.IrisObject;
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.data.KCache;
|
import com.volmit.iris.util.data.KCache;
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.math.M;
|
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -127,7 +121,7 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject> {
|
|||||||
return load(name, true);
|
return load(name, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IrisObject loadRaw(String name){
|
private IrisObject loadRaw(String name) {
|
||||||
for (File i : getFolders(name)) {
|
for (File i : getFolders(name)) {
|
||||||
for (File j : i.listFiles()) {
|
for (File j : i.listFiles()) {
|
||||||
if (j.isFile() && j.getName().endsWith(".iob") && j.getName().split("\\Q.\\E")[0].equals(name)) {
|
if (j.isFile() && j.getName().endsWith(".iob") && j.getName().split("\\Q.\\E")[0].equals(name)) {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import com.volmit.iris.core.project.SchemaBuilder;
|
|||||||
import com.volmit.iris.core.service.PreservationSVC;
|
import com.volmit.iris.core.service.PreservationSVC;
|
||||||
import com.volmit.iris.engine.framework.MeteredCache;
|
import com.volmit.iris.engine.framework.MeteredCache;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.data.KCache;
|
import com.volmit.iris.util.data.KCache;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
@@ -34,7 +33,6 @@ import com.volmit.iris.util.io.IO;
|
|||||||
import com.volmit.iris.util.json.JSONArray;
|
import com.volmit.iris.util.json.JSONArray;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.IrisLock;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -238,8 +236,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
|
|||||||
return load(name, true);
|
return load(name, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private T loadRaw(String name)
|
private T loadRaw(String name) {
|
||||||
{
|
|
||||||
for (File i : getFolders(name)) {
|
for (File i : getFolders(name)) {
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
for (File j : i.listFiles()) {
|
for (File j : i.listFiles()) {
|
||||||
|
|||||||
@@ -113,8 +113,7 @@ public class ScriptResourceLoader extends ResourceLoader<IrisScript> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IrisScript loadRaw(String name)
|
private IrisScript loadRaw(String name) {
|
||||||
{
|
|
||||||
for (File i : getFolders(name)) {
|
for (File i : getFolders(name)) {
|
||||||
for (File j : i.listFiles()) {
|
for (File j : i.listFiles()) {
|
||||||
if (j.isFile() && j.getName().endsWith(".js") && j.getName().split("\\Q.\\E")[0].equals(name)) {
|
if (j.isFile() && j.getName().endsWith(".js") && j.getName().split("\\Q.\\E")[0].equals(name)) {
|
||||||
|
|||||||
@@ -18,28 +18,20 @@
|
|||||||
|
|
||||||
package com.volmit.iris.core.pregenerator;
|
package com.volmit.iris.core.pregenerator;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
|
||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.math.Spiraled;
|
import com.volmit.iris.util.math.Spiraled;
|
||||||
import com.volmit.iris.util.math.Spiraler;
|
import com.volmit.iris.util.math.Spiraler;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.checkerframework.checker.units.qual.K;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
@Builder
|
@Builder
|
||||||
@Data
|
@Data
|
||||||
public class PregenTask {
|
public class PregenTask {
|
||||||
private static final Position2 ZERO = new Position2(0,0);
|
private static final Position2 ZERO = new Position2(0, 0);
|
||||||
private static final KList<Position2> ORDER_CENTER = computeChunkOrder();
|
private static final KList<Position2> ORDER_CENTER = computeChunkOrder();
|
||||||
private static final KMap<Position2, KList<Position2>> ORDERS = new KMap<>();
|
private static final KMap<Position2, KList<Position2>> ORDERS = new KMap<>();
|
||||||
|
|
||||||
@@ -57,7 +49,7 @@ public class PregenTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void iterateRegion(int xr, int zr, Spiraled s) {
|
public static void iterateRegion(int xr, int zr, Spiraled s) {
|
||||||
iterateRegion(xr, zr, s, new Position2(0,0));
|
iterateRegion(xr, zr, s, new Position2(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static KList<Position2> computeOrder(Position2 pull) {
|
private static KList<Position2> computeOrder(Position2 pull) {
|
||||||
|
|||||||
@@ -133,8 +133,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mantle getMantle() {
|
public Mantle getMantle() {
|
||||||
if(IrisToolbelt.isIrisWorld(world))
|
if (IrisToolbelt.isIrisWorld(world)) {
|
||||||
{
|
|
||||||
return IrisToolbelt.access(world).getEngine().getMantle().getMantle();
|
return IrisToolbelt.access(world).getEngine().getMantle().getMantle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,8 +102,7 @@ public class HybridPregenMethod implements PregeneratorMethod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mantle getMantle() {
|
public Mantle getMantle() {
|
||||||
if (headless == null)
|
if (headless == null) {
|
||||||
{
|
|
||||||
return inWorld.getMantle();
|
return inWorld.getMantle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,8 +111,7 @@ public class MedievalPregenMethod implements PregeneratorMethod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mantle getMantle() {
|
public Mantle getMantle() {
|
||||||
if(IrisToolbelt.isIrisWorld(world))
|
if (IrisToolbelt.isIrisWorld(world)) {
|
||||||
{
|
|
||||||
return IrisToolbelt.access(world).getEngine().getMantle().getMantle();
|
return IrisToolbelt.access(world).getEngine().getMantle().getMantle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,22 +19,16 @@
|
|||||||
package com.volmit.iris.core.service;
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.framework.MeteredCache;
|
import com.volmit.iris.engine.framework.MeteredCache;
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
import com.volmit.iris.util.data.KCache;
|
import com.volmit.iris.util.data.KCache;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.plugin.IrisService;
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.scheduling.Looper;
|
import com.volmit.iris.util.scheduling.Looper;
|
||||||
import com.volmit.iris.util.stream.utility.CachedStream2D;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -57,27 +51,24 @@ public class PreservationSVC implements IrisService {
|
|||||||
services.add(service);
|
services.add(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printCaches()
|
public void printCaches() {
|
||||||
{
|
|
||||||
long s = caches.stream().filter(i -> !i.isClosed()).mapToLong(MeteredCache::getSize).sum();
|
long s = caches.stream().filter(i -> !i.isClosed()).mapToLong(MeteredCache::getSize).sum();
|
||||||
long m = caches.stream().filter(i -> !i.isClosed()).mapToLong(MeteredCache::getMaxSize).sum();
|
long m = caches.stream().filter(i -> !i.isClosed()).mapToLong(MeteredCache::getMaxSize).sum();
|
||||||
double p = 0;
|
double p = 0;
|
||||||
double mf = 0;
|
double mf = 0;
|
||||||
|
|
||||||
for(MeteredCache i : caches)
|
for (MeteredCache i : caches) {
|
||||||
{
|
if (i.isClosed()) {
|
||||||
if(i.isClosed())
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mf++;
|
mf++;
|
||||||
p+= i.getUsage();
|
p += i.getUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
mf = mf == 0 ? 1 : mf;
|
mf = mf == 0 ? 1 : mf;
|
||||||
|
|
||||||
Iris.info("Cached " + Form.f(s) + " / " + Form.f(m) + " (" + Form.pc(p/mf) + ") from " + caches.size() + " Caches");
|
Iris.info("Cached " + Form.f(s) + " / " + Form.f(m) + " (" + Form.pc(p / mf) + ") from " + caches.size() + " Caches");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dereference() {
|
public void dereference() {
|
||||||
@@ -131,8 +122,7 @@ public class PreservationSVC implements IrisService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateCaches()
|
public void updateCaches() {
|
||||||
{
|
|
||||||
caches.removeIf(MeteredCache::isClosed);
|
caches.removeIf(MeteredCache::isClosed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,30 +21,20 @@ package com.volmit.iris.engine;
|
|||||||
import com.google.common.util.concurrent.AtomicDouble;
|
import com.google.common.util.concurrent.AtomicDouble;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
|
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
import com.volmit.iris.core.gui.PregeneratorJob;
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
import com.volmit.iris.core.project.IrisProject;
|
||||||
import com.volmit.iris.core.service.PreservationSVC;
|
import com.volmit.iris.core.service.PreservationSVC;
|
||||||
import com.volmit.iris.engine.actuator.IrisBiomeActuator;
|
|
||||||
import com.volmit.iris.engine.actuator.IrisDecorantActuator;
|
|
||||||
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
|
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineEffects;
|
import com.volmit.iris.engine.framework.EngineEffects;
|
||||||
import com.volmit.iris.engine.framework.EngineMetrics;
|
import com.volmit.iris.engine.framework.EngineMetrics;
|
||||||
import com.volmit.iris.engine.framework.EngineMode;
|
import com.volmit.iris.engine.framework.EngineMode;
|
||||||
import com.volmit.iris.engine.framework.EngineStage;
|
|
||||||
import com.volmit.iris.engine.framework.EngineTarget;
|
import com.volmit.iris.engine.framework.EngineTarget;
|
||||||
import com.volmit.iris.engine.framework.EngineWorldManager;
|
import com.volmit.iris.engine.framework.EngineWorldManager;
|
||||||
import com.volmit.iris.engine.framework.SeedManager;
|
import com.volmit.iris.engine.framework.SeedManager;
|
||||||
import com.volmit.iris.engine.framework.WrongEngineBroException;
|
import com.volmit.iris.engine.framework.WrongEngineBroException;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.mode.ModeOverworld;
|
|
||||||
import com.volmit.iris.engine.modifier.IrisCarveModifier;
|
|
||||||
import com.volmit.iris.engine.modifier.IrisDepositModifier;
|
|
||||||
import com.volmit.iris.engine.modifier.IrisPerfectionModifier;
|
|
||||||
import com.volmit.iris.engine.modifier.IrisPostModifier;
|
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
|
import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
|
||||||
import com.volmit.iris.engine.object.IrisDecorator;
|
import com.volmit.iris.engine.object.IrisDecorator;
|
||||||
@@ -53,10 +43,8 @@ import com.volmit.iris.engine.object.IrisJigsawStructure;
|
|||||||
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
|
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
|
||||||
import com.volmit.iris.util.atomics.AtomicRollingSequence;
|
import com.volmit.iris.util.atomics.AtomicRollingSequence;
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
import com.volmit.iris.util.data.B;
|
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
@@ -65,8 +53,6 @@ import com.volmit.iris.util.io.IO;
|
|||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.MatterCavern;
|
|
||||||
import com.volmit.iris.util.matter.MatterFluidBody;
|
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
@@ -196,8 +182,7 @@ public class IrisEngine implements Engine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupMode() {
|
private void setupMode() {
|
||||||
if(mode != null)
|
if (mode != null) {
|
||||||
{
|
|
||||||
mode.close();
|
mode.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,7 +447,7 @@ public class IrisEngine implements Engine {
|
|||||||
mode.generate(x, z, blocks, vbiomes, multicore);
|
mode.generate(x, z, blocks, vbiomes, multicore);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMantle().getMantle().flag(x>>4, z>>4, MantleFlag.REAL, true);
|
getMantle().getMantle().flag(x >> 4, z >> 4, MantleFlag.REAL, true);
|
||||||
getMetrics().getTotal().put(p.getMilliseconds());
|
getMetrics().getTotal().put(p.getMilliseconds());
|
||||||
generated.incrementAndGet();
|
generated.incrementAndGet();
|
||||||
recycle();
|
recycle();
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package com.volmit.iris.engine;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.engine.data.cache.Multicache;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineAssignedWorldManager;
|
import com.volmit.iris.engine.framework.EngineAssignedWorldManager;
|
||||||
import com.volmit.iris.engine.object.IRare;
|
import com.volmit.iris.engine.object.IRare;
|
||||||
@@ -43,8 +42,6 @@ import com.volmit.iris.util.mantle.Mantle;
|
|||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.MatterCavern;
|
|
||||||
import com.volmit.iris.util.matter.MatterFluidBody;
|
|
||||||
import com.volmit.iris.util.matter.MatterMarker;
|
import com.volmit.iris.util.matter.MatterMarker;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.plugin.Chunks;
|
import com.volmit.iris.util.plugin.Chunks;
|
||||||
@@ -56,10 +53,8 @@ import com.volmit.iris.util.scheduling.jobs.QueueJob;
|
|||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -68,7 +63,6 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
|||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -76,7 +70,6 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -133,8 +126,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
getEngine().getWorld().tryGetRealWorld();
|
getEngine().getWorld().tryGetRealWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!IrisSettings.get().getWorld().isMarkerEntitySpawningSystem() && !IrisSettings.get().getWorld().isAnbientEntitySpawningSystem())
|
if (!IrisSettings.get().getWorld().isMarkerEntitySpawningSystem() && !IrisSettings.get().getWorld().isAnbientEntitySpawningSystem()) {
|
||||||
{
|
|
||||||
return 3000;
|
return 3000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,13 +193,11 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
for (int z = -r; z <= r; z++) {
|
for (int z = -r; z <= r; z++) {
|
||||||
if (c.getWorld().isChunkLoaded(c.getX() + x, c.getZ() + z) && Chunks.isSafe(getEngine().getWorld().realWorld(), c.getX() + x, c.getZ() + z)) {
|
if (c.getWorld().isChunkLoaded(c.getX() + x, c.getZ() + z) && Chunks.isSafe(getEngine().getWorld().realWorld(), c.getX() + x, c.getZ() + z)) {
|
||||||
|
|
||||||
if(IrisSettings.get().getWorld().isPostLoadBlockUpdates())
|
if (IrisSettings.get().getWorld().isPostLoadBlockUpdates()) {
|
||||||
{
|
|
||||||
getEngine().updateChunk(c.getWorld().getChunkAt(c.getX() + x, c.getZ() + z));
|
getEngine().updateChunk(c.getWorld().getChunkAt(c.getX() + x, c.getZ() + z));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IrisSettings.get().getWorld().isMarkerEntitySpawningSystem())
|
if (IrisSettings.get().getWorld().isMarkerEntitySpawningSystem()) {
|
||||||
{
|
|
||||||
Chunk cx = getEngine().getWorld().realWorld().getChunkAt(c.getX() + x, c.getZ() + z);
|
Chunk cx = getEngine().getWorld().realWorld().getChunkAt(c.getX() + x, c.getZ() + z);
|
||||||
int finalX = c.getX() + x;
|
int finalX = c.getX() + x;
|
||||||
int finalZ = c.getZ() + z;
|
int finalZ = c.getZ() + z;
|
||||||
@@ -299,8 +289,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void spawnIn(Chunk c, boolean initial) {
|
private void spawnIn(Chunk c, boolean initial) {
|
||||||
if(getEngine().isClosed())
|
if (getEngine().isClosed()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,8 +319,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
.popRandom(RNG.r) : null;
|
.popRandom(RNG.r) : null;
|
||||||
//@done
|
//@done
|
||||||
|
|
||||||
if(IrisSettings.get().getWorld().isMarkerEntitySpawningSystem())
|
if (IrisSettings.get().getWorld().isMarkerEntitySpawningSystem()) {
|
||||||
{
|
|
||||||
getSpawnersFromMarkers(c).forEach((block, spawners) -> {
|
getSpawnersFromMarkers(c).forEach((block, spawners) -> {
|
||||||
if (spawners.isEmpty()) {
|
if (spawners.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -496,8 +484,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkLoad(Chunk e, boolean generated) {
|
public void onChunkLoad(Chunk e, boolean generated) {
|
||||||
if(getEngine().isClosed())
|
if (getEngine().isClosed()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,8 +494,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void spawn(IrisPosition block, IrisSpawner spawner, boolean initial) {
|
private void spawn(IrisPosition block, IrisSpawner spawner, boolean initial) {
|
||||||
if(getEngine().isClosed())
|
if (getEngine().isClosed()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,8 +524,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void teleportAsync(PlayerTeleportEvent e) {
|
public void teleportAsync(PlayerTeleportEvent e) {
|
||||||
if(IrisSettings.get().getWorld().getAsyncTeleport().isEnabled())
|
if (IrisSettings.get().getWorld().getAsyncTeleport().isEnabled()) {
|
||||||
{
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
warmupAreaAsync(e.getPlayer(), e.getTo(), () -> J.s(() -> {
|
warmupAreaAsync(e.getPlayer(), e.getTo(), () -> J.s(() -> {
|
||||||
ignoreTP.set(true);
|
ignoreTP.set(true);
|
||||||
@@ -553,15 +538,12 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
J.a(() -> {
|
J.a(() -> {
|
||||||
int viewDistance = IrisSettings.get().getWorld().getAsyncTeleport().getLoadViewDistance();
|
int viewDistance = IrisSettings.get().getWorld().getAsyncTeleport().getLoadViewDistance();
|
||||||
KList<Future<Chunk>> futures = new KList<>();
|
KList<Future<Chunk>> futures = new KList<>();
|
||||||
for(int i = -viewDistance; i <= viewDistance; i++)
|
for (int i = -viewDistance; i <= viewDistance; i++) {
|
||||||
{
|
for (int j = -viewDistance; j <= viewDistance; j++) {
|
||||||
for(int j = -viewDistance; j <= viewDistance; j++)
|
|
||||||
{
|
|
||||||
int finalJ = j;
|
int finalJ = j;
|
||||||
int finalI = i;
|
int finalI = i;
|
||||||
|
|
||||||
if(to.getWorld().isChunkLoaded((to.getBlockX() >> 4) + i, (to.getBlockZ() >> 4) + j))
|
if (to.getWorld().isChunkLoaded((to.getBlockX() >> 4) + i, (to.getBlockZ() >> 4) + j)) {
|
||||||
{
|
|
||||||
futures.add(CompletableFuture.completedFuture(null));
|
futures.add(CompletableFuture.completedFuture(null));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import com.volmit.iris.core.gui.components.Renderer;
|
|||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.engine.IrisComplex;
|
import com.volmit.iris.engine.IrisComplex;
|
||||||
import com.volmit.iris.engine.IrisWorldManager;
|
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.engine.data.chunk.TerrainChunk;
|
import com.volmit.iris.engine.data.chunk.TerrainChunk;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
@@ -61,7 +60,6 @@ import com.volmit.iris.util.math.M;
|
|||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.MatterCavern;
|
import com.volmit.iris.util.matter.MatterCavern;
|
||||||
import com.volmit.iris.util.matter.MatterFluidBody;
|
|
||||||
import com.volmit.iris.util.matter.MatterUpdate;
|
import com.volmit.iris.util.matter.MatterUpdate;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
@@ -74,13 +72,11 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.EnderSignal;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@@ -794,12 +790,10 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
}
|
}
|
||||||
|
|
||||||
default void gotoJigsaw(IrisJigsawStructure s, Player player) {
|
default void gotoJigsaw(IrisJigsawStructure s, Player player) {
|
||||||
if(s.getLoadKey().equals(getDimension().getStronghold()))
|
if (s.getLoadKey().equals(getDimension().getStronghold())) {
|
||||||
{
|
|
||||||
KList<Position2> p = getDimension().getStrongholds(getSeedManager().getSpawn());
|
KList<Position2> p = getDimension().getStrongholds(getSeedManager().getSpawn());
|
||||||
|
|
||||||
if(p.isEmpty())
|
if (p.isEmpty()) {
|
||||||
{
|
|
||||||
player.sendMessage(C.GOLD + "No strongholds in world.");
|
player.sendMessage(C.GOLD + "No strongholds in world.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -905,10 +899,8 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
Locator.region(r.getLoadKey()).find(player);
|
Locator.region(r.getLoadKey()).find(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void cleanupMantleChunk(int x, int z)
|
default void cleanupMantleChunk(int x, int z) {
|
||||||
{
|
if (IrisSettings.get().getPerformance().isTrimMantleInStudio() || !isStudio()) {
|
||||||
if(IrisSettings.get().getPerformance().isTrimMantleInStudio() || !isStudio())
|
|
||||||
{
|
|
||||||
J.a(() -> getMantle().cleanupChunk(x, z));
|
J.a(() -> getMantle().cleanupChunk(x, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,26 +71,19 @@ public abstract class EngineAssignedWorldManager extends EngineAssignedComponent
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void on(PlayerTeleportEvent e) {
|
public void on(PlayerTeleportEvent e) {
|
||||||
if(ignoreTP.get())
|
if (ignoreTP.get()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!PaperLib.isPaper() || e.getTo() == null)
|
if (!PaperLib.isPaper() || e.getTo() == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
if (e.getTo().getWorld().equals(getTarget().getWorld().realWorld())) {
|
||||||
if(e.getTo().getWorld().equals(getTarget().getWorld().realWorld()))
|
|
||||||
{
|
|
||||||
getEngine().getWorldManager().teleportAsync(e);
|
getEngine().getWorldManager().teleportAsync(e);
|
||||||
}
|
}
|
||||||
}
|
} catch (Throwable ex) {
|
||||||
|
|
||||||
catch(Throwable ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,19 +32,16 @@ public interface EngineMode extends Staged {
|
|||||||
|
|
||||||
Engine getEngine();
|
Engine getEngine();
|
||||||
|
|
||||||
default MultiBurst burst()
|
default MultiBurst burst() {
|
||||||
{
|
|
||||||
return getEngine().burst();
|
return getEngine().burst();
|
||||||
}
|
}
|
||||||
|
|
||||||
default EngineStage burst(EngineStage... stages)
|
default EngineStage burst(EngineStage... stages) {
|
||||||
{
|
|
||||||
return (x, z, blocks, biomes, multicore) -> {
|
return (x, z, blocks, biomes, multicore) -> {
|
||||||
BurstExecutor e = burst().burst(stages.length);
|
BurstExecutor e = burst().burst(stages.length);
|
||||||
e.setMulticore(multicore);
|
e.setMulticore(multicore);
|
||||||
|
|
||||||
for(EngineStage i : stages)
|
for (EngineStage i : stages) {
|
||||||
{
|
|
||||||
e.queue(() -> i.generate(x, z, blocks, biomes, multicore));
|
e.queue(() -> i.generate(x, z, blocks, biomes, multicore));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,13 +49,11 @@ public interface EngineMode extends Staged {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
default IrisComplex getComplex()
|
default IrisComplex getComplex() {
|
||||||
{
|
|
||||||
return getEngine().getComplex();
|
return getEngine().getComplex();
|
||||||
}
|
}
|
||||||
|
|
||||||
default EngineMantle getMantle()
|
default EngineMantle getMantle() {
|
||||||
{
|
|
||||||
return getEngine().getMantle();
|
return getEngine().getMantle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,8 +62,7 @@ public interface EngineMode extends Staged {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
default void generate(int x, int z, Hunk<BlockData> blocks, Hunk<Biome> biomes, boolean multicore)
|
default void generate(int x, int z, Hunk<BlockData> blocks, Hunk<Biome> biomes, boolean multicore) {
|
||||||
{
|
|
||||||
for (EngineStage i : getStages()) {
|
for (EngineStage i : getStages()) {
|
||||||
i.generate(x, z, blocks, biomes, multicore);
|
i.generate(x, z, blocks, biomes, multicore);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,18 +25,15 @@ public abstract class IrisEngineMode implements EngineMode {
|
|||||||
private final KList<EngineStage> stages;
|
private final KList<EngineStage> stages;
|
||||||
private boolean closed;
|
private boolean closed;
|
||||||
|
|
||||||
public IrisEngineMode(Engine engine)
|
public IrisEngineMode(Engine engine) {
|
||||||
{
|
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.stages = new KList<>();
|
this.stages = new KList<>();
|
||||||
this.closed = false;
|
this.closed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void close()
|
public synchronized void close() {
|
||||||
{
|
if (closed) {
|
||||||
if(closed)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,17 +20,15 @@ package com.volmit.iris.engine.framework;
|
|||||||
|
|
||||||
import com.volmit.iris.util.data.KCache;
|
import com.volmit.iris.util.data.KCache;
|
||||||
|
|
||||||
public interface MeteredCache
|
public interface MeteredCache {
|
||||||
{
|
|
||||||
long getSize();
|
long getSize();
|
||||||
|
|
||||||
KCache<?, ?> getRawCache();
|
KCache<?, ?> getRawCache();
|
||||||
|
|
||||||
long getMaxSize();
|
long getMaxSize();
|
||||||
|
|
||||||
default double getUsage()
|
default double getUsage() {
|
||||||
{
|
return (double) getSize() / (double) getMaxSize();
|
||||||
return (double)getSize() / (double)getMaxSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isClosed();
|
boolean isClosed();
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ public interface Staged {
|
|||||||
|
|
||||||
void registerStage(EngineStage stage);
|
void registerStage(EngineStage stage);
|
||||||
|
|
||||||
default void dump()
|
default void dump() {
|
||||||
{
|
|
||||||
getStages().forEach(EngineStage::close);
|
getStages().forEach(EngineStage::close);
|
||||||
getStages().clear();
|
getStages().clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.mantle;
|
package com.volmit.iris.engine.mantle;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.IrisComplex;
|
import com.volmit.iris.engine.IrisComplex;
|
||||||
@@ -46,12 +45,9 @@ import com.volmit.iris.util.matter.MatterMarker;
|
|||||||
import com.volmit.iris.util.matter.slices.UpdateMatter;
|
import com.volmit.iris.util.matter.slices.UpdateMatter;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import io.papermc.lib.PaperLib;
|
|
||||||
import org.bukkit.block.TileState;
|
import org.bukkit.block.TileState;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
// TODO: MOVE PLACER OUT OF MATTER INTO ITS OWN THING
|
// TODO: MOVE PLACER OUT OF MATTER INTO ITS OWN THING
|
||||||
@@ -269,16 +265,14 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
|
|
||||||
MantleObjectComponent getObjectComponent();
|
MantleObjectComponent getObjectComponent();
|
||||||
|
|
||||||
default boolean isCovered(int x, int z)
|
default boolean isCovered(int x, int z) {
|
||||||
{
|
|
||||||
int s = getRealRadius();
|
int s = getRealRadius();
|
||||||
|
|
||||||
for (int i = -s; i <= s; i++) {
|
for (int i = -s; i <= s; i++) {
|
||||||
for (int j = -s; j <= s; j++) {
|
for (int j = -s; j <= s; j++) {
|
||||||
int xx = i + x;
|
int xx = i + x;
|
||||||
int zz = j + z;
|
int zz = j + z;
|
||||||
if(!getMantle().hasFlag(xx, zz, MantleFlag.REAL))
|
if (!getMantle().hasFlag(xx, zz, MantleFlag.REAL)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,10 +281,8 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
default void cleanupChunk(int x, int z)
|
default void cleanupChunk(int x, int z) {
|
||||||
{
|
if (!getMantle().hasFlag(x, z, MantleFlag.CLEANED) && isCovered(x, z)) {
|
||||||
if(!getMantle().hasFlag(x, z, MantleFlag.CLEANED) && isCovered(x, z))
|
|
||||||
{
|
|
||||||
getMantle().raiseFlag(x, z, MantleFlag.CLEANED, () -> {
|
getMantle().raiseFlag(x, z, MantleFlag.CLEANED, () -> {
|
||||||
getMantle().deleteChunkSlice(x, z, BlockData.class);
|
getMantle().deleteChunkSlice(x, z, BlockData.class);
|
||||||
getMantle().deleteChunkSlice(x, z, String.class);
|
getMantle().deleteChunkSlice(x, z, String.class);
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ import com.volmit.iris.engine.framework.EngineMode;
|
|||||||
import com.volmit.iris.engine.framework.IrisEngineMode;
|
import com.volmit.iris.engine.framework.IrisEngineMode;
|
||||||
|
|
||||||
public class ModeEnclosure extends IrisEngineMode implements EngineMode {
|
public class ModeEnclosure extends IrisEngineMode implements EngineMode {
|
||||||
public ModeEnclosure(Engine engine)
|
public ModeEnclosure(Engine engine) {
|
||||||
{
|
|
||||||
super(engine);
|
super(engine);
|
||||||
var terrain = new IrisTerrainNormalActuator(getEngine());
|
var terrain = new IrisTerrainNormalActuator(getEngine());
|
||||||
var biome = new IrisBiomeActuator(getEngine());
|
var biome = new IrisBiomeActuator(getEngine());
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ import com.volmit.iris.engine.framework.EngineMode;
|
|||||||
import com.volmit.iris.engine.framework.IrisEngineMode;
|
import com.volmit.iris.engine.framework.IrisEngineMode;
|
||||||
|
|
||||||
public class ModeIslands extends IrisEngineMode implements EngineMode {
|
public class ModeIslands extends IrisEngineMode implements EngineMode {
|
||||||
public ModeIslands(Engine engine)
|
public ModeIslands(Engine engine) {
|
||||||
{
|
|
||||||
super(engine);
|
super(engine);
|
||||||
var terrain = new IrisTerrainNormalActuator(getEngine());
|
var terrain = new IrisTerrainNormalActuator(getEngine());
|
||||||
var biome = new IrisBiomeActuator(getEngine());
|
var biome = new IrisBiomeActuator(getEngine());
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ import com.volmit.iris.engine.modifier.IrisPostModifier;
|
|||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
public class ModeOverworld extends IrisEngineMode implements EngineMode {
|
public class ModeOverworld extends IrisEngineMode implements EngineMode {
|
||||||
public ModeOverworld(Engine engine)
|
public ModeOverworld(Engine engine) {
|
||||||
{
|
|
||||||
super(engine);
|
super(engine);
|
||||||
var terrain = new IrisTerrainNormalActuator(getEngine());
|
var terrain = new IrisTerrainNormalActuator(getEngine());
|
||||||
var biome = new IrisBiomeActuator(getEngine());
|
var biome = new IrisBiomeActuator(getEngine());
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ import com.volmit.iris.engine.framework.EngineMode;
|
|||||||
import com.volmit.iris.engine.framework.IrisEngineMode;
|
import com.volmit.iris.engine.framework.IrisEngineMode;
|
||||||
|
|
||||||
public class ModeSuperFlat extends IrisEngineMode implements EngineMode {
|
public class ModeSuperFlat extends IrisEngineMode implements EngineMode {
|
||||||
public ModeSuperFlat(Engine engine)
|
public ModeSuperFlat(Engine engine) {
|
||||||
{
|
|
||||||
super(engine);
|
super(engine);
|
||||||
var terrain = new IrisTerrainNormalActuator(getEngine());
|
var terrain = new IrisTerrainNormalActuator(getEngine());
|
||||||
var biome = new IrisBiomeActuator(getEngine());
|
var biome = new IrisBiomeActuator(getEngine());
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import com.volmit.iris.util.math.RNG;
|
|||||||
import com.volmit.iris.util.matter.MatterCavern;
|
import com.volmit.iris.util.matter.MatterCavern;
|
||||||
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import com.volmit.iris.util.stream.utility.CachedStream2D;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@@ -237,8 +236,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
|
|
||||||
blocks = biome.generateCeilingLayers(getDimension(), xx, zz, rng, 3, zone.ceiling, getData(), getComplex());
|
blocks = biome.generateCeilingLayers(getDimension(), xx, zz, rng, 3, zone.ceiling, getData(), getComplex());
|
||||||
|
|
||||||
if(zone.ceiling + 1 < mantle.getWorldHeight())
|
if (zone.ceiling + 1 < mantle.getWorldHeight()) {
|
||||||
{
|
|
||||||
for (int i = 0; i < zone.ceiling + 1; i++) {
|
for (int i = 0; i < zone.ceiling + 1; i++) {
|
||||||
if (!blocks.hasIndex(i)) {
|
if (!blocks.hasIndex(i)) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
|
||||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -18,7 +18,12 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -44,13 +44,11 @@ public enum IrisDimensionModeType {
|
|||||||
;
|
;
|
||||||
private final Function<Engine, EngineMode> factory;
|
private final Function<Engine, EngineMode> factory;
|
||||||
|
|
||||||
IrisDimensionModeType(Function<Engine, EngineMode> factory)
|
IrisDimensionModeType(Function<Engine, EngineMode> factory) {
|
||||||
{
|
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EngineMode create(Engine e)
|
public EngineMode create(Engine e) {
|
||||||
{
|
|
||||||
return factory.apply(e);
|
return factory.apply(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,13 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ import com.volmit.iris.engine.object.annotations.MinNumber;
|
|||||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
import com.volmit.iris.engine.object.annotations.Required;
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.MatterFluidBody;
|
|
||||||
import com.volmit.iris.util.noise.CNG;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ import com.volmit.iris.engine.object.annotations.MinNumber;
|
|||||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
import com.volmit.iris.engine.object.annotations.Required;
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.MatterFluidBody;
|
|
||||||
import com.volmit.iris.util.noise.CNG;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import com.volmit.iris.engine.framework.Engine;
|
|||||||
import com.volmit.iris.engine.framework.EngineTarget;
|
import com.volmit.iris.engine.framework.EngineTarget;
|
||||||
import com.volmit.iris.engine.object.HeadlessWorld;
|
import com.volmit.iris.engine.object.HeadlessWorld;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
|
||||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||||
import com.volmit.iris.util.documentation.RegionCoordinates;
|
import com.volmit.iris.util.documentation.RegionCoordinates;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
@@ -41,7 +40,6 @@ import com.volmit.iris.util.nbt.mca.NBTWorld;
|
|||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -51,7 +49,6 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -135,21 +132,19 @@ public class HeadlessGenerator implements PlatformChunkGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Position2 avgLast(int x, int z) {
|
private Position2 avgLast(int x, int z) {
|
||||||
while(last.size() > 3)
|
while (last.size() > 3) {
|
||||||
{
|
|
||||||
last.remove(0);
|
last.remove(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
double xx = 0;
|
double xx = 0;
|
||||||
double zz = 0;
|
double zz = 0;
|
||||||
|
|
||||||
for(Position2 i : last)
|
for (Position2 i : last) {
|
||||||
{
|
|
||||||
xx += 27 * (i.getX() - x);
|
xx += 27 * (i.getX() - x);
|
||||||
zz += 27 * (i.getZ() - z);
|
zz += 27 * (i.getZ() - z);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Position2((int)xx, (int)zz);
|
return new Position2((int) xx, (int) zz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RegionCoordinates
|
@RegionCoordinates
|
||||||
|
|||||||
@@ -42,12 +42,9 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
|
|||||||
put(gMap);
|
put(gMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public K getKey(V value)
|
public K getKey(V value) {
|
||||||
{
|
for (KeyPair<K, V> i : keypair()) {
|
||||||
for(KeyPair<K,V> i : keypair())
|
if (i.getV().equals(value)) {
|
||||||
{
|
|
||||||
if(i.getV().equals(value))
|
|
||||||
{
|
|
||||||
return i.getK();
|
return i.getK();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,13 +400,11 @@ public class B {
|
|||||||
try {
|
try {
|
||||||
String bd = bdxf.trim();
|
String bd = bdxf.trim();
|
||||||
|
|
||||||
if(bd.startsWith("minecraft:cauldron[level="))
|
if (bd.startsWith("minecraft:cauldron[level=")) {
|
||||||
{
|
|
||||||
bd = bd.replaceAll("\\Q:cauldron[\\E", ":water_cauldron[");
|
bd = bd.replaceAll("\\Q:cauldron[\\E", ":water_cauldron[");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bd.equals("minecraft:grass_path"))
|
if (bd.equals("minecraft:grass_path")) {
|
||||||
{
|
|
||||||
return DIRT_PATH.createBlockData();
|
return DIRT_PATH.createBlockData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ package com.volmit.iris.util.data;
|
|||||||
|
|
||||||
import com.volmit.iris.util.function.Function2;
|
import com.volmit.iris.util.function.Function2;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||||
|
|
||||||
public class ChunkCache<T> {
|
public class ChunkCache<T> {
|
||||||
@@ -30,14 +29,12 @@ public class ChunkCache<T> {
|
|||||||
cache = new AtomicReferenceArray<>(256);
|
cache = new AtomicReferenceArray<>(256);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T compute(int x, int z, Function2<Integer, Integer, T> function)
|
public T compute(int x, int z, Function2<Integer, Integer, T> function) {
|
||||||
{
|
T t = get(x & 15, z & 15);
|
||||||
T t = get(x&15, z&15);
|
|
||||||
|
|
||||||
if(t == null)
|
if (t == null) {
|
||||||
{
|
|
||||||
t = function.apply(x, z);
|
t = function.apply(x, z);
|
||||||
set(x&15, z&15, t);
|
set(x & 15, z & 15, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
|
|||||||
@@ -22,25 +22,21 @@ import com.volmit.iris.engine.data.cache.Cache;
|
|||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
|
|
||||||
public class ComplexCache<T> {
|
public class ComplexCache<T> {
|
||||||
private KMap<Long, ChunkCache<T>> chunks;
|
private final KMap<Long, ChunkCache<T>> chunks;
|
||||||
|
|
||||||
public ComplexCache()
|
public ComplexCache() {
|
||||||
{
|
|
||||||
chunks = new KMap<>();
|
chunks = new KMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean has(int x, int z)
|
public boolean has(int x, int z) {
|
||||||
{
|
|
||||||
return chunks.containsKey(Cache.key(x, z));
|
return chunks.containsKey(Cache.key(x, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invalidate(int x, int z)
|
public void invalidate(int x, int z) {
|
||||||
{
|
|
||||||
chunks.remove(Cache.key(x, z));
|
chunks.remove(Cache.key(x, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkCache<T> chunk(int x, int z)
|
public ChunkCache<T> chunk(int x, int z) {
|
||||||
{
|
|
||||||
return chunks.computeIfAbsent(Cache.key(x, z), (f) -> new ChunkCache<>());
|
return chunks.computeIfAbsent(Cache.key(x, z), (f) -> new ChunkCache<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,27 +24,25 @@ import com.github.benmanes.caffeine.cache.LoadingCache;
|
|||||||
import com.volmit.iris.engine.framework.MeteredCache;
|
import com.volmit.iris.engine.framework.MeteredCache;
|
||||||
import com.volmit.iris.util.math.RollingSequence;
|
import com.volmit.iris.util.math.RollingSequence;
|
||||||
|
|
||||||
public class KCache<K,V> implements MeteredCache {
|
public class KCache<K, V> implements MeteredCache {
|
||||||
private final long max;
|
private final long max;
|
||||||
private CacheLoader<K, V> loader;
|
private CacheLoader<K, V> loader;
|
||||||
private LoadingCache<K, V> cache;
|
private final LoadingCache<K, V> cache;
|
||||||
private final boolean fastDump;
|
private final boolean fastDump;
|
||||||
private final RollingSequence msu = new RollingSequence(100);
|
private final RollingSequence msu = new RollingSequence(100);
|
||||||
|
|
||||||
public KCache(CacheLoader<K, V> loader, long max)
|
public KCache(CacheLoader<K, V> loader, long max) {
|
||||||
{
|
|
||||||
this(loader, max, false);
|
this(loader, max, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public KCache(CacheLoader<K, V> loader, long max, boolean fastDump)
|
public KCache(CacheLoader<K, V> loader, long max, boolean fastDump) {
|
||||||
{
|
|
||||||
this.max = max;
|
this.max = max;
|
||||||
this.fastDump = fastDump;
|
this.fastDump = fastDump;
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
this.cache = create(loader);
|
this.cache = create(loader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoadingCache<K,V> create(CacheLoader<K,V> loader) {
|
private LoadingCache<K, V> create(CacheLoader<K, V> loader) {
|
||||||
return Caffeine
|
return Caffeine
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.maximumSize(max)
|
.maximumSize(max)
|
||||||
@@ -54,23 +52,19 @@ public class KCache<K,V> implements MeteredCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setLoader(CacheLoader<K, V> loader)
|
public void setLoader(CacheLoader<K, V> loader) {
|
||||||
{
|
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invalidate(K k)
|
public void invalidate(K k) {
|
||||||
{
|
|
||||||
cache.invalidate(k);
|
cache.invalidate(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invalidate()
|
public void invalidate() {
|
||||||
{
|
|
||||||
cache.invalidateAll();
|
cache.invalidateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public V get(K k)
|
public V get(K k) {
|
||||||
{
|
|
||||||
return cache.get(k);
|
return cache.get(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,32 +59,26 @@ public class BitStorage {
|
|||||||
this(bits, length, (AtomicLongArray) null);
|
this(bits, length, (AtomicLongArray) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AtomicLongArray atomic(long[] data)
|
private static AtomicLongArray atomic(long[] data) {
|
||||||
{
|
if (data == null) {
|
||||||
if(data == null)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicLongArray d = new AtomicLongArray(data.length);
|
AtomicLongArray d = new AtomicLongArray(data.length);
|
||||||
for(int i = 0; i < data.length; i++)
|
for (int i = 0; i < data.length; i++) {
|
||||||
{
|
|
||||||
d.set(i, data[i]);
|
d.set(i, data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long[] atomic(AtomicLongArray data)
|
private static long[] atomic(AtomicLongArray data) {
|
||||||
{
|
if (data == null) {
|
||||||
if(data == null)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
long[] d = new long[data.length()];
|
long[] d = new long[data.length()];
|
||||||
for(int i = 0; i < data.length(); i++)
|
for (int i = 0; i < data.length(); i++) {
|
||||||
{
|
|
||||||
d[i] = data.get(i);
|
d[i] = data.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,8 +101,7 @@ public class BitStorage {
|
|||||||
this.divideShift = MAGIC[var3 + 2];
|
this.divideShift = MAGIC[var3 + 2];
|
||||||
int var4 = (length + this.valuesPerLong - 1) / this.valuesPerLong;
|
int var4 = (length + this.valuesPerLong - 1) / this.valuesPerLong;
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
if (data.length() != var4)
|
if (data.length() != var4) {
|
||||||
{
|
|
||||||
throw new RuntimeException("NO!");
|
throw new RuntimeException("NO!");
|
||||||
}
|
}
|
||||||
this.data = data;
|
this.data = data;
|
||||||
@@ -166,8 +159,7 @@ public class BitStorage {
|
|||||||
|
|
||||||
public void getAll(IntConsumer var0) {
|
public void getAll(IntConsumer var0) {
|
||||||
int var1 = 0;
|
int var1 = 0;
|
||||||
for(int i = 0; i < data.length(); i++)
|
for (int i = 0; i < data.length(); i++) {
|
||||||
{
|
|
||||||
long var5 = data.get(i);
|
long var5 = data.get(i);
|
||||||
for (int var7 = 0; var7 < this.valuesPerLong; var7++) {
|
for (int var7 = 0; var7 < this.valuesPerLong; var7++) {
|
||||||
var0.accept((int) (var5 & this.mask));
|
var0.accept((int) (var5 & this.mask));
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ package com.volmit.iris.util.data.palette;
|
|||||||
|
|
||||||
import com.google.common.collect.Iterators;
|
import com.google.common.collect.Iterators;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.atomic.AtomicIntegerArray;
|
import java.util.concurrent.atomic.AtomicIntegerArray;
|
||||||
@@ -49,16 +48,14 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
|
|||||||
|
|
||||||
|
|
||||||
public K byId(int var0) {
|
public K byId(int var0) {
|
||||||
if (var0 < 0 || var0 >= this.byId.length())
|
if (var0 < 0 || var0 >= this.byId.length()) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return this.byId.get(var0);
|
return this.byId.get(var0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getValue(int var0) {
|
private int getValue(int var0) {
|
||||||
if (var0 == -1)
|
if (var0 == -1) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return this.values.get(var0);
|
return this.values.get(var0);
|
||||||
@@ -79,8 +76,7 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int nextId() {
|
private int nextId() {
|
||||||
while (nextId < byId.length() && byId.get(nextId) != null)
|
while (nextId < byId.length() && byId.get(nextId) != null) {
|
||||||
{
|
|
||||||
nextId++;
|
nextId++;
|
||||||
}
|
}
|
||||||
return nextId;
|
return nextId;
|
||||||
@@ -95,8 +91,7 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
|
|||||||
this.nextId = 0;
|
this.nextId = 0;
|
||||||
this.size = 0;
|
this.size = 0;
|
||||||
for (int var3 = 0; var3 < var1.length(); var3++) {
|
for (int var3 = 0; var3 < var1.length(); var3++) {
|
||||||
if (var1.get(var3) != null)
|
if (var1.get(var3) != null) {
|
||||||
{
|
|
||||||
addMapping(var1.get(var3), var2.get(var3));
|
addMapping(var1.get(var3), var2.get(var3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,8 +121,7 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
|
|||||||
private int indexOf(K var0, int var1) {
|
private int indexOf(K var0, int var1) {
|
||||||
int var2;
|
int var2;
|
||||||
for (var2 = var1; var2 < this.keys.length(); var2++) {
|
for (var2 = var1; var2 < this.keys.length(); var2++) {
|
||||||
if (this.keys.get(var2) == null)
|
if (this.keys.get(var2) == null) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (this.keys.get(var2).equals(var0))
|
if (this.keys.get(var2).equals(var0))
|
||||||
@@ -158,11 +152,12 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Iterator<K> iterator() {
|
public Iterator<K> iterator() {
|
||||||
return Iterators.filter(new Iterator<K>(){
|
return Iterators.filter(new Iterator<K>() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
return i < byId.length()-1;
|
return i < byId.length() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -174,15 +169,12 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
|
|||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
|
|
||||||
for(int i = 0; i < Math.max(keys.length(), byId.length()); i++)
|
for (int i = 0; i < Math.max(keys.length(), byId.length()); i++) {
|
||||||
{
|
if (i < keys.length() - 1) {
|
||||||
if(i < keys.length() - 1)
|
|
||||||
{
|
|
||||||
keys.set(i, null);
|
keys.set(i, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i < byId.length() - 1)
|
if (i < byId.length() - 1) {
|
||||||
{
|
|
||||||
byId.set(i, null);
|
byId.set(i, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.data.palette;
|
package com.volmit.iris.util.data.palette;
|
||||||
|
|
||||||
import com.volmit.iris.util.nbt.tag.ListTag;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
@@ -28,11 +26,9 @@ public class GlobalPalette<T> implements Palette<T> {
|
|||||||
|
|
||||||
private final T defaultValue;
|
private final T defaultValue;
|
||||||
|
|
||||||
public GlobalPalette(T... f)
|
public GlobalPalette(T... f) {
|
||||||
{
|
|
||||||
IdMapper<T> mapper = new IdMapper<>();
|
IdMapper<T> mapper = new IdMapper<>();
|
||||||
for(T i : f)
|
for (T i : f) {
|
||||||
{
|
|
||||||
mapper.add(i);
|
mapper.add(i);
|
||||||
}
|
}
|
||||||
registry = mapper;
|
registry = mapper;
|
||||||
|
|||||||
@@ -20,12 +20,8 @@ package com.volmit.iris.util.data.palette;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
|
||||||
import com.volmit.iris.util.nbt.tag.ListTag;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
public class HashMapPalette<T> implements Palette<T> {
|
public class HashMapPalette<T> implements Palette<T> {
|
||||||
private final KMap<T, Integer> values;
|
private final KMap<T, Integer> values;
|
||||||
@@ -41,16 +37,14 @@ public class HashMapPalette<T> implements Palette<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int idFor(T var0) {
|
public int idFor(T var0) {
|
||||||
if(var0 == null)
|
if (var0 == null) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.values.computeIfAbsent(var0, (k) -> {
|
return this.values.computeIfAbsent(var0, (k) -> {
|
||||||
int newId = id++;
|
int newId = id++;
|
||||||
|
|
||||||
if (newId >= 1 << this.bits)
|
if (newId >= 1 << this.bits) {
|
||||||
{
|
|
||||||
Iris.info(newId + " to...");
|
Iris.info(newId + " to...");
|
||||||
newId = this.resizeHandler.onResize(this.bits + 1, var0);
|
newId = this.resizeHandler.onResize(this.bits + 1, var0);
|
||||||
Iris.info(newId + "..");
|
Iris.info(newId + "..");
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ public class IdMapper<T> implements IdMap<T> {
|
|||||||
|
|
||||||
public void addMapping(T var0, int var1) {
|
public void addMapping(T var0, int var1) {
|
||||||
this.tToId.put(var0, Integer.valueOf(var1));
|
this.tToId.put(var0, Integer.valueOf(var1));
|
||||||
while (this.idToT.size() <= var1)
|
while (this.idToT.size() <= var1) {
|
||||||
{
|
|
||||||
this.idToT.add(null);
|
this.idToT.add(null);
|
||||||
}
|
}
|
||||||
this.idToT.set(var1, var0);
|
this.idToT.set(var1, var0);
|
||||||
@@ -68,8 +67,7 @@ public class IdMapper<T> implements IdMap<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final T byId(int var0) {
|
public final T byId(int var0) {
|
||||||
if (var0 >= 0 && var0 < this.idToT.size())
|
if (var0 >= 0 && var0 < this.idToT.size()) {
|
||||||
{
|
|
||||||
return this.idToT.get(var0);
|
return this.idToT.get(var0);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ package com.volmit.iris.util.data.palette;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
public class LinearPalette<T> implements Palette<T> {
|
public class LinearPalette<T> implements Palette<T> {
|
||||||
private final AtomicReferenceArray<T> values;
|
private final AtomicReferenceArray<T> values;
|
||||||
@@ -37,13 +36,11 @@ public class LinearPalette<T> implements Palette<T> {
|
|||||||
public int idFor(T var0) {
|
public int idFor(T var0) {
|
||||||
int var1;
|
int var1;
|
||||||
for (var1 = 0; var1 < size; var1++) {
|
for (var1 = 0; var1 < size; var1++) {
|
||||||
if(values.get(var1) == null && var0 == null)
|
if (values.get(var1) == null && var0 == null) {
|
||||||
{
|
|
||||||
return var1;
|
return var1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values.get(var1) != null && values.get(var1).equals(var0))
|
if (values.get(var1) != null && values.get(var1).equals(var0)) {
|
||||||
{
|
|
||||||
return var1;
|
return var1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,8 +54,7 @@ public class LinearPalette<T> implements Palette<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public T valueFor(int var0) {
|
public T valueFor(int var0) {
|
||||||
if (var0 >= 0 && var0 < size)
|
if (var0 >= 0 && var0 < size) {
|
||||||
{
|
|
||||||
return this.values.get(var0);
|
return this.values.get(var0);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -70,8 +66,7 @@ public class LinearPalette<T> implements Palette<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(List<T> fromList) {
|
public void read(List<T> fromList) {
|
||||||
for (int i = 0; i < fromList.size(); i++)
|
for (int i = 0; i < fromList.size(); i++) {
|
||||||
{
|
|
||||||
values.set(i, fromList.get(i));
|
values.set(i, fromList.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,8 +75,7 @@ public class LinearPalette<T> implements Palette<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(List<T> toList) {
|
public void write(List<T> toList) {
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++) {
|
||||||
{
|
|
||||||
T v = values.get(i);
|
T v = values.get(i);
|
||||||
toList.add(v);
|
toList.add(v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,7 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.data.palette;
|
package com.volmit.iris.util.data.palette;
|
||||||
|
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
|
||||||
import com.volmit.iris.util.nbt.tag.ListTag;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
public interface Palette<T> {
|
public interface Palette<T> {
|
||||||
int idFor(T paramT);
|
int idFor(T paramT);
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ public interface PaletteType<T> {
|
|||||||
int v = Varint.readUnsignedVarInt(din);
|
int v = Varint.readUnsignedVarInt(din);
|
||||||
List<T> t = new ArrayList<>();
|
List<T> t = new ArrayList<>();
|
||||||
|
|
||||||
for(int i = 0; i < v; i++)
|
for (int i = 0; i < v; i++) {
|
||||||
{
|
|
||||||
t.add(readPaletteNode(din));
|
t.add(readPaletteNode(din));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ package com.volmit.iris.util.data.palette;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
@SuppressWarnings("DuplicatedCode")
|
@SuppressWarnings("DuplicatedCode")
|
||||||
public class PalettedContainer<T> implements PaletteResize<T> {
|
public class PalettedContainer<T> implements PaletteResize<T> {
|
||||||
@@ -43,8 +43,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setBits(int var0) {
|
private void setBits(int var0) {
|
||||||
if (var0 == this.bits)
|
if (var0 == this.bits) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.bits = var0;
|
this.bits = var0;
|
||||||
@@ -65,8 +64,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
|||||||
setBits(var0);
|
setBits(var0);
|
||||||
for (int var4 = 0; var4 < var2.getSize(); var4++) {
|
for (int var4 = 0; var4 < var2.getSize(); var4++) {
|
||||||
T var5 = var3.valueFor(var2.get(var4));
|
T var5 = var3.valueFor(var2.get(var4));
|
||||||
if (var5 != null)
|
if (var5 != null) {
|
||||||
{
|
|
||||||
set(var4, var5);
|
set(var4, var5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,8 +93,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
|||||||
private void set(int var0, T var1) {
|
private void set(int var0, T var1) {
|
||||||
int var2 = this.palette.idFor(var1);
|
int var2 = this.palette.idFor(var1);
|
||||||
|
|
||||||
if(M.r(0.003))
|
if (M.r(0.003)) {
|
||||||
{
|
|
||||||
Iris.info("ID for " + var1 + " is " + var2 + " Palette: " + palette.getSize());
|
Iris.info("ID for " + var1 + " is " + var2 + " Palette: " + palette.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,8 +110,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
|||||||
|
|
||||||
public void read(List<T> palette, long[] data) {
|
public void read(List<T> palette, long[] data) {
|
||||||
int var2 = Math.max(4, Mth.ceillog2(palette.size()));
|
int var2 = Math.max(4, Mth.ceillog2(palette.size()));
|
||||||
if (var2 != this.bits)
|
if (var2 != this.bits) {
|
||||||
{
|
|
||||||
setBits(var2);
|
setBits(var2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,8 +120,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
|||||||
System.arraycopy(data, 0, this.storage.getRaw(), 0, data.length);
|
System.arraycopy(data, 0, this.storage.getRaw(), 0, data.length);
|
||||||
} else {
|
} else {
|
||||||
BitStorage var4 = new BitStorage(var3, 4096, data);
|
BitStorage var4 = new BitStorage(var3, 4096, data);
|
||||||
for (int var5 = 0; var5 < 4096; var5++)
|
for (int var5 = 0; var5 < 4096; var5++) {
|
||||||
{
|
|
||||||
this.storage.set(var5, var4.get(var5));
|
this.storage.set(var5, var4.get(var5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
|||||||
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
|
||||||
import com.volmit.iris.util.plugin.CommandDummy;
|
import com.volmit.iris.util.plugin.CommandDummy;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.format;
|
package com.volmit.iris.util.format;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.math.RollingSequence;
|
import com.volmit.iris.util.math.RollingSequence;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.Looper;
|
import com.volmit.iris.util.scheduling.Looper;
|
||||||
@@ -30,14 +29,14 @@ public class MemoryMonitor {
|
|||||||
private long garbageLast;
|
private long garbageLast;
|
||||||
private long garbageBin;
|
private long garbageBin;
|
||||||
private long pressure;
|
private long pressure;
|
||||||
private ChronoLatch cl;
|
private final ChronoLatch cl;
|
||||||
private RollingSequence pressureAvg;
|
private final RollingSequence pressureAvg;
|
||||||
private Runtime runtime;
|
private final Runtime runtime;
|
||||||
|
|
||||||
public MemoryMonitor(int sampleDelay){
|
public MemoryMonitor(int sampleDelay) {
|
||||||
this.runtime = Runtime.getRuntime();
|
this.runtime = Runtime.getRuntime();
|
||||||
usedMemory = -1;
|
usedMemory = -1;
|
||||||
pressureAvg = new RollingSequence(Math.max(Math.min(100, 1000/sampleDelay), 3));
|
pressureAvg = new RollingSequence(Math.max(Math.min(100, 1000 / sampleDelay), 3));
|
||||||
garbageBin = 0;
|
garbageBin = 0;
|
||||||
garbageMemory = -1;
|
garbageMemory = -1;
|
||||||
cl = new ChronoLatch(1000);
|
cl = new ChronoLatch(1000);
|
||||||
@@ -56,74 +55,55 @@ public class MemoryMonitor {
|
|||||||
looper.start();
|
looper.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getGarbageBytes()
|
public long getGarbageBytes() {
|
||||||
{
|
|
||||||
return garbageMemory;
|
return garbageMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getUsedBytes()
|
public long getUsedBytes() {
|
||||||
{
|
|
||||||
return usedMemory;
|
return usedMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getMaxBytes()
|
public long getMaxBytes() {
|
||||||
{
|
|
||||||
return runtime.maxMemory();
|
return runtime.maxMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPressure()
|
public long getPressure() {
|
||||||
{
|
|
||||||
return (long) pressureAvg.getAverage();
|
return (long) pressureAvg.getAverage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getUsagePercent()
|
public double getUsagePercent() {
|
||||||
{
|
return usedMemory / (double) getMaxBytes();
|
||||||
return usedMemory / (double)getMaxBytes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sample() {
|
private void sample() {
|
||||||
long used = getVMUse();
|
long used = getVMUse();
|
||||||
if(usedMemory == -1)
|
if (usedMemory == -1) {
|
||||||
{
|
|
||||||
usedMemory = used;
|
usedMemory = used;
|
||||||
garbageMemory = 0;
|
garbageMemory = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(used < usedMemory)
|
if (used < usedMemory) {
|
||||||
{
|
|
||||||
usedMemory = used;
|
usedMemory = used;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
garbageMemory = used - usedMemory;
|
garbageMemory = used - usedMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
long g = garbageMemory - garbageLast;
|
long g = garbageMemory - garbageLast;
|
||||||
|
|
||||||
if(g >= 0)
|
if (g >= 0) {
|
||||||
{
|
garbageBin += g;
|
||||||
garbageBin+= g;
|
|
||||||
garbageLast = garbageMemory;
|
garbageLast = garbageMemory;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
garbageMemory = 0;
|
garbageMemory = 0;
|
||||||
garbageLast = 0;
|
garbageLast = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cl.flip())
|
if (cl.flip()) {
|
||||||
{
|
if (garbageMemory > 0) {
|
||||||
if(garbageMemory > 0)
|
|
||||||
{
|
|
||||||
pressure = garbageBin;
|
pressure = garbageBin;
|
||||||
garbageBin = 0;
|
garbageBin = 0;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pressure = 0;
|
pressure = 0;
|
||||||
garbageBin = 0;
|
garbageBin = 0;
|
||||||
}
|
}
|
||||||
@@ -136,10 +116,8 @@ public class MemoryMonitor {
|
|||||||
return runtime.totalMemory() - runtime.freeMemory();
|
return runtime.totalMemory() - runtime.freeMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close()
|
public void close() {
|
||||||
{
|
if (looper != null) {
|
||||||
if(looper != null)
|
|
||||||
{
|
|
||||||
looper.interrupt();
|
looper.interrupt();
|
||||||
looper = null;
|
looper = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.hunk.bits;
|
package com.volmit.iris.util.hunk.bits;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.data.Varint;
|
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@@ -65,8 +63,7 @@ public class DataBits {
|
|||||||
this(bits, length, (AtomicLongArray) null);
|
this(bits, length, (AtomicLongArray) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataBits(int bits, int length, DataInputStream din) throws IOException
|
public DataBits(int bits, int length, DataInputStream din) throws IOException {
|
||||||
{
|
|
||||||
this(bits, length, longs(din));
|
this(bits, length, longs(din));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,8 +80,7 @@ public class DataBits {
|
|||||||
int var4 = (length + valuesPerLong - 1) / valuesPerLong;
|
int var4 = (length + valuesPerLong - 1) / valuesPerLong;
|
||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
if (data.length() != var4)
|
if (data.length() != var4) {
|
||||||
{
|
|
||||||
throw new RuntimeException("NO! Trying to load " + data.length() + " into actual size of " + var4 + " because length: " + length + " (bits: " + bits + ")");
|
throw new RuntimeException("NO! Trying to load " + data.length() + " into actual size of " + var4 + " because length: " + length + " (bits: " + bits + ")");
|
||||||
}
|
}
|
||||||
this.data = data;
|
this.data = data;
|
||||||
@@ -93,36 +89,30 @@ public class DataBits {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return "DBits: " + size + "/" + bits + "[" + data.length() + "]";
|
return "DBits: " + size + "/" + bits + "[" + data.length() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int dataLength(int bits, int length)
|
private static int dataLength(int bits, int length) {
|
||||||
{
|
|
||||||
return (length + ((char) (64 / bits)) - 1) / ((char) (64 / bits));
|
return (length + ((char) (64 / bits)) - 1) / ((char) (64 / bits));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AtomicLongArray longs(DataInputStream din) throws IOException{
|
private static AtomicLongArray longs(DataInputStream din) throws IOException {
|
||||||
AtomicLongArray a = new AtomicLongArray(din.readInt());
|
AtomicLongArray a = new AtomicLongArray(din.readInt());
|
||||||
|
|
||||||
for(int i = 0; i < a.length(); i++)
|
for (int i = 0; i < a.length(); i++) {
|
||||||
{
|
|
||||||
a.set(i, din.readLong());
|
a.set(i, din.readLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataBits setBits(int newBits)
|
public DataBits setBits(int newBits) {
|
||||||
{
|
if (bits != newBits) {
|
||||||
if(bits != newBits)
|
|
||||||
{
|
|
||||||
DataBits newData = new DataBits(newBits, size);
|
DataBits newData = new DataBits(newBits, size);
|
||||||
AtomicInteger c = new AtomicInteger(0);
|
AtomicInteger c = new AtomicInteger(0);
|
||||||
|
|
||||||
for(int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++) {
|
||||||
{
|
|
||||||
newData.set(i, get(i));
|
newData.set(i, get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,14 +173,12 @@ public class DataBits {
|
|||||||
|
|
||||||
public void getAll(IntConsumer var0) {
|
public void getAll(IntConsumer var0) {
|
||||||
int var1 = 0;
|
int var1 = 0;
|
||||||
for(int i = 0; i < data.length(); i++)
|
for (int i = 0; i < data.length(); i++) {
|
||||||
{
|
|
||||||
long var5 = data.get(i);
|
long var5 = data.get(i);
|
||||||
for (int var7 = 0; var7 < valuesPerLong; var7++) {
|
for (int var7 = 0; var7 < valuesPerLong; var7++) {
|
||||||
var0.accept((int) (var5 & mask));
|
var0.accept((int) (var5 & mask));
|
||||||
var5 >>= bits;
|
var5 >>= bits;
|
||||||
if (++var1 >= size)
|
if (++var1 >= size) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,8 +188,7 @@ public class DataBits {
|
|||||||
public void write(DataOutputStream dos) throws IOException {
|
public void write(DataOutputStream dos) throws IOException {
|
||||||
dos.writeInt(data.length());
|
dos.writeInt(data.length());
|
||||||
|
|
||||||
for(int i = 0; i < data.length(); i++)
|
for (int i = 0; i < data.length(); i++) {
|
||||||
{
|
|
||||||
dos.writeLong(data.get(i));
|
dos.writeLong(data.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.hunk.bits;
|
package com.volmit.iris.util.hunk.bits;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.data.Varint;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@@ -40,8 +37,7 @@ public class DataContainer<T> {
|
|||||||
private final int length;
|
private final int length;
|
||||||
private final Writable<T> writer;
|
private final Writable<T> writer;
|
||||||
|
|
||||||
public DataContainer(Writable<T> writer, int length, T empty)
|
public DataContainer(Writable<T> writer, int length, T empty) {
|
||||||
{
|
|
||||||
this.writer = writer;
|
this.writer = writer;
|
||||||
this.length = length;
|
this.length = length;
|
||||||
this.bits = new AtomicInteger(INITIAL_BITS);
|
this.bits = new AtomicInteger(INITIAL_BITS);
|
||||||
@@ -58,25 +54,22 @@ public class DataContainer<T> {
|
|||||||
this.bits = new AtomicInteger(palette.get().bits());
|
this.bits = new AtomicInteger(palette.get().bits());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString(){
|
public String toString() {
|
||||||
return "DataContainer <" + length + " x " + bits + " bits> -> Palette<"+palette.get().getClass().getSimpleName().replaceAll("\\QPalette\\E", "")+">: " + palette.get().size() +
|
return "DataContainer <" + length + " x " + bits + " bits> -> Palette<" + palette.get().getClass().getSimpleName().replaceAll("\\QPalette\\E", "") + ">: " + palette.get().size() +
|
||||||
" " + data.get().toString() + " PalBit: " + palette.get().bits();
|
" " + data.get().toString() + " PalBit: " + palette.get().bits();
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] write() throws IOException
|
public byte[] write() throws IOException {
|
||||||
{
|
|
||||||
ByteArrayOutputStream boas = new ByteArrayOutputStream();
|
ByteArrayOutputStream boas = new ByteArrayOutputStream();
|
||||||
write(boas);
|
write(boas);
|
||||||
return boas.toByteArray();
|
return boas.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(OutputStream out) throws IOException
|
public void write(OutputStream out) throws IOException {
|
||||||
{
|
|
||||||
writeDos(new DataOutputStream(out));
|
writeDos(new DataOutputStream(out));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeDos(DataOutputStream dos) throws IOException
|
public void writeDos(DataOutputStream dos) throws IOException {
|
||||||
{
|
|
||||||
dos.writeInt(length);
|
dos.writeInt(length);
|
||||||
dos.writeInt(palette.get().size());
|
dos.writeInt(palette.get().size());
|
||||||
palette.get().iterateIO((data, __) -> writer.writeNodeData(dos, data));
|
palette.get().iterateIO((data, __) -> writer.writeNodeData(dos, data));
|
||||||
@@ -91,38 +84,30 @@ public class DataContainer<T> {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Palette<T> newPalette(int bits)
|
private Palette<T> newPalette(int bits) {
|
||||||
{
|
if (bits <= LINEAR_BITS_LIMIT) {
|
||||||
if(bits <= LINEAR_BITS_LIMIT)
|
|
||||||
{
|
|
||||||
return new LinearPalette<>(LINEAR_INITIAL_LENGTH);
|
return new LinearPalette<>(LINEAR_INITIAL_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HashPalette<>();
|
return new HashPalette<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBits()
|
private void checkBits() {
|
||||||
{
|
if (palette.get().size() >= BIT[bits.get()]) {
|
||||||
if(palette.get().size() >= BIT[bits.get()])
|
|
||||||
{
|
|
||||||
setBits(bits.get() + 1);
|
setBits(bits.get() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ensurePaletted(T t)
|
public void ensurePaletted(T t) {
|
||||||
{
|
if (palette.get().id(t) == -1) {
|
||||||
if(palette.get().id(t) == -1)
|
|
||||||
{
|
|
||||||
checkBits();
|
checkBits();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(int position, T t)
|
public void set(int position, T t) {
|
||||||
{
|
|
||||||
int id = palette.get().id(t);
|
int id = palette.get().id(t);
|
||||||
|
|
||||||
if(id == -1)
|
if (id == -1) {
|
||||||
{
|
|
||||||
checkBits();
|
checkBits();
|
||||||
id = palette.get().add(t);
|
id = palette.get().add(t);
|
||||||
}
|
}
|
||||||
@@ -130,24 +115,19 @@ public class DataContainer<T> {
|
|||||||
data.get().set(position, id);
|
data.get().set(position, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T get(int position)
|
public T get(int position) {
|
||||||
{
|
int id = data.get().get(position) + 1;
|
||||||
int id = data.get().get(position)+1;
|
|
||||||
|
|
||||||
if(id <= 0)
|
if (id <= 0) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return palette.get().get(id-1);
|
return palette.get().get(id - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBits(int bits)
|
public void setBits(int bits) {
|
||||||
{
|
if (this.bits.get() != bits) {
|
||||||
if(this.bits.get() != bits)
|
if (this.bits.get() <= LINEAR_BITS_LIMIT != bits <= LINEAR_BITS_LIMIT) {
|
||||||
{
|
|
||||||
if(this.bits.get() <= LINEAR_BITS_LIMIT != bits <= LINEAR_BITS_LIMIT)
|
|
||||||
{
|
|
||||||
palette.set(newPalette(bits).from(palette.get()));
|
palette.set(newPalette(bits).from(palette.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,25 +139,20 @@ public class DataContainer<T> {
|
|||||||
private static int[] computeBitLimits() {
|
private static int[] computeBitLimits() {
|
||||||
int[] m = new int[16];
|
int[] m = new int[16];
|
||||||
|
|
||||||
for(int i = 0; i < m.length; i++)
|
for (int i = 0; i < m.length; i++) {
|
||||||
{
|
|
||||||
m[i] = (int) Math.pow(2, i);
|
m[i] = (int) Math.pow(2, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static int bits(int size)
|
protected static int bits(int size) {
|
||||||
{
|
if (DataContainer.BIT[INITIAL_BITS] >= size) {
|
||||||
if(DataContainer.BIT[INITIAL_BITS] >= size)
|
|
||||||
{
|
|
||||||
return INITIAL_BITS;
|
return INITIAL_BITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < DataContainer.BIT.length; i++)
|
for (int i = 0; i < DataContainer.BIT.length; i++) {
|
||||||
{
|
if (DataContainer.BIT[i] >= size) {
|
||||||
if(DataContainer.BIT[i] >= size)
|
|
||||||
{
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.hunk.bits;
|
package com.volmit.iris.util.hunk.bits;
|
||||||
|
|
||||||
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.function.Consumer2;
|
import com.volmit.iris.util.function.Consumer2;
|
||||||
|
|
||||||
@@ -30,8 +29,7 @@ public class HashPalette<T> implements Palette<T> {
|
|||||||
private final KMap<Integer, T> lookup;
|
private final KMap<Integer, T> lookup;
|
||||||
private final AtomicInteger size;
|
private final AtomicInteger size;
|
||||||
|
|
||||||
public HashPalette()
|
public HashPalette() {
|
||||||
{
|
|
||||||
this.size = new AtomicInteger(0);
|
this.size = new AtomicInteger(0);
|
||||||
this.palette = new LinkedHashMap<>();
|
this.palette = new LinkedHashMap<>();
|
||||||
this.lookup = new KMap<>();
|
this.lookup = new KMap<>();
|
||||||
@@ -39,8 +37,7 @@ public class HashPalette<T> implements Palette<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T get(int id) {
|
public T get(int id) {
|
||||||
if(id < 0 || id >= size.get())
|
if (id < 0 || id >= size.get()) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,8 +49,7 @@ public class HashPalette<T> implements Palette<T> {
|
|||||||
int index = size.getAndIncrement();
|
int index = size.getAndIncrement();
|
||||||
palette.put(t, index);
|
palette.put(t, index);
|
||||||
|
|
||||||
if(t != null)
|
if (t != null) {
|
||||||
{
|
|
||||||
lookup.put(index, t);
|
lookup.put(index, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +69,7 @@ public class HashPalette<T> implements Palette<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void iterate(Consumer2<T, Integer> c) {
|
public void iterate(Consumer2<T, Integer> c) {
|
||||||
for(T i : palette.keySet())
|
for (T i : palette.keySet()) {
|
||||||
{
|
|
||||||
c.accept(i, id(i));
|
c.accept(i, id(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,16 +28,14 @@ public class LinearPalette<T> implements Palette<T> {
|
|||||||
private final AtomicReference<AtomicReferenceArray<T>> palette;
|
private final AtomicReference<AtomicReferenceArray<T>> palette;
|
||||||
private final AtomicInteger size;
|
private final AtomicInteger size;
|
||||||
|
|
||||||
public LinearPalette(int initialSize)
|
public LinearPalette(int initialSize) {
|
||||||
{
|
|
||||||
this.size = new AtomicInteger(0);
|
this.size = new AtomicInteger(0);
|
||||||
this.palette = new AtomicReference<>(new AtomicReferenceArray<>(initialSize));
|
this.palette = new AtomicReference<>(new AtomicReferenceArray<>(initialSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T get(int id) {
|
public T get(int id) {
|
||||||
if(id < 0 || id >= size.get())
|
if (id < 0 || id >= size.get()) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,12 +51,10 @@ public class LinearPalette<T> implements Palette<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void grow(int newLength) {
|
private void grow(int newLength) {
|
||||||
if(newLength > palette.get().length())
|
if (newLength > palette.get().length()) {
|
||||||
{
|
|
||||||
AtomicReferenceArray<T> a = new AtomicReferenceArray<>(newLength + size.get());
|
AtomicReferenceArray<T> a = new AtomicReferenceArray<>(newLength + size.get());
|
||||||
|
|
||||||
for(int i = 0; i < palette.get().length(); i++)
|
for (int i = 0; i < palette.get().length(); i++) {
|
||||||
{
|
|
||||||
a.set(i, palette.get().get(i));
|
a.set(i, palette.get().get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,15 +64,12 @@ public class LinearPalette<T> implements Palette<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int id(T t) {
|
public int id(T t) {
|
||||||
for(int i = 0; i < size(); i++)
|
for (int i = 0; i < size(); i++) {
|
||||||
{
|
if (t == null && palette.get().get(i) == null) {
|
||||||
if(t == null && palette.get().get(i) == null)
|
|
||||||
{
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t != null && t.equals(palette.get().get(i)))
|
if (t != null && t.equals(palette.get().get(i))) {
|
||||||
{
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,8 +84,7 @@ public class LinearPalette<T> implements Palette<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void iterate(Consumer2<T, Integer> c) {
|
public void iterate(Consumer2<T, Integer> c) {
|
||||||
for(int i = 0; i < size(); i++)
|
for (int i = 0; i < size(); i++) {
|
||||||
{
|
|
||||||
c.accept(palette.get().get(i), i);
|
c.accept(palette.get().get(i), i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,18 +34,16 @@ public interface Palette<T> {
|
|||||||
|
|
||||||
int size();
|
int size();
|
||||||
|
|
||||||
default int bits()
|
default int bits() {
|
||||||
{
|
|
||||||
return DataContainer.bits(size());
|
return DataContainer.bits(size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void iterate(Consumer2<T, Integer> c);
|
void iterate(Consumer2<T, Integer> c);
|
||||||
|
|
||||||
default void iterateIO(Consumer2IO<T, Integer> c)
|
default void iterateIO(Consumer2IO<T, Integer> c) {
|
||||||
{
|
iterate((a, b) -> {
|
||||||
iterate((a,b)-> {
|
|
||||||
try {
|
try {
|
||||||
c.accept(a,b);
|
c.accept(a, b);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -53,22 +51,19 @@ public interface Palette<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default Palette<T> from(int size, Writable<T> writable, DataInputStream in) throws IOException {
|
default Palette<T> from(int size, Writable<T> writable, DataInputStream in) throws IOException {
|
||||||
for(int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++) {
|
||||||
{
|
|
||||||
add(writable.readNodeData(in));
|
add(writable.readNodeData(in));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
default Palette<T> from(Palette<T> oldPalette)
|
default Palette<T> from(Palette<T> oldPalette) {
|
||||||
{
|
oldPalette.iterate((k, v) -> add(k));
|
||||||
oldPalette.iterate((k,v) -> add(k));
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
default KList<T> list()
|
default KList<T> list() {
|
||||||
{
|
|
||||||
KList<T> t = new KList<>();
|
KList<T> t = new KList<>();
|
||||||
iterate((tx, __) -> t.add(tx));
|
iterate((tx, __) -> t.add(tx));
|
||||||
return t;
|
return t;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
@SuppressWarnings({"DefaultAnnotationParam", "Lombok"})
|
@SuppressWarnings({"DefaultAnnotationParam", "Lombok"})
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.hunk.storage;
|
package com.volmit.iris.util.hunk.storage;
|
||||||
|
|
||||||
import com.volmit.iris.util.collection.KMap;
|
|
||||||
import com.volmit.iris.util.data.palette.PalettedContainer;
|
|
||||||
import com.volmit.iris.util.function.Consumer4;
|
import com.volmit.iris.util.function.Consumer4;
|
||||||
import com.volmit.iris.util.function.Consumer4IO;
|
import com.volmit.iris.util.function.Consumer4IO;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
@@ -29,7 +27,6 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@SuppressWarnings({"DefaultAnnotationParam", "Lombok"})
|
@SuppressWarnings({"DefaultAnnotationParam", "Lombok"})
|
||||||
@Data
|
@Data
|
||||||
@@ -38,7 +35,7 @@ public class PaletteHunk<T> extends StorageHunk<T> implements Hunk<T> {
|
|||||||
private DataContainer<T> data;
|
private DataContainer<T> data;
|
||||||
|
|
||||||
public PaletteHunk(int w, int h, int d, Writable<T> writer, T e) {
|
public PaletteHunk(int w, int h, int d, Writable<T> writer, T e) {
|
||||||
super(w,h,d);
|
super(w, h, d);
|
||||||
data = new DataContainer<>(writer, w * h * d, e);
|
data = new DataContainer<>(writer, w * h * d, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,16 +54,12 @@ public class PaletteHunk<T> extends StorageHunk<T> implements Hunk<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized Hunk<T> iterateSync(Consumer4<Integer, Integer, Integer, T> c) {
|
public synchronized Hunk<T> iterateSync(Consumer4<Integer, Integer, Integer, T> c) {
|
||||||
for(int i = 0; i < getWidth(); i++)
|
for (int i = 0; i < getWidth(); i++) {
|
||||||
{
|
for (int j = 0; j < getHeight(); j++) {
|
||||||
for(int j = 0; j < getHeight(); j++)
|
for (int k = 0; k < getDepth(); k++) {
|
||||||
{
|
T t = getRaw(i, j, k);
|
||||||
for(int k = 0; k < getDepth(); k++)
|
if (t != null) {
|
||||||
{
|
c.accept(i, j, k, t);
|
||||||
T t = getRaw(i,j,k);
|
|
||||||
if(t != null)
|
|
||||||
{
|
|
||||||
c.accept(i,j,k,t);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,16 +69,12 @@ public class PaletteHunk<T> extends StorageHunk<T> implements Hunk<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized Hunk<T> iterateSyncIO(Consumer4IO<Integer, Integer, Integer, T> c) throws IOException {
|
public synchronized Hunk<T> iterateSyncIO(Consumer4IO<Integer, Integer, Integer, T> c) throws IOException {
|
||||||
for(int i = 0; i < getWidth(); i++)
|
for (int i = 0; i < getWidth(); i++) {
|
||||||
{
|
for (int j = 0; j < getHeight(); j++) {
|
||||||
for(int j = 0; j < getHeight(); j++)
|
for (int k = 0; k < getDepth(); k++) {
|
||||||
{
|
T t = getRaw(i, j, k);
|
||||||
for(int k = 0; k < getDepth(); k++)
|
if (t != null) {
|
||||||
{
|
c.accept(i, j, k, t);
|
||||||
T t = getRaw(i,j,k);
|
|
||||||
if(t != null)
|
|
||||||
{
|
|
||||||
c.accept(i,j,k,t);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.hunk.storage;
|
package com.volmit.iris.util.hunk.storage;
|
||||||
|
|
||||||
import com.volmit.iris.util.data.palette.PalettedContainer;
|
|
||||||
import com.volmit.iris.util.function.Consumer4;
|
import com.volmit.iris.util.function.Consumer4;
|
||||||
import com.volmit.iris.util.function.Consumer4IO;
|
import com.volmit.iris.util.function.Consumer4IO;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
@@ -26,41 +25,38 @@ import com.volmit.iris.util.hunk.bits.DataContainer;
|
|||||||
import com.volmit.iris.util.hunk.bits.Writable;
|
import com.volmit.iris.util.hunk.bits.Writable;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public abstract class PaletteOrHunk<T> extends StorageHunk<T> implements Hunk<T>, Writable<T> {
|
public abstract class PaletteOrHunk<T> extends StorageHunk<T> implements Hunk<T>, Writable<T> {
|
||||||
private final Hunk<T> hunk;
|
private final Hunk<T> hunk;
|
||||||
|
|
||||||
public PaletteOrHunk(int width, int height, int depth, boolean allow, Supplier<Hunk<T>> factory, T e) {
|
public PaletteOrHunk(int width, int height, int depth, boolean allow, Supplier<Hunk<T>> factory, T e) {
|
||||||
super(width, height, depth);
|
super(width, height, depth);
|
||||||
hunk = (allow) ? new PaletteHunk<>(width, height, depth, this, e) : factory.get();
|
hunk = (allow) ? new PaletteHunk<>(width, height, depth, this, e) : factory.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataContainer<T> palette()
|
public DataContainer<T> palette() {
|
||||||
{
|
return isPalette() ? ((PaletteHunk<T>) hunk).getData() : null;
|
||||||
return isPalette() ? ((PaletteHunk<T>)hunk).getData() : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPalette(DataContainer<T> c) {
|
public void setPalette(DataContainer<T> c) {
|
||||||
if(isPalette())
|
if (isPalette()) {
|
||||||
{
|
((PaletteHunk<T>) hunk).setPalette(c);
|
||||||
((PaletteHunk<T>)hunk).setPalette(c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPalette()
|
public boolean isPalette() {
|
||||||
{
|
|
||||||
return hunk instanceof PaletteHunk;
|
return hunk instanceof PaletteHunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRaw(int x, int y, int z, T t) {
|
public void setRaw(int x, int y, int z, T t) {
|
||||||
hunk.setRaw(x,y,z,t);
|
hunk.setRaw(x, y, z, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T getRaw(int x, int y, int z) {
|
public T getRaw(int x, int y, int z) {
|
||||||
return hunk.getRaw(x,y,z);
|
return hunk.getRaw(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEntryCount() {
|
public int getEntryCount() {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import java.io.BufferedReader;
|
|||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.CharArrayWriter;
|
import java.io.CharArrayWriter;
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@@ -166,16 +165,15 @@ public class IO {
|
|||||||
public static String longsToHex(long[] bytes) {
|
public static String longsToHex(long[] bytes) {
|
||||||
byte[] v = new byte[bytes.length * 8];
|
byte[] v = new byte[bytes.length * 8];
|
||||||
|
|
||||||
for(int i = 0; i < bytes.length; i++)
|
for (int i = 0; i < bytes.length; i++) {
|
||||||
{
|
v[i * 8] = (byte) (bytes[i] >>> 56);
|
||||||
v[i * 8] = (byte)(bytes[i] >>> 56);
|
v[(i * 8) + 1] = (byte) (bytes[i] >>> 48);
|
||||||
v[(i * 8) + 1] = (byte)(bytes[i] >>> 48);
|
v[(i * 8) + 2] = (byte) (bytes[i] >>> 40);
|
||||||
v[(i * 8) + 2] = (byte)(bytes[i] >>> 40);
|
v[(i * 8) + 3] = (byte) (bytes[i] >>> 32);
|
||||||
v[(i * 8) + 3] = (byte)(bytes[i] >>> 32);
|
v[(i * 8) + 4] = (byte) (bytes[i] >>> 24);
|
||||||
v[(i * 8) + 4] = (byte)(bytes[i] >>> 24);
|
v[(i * 8) + 5] = (byte) (bytes[i] >>> 16);
|
||||||
v[(i * 8) + 5] = (byte)(bytes[i] >>> 16);
|
v[(i * 8) + 6] = (byte) (bytes[i] >>> 8);
|
||||||
v[(i * 8) + 6] = (byte)(bytes[i] >>> 8);
|
v[(i * 8) + 7] = (byte) (bytes[i] >>> 0);
|
||||||
v[(i * 8) + 7] = (byte)(bytes[i] >>> 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytesToHex(v);
|
return bytesToHex(v);
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import com.volmit.iris.util.matter.MatterSlice;
|
|||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.HyperLock;
|
import com.volmit.iris.util.parallel.HyperLock;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,9 @@ package com.volmit.iris.util.mantle;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
|
||||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.matter.Matter;
|
|
||||||
import com.volmit.iris.util.nbt.mca.Section;
|
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,10 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.matter;
|
package com.volmit.iris.util.matter;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.util.data.Varint;
|
import com.volmit.iris.util.data.Varint;
|
||||||
import com.volmit.iris.util.data.palette.Palette;
|
import com.volmit.iris.util.data.palette.Palette;
|
||||||
import com.volmit.iris.util.data.palette.PaletteType;
|
import com.volmit.iris.util.data.palette.PaletteType;
|
||||||
import com.volmit.iris.util.data.palette.PalettedContainer;
|
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.hunk.bits.DataContainer;
|
import com.volmit.iris.util.hunk.bits.DataContainer;
|
||||||
import com.volmit.iris.util.hunk.bits.Writable;
|
import com.volmit.iris.util.hunk.bits.Writable;
|
||||||
@@ -38,8 +35,6 @@ import org.bukkit.util.BlockVector;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MatterSlice<T> extends Hunk<T>, PaletteType<T>, Writable<T> {
|
public interface MatterSlice<T> extends Hunk<T>, PaletteType<T>, Writable<T> {
|
||||||
Class<T> getType();
|
Class<T> getType();
|
||||||
@@ -164,8 +159,7 @@ public interface MatterSlice<T> extends Hunk<T>, PaletteType<T>, Writable<T> {
|
|||||||
|
|
||||||
default void write(DataOutputStream dos) throws IOException {
|
default void write(DataOutputStream dos) throws IOException {
|
||||||
dos.writeUTF(getType().getCanonicalName());
|
dos.writeUTF(getType().getCanonicalName());
|
||||||
if((this instanceof PaletteOrHunk f && f.isPalette()))
|
if ((this instanceof PaletteOrHunk f && f.isPalette())) {
|
||||||
{
|
|
||||||
f.palette().writeDos(dos);
|
f.palette().writeDos(dos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -189,8 +183,7 @@ public interface MatterSlice<T> extends Hunk<T>, PaletteType<T>, Writable<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default void read(DataInputStream din) throws IOException {
|
default void read(DataInputStream din) throws IOException {
|
||||||
if((this instanceof PaletteOrHunk f && f.isPalette()))
|
if ((this instanceof PaletteOrHunk f && f.isPalette())) {
|
||||||
{
|
|
||||||
f.setPalette(new DataContainer<>(din, this));
|
f.setPalette(new DataContainer<>(din, this));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,21 +18,8 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.matter;
|
package com.volmit.iris.util.matter;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.hunk.bits.DataContainer;
|
|
||||||
import com.volmit.iris.util.hunk.bits.Writable;
|
|
||||||
import com.volmit.iris.util.io.IO;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class MatterTest {
|
public class MatterTest {
|
||||||
public static void test()
|
public static void test() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import com.volmit.iris.util.matter.Sliced;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ package com.volmit.iris.util.matter.slices;
|
|||||||
|
|
||||||
import com.volmit.iris.util.data.palette.Palette;
|
import com.volmit.iris.util.data.palette.Palette;
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package com.volmit.iris.util.matter.slices;
|
|||||||
import com.volmit.iris.util.data.palette.Palette;
|
import com.volmit.iris.util.data.palette.Palette;
|
||||||
import com.volmit.iris.util.matter.MatterCavern;
|
import com.volmit.iris.util.matter.MatterCavern;
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import com.volmit.iris.util.nbt.tag.CompoundTag;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.BoundingBox;
|
import org.bukkit.util.BoundingBox;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package com.volmit.iris.util.matter.slices;
|
|||||||
import com.volmit.iris.util.data.Varint;
|
import com.volmit.iris.util.data.Varint;
|
||||||
import com.volmit.iris.util.data.palette.Palette;
|
import com.volmit.iris.util.data.palette.Palette;
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package com.volmit.iris.util.matter.slices;
|
|||||||
import com.volmit.iris.util.data.Varint;
|
import com.volmit.iris.util.data.Varint;
|
||||||
import com.volmit.iris.util.data.palette.Palette;
|
import com.volmit.iris.util.data.palette.Palette;
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.volmit.iris.util.collection.KMap;
|
|||||||
import com.volmit.iris.util.data.palette.Palette;
|
import com.volmit.iris.util.data.palette.Palette;
|
||||||
import com.volmit.iris.util.matter.MatterMarker;
|
import com.volmit.iris.util.matter.MatterMarker;
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|||||||
@@ -20,10 +20,7 @@ package com.volmit.iris.util.matter.slices;
|
|||||||
|
|
||||||
import com.volmit.iris.util.data.palette.Palette;
|
import com.volmit.iris.util.data.palette.Palette;
|
||||||
import com.volmit.iris.util.nbt.io.NBTUtil;
|
import com.volmit.iris.util.nbt.io.NBTUtil;
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
|
||||||
import com.volmit.iris.util.nbt.tag.IntTag;
|
|
||||||
import com.volmit.iris.util.nbt.tag.Tag;
|
import com.volmit.iris.util.nbt.tag.Tag;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
package com.volmit.iris.util.matter.slices;
|
package com.volmit.iris.util.matter.slices;
|
||||||
|
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.hunk.bits.Writable;
|
|
||||||
import com.volmit.iris.util.hunk.storage.MappedHunk;
|
import com.volmit.iris.util.hunk.storage.MappedHunk;
|
||||||
import com.volmit.iris.util.hunk.storage.PaletteOrHunk;
|
import com.volmit.iris.util.hunk.storage.PaletteOrHunk;
|
||||||
import com.volmit.iris.util.matter.MatterReader;
|
import com.volmit.iris.util.matter.MatterReader;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package com.volmit.iris.util.matter.slices;
|
|||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
import com.volmit.iris.util.data.palette.Palette;
|
import com.volmit.iris.util.data.palette.Palette;
|
||||||
import com.volmit.iris.util.matter.MatterTile;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ package com.volmit.iris.util.matter.slices;
|
|||||||
|
|
||||||
import com.volmit.iris.util.data.palette.GlobalPalette;
|
import com.volmit.iris.util.data.palette.GlobalPalette;
|
||||||
import com.volmit.iris.util.data.palette.Palette;
|
import com.volmit.iris.util.data.palette.Palette;
|
||||||
import com.volmit.iris.util.matter.MatterTile;
|
|
||||||
import com.volmit.iris.util.matter.MatterUpdate;
|
import com.volmit.iris.util.matter.MatterUpdate;
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
|
|
||||||
|
|||||||
@@ -255,8 +255,7 @@ public class Chunk {
|
|||||||
public CompoundTag getBlockStateAt(int blockX, int blockY, int blockZ) {
|
public CompoundTag getBlockStateAt(int blockX, int blockY, int blockZ) {
|
||||||
int s = MCAUtil.blockToChunk(blockY);
|
int s = MCAUtil.blockToChunk(blockY);
|
||||||
|
|
||||||
if(sections.length() <= s)
|
if (sections.length() <= s) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,8 +281,7 @@ public class Chunk {
|
|||||||
public void setBlockStateAt(int blockX, int blockY, int blockZ, CompoundTag state, boolean cleanup) {
|
public void setBlockStateAt(int blockX, int blockY, int blockZ, CompoundTag state, boolean cleanup) {
|
||||||
int sectionIndex = MCAUtil.blockToChunk(blockY);
|
int sectionIndex = MCAUtil.blockToChunk(blockY);
|
||||||
|
|
||||||
if(sections.length() <= sectionIndex)
|
if (sections.length() <= sectionIndex) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.nbt.mca;
|
package com.volmit.iris.util.nbt.mca;
|
||||||
|
|
||||||
import com.volmit.iris.core.pregenerator.syndicate.SyndicateServer;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
|
|||||||
@@ -79,8 +79,7 @@ public class MCALinearPalette<T> implements MCAPalette<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void read(ListTag var0) {
|
public void read(ListTag var0) {
|
||||||
for (int var1 = 0; var1 < var0.size(); var1++)
|
for (int var1 = 0; var1 < var0.size(); var1++) {
|
||||||
{
|
|
||||||
this.values[var1] = this.reader.apply((CompoundTag) var0.get(var1));
|
this.values[var1] = this.reader.apply((CompoundTag) var0.get(var1));
|
||||||
}
|
}
|
||||||
this.size = var0.size();
|
this.size = var0.size();
|
||||||
|
|||||||
@@ -156,17 +156,12 @@ public class MultiBurst {
|
|||||||
try {
|
try {
|
||||||
while (!service.awaitTermination(1, TimeUnit.SECONDS)) {
|
while (!service.awaitTermination(1, TimeUnit.SECONDS)) {
|
||||||
Iris.info("Still waiting to shutdown burster...");
|
Iris.info("Still waiting to shutdown burster...");
|
||||||
if(p.getMilliseconds() > 7000)
|
if (p.getMilliseconds() > 7000) {
|
||||||
{
|
|
||||||
Iris.warn("Forcing Shutdown...");
|
Iris.warn("Forcing Shutdown...");
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
service.shutdownNow();
|
service.shutdownNow();
|
||||||
}
|
} catch (Throwable e) {
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,8 +72,7 @@ public interface Job {
|
|||||||
}, sender.isPlayer() ? 0 : 20);
|
}, sender.isPlayer() ? 0 : 20);
|
||||||
f.whenComplete((fs, ff) -> {
|
f.whenComplete((fs, ff) -> {
|
||||||
J.car(c);
|
J.car(c);
|
||||||
if(!silentMsg)
|
if (!silentMsg) {
|
||||||
{
|
|
||||||
sender.sendMessage(C.AQUA + "Completed " + getName() + " in " + Form.duration(p.getMilliseconds(), 1));
|
sender.sendMessage(C.AQUA + "Completed " + getName() + " in " + Form.duration(p.getMilliseconds(), 1));
|
||||||
}
|
}
|
||||||
whenComplete.run();
|
whenComplete.run();
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import com.volmit.iris.engine.framework.Engine;
|
|||||||
import com.volmit.iris.engine.object.IRare;
|
import com.volmit.iris.engine.object.IRare;
|
||||||
import com.volmit.iris.engine.object.IrisStyledRange;
|
import com.volmit.iris.engine.object.IrisStyledRange;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.ComplexCache;
|
|
||||||
import com.volmit.iris.util.function.Function2;
|
import com.volmit.iris.util.function.Function2;
|
||||||
import com.volmit.iris.util.function.Function3;
|
import com.volmit.iris.util.function.Function3;
|
||||||
import com.volmit.iris.util.function.Function4;
|
import com.volmit.iris.util.function.Function4;
|
||||||
|
|||||||
@@ -18,16 +18,11 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.stream.utility;
|
package com.volmit.iris.util.stream.utility;
|
||||||
|
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
|
||||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
|
||||||
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.PreservationSVC;
|
import com.volmit.iris.core.service.PreservationSVC;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.MeteredCache;
|
import com.volmit.iris.engine.framework.MeteredCache;
|
||||||
import com.volmit.iris.util.data.ComplexCache;
|
|
||||||
import com.volmit.iris.util.data.KCache;
|
import com.volmit.iris.util.data.KCache;
|
||||||
import com.volmit.iris.util.stream.BasicStream;
|
import com.volmit.iris.util.stream.BasicStream;
|
||||||
import com.volmit.iris.util.stream.ProceduralStream;
|
import com.volmit.iris.util.stream.ProceduralStream;
|
||||||
@@ -57,7 +52,7 @@ public class CachedStream2D<T> extends BasicStream<T> implements ProceduralStrea
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T get(double x, double z) {
|
public T get(double x, double z) {
|
||||||
return cache.get(Cache.key((int)x, (int)z));
|
return cache.get(Cache.key((int) x, (int) z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user