mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 08:26:11 +00:00
Formatting
This commit is contained in:
parent
ec1187923b
commit
ae2600227e
@ -30,6 +30,8 @@ import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
||||
import com.volmit.iris.core.safeguard.IrisSafeguard;
|
||||
import com.volmit.iris.core.safeguard.UtilsSFG;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.EnginePanic;
|
||||
@ -38,8 +40,6 @@ import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.engine.object.IrisWorld;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import com.volmit.iris.engine.platform.DummyChunkGenerator;
|
||||
import com.volmit.iris.core.safeguard.IrisSafeguard;
|
||||
import com.volmit.iris.core.safeguard.UtilsSFG;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.exceptions.IrisException;
|
||||
@ -52,7 +52,6 @@ import com.volmit.iris.util.io.InstanceState;
|
||||
import com.volmit.iris.util.io.JarScanner;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.misc.E;
|
||||
import com.volmit.iris.util.misc.getHardware;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.plugin.IrisService;
|
||||
@ -64,16 +63,16 @@ import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.Queue;
|
||||
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import lombok.Getter;
|
||||
import net.bytebuddy.agent.ByteBuddyAgent;
|
||||
import net.bytebuddy.implementation.bytecode.Throw;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.filefilter.IOFileFilter;
|
||||
import org.apache.commons.io.filefilter.TrueFileFilter;
|
||||
import org.apache.commons.io.filefilter.WildcardFileFilter;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -93,18 +92,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.OperatingSystemMXBean;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.*;
|
||||
import static com.volmit.iris.core.safeguard.ServerBootSFG.passedserversoftware;
|
||||
import static com.volmit.iris.util.misc.getHardware.getCPUModel;
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.InitializeSafeguard;
|
||||
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
public class Iris extends VolmitPlugin implements Listener {
|
||||
@ -329,6 +325,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
public static void info(String format, Object... args) {
|
||||
msg(C.WHITE + String.format(format, args));
|
||||
}
|
||||
|
||||
public static void safeguard(String format, Object... args) {
|
||||
msg(C.RESET + String.format(format, args));
|
||||
}
|
||||
@ -457,6 +454,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
private static void fixShading() {
|
||||
ShadeFix.fix(ComponentSerializer.class);
|
||||
}
|
||||
|
||||
private void enable() {
|
||||
instance = this;
|
||||
InitializeSafeguard();
|
||||
@ -469,7 +467,8 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
IrisSafeguard.instance.IrisSafeguardSystem();
|
||||
getSender().setTag(getTag());
|
||||
INMS.get().injectBukkit();
|
||||
if (IrisSafeguard.instance.unstablemode && !IrisSafeguard.instance.acceptUnstable) IrisSafeguard.instance.earlySplash();
|
||||
if (IrisSafeguard.instance.unstablemode && !IrisSafeguard.instance.acceptUnstable)
|
||||
IrisSafeguard.instance.earlySplash();
|
||||
compat = IrisCompat.configured(getDataFile("compat.json"));
|
||||
linkMultiverseCore = new MultiverseCoreLink();
|
||||
linkMythicMobs = new MythicMobsLink();
|
||||
|
@ -24,12 +24,10 @@ import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.json.JSONException;
|
||||
import com.volmit.iris.util.json.JSONObject;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("SynchronizeOnNonFinalField")
|
||||
@Data
|
||||
@ -196,6 +194,7 @@ public class IrisSettings {
|
||||
public boolean disableTimeAndWeather = true;
|
||||
public boolean autoStartDefaultStudio = false;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class IrisWorldDump {
|
||||
public int mcaCacheSize = 3;
|
||||
|
@ -27,10 +27,8 @@ import com.volmit.iris.util.decree.DecreeOrigin;
|
||||
import com.volmit.iris.util.decree.annotations.Decree;
|
||||
import com.volmit.iris.util.decree.annotations.Param;
|
||||
import com.volmit.iris.util.decree.specialhandlers.NullableBiomeHandler;
|
||||
import com.volmit.iris.util.decree.specialhandlers.NullablePlayerHandler;
|
||||
import com.volmit.iris.util.decree.specialhandlers.NullableRegionHandler;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.awt.*;
|
||||
|
@ -20,17 +20,13 @@ package com.volmit.iris.core.commands;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.ServerConfigurator;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.datapack.DataVersion;
|
||||
import com.volmit.iris.core.pregenerator.ChunkUpdater;
|
||||
import com.volmit.iris.core.safeguard.IrisSafeguard;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.core.tools.IrisBenchmarking;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.core.safeguard.UtilsSFG;
|
||||
import com.volmit.iris.engine.object.IrisWorld;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import com.volmit.iris.engine.platform.DummyChunkGenerator;
|
||||
@ -44,13 +40,10 @@ import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import io.lumine.mythic.bukkit.adapters.BukkitPlayer;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.filefilter.IOFileFilter;
|
||||
import org.apache.commons.io.filefilter.TrueFileFilter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -60,10 +53,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.Console;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -71,11 +62,14 @@ import java.util.List;
|
||||
import static com.volmit.iris.Iris.service;
|
||||
import static com.volmit.iris.core.service.EditSVC.deletingWorld;
|
||||
import static com.volmit.iris.core.tools.IrisBenchmarking.inProgress;
|
||||
import static com.volmit.iris.core.safeguard.ServerBootSFG.incompatibilities;
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
@Decree(name = "iris", aliases = {"ir", "irs"}, description = "Basic Command")
|
||||
public class CommandIris implements DecreeExecutor {
|
||||
public static boolean worldCreation = false;
|
||||
String WorldEngine;
|
||||
String worldNameToCheck = "YourWorldName";
|
||||
VolmitSender sender = Iris.getSender();
|
||||
private CommandStudio studio;
|
||||
private CommandPregen pregen;
|
||||
private CommandLazyPregen lazyPregen;
|
||||
@ -87,10 +81,19 @@ public class CommandIris implements DecreeExecutor {
|
||||
private CommandFind find;
|
||||
private CommandSupport support;
|
||||
private CommandDeveloper developer;
|
||||
public static boolean worldCreation = false;
|
||||
String WorldEngine;
|
||||
String worldNameToCheck = "YourWorldName";
|
||||
VolmitSender sender = Iris.getSender();
|
||||
|
||||
public static boolean deleteDirectory(File dir) {
|
||||
if (dir.isDirectory()) {
|
||||
File[] children = dir.listFiles();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
boolean success = deleteDirectory(children[i]);
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dir.delete();
|
||||
}
|
||||
|
||||
@Decree(description = "Create a new world", aliases = {"+", "c"})
|
||||
public void create(
|
||||
@ -171,16 +174,6 @@ public class CommandIris implements DecreeExecutor {
|
||||
sender().sendMessage(C.GREEN + "Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");
|
||||
}
|
||||
|
||||
//todo Move to React
|
||||
@Decree(description = "Benchmark your server", origin = DecreeOrigin.CONSOLE)
|
||||
public void serverbenchmark() throws InterruptedException {
|
||||
if(!inProgress) {
|
||||
IrisBenchmarking.runBenchmark();
|
||||
} else {
|
||||
Iris.info(C.RED + "Benchmark already is in progress.");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/todo
|
||||
@Decree(description = "Benchmark a pack", origin = DecreeOrigin.CONSOLE)
|
||||
@ -194,6 +187,16 @@ public class CommandIris implements DecreeExecutor {
|
||||
IrisPackBenchmarking.runBenchmark();
|
||||
} */
|
||||
|
||||
//todo Move to React
|
||||
@Decree(description = "Benchmark your server", origin = DecreeOrigin.CONSOLE)
|
||||
public void serverbenchmark() throws InterruptedException {
|
||||
if (!inProgress) {
|
||||
IrisBenchmarking.runBenchmark();
|
||||
} else {
|
||||
Iris.info(C.RED + "Benchmark already is in progress.");
|
||||
}
|
||||
}
|
||||
|
||||
@Decree(description = "Print world height information", origin = DecreeOrigin.PLAYER)
|
||||
public void height() {
|
||||
if (sender().isPlayer()) {
|
||||
@ -297,19 +300,6 @@ public class CommandIris implements DecreeExecutor {
|
||||
deletingWorld = false;
|
||||
}
|
||||
|
||||
public static boolean deleteDirectory(File dir) {
|
||||
if (dir.isDirectory()) {
|
||||
File[] children = dir.listFiles();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
boolean success = deleteDirectory(children[i]);
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dir.delete();
|
||||
}
|
||||
|
||||
@Decree(description = "Updates all chunk in the specified world")
|
||||
public void updater(
|
||||
@Param(description = "World to update chunks at")
|
||||
@ -543,6 +533,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Decree(description = "Evacuate an iris world", origin = DecreeOrigin.PLAYER, sync = true)
|
||||
public void evacuate(
|
||||
@Param(description = "Evacuate the world")
|
||||
@ -561,6 +552,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
File worldDirectory = new File(worldContainer, worldName);
|
||||
return worldDirectory.exists() && worldDirectory.isDirectory();
|
||||
}
|
||||
|
||||
private void checkForBukkitWorlds(String world) {
|
||||
FileConfiguration fc = new YamlConfiguration();
|
||||
try {
|
||||
@ -603,6 +595,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||
Iris.debug("Default World Generator Called for " + worldName + " using ID: " + id);
|
||||
if (worldName.equals("test")) {
|
||||
|
@ -19,16 +19,11 @@
|
||||
package com.volmit.iris.core.commands;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||
import com.volmit.iris.util.decree.annotations.Decree;
|
||||
import com.volmit.iris.util.decree.annotations.Param;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -39,6 +34,7 @@ import java.io.IOException;
|
||||
@Decree(name = "lazypregen", aliases = "lazy", description = "Pregenerate your Iris worlds!")
|
||||
public class CommandLazyPregen implements DecreeExecutor {
|
||||
public String worldName;
|
||||
|
||||
@Decree(description = "Pregenerate a world")
|
||||
public void start(
|
||||
@Param(description = "The radius of the pregen in blocks", aliases = "size")
|
||||
|
@ -74,7 +74,8 @@ public class CommandObject implements DecreeExecutor {
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
|
||||
//Prevent blocks being set in or bellow bedrock
|
||||
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK) return;
|
||||
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK)
|
||||
return;
|
||||
|
||||
futureBlockChanges.put(block, block.getBlockData());
|
||||
|
||||
|
@ -19,9 +19,7 @@
|
||||
package com.volmit.iris.core.commands;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||
@ -29,12 +27,10 @@ import com.volmit.iris.util.decree.annotations.Decree;
|
||||
import com.volmit.iris.util.decree.annotations.Param;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
|
||||
@Decree(name = "pregen", aliases = "pregenerate", description = "Pregenerate your Iris worlds!")
|
||||
public class CommandPregen implements DecreeExecutor {
|
||||
|
@ -197,7 +197,8 @@ public class CommandStudio implements DecreeExecutor {
|
||||
while (futures.isNotEmpty()) {
|
||||
try {
|
||||
futures.remove(0).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
} catch (InterruptedException |
|
||||
ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,8 @@ public class CommandSupport implements DecreeExecutor {
|
||||
@Decree(description = "report")
|
||||
public void report() {
|
||||
try {
|
||||
if (sender().isPlayer()) sender().sendMessage(C.GOLD + "Creating report..");
|
||||
if (sender().isPlayer())
|
||||
sender().sendMessage(C.GOLD + "Creating report..");
|
||||
if (!sender().isPlayer()) Iris.info(C.GOLD + "Creating report..");
|
||||
Hastebin.enviornment(sender());
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
package com.volmit.iris.core.commands;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
||||
import com.volmit.iris.core.pregenerator.TurboPregenerator;
|
||||
import com.volmit.iris.core.pregenerator.TurboPregenerator;
|
||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||
import com.volmit.iris.util.decree.annotations.Decree;
|
||||
@ -36,6 +34,7 @@ import java.io.IOException;
|
||||
@Decree(name = "turbopregen", aliases = "turbo", description = "Pregenerate your Iris worlds!")
|
||||
public class CommandTurboPregen implements DecreeExecutor {
|
||||
public String worldName;
|
||||
|
||||
@Decree(description = "Pregenerate a world")
|
||||
public void start(
|
||||
@Param(description = "The radius of the pregen in blocks", aliases = "size")
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
package com.volmit.iris.core.commands;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.pregenerator.ChunkUpdater;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
@ -29,6 +27,7 @@ import com.volmit.iris.util.decree.annotations.Decree;
|
||||
import com.volmit.iris.util.decree.annotations.Param;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import org.bukkit.World;
|
||||
|
||||
@Decree(name = "updater", origin = DecreeOrigin.BOTH, description = "Iris World Updater")
|
||||
public class CommandUpdater implements DecreeExecutor {
|
||||
|
@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.edit.BlockSignal;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisRegion;
|
||||
import com.volmit.iris.util.data.B;
|
||||
@ -39,7 +38,6 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Decree(name = "what", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris What?")
|
||||
|
@ -24,7 +24,6 @@ import com.volmit.iris.core.pregenerator.IrisPregenerator;
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||
import com.volmit.iris.core.tools.IrisPackBenchmarking;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
@ -45,8 +44,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static com.volmit.iris.core.tools.IrisPackBenchmarking.benchmarkInProgress;
|
||||
|
||||
public class PregeneratorJob implements PregenListener {
|
||||
private static final Color COLOR_EXISTS = parseColor("#4d7d5b");
|
||||
private static final Color COLOR_BLACK = parseColor("#4d7d5b");
|
||||
|
@ -59,7 +59,8 @@ public class EcoItemsDataProvider extends ExternalDataProvider {
|
||||
@Override
|
||||
public ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) throws MissingResourceException {
|
||||
EcoItem item = EcoItems.INSTANCE.getByID(itemId.key());
|
||||
if (item == null) throw new MissingResourceException("Failed to find Item!", itemId.namespace(), itemId.key());
|
||||
if (item == null)
|
||||
throw new MissingResourceException("Failed to find Item!", itemId.namespace(), itemId.key());
|
||||
return itemStack.get(item).clone();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,8 @@ public abstract class ExternalDataProvider {
|
||||
|
||||
public abstract ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) throws MissingResourceException;
|
||||
|
||||
public void processUpdate(Engine engine, Block block, Identifier blockId) {}
|
||||
public void processUpdate(Engine engine, Block block, Identifier blockId) {
|
||||
}
|
||||
|
||||
public abstract Identifier[] getBlockTypes();
|
||||
|
||||
|
@ -49,9 +49,11 @@ public class MMOItemsDataProvider extends ExternalDataProvider {
|
||||
int id = -1;
|
||||
try {
|
||||
id = Integer.parseInt(blockId.key());
|
||||
} catch (NumberFormatException ignored) {}
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
CustomBlock block = api().getCustomBlocks().getBlock(id);
|
||||
if (block == null) throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||
if (block == null)
|
||||
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||
return block.getState().getBlockData();
|
||||
}
|
||||
|
||||
@ -88,7 +90,8 @@ public class MMOItemsDataProvider extends ExternalDataProvider {
|
||||
ItemStack item = null;
|
||||
try {
|
||||
item = future.get();
|
||||
} catch (InterruptedException | ExecutionException ignored) {}
|
||||
} catch (InterruptedException | ExecutionException ignored) {
|
||||
}
|
||||
if (item == null)
|
||||
throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
||||
return item;
|
||||
|
@ -143,7 +143,8 @@ public class OraxenDataProvider extends ExternalDataProvider {
|
||||
BiomeColor type = null;
|
||||
try {
|
||||
type = BiomeColor.valueOf(state.get("matchBiome").toUpperCase());
|
||||
} catch (NullPointerException | IllegalArgumentException ignored) {}
|
||||
} catch (NullPointerException | IllegalArgumentException ignored) {
|
||||
}
|
||||
|
||||
if (type != null) {
|
||||
var biomeColor = INMS.get().getBiomeColor(block.getLocation(), type);
|
||||
|
@ -21,14 +21,11 @@ package com.volmit.iris.core.link;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||
import com.volmit.iris.util.data.Cuboid;
|
||||
import com.volmit.iris.util.data.KCache;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.time.Duration;
|
||||
import java.util.UUID;
|
||||
|
||||
public class WorldEditLink {
|
||||
private static final AtomicCache<Boolean> active = new AtomicCache<>();
|
||||
@ -49,7 +46,8 @@ public class WorldEditLink {
|
||||
Object region = null;
|
||||
try {
|
||||
region = localSession.getClass().getDeclaredMethod("getSelection", Class.forName("com.sk89q.worldedit.world.World")).invoke(localSession, world);
|
||||
} catch (InvocationTargetException ignored) {}
|
||||
} catch (InvocationTargetException ignored) {
|
||||
}
|
||||
if (region == null) return null;
|
||||
|
||||
Object min = region.getClass().getDeclaredMethod("getMinimumPoint").invoke(region);
|
||||
|
@ -75,7 +75,9 @@ public class INMS {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (ClassNotFoundException|NoClassDefFoundError classNotFoundException) {}
|
||||
} catch (ClassNotFoundException |
|
||||
NoClassDefFoundError classNotFoundException) {
|
||||
}
|
||||
|
||||
Iris.info("Craftbukkit " + code + " <-> " + NMSBinding1X.class.getSimpleName() + " Successfully Bound");
|
||||
Iris.warn("Note: Some features of Iris may not work the same since you are on an unsupported version of Minecraft.");
|
||||
|
@ -22,11 +22,18 @@ import java.util.Collection;
|
||||
|
||||
public interface IPackRepository {
|
||||
void reload();
|
||||
|
||||
void reloadWorldData();
|
||||
|
||||
void setSelected(Collection<String> packs);
|
||||
|
||||
boolean addPack(String packId);
|
||||
|
||||
boolean removePack(String packId);
|
||||
|
||||
Collection<String> getAvailableIds();
|
||||
|
||||
Collection<String> getSelectedIds();
|
||||
|
||||
boolean isAvailable(String packId);
|
||||
}
|
||||
|
@ -44,10 +44,6 @@ public enum DataVersion {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public IDataFixer get() {
|
||||
return cache.computeIfAbsent(this, k -> constructor.get());
|
||||
}
|
||||
|
||||
public static IDataFixer getDefault() {
|
||||
return INMS.get().getDataVersion().get();
|
||||
}
|
||||
@ -55,4 +51,8 @@ public enum DataVersion {
|
||||
public static DataVersion getLatest() {
|
||||
return values()[values().length - 1];
|
||||
}
|
||||
|
||||
public IDataFixer get() {
|
||||
return cache.computeIfAbsent(this, k -> constructor.get());
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class NMSBinding1X implements INMSBinding {
|
||||
|
@ -22,17 +22,19 @@ import com.volmit.iris.core.nms.container.IPackRepository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
class PackRepository1X implements IPackRepository {
|
||||
@Override
|
||||
public void reload() {}
|
||||
public void reload() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadWorldData() {}
|
||||
public void reloadWorldData() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(Collection<String> packs) {}
|
||||
public void setSelected(Collection<String> packs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPack(String packId) {
|
||||
|
@ -33,7 +33,6 @@ import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@ -41,9 +40,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public class ChunkUpdater {
|
||||
private AtomicBoolean paused;
|
||||
private AtomicBoolean cancelled;
|
||||
private KMap<Chunk, Long> lastUse;
|
||||
private final RollingSequence chunksPerSecond;
|
||||
private final AtomicInteger worldheightsize;
|
||||
private final AtomicInteger worldwidthsize;
|
||||
@ -51,6 +47,12 @@ public class ChunkUpdater {
|
||||
private final AtomicInteger totalMaxChunks;
|
||||
private final AtomicInteger totalMcaregions;
|
||||
private final AtomicInteger position;
|
||||
private final Object pauseLock;
|
||||
private final Engine engine;
|
||||
private final World world;
|
||||
private AtomicBoolean paused;
|
||||
private AtomicBoolean cancelled;
|
||||
private KMap<Chunk, Long> lastUse;
|
||||
private AtomicInteger chunksProcessed;
|
||||
private AtomicInteger chunksUpdated;
|
||||
private AtomicLong startTime;
|
||||
@ -59,9 +61,6 @@ public class ChunkUpdater {
|
||||
private ScheduledExecutorService scheduler;
|
||||
private CompletableFuture future;
|
||||
private CountDownLatch latch;
|
||||
private final Object pauseLock;
|
||||
private final Engine engine;
|
||||
private final World world;
|
||||
|
||||
public ChunkUpdater(World world) {
|
||||
this.engine = IrisToolbelt.access(world).getEngine();
|
||||
@ -235,7 +234,8 @@ public class ChunkUpdater {
|
||||
});
|
||||
try {
|
||||
latch.await();
|
||||
} catch (InterruptedException ignored) {}
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
if (!c.isGenerated()) {
|
||||
generated.set(false);
|
||||
@ -248,7 +248,8 @@ public class ChunkUpdater {
|
||||
futures.removeIf(Future::isDone);
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
} catch (InterruptedException ignored) {}
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
return generated.get();
|
||||
}
|
||||
|
@ -55,6 +55,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public class IrisPregenerator {
|
||||
private static AtomicInteger generated;
|
||||
private static AtomicInteger totalChunks;
|
||||
private final String saveFile = "regions.json";
|
||||
private final PregenTask task;
|
||||
private final PregeneratorMethod generator;
|
||||
@ -66,18 +68,16 @@ public class IrisPregenerator {
|
||||
private final RollingSequence chunksPerMinute;
|
||||
private final RollingSequence regionsPerMinute;
|
||||
private final KList<Integer> chunksPerSecondHistory;
|
||||
private static AtomicInteger generated;
|
||||
private final AtomicInteger generatedLast;
|
||||
private final AtomicInteger generatedLastMinute;
|
||||
private static AtomicInteger totalChunks;
|
||||
private final AtomicLong startTime;
|
||||
private final ChronoLatch minuteLatch;
|
||||
private final AtomicReference<String> currentGeneratorMethod;
|
||||
private Set<Position2> generatedRegions;
|
||||
private final KSet<Position2> retry;
|
||||
private final KSet<Position2> net;
|
||||
private final ChronoLatch cl;
|
||||
private final ChronoLatch saveLatch = new ChronoLatch(30000);
|
||||
private Set<Position2> generatedRegions;
|
||||
|
||||
public IrisPregenerator(PregenTask task, PregeneratorMethod generator, PregenListener listener) {
|
||||
generatedRegions = ConcurrentHashMap.newKeySet();
|
||||
@ -317,7 +317,8 @@ public class IrisPregenerator {
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
try (Reader reader = new FileReader(generator.getWorld().getWorldFolder().getPath() + "/" + saveFile)) {
|
||||
Type setType = new TypeToken<HashSet<Position2>>(){}.getType();
|
||||
Type setType = new TypeToken<HashSet<Position2>>() {
|
||||
}.getType();
|
||||
Set<Position2> loadedSet = gson.fromJson(reader, setType);
|
||||
if (loadedSet != null) {
|
||||
generatedRegions.clear();
|
||||
|
@ -42,32 +42,31 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class LazyPregenerator extends Thread implements Listener {
|
||||
private static final Map<String, LazyPregenJob> jobs = new HashMap<>();
|
||||
@Getter
|
||||
private static LazyPregenerator instance;
|
||||
private static AtomicInteger lazyGeneratedChunks;
|
||||
private final LazyPregenJob job;
|
||||
private final File destination;
|
||||
private final int maxPosition;
|
||||
private World world;
|
||||
private final long rate;
|
||||
private final ChronoLatch latch;
|
||||
private static AtomicInteger lazyGeneratedChunks;
|
||||
private final AtomicInteger generatedLast;
|
||||
private final AtomicInteger lazyTotalChunks;
|
||||
private final AtomicLong startTime;
|
||||
private final RollingSequence chunksPerSecond;
|
||||
private final RollingSequence chunksPerMinute;
|
||||
|
||||
private static final Map<String, LazyPregenJob> jobs = new HashMap<>();
|
||||
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
private World world;
|
||||
|
||||
public LazyPregenerator(LazyPregenJob job, File destination) {
|
||||
this.job = job;
|
||||
@ -106,6 +105,26 @@ public class LazyPregenerator extends Thread implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setPausedLazy(World world) {
|
||||
LazyPregenJob job = jobs.get(world.getName());
|
||||
if (isPausedLazy(world)) {
|
||||
job.paused = false;
|
||||
} else {
|
||||
job.paused = true;
|
||||
}
|
||||
|
||||
if (job.paused) {
|
||||
Iris.info(C.BLUE + "LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Paused");
|
||||
} else {
|
||||
Iris.info(C.BLUE + "LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPausedLazy(World world) {
|
||||
LazyPregenJob job = jobs.get(world.getName());
|
||||
return job != null && job.isPaused();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(WorldUnloadEvent e) {
|
||||
if (e.getWorld().equals(world)) {
|
||||
@ -164,8 +183,6 @@ public class LazyPregenerator extends Thread implements Listener {
|
||||
// todo broken
|
||||
}
|
||||
|
||||
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
|
||||
private void tickGenerate(Position2 chunk) {
|
||||
executorService.submit(() -> {
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
@ -184,7 +201,8 @@ public class LazyPregenerator extends Thread implements Listener {
|
||||
}
|
||||
try {
|
||||
latch.await();
|
||||
} catch (InterruptedException ignored) {}
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
lazyGeneratedChunks.addAndGet(1);
|
||||
});
|
||||
}
|
||||
@ -220,26 +238,6 @@ public class LazyPregenerator extends Thread implements Listener {
|
||||
});
|
||||
}
|
||||
|
||||
public static void setPausedLazy(World world) {
|
||||
LazyPregenJob job = jobs.get(world.getName());
|
||||
if (isPausedLazy(world)){
|
||||
job.paused = false;
|
||||
} else {
|
||||
job.paused = true;
|
||||
}
|
||||
|
||||
if ( job.paused) {
|
||||
Iris.info(C.BLUE + "LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Paused");
|
||||
} else {
|
||||
Iris.info(C.BLUE + "LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPausedLazy(World world) {
|
||||
LazyPregenJob job = jobs.get(world.getName());
|
||||
return job != null && job.isPaused();
|
||||
}
|
||||
|
||||
public void shutdownInstance(World world) throws IOException {
|
||||
Iris.info("LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Shutting down..");
|
||||
LazyPregenJob job = jobs.get(world.getName());
|
||||
@ -284,6 +282,10 @@ public class LazyPregenerator extends Thread implements Listener {
|
||||
@Data
|
||||
@Builder
|
||||
public static class LazyPregenJob {
|
||||
@Builder.Default
|
||||
boolean silent = false;
|
||||
@Builder.Default
|
||||
boolean paused = false;
|
||||
private String world;
|
||||
@Builder.Default
|
||||
private int healingPosition = 0;
|
||||
@ -295,10 +297,6 @@ public class LazyPregenerator extends Thread implements Listener {
|
||||
private int radiusBlocks = 5000;
|
||||
@Builder.Default
|
||||
private int position = 0;
|
||||
@Builder.Default
|
||||
boolean silent = false;
|
||||
@Builder.Default
|
||||
boolean paused = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
package com.volmit.iris.core.pregenerator;
|
||||
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import org.bukkit.World;
|
||||
|
||||
|
@ -20,7 +20,6 @@ package com.volmit.iris.core.pregenerator;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
@ -39,20 +38,21 @@ import io.papermc.lib.PaperLib;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import org.apache.logging.log4j.core.util.ExecutorServices;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.checkerframework.checker.units.qual.N;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@ -60,14 +60,14 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class TurboPregenerator extends Thread implements Listener {
|
||||
private static final Map<String, TurboPregenJob> jobs = new HashMap<>();
|
||||
@Getter
|
||||
private static TurboPregenerator instance;
|
||||
private static AtomicInteger turboGeneratedChunks;
|
||||
private final TurboPregenJob job;
|
||||
private final File destination;
|
||||
private final int maxPosition;
|
||||
private World world;
|
||||
private final ChronoLatch latch;
|
||||
private static AtomicInteger turboGeneratedChunks;
|
||||
private final AtomicInteger generatedLast;
|
||||
private final AtomicLong cachedLast;
|
||||
private final RollingSequence cachePerSecond;
|
||||
@ -75,14 +75,15 @@ public class TurboPregenerator extends Thread implements Listener {
|
||||
private final AtomicLong startTime;
|
||||
private final RollingSequence chunksPerSecond;
|
||||
private final RollingSequence chunksPerMinute;
|
||||
private final HyperLock hyperLock;
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(10);
|
||||
private World world;
|
||||
private KList<Position2> queue;
|
||||
private ConcurrentHashMap<Integer, Position2> cache;
|
||||
private AtomicInteger maxWaiting;
|
||||
private ReentrantLock cachinglock;
|
||||
private AtomicBoolean caching;
|
||||
private final HyperLock hyperLock;
|
||||
private MultiBurst burst;
|
||||
private static final Map<String, TurboPregenJob> jobs = new HashMap<>();
|
||||
|
||||
public TurboPregenerator(TurboPregenJob job, File destination) {
|
||||
this.job = job;
|
||||
@ -129,6 +130,26 @@ public class TurboPregenerator extends Thread implements Listener {
|
||||
|
||||
}
|
||||
|
||||
public static void setPausedTurbo(World world) {
|
||||
TurboPregenJob job = jobs.get(world.getName());
|
||||
if (isPausedTurbo(world)) {
|
||||
job.paused = false;
|
||||
} else {
|
||||
job.paused = true;
|
||||
}
|
||||
|
||||
if (job.paused) {
|
||||
Iris.info(C.BLUE + "TurboGen: " + C.IRIS + world.getName() + C.BLUE + " Paused");
|
||||
} else {
|
||||
Iris.info(C.BLUE + "TurboGen: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPausedTurbo(World world) {
|
||||
TurboPregenJob job = jobs.get(world.getName());
|
||||
return job != null && job.isPaused();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(WorldUnloadEvent e) {
|
||||
if (e.getWorld().equals(world)) {
|
||||
@ -242,7 +263,6 @@ public class TurboPregenerator extends Thread implements Listener {
|
||||
// todo broken
|
||||
}
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(10);
|
||||
private void tickGenerate(Position2 chunk) {
|
||||
executorService.submit(() -> {
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
@ -284,26 +304,6 @@ public class TurboPregenerator extends Thread implements Listener {
|
||||
});
|
||||
}
|
||||
|
||||
public static void setPausedTurbo(World world) {
|
||||
TurboPregenJob job = jobs.get(world.getName());
|
||||
if (isPausedTurbo(world)) {
|
||||
job.paused = false;
|
||||
} else {
|
||||
job.paused = true;
|
||||
}
|
||||
|
||||
if (job.paused) {
|
||||
Iris.info(C.BLUE + "TurboGen: " + C.IRIS + world.getName() + C.BLUE + " Paused");
|
||||
} else {
|
||||
Iris.info(C.BLUE + "TurboGen: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPausedTurbo(World world) {
|
||||
TurboPregenJob job = jobs.get(world.getName());
|
||||
return job != null && job.isPaused();
|
||||
}
|
||||
|
||||
public void shutdownInstance(World world) throws IOException {
|
||||
Iris.info("turboGen: " + C.IRIS + world.getName() + C.BLUE + " Shutting down..");
|
||||
TurboPregenJob job = jobs.get(world.getName());
|
||||
@ -348,13 +348,13 @@ public class TurboPregenerator extends Thread implements Listener {
|
||||
@Data
|
||||
@Builder
|
||||
public static class TurboPregenJob {
|
||||
@Builder.Default
|
||||
boolean paused = false;
|
||||
private String world;
|
||||
@Builder.Default
|
||||
private int radiusBlocks = 5000;
|
||||
@Builder.Default
|
||||
private int position = 0;
|
||||
@Builder.Default
|
||||
boolean paused = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
package com.volmit.iris.core.pregenerator.methods;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.IHeadless;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
@ -32,13 +30,12 @@ import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class AsyncPregenMethod implements PregeneratorMethod {
|
||||
|
@ -48,13 +48,15 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {}
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
try {
|
||||
semaphore.acquire(max);
|
||||
} catch (InterruptedException ignored) {}
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
try {
|
||||
headless.close();
|
||||
} catch (IOException e) {
|
||||
@ -64,7 +66,8 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {}
|
||||
public void save() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsRegions(int x, int z, PregenListener listener) {
|
||||
@ -77,7 +80,8 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRegion(int x, int z, PregenListener listener) {}
|
||||
public void generateRegion(int x, int z, PregenListener listener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateChunk(int x, int z, PregenListener listener) {
|
||||
|
@ -28,7 +28,6 @@ import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
|
||||
|
@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
public class ModesSFG {
|
||||
public static void selectMode() {
|
||||
|
@ -24,6 +24,7 @@ import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.ToolProvider;
|
||||
import java.io.File;
|
||||
@ -38,8 +39,6 @@ import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import static com.volmit.iris.Iris.getJavaVersion;
|
||||
import static com.volmit.iris.Iris.instance;
|
||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.*;
|
||||
|
||||
public class ServerBootSFG {
|
||||
public static final Map<String, Boolean> incompatibilities = new HashMap<>();
|
||||
@ -48,13 +47,13 @@ public class ServerBootSFG {
|
||||
public static boolean isJRE = false;
|
||||
public static boolean hasPrivileges = true;
|
||||
public static boolean unsuportedversion = false;
|
||||
protected static boolean safeguardPassed;
|
||||
public static boolean passedserversoftware = true;
|
||||
public static String allIncompatibilities;
|
||||
protected static boolean safeguardPassed;
|
||||
protected static int count;
|
||||
protected static byte severityLow;
|
||||
protected static byte severityMedium;
|
||||
protected static byte severityHigh;
|
||||
public static String allIncompatibilities;
|
||||
|
||||
public static void BootCheck() {
|
||||
Iris.info("Checking for possible conflicts..");
|
||||
@ -155,9 +154,11 @@ public class ServerBootSFG {
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
// If the compiler is null, it means this is a JRE environment, not a JDK.
|
||||
return compiler != null;
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasPrivileges() {
|
||||
Path pv = Paths.get(Bukkit.getWorldContainer() + "iristest.json");
|
||||
try (FileChannel fc = FileChannel.open(pv, StandardOpenOption.CREATE, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.READ, StandardOpenOption.WRITE)) {
|
||||
|
@ -32,8 +32,8 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
|
||||
public class EditSVC implements IrisService {
|
||||
private KMap<World, BlockEditor> editors;
|
||||
public static boolean deletingWorld = false;
|
||||
private KMap<World, BlockEditor> editors;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -33,7 +33,9 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
@ -41,6 +43,29 @@ public class ExternalDataSVC implements IrisService {
|
||||
|
||||
private KList<ExternalDataProvider> providers = new KList<>(), activeProviders = new KList<>();
|
||||
|
||||
public static Pair<Identifier, KMap<String, String>> parseState(Identifier key) {
|
||||
if (!key.key().contains("[") || !key.key().contains("]")) {
|
||||
return new Pair<>(key, new KMap<>());
|
||||
}
|
||||
String state = key.key().split("\\Q[\\E")[1].split("\\Q]\\E")[0];
|
||||
KMap<String, String> stateMap = new KMap<>();
|
||||
if (!state.isEmpty()) {
|
||||
Arrays.stream(state.split(",")).forEach(s -> stateMap.put(s.split("=")[0], s.split("=")[1]));
|
||||
}
|
||||
return new Pair<>(new Identifier(key.namespace(), key.key().split("\\Q[\\E")[0]), stateMap);
|
||||
}
|
||||
|
||||
public static Identifier buildState(Identifier key, KMap<String, String> state) {
|
||||
if (state.isEmpty()) {
|
||||
return key;
|
||||
}
|
||||
String path = state.entrySet()
|
||||
.stream()
|
||||
.map(e -> e.getKey() + "=" + e.getValue())
|
||||
.collect(Collectors.joining(",", key.key() + "[", "]"));
|
||||
return new Identifier(key.namespace(), path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Iris.info("Loading ExternalDataProvider...");
|
||||
@ -144,27 +169,4 @@ public class ExternalDataSVC implements IrisService {
|
||||
activeProviders.forEach(p -> names.add(p.getItemTypes()));
|
||||
return names.toArray(new Identifier[0]);
|
||||
}
|
||||
|
||||
public static Pair<Identifier, KMap<String, String>> parseState(Identifier key) {
|
||||
if (!key.key().contains("[") || !key.key().contains("]")) {
|
||||
return new Pair<>(key, new KMap<>());
|
||||
}
|
||||
String state = key.key().split("\\Q[\\E")[1].split("\\Q]\\E")[0];
|
||||
KMap<String, String> stateMap = new KMap<>();
|
||||
if (!state.isEmpty()) {
|
||||
Arrays.stream(state.split(",")).forEach(s -> stateMap.put(s.split("=")[0], s.split("=")[1]));
|
||||
}
|
||||
return new Pair<>(new Identifier(key.namespace(), key.key().split("\\Q[\\E")[0]), stateMap);
|
||||
}
|
||||
|
||||
public static Identifier buildState(Identifier key, KMap<String, String> state) {
|
||||
if (state.isEmpty()) {
|
||||
return key;
|
||||
}
|
||||
String path = state.entrySet()
|
||||
.stream()
|
||||
.map(e -> e.getKey() + "=" + e.getValue())
|
||||
.collect(Collectors.joining(",", key.key() + "[", "]"));
|
||||
return new Identifier(key.namespace(), path);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ import com.volmit.iris.util.misc.E;
|
||||
import com.volmit.iris.util.plugin.IrisService;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.S;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -197,7 +196,8 @@ public class WandSVC implements IrisService {
|
||||
meta.setLore(new ArrayList<>()); //Reset the lore on this too so we can compare them
|
||||
stack.setItemMeta(meta); //We dont need to clone the item as items from .get are cloned
|
||||
|
||||
if (wand.isSimilar(stack)) return s; //If the name, material and NBT is the same
|
||||
if (wand.isSimilar(stack))
|
||||
return s; //If the name, material and NBT is the same
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -21,9 +21,7 @@ package com.volmit.iris.core.tools;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import oshi.SystemInfo;
|
||||
import oshi.hardware.CentralProcessor;
|
||||
import oshi.hardware.GlobalMemory;
|
||||
import oshi.hardware.HWDiskStore;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
|
||||
import java.io.*;
|
||||
@ -35,18 +33,17 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import static com.google.common.math.LongMath.isPrime;
|
||||
import static com.volmit.iris.util.misc.getHardware.getCPUModel;
|
||||
|
||||
public class IrisBenchmarking {
|
||||
public static boolean inProgress = false;
|
||||
static String ServerOS;
|
||||
static String filePath = "benchmark.dat";
|
||||
static double avgWriteSpeedMBps;
|
||||
@ -72,7 +69,6 @@ public class IrisBenchmarking {
|
||||
static double elapsedTimeNs;
|
||||
static boolean Winsat = false;
|
||||
static boolean WindowsDiskSpeed = false;
|
||||
public static boolean inProgress = false;
|
||||
static double startTime;
|
||||
// Good enough for now. . .
|
||||
|
||||
|
@ -19,19 +19,16 @@
|
||||
package com.volmit.iris.core.tools;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.engine.object.IrisObject;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.nbt.io.NBTUtil;
|
||||
import com.volmit.iris.util.nbt.io.NamedTag;
|
||||
import com.volmit.iris.util.nbt.tag.*;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.reflect.V;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -258,7 +255,6 @@ public class IrisConverter {
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int h = 0; h < objH; h++) {
|
||||
for (int d = 0; d < objD; d++) {
|
||||
for (int w = 0; w < objW; w++) {
|
||||
|
@ -21,7 +21,6 @@ package com.volmit.iris.core.tools;
|
||||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
@ -98,6 +97,7 @@ public class IrisCreator {
|
||||
yml.save(BUKKIT_YML);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean worldLoaded() {
|
||||
return true;
|
||||
}
|
||||
|
@ -24,9 +24,6 @@ import com.volmit.iris.core.project.IrisProject;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||
import com.volmit.iris.util.decree.annotations.Decree;
|
||||
import com.volmit.iris.util.decree.annotations.Param;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.function.NoiseProvider;
|
||||
|
@ -36,7 +36,6 @@ import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.exceptions.IrisException;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import lombok.Getter;
|
||||
@ -59,13 +58,13 @@ public class IrisPackBenchmarking {
|
||||
@Getter
|
||||
public static IrisPackBenchmarking instance;
|
||||
public static boolean benchmarkInProgress = false;
|
||||
private IrisDimension IrisDimension;
|
||||
private int radius;
|
||||
private final boolean headless;
|
||||
private final boolean gui;
|
||||
PrecisionStopwatch stopwatch;
|
||||
private IrisDimension IrisDimension;
|
||||
private int radius;
|
||||
private boolean finished = false;
|
||||
private Engine engine;
|
||||
PrecisionStopwatch stopwatch;
|
||||
|
||||
public IrisPackBenchmarking(IrisDimension dimension, int r, boolean headless, boolean gui) {
|
||||
instance = this;
|
||||
@ -151,6 +150,7 @@ public class IrisPackBenchmarking {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private Engine createBenchmark() {
|
||||
try {
|
||||
if (headless) {
|
||||
|
@ -20,7 +20,8 @@ package com.volmit.iris.core.tools;
|
||||
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.engine.object.IrisWorld;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
@ -21,7 +21,6 @@ package com.volmit.iris.core.tools;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.M;
|
||||
@ -134,21 +133,6 @@ public class IrisWorldDump {
|
||||
|
||||
}
|
||||
|
||||
public class blockData {
|
||||
@Getter
|
||||
@Setter
|
||||
private String block;
|
||||
private int biome;
|
||||
private int height;
|
||||
|
||||
public blockData(String b, int bm, int h) {
|
||||
this.block = b;
|
||||
this.height = h;
|
||||
this.biome = bm;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void dump() {
|
||||
Iris.info("Starting the dump process.");
|
||||
int threads = Runtime.getRuntime().availableProcessors();
|
||||
@ -256,4 +240,18 @@ public class IrisWorldDump {
|
||||
);
|
||||
}
|
||||
|
||||
public class blockData {
|
||||
@Getter
|
||||
@Setter
|
||||
private String block;
|
||||
private int biome;
|
||||
private int height;
|
||||
|
||||
public blockData(String b, int bm, int h) {
|
||||
this.block = b;
|
||||
this.height = h;
|
||||
this.biome = bm;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -288,7 +288,6 @@ public class IrisComplex implements DataProvider {
|
||||
return biome;
|
||||
}
|
||||
|
||||
private record DPair(double x, double z) {}
|
||||
private double interpolateGenerators(Engine engine, IrisInterpolator interpolator, KSet<IrisGenerator> generators, double x, double z, long seed) {
|
||||
if (generators.isEmpty()) {
|
||||
return 0;
|
||||
@ -389,4 +388,7 @@ public class IrisComplex implements DataProvider {
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
private record DPair(double x, double z) {
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ import com.volmit.iris.util.mantle.MantleFlag;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.matter.MatterStructurePOI;
|
||||
import com.volmit.iris.util.misc.E;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
@ -55,7 +54,6 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@ -66,7 +64,10 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@ -97,6 +98,7 @@ public class IrisEngine implements Engine {
|
||||
private final AtomicBoolean cleaning;
|
||||
private final ChronoLatch cleanLatch;
|
||||
private final SeedManager seedManager;
|
||||
private final ReentrantLock dataLock;
|
||||
private EngineMode mode;
|
||||
private EngineExecutionEnvironment execution;
|
||||
private EngineWorldManager worldManager;
|
||||
@ -109,7 +111,6 @@ public class IrisEngine implements Engine {
|
||||
private double maxBiomeLayerDensity;
|
||||
private double maxBiomeDecoratorDensity;
|
||||
private IrisComplex complex;
|
||||
private final ReentrantLock dataLock;
|
||||
|
||||
public IrisEngine(EngineTarget target, boolean studio) {
|
||||
this.studio = studio;
|
||||
@ -145,6 +146,26 @@ public class IrisEngine implements Engine {
|
||||
Iris.debug("Engine Initialized " + getCacheID());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Map<Class<? extends IrisEngineService>, Constructor<? extends IrisEngineService>> scanServices() {
|
||||
JarScanner js = new JarScanner(Iris.instance.getJarFile(), "com.volmit.iris.engine.service");
|
||||
J.attempt(js::scan);
|
||||
KMap<Class<? extends IrisEngineService>, Constructor<? extends IrisEngineService>> map = new KMap<>();
|
||||
js.getClasses()
|
||||
.stream()
|
||||
.filter(IrisEngineService.class::isAssignableFrom)
|
||||
.map(c -> (Class<? extends IrisEngineService>) c)
|
||||
.forEach(c -> {
|
||||
try {
|
||||
map.put(c, c.getConstructor(Engine.class));
|
||||
} catch (NoSuchMethodException e) {
|
||||
Iris.warn("Failed to load service " + c.getName() + " due to missing constructor");
|
||||
}
|
||||
});
|
||||
|
||||
return Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
private void verifySeed() {
|
||||
if (getEngineData().getSeed() != null && getEngineData().getSeed() != target.getWorld().getRawWorldSeed()) {
|
||||
target.getWorld().setRawWorldSeed(getEngineData().getSeed());
|
||||
@ -182,7 +203,8 @@ public class IrisEngine implements Engine {
|
||||
SERVICES.forEach((s, c) -> {
|
||||
try {
|
||||
services.put(s, c.newInstance(this));
|
||||
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
|
||||
} catch (InstantiationException | IllegalAccessException |
|
||||
InvocationTargetException e) {
|
||||
Iris.error("Failed to create service " + s.getName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -599,24 +621,4 @@ public class IrisEngine implements Engine {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Map<Class<? extends IrisEngineService>, Constructor<? extends IrisEngineService>> scanServices() {
|
||||
JarScanner js = new JarScanner(Iris.instance.getJarFile(), "com.volmit.iris.engine.service");
|
||||
J.attempt(js::scan);
|
||||
KMap<Class<? extends IrisEngineService>, Constructor<? extends IrisEngineService>> map = new KMap<>();
|
||||
js.getClasses()
|
||||
.stream()
|
||||
.filter(IrisEngineService.class::isAssignableFrom)
|
||||
.map(c -> (Class<? extends IrisEngineService>) c)
|
||||
.forEach(c -> {
|
||||
try {
|
||||
map.put(c, c.getConstructor(Engine.class));
|
||||
} catch (NoSuchMethodException e) {
|
||||
Iris.warn("Failed to load service " + c.getName() + " due to missing constructor");
|
||||
}
|
||||
});
|
||||
|
||||
return Collections.unmodifiableMap(map);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import com.volmit.iris.engine.object.*;
|
||||
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.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
|
@ -552,7 +552,8 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
public void execute(Future<Chunk> chunkFuture) {
|
||||
try {
|
||||
chunkFuture.get();
|
||||
} catch (InterruptedException | ExecutionException ignored) {
|
||||
} catch (InterruptedException |
|
||||
ExecutionException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -958,5 +958,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
J.a(() -> getMantle().cleanupChunk(x, z));
|
||||
}
|
||||
}
|
||||
|
||||
<T extends IrisEngineService> T getService(Class<T> clazz);
|
||||
}
|
||||
|
@ -40,11 +40,13 @@ public class IrisLootEvent extends Event {
|
||||
this.slot = slot;
|
||||
this.tables = tables;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,8 @@ public interface Locator<T> {
|
||||
(at.getZ() << 4) + 8, false),
|
||||
(at.getZ() << 4) + 8));
|
||||
}
|
||||
} catch (WrongEngineBroException | InterruptedException | ExecutionException e) {
|
||||
} catch (WrongEngineBroException | InterruptedException |
|
||||
ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}) {
|
||||
|
@ -52,7 +52,8 @@ public class WorldObjectPlacer implements IObjectPlacer {
|
||||
|
||||
public WorldObjectPlacer(World world) {
|
||||
var a = IrisToolbelt.access(world);
|
||||
if (a == null || a.getEngine() == null) throw new IllegalStateException(world.getName() + " is not an Iris World!");
|
||||
if (a == null || a.getEngine() == null)
|
||||
throw new IllegalStateException(world.getName() + " is not an Iris World!");
|
||||
this.world = world;
|
||||
this.engine = a.getEngine();
|
||||
this.mantle = engine.getMantle();
|
||||
@ -72,7 +73,8 @@ public class WorldObjectPlacer implements IObjectPlacer {
|
||||
public void set(int x, int y, int z, BlockData d) {
|
||||
Block block = world.getBlockAt(x, y + world.getMinHeight(), z);
|
||||
|
||||
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK) return;
|
||||
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK)
|
||||
return;
|
||||
InventorySlotType slot = null;
|
||||
if (B.isStorageChest(d)) {
|
||||
slot = InventorySlotType.STORAGE;
|
||||
|
@ -195,7 +195,10 @@ public class PlannedPiece {
|
||||
}
|
||||
}
|
||||
|
||||
public record ParentConnection(PlannedPiece parent, IrisJigsawPieceConnector parentConnector, PlannedPiece self, IrisJigsawPieceConnector connector) {
|
||||
public record ParentConnection(PlannedPiece parent,
|
||||
IrisJigsawPieceConnector parentConnector,
|
||||
PlannedPiece self,
|
||||
IrisJigsawPieceConnector connector) {
|
||||
public IrisPosition getTargetPosition() {
|
||||
var pos = parent.realPositions.get(parentConnector);
|
||||
if (pos == null) return null;
|
||||
|
@ -25,7 +25,6 @@ import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.placer.WorldObjectPlacer;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.data.IrisCustomData;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
@ -22,6 +22,7 @@ import com.volmit.iris.util.plugin.VolmitSender;
|
||||
|
||||
public class VMJavaFX {
|
||||
private VolmitSender sender;
|
||||
|
||||
public VMJavaFX(VolmitSender user) {
|
||||
this.sender = user;
|
||||
|
||||
@ -46,5 +47,4 @@ public class VMJavaFX {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.IrisComplex;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.EngineTarget;
|
||||
import com.volmit.iris.engine.framework.SeedManager;
|
||||
import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
|
||||
import com.volmit.iris.engine.mantle.components.MantleObjectComponent;
|
||||
import com.volmit.iris.engine.object.IObjectPlacer;
|
||||
@ -179,6 +178,7 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
default void trim(int limit) {
|
||||
getMantle().trim(TimeUnit.SECONDS.toMillis(IrisSettings.get().getPerformance().getMantleKeepAlive()), limit);
|
||||
}
|
||||
|
||||
default int unloadTectonicPlate(int tectonicLimit) {
|
||||
return getMantle().unloadTectonicPlate(tectonicLimit);
|
||||
}
|
||||
@ -261,6 +261,7 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
default int getLoadedRegionCount() {
|
||||
return getMantle().getLoadedRegionCount();
|
||||
}
|
||||
|
||||
default long getLastUseMapMemoryUsage() {
|
||||
return getMantle().LastUseMapMemoryUsage();
|
||||
}
|
||||
@ -299,9 +300,11 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
default long getToUnload() {
|
||||
return getMantle().getToUnload().size();
|
||||
}
|
||||
|
||||
default long getNotQueuedLoadedRegions() {
|
||||
return getMantle().getLoadedRegions().size() - getMantle().getToUnload().size();
|
||||
}
|
||||
|
||||
default double getTectonicDuration() {
|
||||
return getMantle().getAdjustedIdleDuration().get();
|
||||
}
|
||||
|
@ -148,7 +148,8 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
|
||||
IrisJigsawStructurePlacement i = pick(biome.getJigsawStructures(), seed, x, z);
|
||||
if (i == null) i = pick(region.getJigsawStructures(), seed, x, z);
|
||||
if (i == null) i = pick(getDimension().getJigsawStructures(), seed, x, z);
|
||||
if (i == null)
|
||||
i = pick(getDimension().getJigsawStructures(), seed, x, z);
|
||||
return i != null ? getData().getJigsawStructureLoader().load(i.getStructure()) : null;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,10 @@ import com.volmit.iris.engine.data.cache.Cache;
|
||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisObject;
|
||||
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.engine.object.IrisRegion;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
import com.volmit.iris.util.context.ChunkContext;
|
||||
import com.volmit.iris.util.data.B;
|
||||
|
@ -170,6 +170,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
||||
@Desc("Collection of ores to be generated")
|
||||
@ArrayType(type = IrisOreGenerator.class, min = 1)
|
||||
private KList<IrisOreGenerator> ores = new KList<>();
|
||||
|
||||
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
if (ores.isEmpty()) {
|
||||
return null;
|
||||
|
@ -70,9 +70,11 @@ public enum IrisDirection {
|
||||
return switch (f) {
|
||||
case DOWN -> DOWN_NEGATIVE_Y;
|
||||
case EAST, EAST_NORTH_EAST, EAST_SOUTH_EAST -> EAST_POSITIVE_X;
|
||||
case NORTH, NORTH_NORTH_WEST, NORTH_EAST, NORTH_NORTH_EAST, NORTH_WEST -> NORTH_NEGATIVE_Z;
|
||||
case NORTH, NORTH_NORTH_WEST, NORTH_EAST, NORTH_NORTH_EAST,
|
||||
NORTH_WEST -> NORTH_NEGATIVE_Z;
|
||||
case SELF, UP -> UP_POSITIVE_Y;
|
||||
case SOUTH, SOUTH_EAST, SOUTH_SOUTH_EAST, SOUTH_SOUTH_WEST, SOUTH_WEST -> SOUTH_POSITIVE_Z;
|
||||
case SOUTH, SOUTH_EAST, SOUTH_SOUTH_EAST, SOUTH_SOUTH_WEST,
|
||||
SOUTH_WEST -> SOUTH_POSITIVE_Z;
|
||||
case WEST, WEST_NORTH_WEST, WEST_SOUTH_WEST -> WEST_NEGATIVE_X;
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,6 @@ import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -20,8 +20,6 @@ package com.volmit.iris.engine.object;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@Data
|
||||
public class IrisEngineStatistics {
|
||||
private int unsafeShutdown = 0;
|
||||
|
@ -468,7 +468,6 @@ public class IrisEntity extends IrisRegistrant {
|
||||
}
|
||||
|
||||
|
||||
|
||||
return INMS.get().spawnEntity(at, getType(), getReason());
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,6 @@ import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.math.Vector3d;
|
||||
import com.volmit.iris.util.matter.MatterMarker;
|
||||
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
||||
import io.lumine.mythic.bukkit.adapters.BukkitEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -38,9 +37,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
@Snippet("entity-spawn")
|
||||
@Accessors(chain = true)
|
||||
|
@ -18,11 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||
import com.volmit.iris.engine.object.annotations.Required;
|
||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -19,13 +19,7 @@
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||
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.RegistryListResource;
|
||||
import com.volmit.iris.engine.object.annotations.Required;
|
||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
|
@ -105,7 +105,8 @@ public class IrisObjectRotation {
|
||||
var translate = piece.getPlacementOptions().getTranslate();
|
||||
var pos = rotate(new IrisPosition(translate.getX(), translate.getY(), translate.getZ()));
|
||||
translate.setX(pos.getX()).setY(pos.getY()).setZ(pos.getZ());
|
||||
} catch (NullPointerException ignored) {}
|
||||
} catch (NullPointerException ignored) {
|
||||
}
|
||||
|
||||
return piece;
|
||||
}
|
||||
|
@ -112,8 +112,17 @@ public class TileBanner implements TileData<Banner> {
|
||||
|
||||
public boolean isBanner(Material material) {
|
||||
return switch (material) {
|
||||
case RED_BANNER, RED_WALL_BANNER, ORANGE_BANNER, ORANGE_WALL_BANNER, YELLOW_BANNER, YELLOW_WALL_BANNER, LIME_BANNER, LIME_WALL_BANNER, GREEN_BANNER, GREEN_WALL_BANNER, CYAN_BANNER, CYAN_WALL_BANNER, LIGHT_BLUE_BANNER, LIGHT_BLUE_WALL_BANNER, BLUE_BANNER, BLUE_WALL_BANNER, PURPLE_BANNER, PURPLE_WALL_BANNER, MAGENTA_BANNER, MAGENTA_WALL_BANNER, PINK_BANNER, PINK_WALL_BANNER, WHITE_BANNER, WHITE_WALL_BANNER, LIGHT_GRAY_BANNER, LIGHT_GRAY_WALL_BANNER, GRAY_BANNER, GRAY_WALL_BANNER, BLACK_BANNER, BLACK_WALL_BANNER, BROWN_BANNER, BROWN_WALL_BANNER ->
|
||||
true;
|
||||
case RED_BANNER, RED_WALL_BANNER, ORANGE_BANNER, ORANGE_WALL_BANNER,
|
||||
YELLOW_BANNER, YELLOW_WALL_BANNER, LIME_BANNER,
|
||||
LIME_WALL_BANNER, GREEN_BANNER, GREEN_WALL_BANNER, CYAN_BANNER,
|
||||
CYAN_WALL_BANNER, LIGHT_BLUE_BANNER, LIGHT_BLUE_WALL_BANNER,
|
||||
BLUE_BANNER, BLUE_WALL_BANNER, PURPLE_BANNER,
|
||||
PURPLE_WALL_BANNER, MAGENTA_BANNER, MAGENTA_WALL_BANNER,
|
||||
PINK_BANNER, PINK_WALL_BANNER, WHITE_BANNER, WHITE_WALL_BANNER,
|
||||
LIGHT_GRAY_BANNER, LIGHT_GRAY_WALL_BANNER, GRAY_BANNER,
|
||||
GRAY_WALL_BANNER,
|
||||
BLACK_BANNER, BLACK_WALL_BANNER, BROWN_BANNER,
|
||||
BROWN_WALL_BANNER -> true;
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
@ -52,7 +52,8 @@ public interface TileData<T extends TileState> extends Cloneable {
|
||||
@SuppressWarnings("unchecked") TileData<? extends TileState> d = registry.get(id).getClass().getConstructor().newInstance();
|
||||
d.fromBinary(s);
|
||||
return d;
|
||||
} catch (InvocationTargetException | InstantiationException | IllegalAccessException |
|
||||
} catch (InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException |
|
||||
NoSuchMethodException e) {
|
||||
throw new IOException("Failed to create TileData instance due to missing type registrar!");
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ package com.volmit.iris.engine.platform;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.safeguard.IrisSafeguard;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.engine.IrisEngine;
|
||||
import com.volmit.iris.engine.data.chunk.TerrainChunk;
|
||||
@ -33,7 +32,6 @@ import com.volmit.iris.engine.object.StudioMode;
|
||||
import com.volmit.iris.engine.platform.studio.StudioGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.data.IrisBiomeStorage;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.hunk.view.BiomeGridHunkHolder;
|
||||
import com.volmit.iris.util.hunk.view.ChunkDataHunkHolder;
|
||||
|
@ -19,7 +19,6 @@
|
||||
package com.volmit.iris.engine.platform;
|
||||
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
|
@ -31,6 +31,36 @@ public class EngineStatusSVC extends IrisEngineService {
|
||||
super(engine);
|
||||
}
|
||||
|
||||
public static int getEngineCount() {
|
||||
return Math.max(INSTANCES.size(), 1);
|
||||
}
|
||||
|
||||
public static Status getStatus() {
|
||||
synchronized (INSTANCES) {
|
||||
long loadedChunks = 0;
|
||||
long tectonicPlates = 0;
|
||||
long activeTectonicPlates = 0;
|
||||
long queuedTectonicPlates = 0;
|
||||
long minTectonicUnloadDuration = Long.MAX_VALUE;
|
||||
long maxTectonicUnloadDuration = Long.MIN_VALUE;
|
||||
|
||||
for (var service : INSTANCES) {
|
||||
var world = service.engine.getWorld();
|
||||
if (world.hasRealWorld())
|
||||
loadedChunks += world.realWorld().getLoadedChunks().length;
|
||||
if (world.hasHeadless())
|
||||
loadedChunks += world.headless().getLoadedChunks();
|
||||
|
||||
tectonicPlates += service.engine.getMantle().getLoadedRegionCount();
|
||||
activeTectonicPlates += service.engine.getMantle().getNotQueuedLoadedRegions();
|
||||
queuedTectonicPlates += service.engine.getMantle().getToUnload();
|
||||
minTectonicUnloadDuration = Math.min(minTectonicUnloadDuration, (long) service.engine.getMantle().getTectonicDuration());
|
||||
maxTectonicUnloadDuration = Math.max(maxTectonicUnloadDuration, (long) service.engine.getMantle().getTectonicDuration());
|
||||
}
|
||||
return new Status(INSTANCES.size(), loadedChunks, MantleCleanerSVC.getTectonicLimit(), tectonicPlates, activeTectonicPlates, queuedTectonicPlates, minTectonicUnloadDuration, maxTectonicUnloadDuration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable(boolean hotload) {
|
||||
if (hotload) return;
|
||||
@ -48,33 +78,10 @@ public class EngineStatusSVC extends IrisEngineService {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getEngineCount() {
|
||||
return Math.max(INSTANCES.size(), 1);
|
||||
}
|
||||
|
||||
public static Status getStatus() {
|
||||
synchronized (INSTANCES) {
|
||||
long loadedChunks = 0;
|
||||
long tectonicPlates = 0;
|
||||
long activeTectonicPlates = 0;
|
||||
long queuedTectonicPlates = 0;
|
||||
long minTectonicUnloadDuration = Long.MAX_VALUE;
|
||||
long maxTectonicUnloadDuration = Long.MIN_VALUE;
|
||||
|
||||
for (var service : INSTANCES) {
|
||||
var world = service.engine.getWorld();
|
||||
if (world.hasRealWorld()) loadedChunks += world.realWorld().getLoadedChunks().length;
|
||||
if (world.hasHeadless()) loadedChunks += world.headless().getLoadedChunks();
|
||||
|
||||
tectonicPlates += service.engine.getMantle().getLoadedRegionCount();
|
||||
activeTectonicPlates += service.engine.getMantle().getNotQueuedLoadedRegions();
|
||||
queuedTectonicPlates += service.engine.getMantle().getToUnload();
|
||||
minTectonicUnloadDuration = Math.min(minTectonicUnloadDuration, (long) service.engine.getMantle().getTectonicDuration());
|
||||
maxTectonicUnloadDuration = Math.max(maxTectonicUnloadDuration, (long) service.engine.getMantle().getTectonicDuration());
|
||||
}
|
||||
return new Status(INSTANCES.size(), loadedChunks, MantleCleanerSVC.getTectonicLimit(), tectonicPlates, activeTectonicPlates, queuedTectonicPlates, minTectonicUnloadDuration, maxTectonicUnloadDuration);
|
||||
public record Status(int engineCount, long loadedChunks, int tectonicLimit,
|
||||
long tectonicPlates, long activeTectonicPlates,
|
||||
long queuedTectonicPlates,
|
||||
long minTectonicUnloadDuration,
|
||||
long maxTectonicUnloadDuration) {
|
||||
}
|
||||
}
|
||||
|
||||
public record Status(int engineCount, long loadedChunks, int tectonicLimit, long tectonicPlates, long activeTectonicPlates, long queuedTectonicPlates, long minTectonicUnloadDuration, long maxTectonicUnloadDuration) {}
|
||||
}
|
||||
|
@ -35,29 +35,6 @@ import static com.volmit.iris.engine.service.EngineStatusSVC.getEngineCount;
|
||||
|
||||
public class MantleCleanerSVC extends IrisEngineService {
|
||||
private static final AtomicInteger tectonicLimit = new AtomicInteger(30);
|
||||
private Ticker trimmer;
|
||||
private Ticker unloader;
|
||||
|
||||
public MantleCleanerSVC(Engine engine) {
|
||||
super(engine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable(boolean hotload) {
|
||||
if (engine.isStudio() && !IrisSettings.get().getPerformance().trimMantleInStudio)
|
||||
return;
|
||||
if (trimmer == null || !trimmer.isAlive())
|
||||
trimmer = createTrimmer(engine);
|
||||
if (unloader == null || !unloader.isAlive())
|
||||
unloader = createUnloader(engine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable(boolean hotload) {
|
||||
if (hotload) return;
|
||||
if (trimmer != null) trimmer.await();
|
||||
if (unloader != null) unloader.await();
|
||||
}
|
||||
|
||||
static {
|
||||
tectonicLimit.set(2);
|
||||
@ -68,6 +45,13 @@ public class MantleCleanerSVC extends IrisEngineService {
|
||||
}
|
||||
}
|
||||
|
||||
private Ticker trimmer;
|
||||
private Ticker unloader;
|
||||
|
||||
public MantleCleanerSVC(Engine engine) {
|
||||
super(engine);
|
||||
}
|
||||
|
||||
public static int getTectonicLimit() {
|
||||
return tectonicLimit.get();
|
||||
}
|
||||
@ -108,6 +92,23 @@ public class MantleCleanerSVC extends IrisEngineService {
|
||||
}, "Iris Mantle Unloader - " + engine.getWorld().name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable(boolean hotload) {
|
||||
if (engine.isStudio() && !IrisSettings.get().getPerformance().trimMantleInStudio)
|
||||
return;
|
||||
if (trimmer == null || !trimmer.isAlive())
|
||||
trimmer = createTrimmer(engine);
|
||||
if (unloader == null || !unloader.isAlive())
|
||||
unloader = createUnloader(engine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable(boolean hotload) {
|
||||
if (hotload) return;
|
||||
if (trimmer != null) trimmer.await();
|
||||
if (unloader != null) unloader.await();
|
||||
}
|
||||
|
||||
private static class Ticker extends Looper {
|
||||
private final LongSupplier supplier;
|
||||
private final CountDownLatch exit = new CountDownLatch(1);
|
||||
@ -124,7 +125,8 @@ public class MantleCleanerSVC extends IrisEngineService {
|
||||
long wait = -1;
|
||||
try {
|
||||
wait = supplier.getAsLong();
|
||||
} catch (Throwable ignored) {}
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
if (wait < 0) exit.countDown();
|
||||
return wait;
|
||||
}
|
||||
@ -132,7 +134,8 @@ public class MantleCleanerSVC extends IrisEngineService {
|
||||
public void await() {
|
||||
try {
|
||||
exit.await();
|
||||
} catch (InterruptedException ignored) {}
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.link.Identifier;
|
||||
import com.volmit.iris.core.service.ExternalDataSVC;
|
||||
import com.volmit.iris.engine.object.IrisCompat;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.misc.E;
|
||||
@ -50,10 +49,10 @@ public class B {
|
||||
private static final Material SHORT_GRASS = E.getOrDefault(Material.class, "GRASS", "SHORT_GRASS");
|
||||
private static final BlockData AIR = AIR_MATERIAL.createBlockData();
|
||||
private static final IntSet foliageCache = buildFoliageCache();
|
||||
private static final IntSet decorantCache = buildDecorantCache();
|
||||
private static final IntSet deepslateCache = buildDeepslateCache();
|
||||
private static final Int2IntMap normal2DeepslateCache = buildNormal2DeepslateCache();
|
||||
private static final Int2IntMap deepslate2NormalCache = buildDeepslate2NormalCache();
|
||||
private static final IntSet decorantCache = buildDecorantCache();
|
||||
private static final IntSet storageCache = buildStorageCache();
|
||||
private static final IntSet storageChestCache = buildStorageChestCache();
|
||||
private static final IntSet litCache = buildLitCache();
|
||||
|
@ -25,7 +25,8 @@ import java.util.Arrays;
|
||||
|
||||
public class DoubleArrayUtils {
|
||||
public static void shiftRight(double[] values, double push) {
|
||||
if (values.length - 2 + 1 >= 0) System.arraycopy(values, 0, values, 1, values.length - 2 + 1);
|
||||
if (values.length - 2 + 1 >= 0)
|
||||
System.arraycopy(values, 0, values, 1, values.length - 2 + 1);
|
||||
|
||||
values[0] = push;
|
||||
}
|
||||
|
@ -21,8 +21,6 @@ package com.volmit.iris.util.decree.specialhandlers;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.decree.handlers.BiomeHandler;
|
||||
import com.volmit.iris.util.decree.handlers.PlayerHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class NullableBiomeHandler extends BiomeHandler {
|
||||
|
||||
|
@ -18,14 +18,10 @@
|
||||
|
||||
package com.volmit.iris.util.decree.specialhandlers;
|
||||
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisRegion;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.decree.handlers.BiomeHandler;
|
||||
import com.volmit.iris.util.decree.handlers.RegionHandler;
|
||||
|
||||
import javax.swing.plaf.synth.Region;
|
||||
|
||||
public class NullableRegionHandler extends RegionHandler {
|
||||
|
||||
@Override
|
||||
|
@ -40,15 +40,17 @@ import com.volmit.iris.util.matter.MatterSlice;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
import com.volmit.iris.util.parallel.HyperLock;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.scheduling.Looper;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Chunk;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@ -73,6 +75,15 @@ public class Mantle {
|
||||
private final MultiBurst ioBurst;
|
||||
private final AtomicBoolean ioTrim;
|
||||
private final AtomicBoolean ioTectonicUnload;
|
||||
@Getter
|
||||
private final AtomicDouble adjustedIdleDuration = new AtomicDouble(0);
|
||||
@Getter
|
||||
private final AtomicInteger forceAggressiveThreshold = new AtomicInteger(30);
|
||||
@Getter
|
||||
private final AtomicLong oldestTectonicPlate = new AtomicLong(0);
|
||||
private final ReentrantLock unloadLock = new ReentrantLock();
|
||||
@Getter
|
||||
private final KList<Long> toUnload = new KList<>();
|
||||
|
||||
/**
|
||||
* Create a new mantle
|
||||
@ -393,16 +404,6 @@ public class Mantle {
|
||||
return numberOfEntries * bytesPerEntry;
|
||||
}
|
||||
|
||||
@Getter
|
||||
private final AtomicDouble adjustedIdleDuration = new AtomicDouble(0);
|
||||
@Getter
|
||||
private final AtomicInteger forceAggressiveThreshold = new AtomicInteger(30);
|
||||
@Getter
|
||||
private final AtomicLong oldestTectonicPlate = new AtomicLong(0);
|
||||
private final ReentrantLock unloadLock = new ReentrantLock();
|
||||
@Getter
|
||||
private final KList<Long> toUnload = new KList<>();
|
||||
|
||||
/**
|
||||
* Save & unload regions that have not been used for more than the
|
||||
* specified amount of milliseconds
|
||||
|
@ -28,8 +28,6 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import lombok.Getter;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
import net.jpountz.lz4.LZ4BlockOutputStream;
|
||||
import net.jpountz.lz4.LZ4FrameInputStream;
|
||||
import net.jpountz.lz4.LZ4FrameOutputStream;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||
|
@ -59,9 +59,11 @@ public enum Direction {
|
||||
return switch (f) {
|
||||
case DOWN -> D;
|
||||
case EAST, EAST_SOUTH_EAST, EAST_NORTH_EAST -> E;
|
||||
case NORTH, NORTH_WEST, NORTH_NORTH_WEST, NORTH_NORTH_EAST, NORTH_EAST -> N;
|
||||
case NORTH, NORTH_WEST, NORTH_NORTH_WEST, NORTH_NORTH_EAST,
|
||||
NORTH_EAST -> N;
|
||||
case SELF, UP -> U;
|
||||
case SOUTH, SOUTH_WEST, SOUTH_SOUTH_WEST, SOUTH_SOUTH_EAST, SOUTH_EAST -> S;
|
||||
case SOUTH, SOUTH_WEST, SOUTH_SOUTH_WEST, SOUTH_SOUTH_EAST,
|
||||
SOUTH_EAST -> S;
|
||||
case WEST, WEST_SOUTH_WEST, WEST_NORTH_WEST -> W;
|
||||
};
|
||||
|
||||
|
@ -19,14 +19,9 @@
|
||||
package com.volmit.iris.util.math;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class RNGV2 extends SecureRandom {
|
||||
private static final long serialVersionUID = 5222938581174415179L;
|
||||
|
@ -36,7 +36,8 @@ import java.util.Set;
|
||||
public class JigsawStructuresContainer {
|
||||
private final Map<String, List<Position2>> map = new KMap<>();
|
||||
|
||||
public JigsawStructuresContainer() {}
|
||||
public JigsawStructuresContainer() {
|
||||
}
|
||||
|
||||
public JigsawStructuresContainer(DataInputStream din) throws IOException {
|
||||
int s0 = din.readInt();
|
||||
|
@ -33,12 +33,9 @@ import oshi.SystemInfo;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
|
||||
public class Hastebin {
|
||||
|
||||
|
@ -22,13 +22,10 @@ package com.volmit.iris.util.misc;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import oshi.SystemInfo;
|
||||
import oshi.hardware.*;
|
||||
import oshi.software.os.FileSystem;
|
||||
import oshi.software.os.OSFileStore;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
import oshi.util.EdidUtil;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
@ -36,7 +33,6 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class getHardware {
|
||||
public static String getServerOS() {
|
||||
@ -44,10 +40,12 @@ public class getHardware {
|
||||
OperatingSystem os = systemInfo.getOperatingSystem();
|
||||
return os.toString();
|
||||
}
|
||||
|
||||
public static long getProcessMemory() {
|
||||
long maxMemory = Runtime.getRuntime().maxMemory() / (1024 * 1024);
|
||||
return maxMemory;
|
||||
}
|
||||
|
||||
public static long getProcessUsedMemory() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
|
||||
|
@ -20,9 +20,7 @@ package com.volmit.iris.util.nbt.mca;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.tools.IrisWorldDump;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.nbt.io.NBTDeserializer;
|
||||
import com.volmit.iris.util.nbt.io.NBTSerializer;
|
||||
import com.volmit.iris.util.nbt.io.NamedTag;
|
||||
@ -605,7 +603,8 @@ public class Chunk {
|
||||
if (tileTicks != null) level.put("TileTicks", tileTicks);
|
||||
if (liquidTicks != null) level.put("LiquidTicks", liquidTicks);
|
||||
if (lights != null) level.put("Lights", lights);
|
||||
if (liquidsToBeTicked != null) level.put("LiquidsToBeTicked", liquidsToBeTicked);
|
||||
if (liquidsToBeTicked != null)
|
||||
level.put("LiquidsToBeTicked", liquidsToBeTicked);
|
||||
if (toBeTicked != null) level.put("ToBeTicked", toBeTicked);
|
||||
if (postProcessing != null) level.put("PostProcessing", postProcessing);
|
||||
level.putString("Status", status);
|
||||
|
@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.util.nbt.mca.palette;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
// todo Cool idea but im way to dumb for this for now
|
||||
public class MCABitStorageByteArray {
|
||||
private final byte[] data;
|
||||
|
@ -20,7 +20,6 @@ package com.volmit.iris.util.nbt.mca.palette;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import java.util.BitSet;
|
||||
import java.util.function.IntConsumer;
|
||||
|
||||
public class MCABitStorageLongArray {
|
||||
|
@ -122,9 +122,11 @@ public class MCAPalettedContainer<T> implements MCAPaletteResize<T> {
|
||||
T var1 = this.palette.valueFor(this.storage.get(var0));
|
||||
return (var1 == null) ? this.defaultValue : var1;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* /**
|
||||
* Reads and processes block data from encoded byte arrays.
|
||||
*
|
||||
* @param var0 BlockID Strings - List of block types identified by strings.
|
||||
* @param var1 Encoded Locations - Long array containing compactly encoded block IDs, representing sequential block positions within a chunk.
|
||||
*/
|
||||
@ -152,6 +154,7 @@ public class MCAPalettedContainer<T> implements MCAPaletteResize<T> {
|
||||
|
||||
/**
|
||||
* Reads and processes block data from encoded byte arrays.
|
||||
*
|
||||
* @param var0 BlockID Strings - List of block types identified by strings.
|
||||
* @param var1 Encoded Locations - Byte array containing compactly encoded block IDs, representing sequential block positions within a chunk.
|
||||
* Currently, Minecraft doesn't use ByteArray storage.
|
||||
@ -184,6 +187,7 @@ public class MCAPalettedContainer<T> implements MCAPaletteResize<T> {
|
||||
|
||||
/**
|
||||
* Reads and processes block data from encoded byte arrays.
|
||||
*
|
||||
* @param var0 BlockID Strings - List of block types identified by strings.
|
||||
* This method is primarily used to read air sections.
|
||||
*/
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
package com.volmit.iris.util.nbt.mca.palette;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.nbt.tag.ByteArrayTag;
|
||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||
import com.volmit.iris.util.nbt.tag.LongArrayTag;
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
package com.volmit.iris.util.plugin;
|
||||
|
||||
import com.volmit.iris.util.format.C;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
@ -387,7 +387,8 @@ public class Metrics {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException |
|
||||
} catch (NullPointerException | NoSuchMethodException |
|
||||
IllegalAccessException |
|
||||
InvocationTargetException ignored) {
|
||||
Iris.reportError(ignored);
|
||||
}
|
||||
|
@ -363,7 +363,8 @@ public class MetricsLite {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException |
|
||||
} catch (NullPointerException | NoSuchMethodException |
|
||||
IllegalAccessException |
|
||||
InvocationTargetException ignored) {
|
||||
Iris.reportError(ignored);
|
||||
}
|
||||
|
@ -191,8 +191,10 @@ public abstract class MortarCommand implements ICommand {
|
||||
}
|
||||
|
||||
p.add(pc);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
|
||||
InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException |
|
||||
InstantiationException |
|
||||
InvocationTargetException | NoSuchMethodException |
|
||||
SecurityException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -36,8 +36,10 @@ public abstract class MortarPermission {
|
||||
MortarPermission px = (MortarPermission) i.getType().getConstructor().newInstance();
|
||||
px.setParent(this);
|
||||
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, px);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
|
||||
InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException |
|
||||
InstantiationException |
|
||||
InvocationTargetException | NoSuchMethodException |
|
||||
SecurityException e) {
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
}
|
||||
@ -52,7 +54,8 @@ public abstract class MortarPermission {
|
||||
if (i.isAnnotationPresent(Permission.class)) {
|
||||
try {
|
||||
p.add((MortarPermission) i.get(Modifier.isStatic(i.getModifiers()) ? null : this));
|
||||
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException |
|
||||
SecurityException e) {
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
}
|
||||
|
@ -166,8 +166,10 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
registerPermission(pc);
|
||||
permissionCache.add(pc);
|
||||
v("Registered Permissions " + pc.getFullNode() + " (" + i.getName() + ")");
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
|
||||
InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException |
|
||||
InstantiationException |
|
||||
InvocationTargetException | NoSuchMethodException |
|
||||
SecurityException e) {
|
||||
Iris.reportError(e);
|
||||
w("Failed to register permission (field " + i.getName() + ")");
|
||||
e.printStackTrace();
|
||||
@ -193,7 +195,8 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
MortarPermission x = (MortarPermission) i.get(Modifier.isStatic(i.getModifiers()) ? null : this);
|
||||
g.add(toPermission(x));
|
||||
g.addAll(computePermissions(x));
|
||||
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException |
|
||||
SecurityException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -281,7 +284,8 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
i.setAccessible(true);
|
||||
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, this);
|
||||
v("Registered Instance " + i.getName());
|
||||
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException |
|
||||
SecurityException e) {
|
||||
w("Failed to register instance (field " + i.getName() + ")");
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
@ -300,7 +304,8 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
i.setAccessible(true);
|
||||
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, null);
|
||||
v("Unregistered Instance " + i.getName());
|
||||
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException |
|
||||
SecurityException e) {
|
||||
w("Failed to unregister instance (field " + i.getName() + ")");
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
@ -325,8 +330,10 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
||||
registerCommand(pc, c.value());
|
||||
commandCache.add(pc);
|
||||
v("Registered Commands /" + pc.getNode() + " (" + i.getName() + ")");
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
|
||||
InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException |
|
||||
InstantiationException |
|
||||
InvocationTargetException | NoSuchMethodException |
|
||||
SecurityException e) {
|
||||
w("Failed to register command (field " + i.getName() + ")");
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user