mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 00:17:15 +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();
|
||||
@ -527,7 +526,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
File world = new File(Bukkit.getWorldContainer().getPath() + "/" + s + "/iris/engine-data/");
|
||||
IOFileFilter jsonFilter = org.apache.commons.io.filefilter.FileFilterUtils.suffixFileFilter(".json");
|
||||
Collection<File> files = FileUtils.listFiles(world, jsonFilter, TrueFileFilter.INSTANCE);
|
||||
if(files.size() != 1) {
|
||||
if (files.size() != 1) {
|
||||
Iris.info(C.DARK_GRAY + "------------------------------------------");
|
||||
Iris.info(C.RED + "Failed to load " + C.GRAY + s + C.RED + ". No valid engine-data file was found.");
|
||||
Iris.info(C.DARK_GRAY + "------------------------------------------");
|
||||
@ -538,7 +537,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
int lastDotIndex = file.getName().lastIndexOf(".");
|
||||
generator = file.getName().substring(0, lastDotIndex);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (generator.startsWith("Iris:")) {
|
||||
generator = generator.split("\\Q:\\E")[1];
|
||||
} else if (generator.equalsIgnoreCase("Iris")) {
|
||||
@ -857,35 +856,35 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
}
|
||||
|
||||
String[] info = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
padd2 + colorIris + " Iris",
|
||||
padd2 + C.GRAY + " by " + colorVolmit + "Volmit Software",
|
||||
padd2 + C.GRAY + " v" + colorVersion + getDescription().getVersion()
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
padd2 + colorIris + " Iris",
|
||||
padd2 + C.GRAY + " by " + colorVolmit + "Volmit Software",
|
||||
padd2 + C.GRAY + " v" + colorVersion + getDescription().getVersion()
|
||||
};
|
||||
|
||||
String[] splash = {
|
||||
padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@",
|
||||
padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + colorIris + " .(((()))). ",
|
||||
padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + colorIris + " .((((((())))))). ",
|
||||
padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + colorIris + " ((((((((())))))))) " + C.GRAY + " @",
|
||||
padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + colorIris + " ((((((((-))))))))) " + C.GRAY + " @@",
|
||||
padd + C.GRAY + "@@@&&" + colorIris + " ((((((({ })))))))) " + C.GRAY + " &&@@@",
|
||||
padd + C.GRAY + "@@" + colorIris + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@",
|
||||
padd + C.GRAY + "@" + colorIris + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@",
|
||||
padd + C.GRAY + "" + colorIris + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@",
|
||||
padd + C.GRAY + "" + colorIris + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@",
|
||||
padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
|
||||
padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@",
|
||||
padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + colorIris + " .(((()))). ",
|
||||
padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + colorIris + " .((((((())))))). ",
|
||||
padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + colorIris + " ((((((((())))))))) " + C.GRAY + " @",
|
||||
padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + colorIris + " ((((((((-))))))))) " + C.GRAY + " @@",
|
||||
padd + C.GRAY + "@@@&&" + colorIris + " ((((((({ })))))))) " + C.GRAY + " &&@@@",
|
||||
padd + C.GRAY + "@@" + colorIris + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@",
|
||||
padd + C.GRAY + "@" + colorIris + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@",
|
||||
padd + C.GRAY + "" + colorIris + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@",
|
||||
padd + C.GRAY + "" + colorIris + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@",
|
||||
padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
|
||||
};
|
||||
|
||||
setupChecks();
|
||||
Iris.info("Java: " + getJava());
|
||||
if (!instance.getServer().getVersion().contains("Purpur")) {
|
||||
if (instance.getServer().getVersion().contains("Spigot") && instance.getServer().getVersion().contains("Bukkit")) {
|
||||
Iris.info(C.RED + " Iris requires paper or above to function properly..");
|
||||
Iris.info(C.RED + " Iris requires paper or above to function properly..");
|
||||
} else {
|
||||
Iris.info(C.YELLOW + "Purpur is recommended to use with iris.");
|
||||
}
|
||||
|
@ -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
|
||||
@ -145,7 +143,7 @@ public class IrisSettings {
|
||||
|
||||
@Data
|
||||
public static class IrisSettingsPerformance {
|
||||
public boolean trimMantleInStudio = false;
|
||||
public boolean trimMantleInStudio = false;
|
||||
public int mantleKeepAlive = 30;
|
||||
public int cacheSize = 4_096;
|
||||
public int resourceLoaderCacheSize = 1_024;
|
||||
@ -196,6 +194,7 @@ public class IrisSettings {
|
||||
public boolean disableTimeAndWeather = true;
|
||||
public boolean autoStartDefaultStudio = false;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class IrisWorldDump {
|
||||
public int mcaCacheSize = 3;
|
||||
|
@ -91,7 +91,7 @@ public class CommandDeveloper implements DecreeExecutor {
|
||||
for (File i : Objects.requireNonNull(tectonicplates.listFiles())) {
|
||||
TectonicPlate.read(maxHeight, i);
|
||||
c++;
|
||||
sender().sendMessage("Loaded count: " + c );
|
||||
sender().sendMessage("Loaded count: " + c);
|
||||
|
||||
}
|
||||
|
||||
@ -115,11 +115,11 @@ public class CommandDeveloper implements DecreeExecutor {
|
||||
}
|
||||
|
||||
@Decree(description = "test")
|
||||
public void mca (
|
||||
public void mca(
|
||||
@Param(description = "String") World world) {
|
||||
try {
|
||||
IrisWorldDump dump = new IrisWorldDump(world, sender());
|
||||
dump.start();
|
||||
IrisWorldDump dump = new IrisWorldDump(world, sender());
|
||||
dump.start();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -128,7 +128,7 @@ public class CommandDeveloper implements DecreeExecutor {
|
||||
}
|
||||
|
||||
@Decree(description = "test")
|
||||
public void devtest () {
|
||||
public void devtest() {
|
||||
try {
|
||||
|
||||
for (File mcafile : new File("rrtrender1/region").listFiles()) {
|
||||
@ -200,7 +200,7 @@ public class CommandDeveloper implements DecreeExecutor {
|
||||
if (!file.exists()) return;
|
||||
|
||||
Engine engine = IrisToolbelt.access(world).getEngine();
|
||||
if(engine != null) {
|
||||
if (engine != null) {
|
||||
int height = engine.getTarget().getHeight();
|
||||
VolmitSender sender = sender();
|
||||
new Thread(() -> {
|
||||
@ -232,13 +232,13 @@ public class CommandDeveloper implements DecreeExecutor {
|
||||
}
|
||||
IO.delete(folder);
|
||||
sender.sendMessage(algorithm + " is " + Form.fileSize(size) + " big after compression");
|
||||
sender.sendMessage(algorithm + " Took " + d2/amount + "ms to read");
|
||||
sender.sendMessage(algorithm + " Took " + d1/amount + "ms to write");
|
||||
sender.sendMessage(algorithm + " Took " + d2 / amount + "ms to read");
|
||||
sender.sendMessage(algorithm + " Took " + d1 / amount + "ms to write");
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, "Compression Test").start();
|
||||
} else {
|
||||
} else {
|
||||
Iris.info(C.RED + "Engine is null!");
|
||||
}
|
||||
}
|
||||
|
@ -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.*;
|
||||
@ -57,11 +55,11 @@ public class CommandEdit implements DecreeExecutor {
|
||||
|
||||
|
||||
@Decree(description = "Edit the biome you specified", aliases = {"b"}, origin = DecreeOrigin.PLAYER)
|
||||
public void biome(@Param(contextual = false, description = "The biome to edit", defaultValue = "---", customHandler = NullableBiomeHandler.class) IrisBiome biome ) {
|
||||
public void biome(@Param(contextual = false, description = "The biome to edit", defaultValue = "---", customHandler = NullableBiomeHandler.class) IrisBiome biome) {
|
||||
if (noStudio()) {
|
||||
return;
|
||||
}
|
||||
if(biome == null) {
|
||||
if (biome == null) {
|
||||
try {
|
||||
IrisBiome b = engine().getBiome(player().getLocation().getBlockX(), player().getLocation().getBlockY() - player().getWorld().getMinHeight(), player().getLocation().getBlockZ());
|
||||
Desktop.getDesktop().open(b.getLoadFile());
|
||||
@ -98,7 +96,7 @@ public class CommandEdit implements DecreeExecutor {
|
||||
if (noStudio()) {
|
||||
return;
|
||||
}
|
||||
if(region == null) {
|
||||
if (region == null) {
|
||||
try {
|
||||
IrisRegion r = engine().getRegion(player().getLocation().getBlockX(), player().getLocation().getBlockZ());
|
||||
Desktop.getDesktop().open(r.getLoadFile());
|
||||
|
@ -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(
|
||||
@ -104,16 +107,16 @@ public class CommandIris implements DecreeExecutor {
|
||||
boolean vanillaheight
|
||||
) {
|
||||
|
||||
if (name.equals("iris")) {
|
||||
sender().sendMessage(C.RED + "You cannot use the world name \"iris\" for creating worlds as Iris uses this directory for studio worlds.");
|
||||
sender().sendMessage(C.RED + "May we suggest the name \"IrisWorld\" instead?");
|
||||
return;
|
||||
}
|
||||
if (name.equals("Benchmark")) {
|
||||
sender().sendMessage(C.RED + "You cannot use the world name \"Benchmark\" for creating worlds as Iris uses this directory for Benchmarking Packs.");
|
||||
sender().sendMessage(C.RED + "May we suggest the name \"IrisWorld\" instead?");
|
||||
return;
|
||||
}
|
||||
if (name.equals("iris")) {
|
||||
sender().sendMessage(C.RED + "You cannot use the world name \"iris\" for creating worlds as Iris uses this directory for studio worlds.");
|
||||
sender().sendMessage(C.RED + "May we suggest the name \"IrisWorld\" instead?");
|
||||
return;
|
||||
}
|
||||
if (name.equals("Benchmark")) {
|
||||
sender().sendMessage(C.RED + "You cannot use the world name \"Benchmark\" for creating worlds as Iris uses this directory for Benchmarking Packs.");
|
||||
sender().sendMessage(C.RED + "May we suggest the name \"IrisWorld\" instead?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (new File(Bukkit.getWorldContainer(), name).exists()) {
|
||||
sender().sendMessage(C.RED + "That folder already exists!");
|
||||
@ -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()) {
|
||||
@ -231,22 +234,22 @@ public class CommandIris implements DecreeExecutor {
|
||||
if (sender().isPlayer()) {
|
||||
sender().sendMessage(C.BLUE + "Iris Worlds: ");
|
||||
for (World IrisWorld : IrisWorlds.copy()) {
|
||||
sender().sendMessage(C.IRIS + "- " +IrisWorld.getName());
|
||||
sender().sendMessage(C.IRIS + "- " + IrisWorld.getName());
|
||||
}
|
||||
sender().sendMessage(C.GOLD + "Bukkit Worlds: ");
|
||||
for (World BukkitWorld : BukkitWorlds.copy()) {
|
||||
sender().sendMessage(C.GRAY + "- " +BukkitWorld.getName());
|
||||
sender().sendMessage(C.GRAY + "- " + BukkitWorld.getName());
|
||||
}
|
||||
} else {
|
||||
Iris.info(C.BLUE + "Iris Worlds: ");
|
||||
for (World IrisWorld : IrisWorlds.copy()) {
|
||||
Iris.info(C.IRIS + "- " +IrisWorld.getName());
|
||||
Iris.info(C.IRIS + "- " + IrisWorld.getName());
|
||||
}
|
||||
Iris.info(C.GOLD + "Bukkit Worlds: ");
|
||||
for (World BukkitWorld : BukkitWorlds.copy()) {
|
||||
Iris.info(C.GRAY + "- " +BukkitWorld.getName());
|
||||
Iris.info(C.GRAY + "- " + BukkitWorld.getName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,13 +283,13 @@ public class CommandIris implements DecreeExecutor {
|
||||
if (deleteDirectory(world.getWorldFolder())) {
|
||||
sender().sendMessage(C.GREEN + "Successfully removed world folder");
|
||||
} else {
|
||||
while(true){
|
||||
if (deleteDirectory(world.getWorldFolder())){
|
||||
while (true) {
|
||||
if (deleteDirectory(world.getWorldFolder())) {
|
||||
sender().sendMessage(C.GREEN + "Successfully removed world folder");
|
||||
break;
|
||||
}
|
||||
retries--;
|
||||
if (retries == 0){
|
||||
if (retries == 0) {
|
||||
sender().sendMessage(C.RED + "Failed to remove world folder");
|
||||
break;
|
||||
}
|
||||
@ -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")
|
||||
@ -507,7 +497,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
File worldFolder = new File(Bukkit.getWorldContainer().getPath() + "/" + s + "/iris/engine-data/");
|
||||
IOFileFilter jsonFilter = org.apache.commons.io.filefilter.FileFilterUtils.suffixFileFilter(".json");
|
||||
Collection<File> files = FileUtils.listFiles(worldFolder, jsonFilter, TrueFileFilter.INSTANCE);
|
||||
if(files.size() != 1) {
|
||||
if (files.size() != 1) {
|
||||
Iris.info(C.DARK_GRAY + "------------------------------------------");
|
||||
Iris.info(C.RED + "Failed to load " + C.GRAY + s + C.RED + ". No valid engine-data file was found.");
|
||||
Iris.info(C.DARK_GRAY + "------------------------------------------");
|
||||
@ -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 {
|
||||
@ -572,7 +564,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
|
||||
List<String> worldsToLoad = Collections.singletonList(world);
|
||||
|
||||
for (String s : section.getKeys(false)) {
|
||||
for (String s : section.getKeys(false)) {
|
||||
if (!worldsToLoad.contains(s)) {
|
||||
continue;
|
||||
}
|
||||
@ -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")
|
||||
@ -51,7 +47,7 @@ public class CommandLazyPregen implements DecreeExecutor {
|
||||
int cpm,
|
||||
@Param(aliases = "silent", description = "Silent generation", defaultValue = "false")
|
||||
boolean silent
|
||||
) {
|
||||
) {
|
||||
|
||||
worldName = world.getName();
|
||||
File worldDirectory = new File(Bukkit.getWorldContainer(), world.getName());
|
||||
|
@ -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());
|
||||
|
||||
@ -428,7 +429,7 @@ public class CommandObject implements DecreeExecutor {
|
||||
ObjectSVC service = Iris.service(ObjectSVC.class);
|
||||
int actualReverts = Math.min(service.getUndos().size(), amount);
|
||||
service.revertChanges(actualReverts);
|
||||
sender().sendMessage(C.BLUE + "Reverted " + actualReverts + C.BLUE +" pastes!");
|
||||
sender().sendMessage(C.BLUE + "Reverted " + actualReverts + C.BLUE + " pastes!");
|
||||
}
|
||||
|
||||
@Decree(description = "Gets an object wand and grabs the current WorldEdit selection.", aliases = "we", origin = DecreeOrigin.PLAYER, studio = true)
|
||||
|
@ -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 {
|
||||
@ -80,7 +76,7 @@ public class CommandPregen implements DecreeExecutor {
|
||||
@Decree(description = "Stop the active pregeneration task", aliases = "x")
|
||||
public void stop() {
|
||||
if (PregeneratorJob.shutdownInstance()) {
|
||||
Iris.info( C.BLUE + "Finishing up mca region...");
|
||||
Iris.info(C.BLUE + "Finishing up mca region...");
|
||||
} else {
|
||||
sender().sendMessage(C.YELLOW + "No active pregeneration tasks to stop");
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
@ -335,7 +336,7 @@ public class CommandStudio implements DecreeExecutor {
|
||||
return;
|
||||
}
|
||||
var sender = sender();
|
||||
int d = radius*2;
|
||||
int d = radius * 2;
|
||||
KMap<String, KList<Position2>> data = new KMap<>();
|
||||
var multiBurst = new MultiBurst("Distance Sampler", Thread.MIN_PRIORITY);
|
||||
var executor = multiBurst.burst(radius * radius);
|
||||
|
@ -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")
|
||||
@ -44,7 +43,7 @@ public class CommandTurboPregen implements DecreeExecutor {
|
||||
World world,
|
||||
@Param(aliases = "middle", description = "The center location of the pregen. Use \"me\" for your current location", defaultValue = "0,0")
|
||||
Vector center
|
||||
) {
|
||||
) {
|
||||
|
||||
worldName = world.getName();
|
||||
File worldDirectory = new File(Bukkit.getWorldContainer(), world.getName());
|
||||
@ -57,9 +56,9 @@ public class CommandTurboPregen implements DecreeExecutor {
|
||||
} else {
|
||||
try {
|
||||
TurboFile.delete();
|
||||
} catch (Exception e){
|
||||
Iris.error("Failed to delete the old instance file of Turbo Pregen!");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Iris.error("Failed to delete the old instance file of Turbo Pregen!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,7 +118,7 @@ public class CommandTurboPregen implements DecreeExecutor {
|
||||
} else {
|
||||
File worldDirectory = new File(Bukkit.getWorldContainer(), world.getName());
|
||||
File TurboFile = new File(worldDirectory, "turbogen.json");
|
||||
if (TurboFile.exists()){
|
||||
if (TurboFile.exists()) {
|
||||
TurboPregenerator.loadTurboGenerator(world.getName());
|
||||
sender().sendMessage(C.YELLOW + "Started Turbo Pregen back up!");
|
||||
} else {
|
||||
|
@ -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 {
|
||||
@ -45,7 +44,7 @@ public class CommandUpdater implements DecreeExecutor {
|
||||
}
|
||||
chunkUpdater = new ChunkUpdater(world);
|
||||
if (sender().isPlayer()) {
|
||||
sender().sendMessage(C.GREEN + "Updating " + world.getName() + C.GRAY + " Total chunks: " + Form.f(chunkUpdater.getChunks()));
|
||||
sender().sendMessage(C.GREEN + "Updating " + world.getName() + C.GRAY + " Total chunks: " + Form.f(chunkUpdater.getChunks()));
|
||||
} else {
|
||||
Iris.info(C.GREEN + "Updating " + world.getName() + C.GRAY + " Total chunks: " + Form.f(chunkUpdater.getChunks()));
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -40,118 +40,118 @@ import java.util.MissingResourceException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class HMCLeavesDataProvider extends ExternalDataProvider {
|
||||
private Object apiInstance;
|
||||
private WrappedReturningMethod<Object, Material> worldBlockType;
|
||||
private WrappedReturningMethod<Object, Boolean> setCustomBlock;
|
||||
private Map<String, Object> blockDataMap = Map.of();
|
||||
private Map<String, Supplier<ItemStack>> itemDataField = Map.of();
|
||||
private Object apiInstance;
|
||||
private WrappedReturningMethod<Object, Material> worldBlockType;
|
||||
private WrappedReturningMethod<Object, Boolean> setCustomBlock;
|
||||
private Map<String, Object> blockDataMap = Map.of();
|
||||
private Map<String, Supplier<ItemStack>> itemDataField = Map.of();
|
||||
|
||||
public HMCLeavesDataProvider() {
|
||||
super("HMCLeaves");
|
||||
}
|
||||
public HMCLeavesDataProvider() {
|
||||
super("HMCLeaves");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "HMCLeaves";
|
||||
}
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "HMCLeaves";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
try {
|
||||
worldBlockType = new WrappedReturningMethod<>((Class<Object>) Class.forName("io.github.fisher2911.hmcleaves.data.BlockData"), "worldBlockType");
|
||||
apiInstance = getApiInstance(Class.forName("io.github.fisher2911.hmcleaves.api.HMCLeavesAPI"));
|
||||
setCustomBlock = new WrappedReturningMethod<>((Class<Object>) apiInstance.getClass(), "setCustomBlock", Location.class, String.class, boolean.class);
|
||||
Object config = getLeavesConfig(apiInstance.getClass());
|
||||
blockDataMap = getMap(config, "blockDataMap");
|
||||
itemDataField = getMap(config, "itemSupplierMap");
|
||||
} catch (Throwable e) {
|
||||
Iris.error("Failed to initialize HMCLeavesDataProvider: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
try {
|
||||
worldBlockType = new WrappedReturningMethod<>((Class<Object>) Class.forName("io.github.fisher2911.hmcleaves.data.BlockData"), "worldBlockType");
|
||||
apiInstance = getApiInstance(Class.forName("io.github.fisher2911.hmcleaves.api.HMCLeavesAPI"));
|
||||
setCustomBlock = new WrappedReturningMethod<>((Class<Object>) apiInstance.getClass(), "setCustomBlock", Location.class, String.class, boolean.class);
|
||||
Object config = getLeavesConfig(apiInstance.getClass());
|
||||
blockDataMap = getMap(config, "blockDataMap");
|
||||
itemDataField = getMap(config, "itemSupplierMap");
|
||||
} catch (Throwable e) {
|
||||
Iris.error("Failed to initialize HMCLeavesDataProvider: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData getBlockData(Identifier blockId, KMap<String, String> state) throws MissingResourceException {
|
||||
Object o = blockDataMap.get(blockId.key());
|
||||
if (o == null)
|
||||
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||
Material material = worldBlockType.invoke(o, new Object[0]);
|
||||
if (material == null)
|
||||
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||
BlockData blockData = Bukkit.createBlockData(material);
|
||||
if (IrisSettings.get().getGenerator().preventLeafDecay && blockData instanceof Leaves leaves)
|
||||
leaves.setPersistent(true);
|
||||
return new IrisCustomData(blockData, ExternalDataSVC.buildState(blockId, state));
|
||||
}
|
||||
@Override
|
||||
public BlockData getBlockData(Identifier blockId, KMap<String, String> state) throws MissingResourceException {
|
||||
Object o = blockDataMap.get(blockId.key());
|
||||
if (o == null)
|
||||
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||
Material material = worldBlockType.invoke(o, new Object[0]);
|
||||
if (material == null)
|
||||
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||
BlockData blockData = Bukkit.createBlockData(material);
|
||||
if (IrisSettings.get().getGenerator().preventLeafDecay && blockData instanceof Leaves leaves)
|
||||
leaves.setPersistent(true);
|
||||
return new IrisCustomData(blockData, ExternalDataSVC.buildState(blockId, state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) throws MissingResourceException {
|
||||
if (!itemDataField.containsKey(itemId.key()))
|
||||
throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
||||
return itemDataField.get(itemId.key()).get();
|
||||
}
|
||||
@Override
|
||||
public ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) throws MissingResourceException {
|
||||
if (!itemDataField.containsKey(itemId.key()))
|
||||
throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
||||
return itemDataField.get(itemId.key()).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processUpdate(Engine engine, Block block, Identifier blockId) {
|
||||
var pair = ExternalDataSVC.parseState(blockId);
|
||||
blockId = pair.getA();
|
||||
Boolean result = setCustomBlock.invoke(apiInstance, new Object[]{block.getLocation(), blockId.key(), false});
|
||||
if (result == null || !result)
|
||||
Iris.warn("Failed to set custom block! " + blockId.key() + " " + block.getX() + " " + block.getY() + " " + block.getZ());
|
||||
else if (IrisSettings.get().getGenerator().preventLeafDecay) {
|
||||
BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Leaves leaves)
|
||||
leaves.setPersistent(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void processUpdate(Engine engine, Block block, Identifier blockId) {
|
||||
var pair = ExternalDataSVC.parseState(blockId);
|
||||
blockId = pair.getA();
|
||||
Boolean result = setCustomBlock.invoke(apiInstance, new Object[]{block.getLocation(), blockId.key(), false});
|
||||
if (result == null || !result)
|
||||
Iris.warn("Failed to set custom block! " + blockId.key() + " " + block.getX() + " " + block.getY() + " " + block.getZ());
|
||||
else if (IrisSettings.get().getGenerator().preventLeafDecay) {
|
||||
BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Leaves leaves)
|
||||
leaves.setPersistent(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier[] getBlockTypes() {
|
||||
KList<Identifier> names = new KList<>();
|
||||
for (String name : blockDataMap.keySet()) {
|
||||
try {
|
||||
Identifier key = new Identifier("hmcleaves", name);
|
||||
if (getBlockData(key) != null)
|
||||
names.add(key);
|
||||
} catch (MissingResourceException ignored) {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Identifier[] getBlockTypes() {
|
||||
KList<Identifier> names = new KList<>();
|
||||
for (String name : blockDataMap.keySet()) {
|
||||
try {
|
||||
Identifier key = new Identifier("hmcleaves", name);
|
||||
if (getBlockData(key) != null)
|
||||
names.add(key);
|
||||
} catch (MissingResourceException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
return names.toArray(new Identifier[0]);
|
||||
}
|
||||
return names.toArray(new Identifier[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier[] getItemTypes() {
|
||||
KList<Identifier> names = new KList<>();
|
||||
for (String name : itemDataField.keySet()) {
|
||||
try {
|
||||
Identifier key = new Identifier("hmcleaves", name);
|
||||
if (getItemStack(key) != null)
|
||||
names.add(key);
|
||||
} catch (MissingResourceException ignored) {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Identifier[] getItemTypes() {
|
||||
KList<Identifier> names = new KList<>();
|
||||
for (String name : itemDataField.keySet()) {
|
||||
try {
|
||||
Identifier key = new Identifier("hmcleaves", name);
|
||||
if (getItemStack(key) != null)
|
||||
names.add(key);
|
||||
} catch (MissingResourceException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
return names.toArray(new Identifier[0]);
|
||||
}
|
||||
return names.toArray(new Identifier[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidProvider(Identifier id, boolean isItem) {
|
||||
return (isItem ? itemDataField.keySet() : blockDataMap.keySet()).contains(id.key());
|
||||
}
|
||||
@Override
|
||||
public boolean isValidProvider(Identifier id, boolean isItem) {
|
||||
return (isItem ? itemDataField.keySet() : blockDataMap.keySet()).contains(id.key());
|
||||
}
|
||||
|
||||
private <C, T> Map<String, T> getMap(C config, String name) {
|
||||
WrappedField<C, Map<String, T>> field = new WrappedField<>((Class<C>) config.getClass(), name);
|
||||
return field.get(config);
|
||||
}
|
||||
private <C, T> Map<String, T> getMap(C config, String name) {
|
||||
WrappedField<C, Map<String, T>> field = new WrappedField<>((Class<C>) config.getClass(), name);
|
||||
return field.get(config);
|
||||
}
|
||||
|
||||
private <A> A getApiInstance(Class<A> apiClass) {
|
||||
WrappedReturningMethod<A, A> instance = new WrappedReturningMethod<>(apiClass, "getInstance");
|
||||
return instance.invoke();
|
||||
}
|
||||
private <A> A getApiInstance(Class<A> apiClass) {
|
||||
WrappedReturningMethod<A, A> instance = new WrappedReturningMethod<>(apiClass, "getInstance");
|
||||
return instance.invoke();
|
||||
}
|
||||
|
||||
private <A, C> C getLeavesConfig(Class<A> apiClass) {
|
||||
WrappedReturningMethod<A, A> instance = new WrappedReturningMethod<>(apiClass, "getInstance");
|
||||
WrappedField<A, C> config = new WrappedField<>(apiClass, "config");
|
||||
return config.get(instance.invoke());
|
||||
}
|
||||
private <A, C> C getLeavesConfig(Class<A> apiClass) {
|
||||
WrappedReturningMethod<A, A> instance = new WrappedReturningMethod<>(apiClass, "getInstance");
|
||||
WrappedField<A, C> config = new WrappedField<>(apiClass, "config");
|
||||
return config.get(instance.invoke());
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -27,9 +27,9 @@ import java.util.Map;
|
||||
|
||||
public class INMS {
|
||||
private static final Map<String, String> REVISION = Map.of(
|
||||
"1.20.5", "v1_20_R4",
|
||||
"1.20.6", "v1_20_R4",
|
||||
"1.21", "v1_21_R1"
|
||||
"1.20.5", "v1_20_R4",
|
||||
"1.20.6", "v1_20_R4",
|
||||
"1.21", "v1_21_R1"
|
||||
);
|
||||
//@done
|
||||
private static final INMSBinding binding = bind();
|
||||
@ -64,7 +64,7 @@ public class INMS {
|
||||
Iris.info("Locating NMS Binding for " + code);
|
||||
|
||||
try {
|
||||
Class<?> clazz = Class.forName("com.volmit.iris.core.nms."+code+".NMSBinding");
|
||||
Class<?> clazz = Class.forName("com.volmit.iris.core.nms." + code + ".NMSBinding");
|
||||
try {
|
||||
Object b = clazz.getConstructor().newInstance();
|
||||
if (b instanceof INMSBinding binding) {
|
||||
@ -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.");
|
||||
|
@ -116,7 +116,7 @@ public interface INMSBinding {
|
||||
void inject(long seed, Engine engine, World world) throws NoSuchFieldException, IllegalAccessException;
|
||||
|
||||
Vector3d getBoundingbox(org.bukkit.entity.EntityType entity);
|
||||
|
||||
|
||||
Entity spawnEntity(Location location, EntityType type, CreatureSpawnEvent.SpawnReason reason);
|
||||
|
||||
Color getBiomeColor(Location location, BiomeColor type);
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class DataFixerV1206 implements IDataFixer {
|
||||
public JSONObject fixCustomBiome(IrisBiomeCustom biome, JSONObject json) {
|
||||
int spawnRarity = biome.getSpawnRarity();
|
||||
if (spawnRarity > 0) {
|
||||
json.put("creature_spawn_probability", Math.min(spawnRarity/20d, 0.9999999));
|
||||
json.put("creature_spawn_probability", Math.min(spawnRarity / 20d, 0.9999999));
|
||||
}
|
||||
|
||||
var spawns = biome.getSpawns();
|
||||
@ -46,8 +46,8 @@ public class DataFixerV1206 implements IDataFixer {
|
||||
JSONObject o = new JSONObject();
|
||||
o.put("type", "minecraft:" + i.getType().name().toLowerCase());
|
||||
o.put("weight", i.getWeight());
|
||||
o.put("minCount", Math.min(i.getMinCount()/20d, 0));
|
||||
o.put("maxCount", Math.min(i.getMaxCount()/20d, 0.9999999));
|
||||
o.put("minCount", Math.min(i.getMinCount() / 20d, 0));
|
||||
o.put("maxCount", Math.min(i.getMaxCount() / 20d, 0.9999999));
|
||||
g.put(o);
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
@ -252,7 +251,7 @@ public class NMSBinding1X implements INMSBinding {
|
||||
|
||||
@Override
|
||||
public Vector3d getBoundingbox(org.bukkit.entity.EntityType entity) {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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;
|
||||
@ -58,10 +60,7 @@ public class ChunkUpdater {
|
||||
private ExecutorService chunkExecutor;
|
||||
private ScheduledExecutorService scheduler;
|
||||
private CompletableFuture future;
|
||||
private CountDownLatch latch;
|
||||
private final Object pauseLock;
|
||||
private final Engine engine;
|
||||
private final World world;
|
||||
private CountDownLatch latch;
|
||||
|
||||
public ChunkUpdater(World world) {
|
||||
this.engine = IrisToolbelt.access(world).getEngine();
|
||||
@ -154,7 +153,7 @@ public class ChunkUpdater {
|
||||
}
|
||||
executor.submit(() -> {
|
||||
if (!cancelled.get()) {
|
||||
processNextChunk();
|
||||
processNextChunk();
|
||||
}
|
||||
latch.countDown();
|
||||
});
|
||||
@ -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();
|
||||
@ -99,7 +99,7 @@ public class IrisPregenerator {
|
||||
generatedLast = new AtomicInteger(0);
|
||||
generatedLastMinute = new AtomicInteger(0);
|
||||
totalChunks = new AtomicInteger(0);
|
||||
if(!IrisPackBenchmarking.benchmarkInProgress) {
|
||||
if (!IrisPackBenchmarking.benchmarkInProgress) {
|
||||
loadCompletedRegions();
|
||||
IrisToolbelt.access(generator.getWorld()).getEngine().saveEngineData();
|
||||
}
|
||||
@ -216,7 +216,7 @@ public class IrisPregenerator {
|
||||
if (!matcher.find()) continue;
|
||||
int x = Integer.parseInt(matcher.group(1));
|
||||
int z = Integer.parseInt(matcher.group(2));
|
||||
Position2 pos = new Position2(x,z);
|
||||
Position2 pos = new Position2(x, z);
|
||||
generatedRegions.add(pos);
|
||||
|
||||
MCAFile mca = MCAUtil.read(file, 0);
|
||||
@ -252,7 +252,7 @@ public class IrisPregenerator {
|
||||
Position2 pos = new Position2(x, z);
|
||||
|
||||
if (generatedRegions.contains(pos)) {
|
||||
if(regions) {
|
||||
if (regions) {
|
||||
listener.onRegionGenerated(x, z);
|
||||
generated.addAndGet(1024);
|
||||
}
|
||||
@ -299,7 +299,7 @@ public class IrisPregenerator {
|
||||
}
|
||||
|
||||
public void saveCompletedRegions() {
|
||||
if(IrisPackBenchmarking.benchmarkInProgress) return;
|
||||
if (IrisPackBenchmarking.benchmarkInProgress) return;
|
||||
Gson gson = new Gson();
|
||||
try (Writer writer = new FileWriter(generator.getWorld().getWorldFolder().getPath() + "/" + saveFile)) {
|
||||
gson.toJson(new HashSet<>(generatedRegions), writer);
|
||||
@ -309,22 +309,23 @@ public class IrisPregenerator {
|
||||
}
|
||||
|
||||
public void loadCompletedRegions() {
|
||||
if(task.isResetCache()) {
|
||||
if (task.isResetCache()) {
|
||||
File test = new File(generator.getWorld().getWorldFolder().getPath() + "/" + saveFile);
|
||||
if(!test.delete()) {
|
||||
if (!test.delete()) {
|
||||
Iris.info(C.RED + "Failed to reset region cache ");
|
||||
}
|
||||
}
|
||||
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();
|
||||
generatedRegions.addAll(loadedSet);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
// all fine
|
||||
// all fine
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -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());
|
||||
@ -260,7 +258,7 @@ public class LazyPregenerator extends Thread implements Listener {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
while (lazyFile.exists()){
|
||||
while (lazyFile.exists()) {
|
||||
lazyFile.delete();
|
||||
J.sleep(1000);
|
||||
}
|
||||
@ -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..");
|
||||
@ -123,7 +122,7 @@ public class ServerBootSFG {
|
||||
// severityMedium++;
|
||||
// } Some servers dont like this
|
||||
|
||||
if (!enoughDiskSpace()){
|
||||
if (!enoughDiskSpace()) {
|
||||
hasEnoughDiskSpace = false;
|
||||
joiner.add("Insufficient Disk Space");
|
||||
severityMedium++;
|
||||
@ -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)) {
|
||||
@ -173,7 +174,7 @@ public class ServerBootSFG {
|
||||
public static boolean enoughDiskSpace() {
|
||||
File freeSpace = new File(Bukkit.getWorldContainer() + ".");
|
||||
double gigabytes = freeSpace.getFreeSpace() / (1024.0 * 1024.0 * 1024.0);
|
||||
if (gigabytes > 3){
|
||||
if (gigabytes > 3) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -37,7 +37,7 @@ public class onCommandWarning implements Listener {
|
||||
VolmitSender sender = new VolmitSender(player);
|
||||
boolean perm = sender.hasPermission("iris.all") || sender.isOp();
|
||||
if (perm) {
|
||||
sender.sendMessage(C.DARK_GRAY + "[" + C.RED + "!" + C.DARK_GRAY+ "]" + C.DARK_RED + "Iris is running unstably! Please resolve this.");
|
||||
sender.sendMessage(C.DARK_GRAY + "[" + C.RED + "!" + C.DARK_GRAY + "]" + C.DARK_RED + "Iris is running unstably! Please resolve this.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,12 +125,12 @@ public class BoardSVC implements IrisService, BoardProvider {
|
||||
int y = player.getLocation().getBlockY() - player.getWorld().getMinHeight();
|
||||
int z = player.getLocation().getBlockZ();
|
||||
|
||||
if(IrisSettings.get().getGeneral().debug){
|
||||
if (IrisSettings.get().getGeneral().debug) {
|
||||
lines.add("&7&m ");
|
||||
lines.add(C.GREEN + "Speed" + C.GRAY + ": " + Form.f(engine.getGeneratedPerSecond(), 0) + "/s " + Form.duration(1000D / engine.getGeneratedPerSecond(), 0));
|
||||
lines.add(C.AQUA + "Cache" + C.GRAY + ": " + Form.f(IrisData.cacheSize()));
|
||||
lines.add(C.AQUA + "Mantle" + C.GRAY + ": " + engine.getMantle().getLoadedRegionCount());
|
||||
lines.add(C.LIGHT_PURPLE + "Carving" + C.GRAY + ": " + engine.getMantle().isCarved(x,y,z));
|
||||
lines.add(C.LIGHT_PURPLE + "Carving" + C.GRAY + ": " + engine.getMantle().isCarved(x, y, z));
|
||||
lines.add("&7&m ");
|
||||
lines.add(C.AQUA + "Region" + C.GRAY + ": " + engine.getRegion(x, z).getName());
|
||||
lines.add(C.AQUA + "Biome" + C.GRAY + ": " + engine.getBiomeOrMantle(x, y, z).getName());
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ public class TreeSVC implements IrisService {
|
||||
boolean isUseAll = worldAccess.getEngine().getDimension().getTreeSettings().getMode().equals(IrisTreeModes.ALL);
|
||||
|
||||
// Retrieve objectPlacements of type `species` from biome
|
||||
IrisBiome biome = worldAccess.getEngine().getBiome(location.getBlockX(), location.getBlockY()-worldAccess.getTarget().getWorld().minHeight(), location.getBlockZ());
|
||||
IrisBiome biome = worldAccess.getEngine().getBiome(location.getBlockX(), location.getBlockY() - worldAccess.getTarget().getWorld().minHeight(), location.getBlockZ());
|
||||
placements.addAll(matchObjectPlacements(biome.getObjects(), size, type));
|
||||
|
||||
// Add more or find any in the region
|
||||
|
@ -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;
|
||||
@ -56,7 +55,7 @@ import java.util.Objects;
|
||||
|
||||
public class WandSVC implements IrisService {
|
||||
private static final Particle CRIT_MAGIC = E.getOrDefault(Particle.class, "CRIT_MAGIC", "CRIT");
|
||||
private static final Particle REDSTONE = E.getOrDefault(Particle.class, "REDSTONE", "DUST");
|
||||
private static final Particle REDSTONE = E.getOrDefault(Particle.class, "REDSTONE", "DUST");
|
||||
|
||||
private static ItemStack dust;
|
||||
private static ItemStack wand;
|
||||
@ -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. . .
|
||||
|
||||
@ -202,7 +198,7 @@ public class IrisBenchmarking {
|
||||
Iris.info("- Sequential 64.0 Write: " + C.BLUE + formatDouble(avgWriteSpeedMBps) + " Mbps");
|
||||
Iris.info("- Sequential 64.0 Read: " + C.BLUE + formatDouble(avgReadSpeedMBps) + " Mbps");
|
||||
} else {
|
||||
// Iris.info("Disk Model: " + getDiskModel());
|
||||
// Iris.info("Disk Model: " + getDiskModel());
|
||||
Iris.info(C.GREEN + "- Running in Native Mode");
|
||||
Iris.info("- Average Write Speed: " + C.GREEN + formatDouble(avgWriteSpeedMBps) + " Mbps");
|
||||
Iris.info("- Average Read Speed: " + C.GREEN + formatDouble(avgReadSpeedMBps) + " Mbps");
|
||||
|
@ -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;
|
||||
|
||||
@ -53,8 +50,8 @@ public class IrisConverter {
|
||||
File[] fileList = folder.listFiles(filter);
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||
executorService.submit(() -> {
|
||||
for (File schem : fileList) {
|
||||
try {
|
||||
for (File schem : fileList) {
|
||||
try {
|
||||
PrecisionStopwatch p = new PrecisionStopwatch();
|
||||
boolean largeObject = false;
|
||||
NamedTag tag = null;
|
||||
@ -66,241 +63,240 @@ public class IrisConverter {
|
||||
}
|
||||
CompoundTag compound = (CompoundTag) tag.getTag();
|
||||
|
||||
if (compound.containsKey("Palette") && compound.containsKey("Width") && compound.containsKey("Height") && compound.containsKey("Length")) {
|
||||
int objW = ((ShortTag) compound.get("Width")).getValue();
|
||||
int objH = ((ShortTag) compound.get("Height")).getValue();
|
||||
int objD = ((ShortTag) compound.get("Length")).getValue();
|
||||
int mv = objW * objH * objD;
|
||||
AtomicInteger v = new AtomicInteger(0);
|
||||
AtomicInteger fv = new AtomicInteger(0);
|
||||
if (mv > 500_000) {
|
||||
largeObject = true;
|
||||
Iris.info(C.GRAY + "Converting.. "+ schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
|
||||
Iris.info(C.GRAY + "- It may take a while");
|
||||
if (sender.isPlayer()) {
|
||||
J.a(() -> {
|
||||
if (compound.containsKey("Palette") && compound.containsKey("Width") && compound.containsKey("Height") && compound.containsKey("Length")) {
|
||||
int objW = ((ShortTag) compound.get("Width")).getValue();
|
||||
int objH = ((ShortTag) compound.get("Height")).getValue();
|
||||
int objD = ((ShortTag) compound.get("Length")).getValue();
|
||||
int mv = objW * objH * objD;
|
||||
AtomicInteger v = new AtomicInteger(0);
|
||||
AtomicInteger fv = new AtomicInteger(0);
|
||||
if (mv > 500_000) {
|
||||
largeObject = true;
|
||||
Iris.info(C.GRAY + "Converting.. " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
|
||||
Iris.info(C.GRAY + "- It may take a while");
|
||||
if (sender.isPlayer()) {
|
||||
J.a(() -> {
|
||||
// while (v.get() != mv) {
|
||||
// double pr = ((double) v.get() / (double ) mv);
|
||||
// sender.sendProgress(pr, "Converting");
|
||||
// J.sleep(16);
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
CompoundTag paletteTag = (CompoundTag) compound.get("Palette");
|
||||
Map<Integer, BlockData> blockmap = new HashMap<>(paletteTag.size(), 0.9f);
|
||||
for (Map.Entry<String, Tag<?>> entry : paletteTag.getValue().entrySet()) {
|
||||
String blockName = entry.getKey();
|
||||
BlockData bd = Bukkit.createBlockData(blockName);
|
||||
Tag<?> blockTag = entry.getValue();
|
||||
int blockId = ((IntTag) blockTag).getValue();
|
||||
blockmap.put(blockId, bd);
|
||||
}
|
||||
|
||||
ByteArrayTag byteArray = (ByteArrayTag) compound.get("BlockData");
|
||||
byte[] originalBlockArray = byteArray.getValue();
|
||||
int b = 0;
|
||||
int a = 0;
|
||||
Map<Integer, Byte> y = new HashMap<>();
|
||||
Map<Integer, Byte> x = new HashMap<>();
|
||||
Map<Integer, Byte> z = new HashMap<>();
|
||||
|
||||
// Height adjustments
|
||||
for (int h = 0; h < objH; h++) {
|
||||
if (b == 0) {
|
||||
y.put(h, (byte) 0);
|
||||
}
|
||||
if (b > 0) {
|
||||
y.put(h, (byte) 1);
|
||||
}
|
||||
a = 0;
|
||||
b = 0;
|
||||
for (int d = 0; d < objD; d++) {
|
||||
for (int w = 0; w < objW; w++) {
|
||||
BlockData db = blockmap.get((int) originalBlockArray[fv.get()]);
|
||||
if(db.getAsString().contains("minecraft:air")) {
|
||||
a++;
|
||||
} else {
|
||||
b++;
|
||||
}
|
||||
fv.getAndAdd(1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
fv.set(0);
|
||||
|
||||
// Width adjustments
|
||||
for (int w = 0; w < objW; w++) {
|
||||
if (b == 0) {
|
||||
x.put(w, (byte) 0);
|
||||
CompoundTag paletteTag = (CompoundTag) compound.get("Palette");
|
||||
Map<Integer, BlockData> blockmap = new HashMap<>(paletteTag.size(), 0.9f);
|
||||
for (Map.Entry<String, Tag<?>> entry : paletteTag.getValue().entrySet()) {
|
||||
String blockName = entry.getKey();
|
||||
BlockData bd = Bukkit.createBlockData(blockName);
|
||||
Tag<?> blockTag = entry.getValue();
|
||||
int blockId = ((IntTag) blockTag).getValue();
|
||||
blockmap.put(blockId, bd);
|
||||
}
|
||||
if (b > 0) {
|
||||
x.put(w, (byte) 1);
|
||||
|
||||
ByteArrayTag byteArray = (ByteArrayTag) compound.get("BlockData");
|
||||
byte[] originalBlockArray = byteArray.getValue();
|
||||
int b = 0;
|
||||
int a = 0;
|
||||
Map<Integer, Byte> y = new HashMap<>();
|
||||
Map<Integer, Byte> x = new HashMap<>();
|
||||
Map<Integer, Byte> z = new HashMap<>();
|
||||
|
||||
// Height adjustments
|
||||
for (int h = 0; h < objH; h++) {
|
||||
if (b == 0) {
|
||||
y.put(h, (byte) 0);
|
||||
}
|
||||
if (b > 0) {
|
||||
y.put(h, (byte) 1);
|
||||
}
|
||||
a = 0;
|
||||
b = 0;
|
||||
for (int d = 0; d < objD; d++) {
|
||||
for (int w = 0; w < objW; w++) {
|
||||
BlockData db = blockmap.get((int) originalBlockArray[fv.get()]);
|
||||
if (db.getAsString().contains("minecraft:air")) {
|
||||
a++;
|
||||
} else {
|
||||
b++;
|
||||
}
|
||||
fv.getAndAdd(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
a = 0;
|
||||
b = 0;
|
||||
fv.set(0);
|
||||
|
||||
// Width adjustments
|
||||
for (int w = 0; w < objW; w++) {
|
||||
if (b == 0) {
|
||||
x.put(w, (byte) 0);
|
||||
}
|
||||
if (b > 0) {
|
||||
x.put(w, (byte) 1);
|
||||
}
|
||||
a = 0;
|
||||
b = 0;
|
||||
for (int h = 0; h < objH; h++) {
|
||||
for (int d = 0; d < objD; d++) {
|
||||
BlockData db = blockmap.get((int) originalBlockArray[fv.get()]);
|
||||
if (db.getAsString().contains("minecraft:air")) {
|
||||
a++;
|
||||
} else {
|
||||
b++;
|
||||
}
|
||||
fv.getAndAdd(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
fv.set(0);
|
||||
|
||||
// Depth adjustments
|
||||
for (int d = 0; d < objD; d++) {
|
||||
if (b == 0) {
|
||||
z.put(d, (byte) 0);
|
||||
}
|
||||
if (b > 0) {
|
||||
z.put(d, (byte) 1);
|
||||
}
|
||||
a = 0;
|
||||
b = 0;
|
||||
for (int h = 0; h < objH; h++) {
|
||||
for (int w = 0; w < objW; w++) {
|
||||
BlockData db = blockmap.get((int) originalBlockArray[fv.get()]);
|
||||
if (db.getAsString().contains("minecraft:air")) {
|
||||
a++;
|
||||
} else {
|
||||
b++;
|
||||
}
|
||||
fv.getAndAdd(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
fv.set(0);
|
||||
int CorrectObjH = getCorrectY(y, objH);
|
||||
int CorrectObjW = getCorrectX(x, objW);
|
||||
int CorrectObjD = getCorrectZ(z, objD);
|
||||
|
||||
//IrisObject object = new IrisObject(CorrectObjW, CorrectObjH, CorrectObjH);
|
||||
IrisObject object = new IrisObject(objW, objH, objD);
|
||||
Vector originalVector = new Vector(objW, objH, objD);
|
||||
|
||||
|
||||
int[] yc = null;
|
||||
int[] xc = null;
|
||||
int[] zc = null;
|
||||
|
||||
|
||||
int fo = 0;
|
||||
int so = 0;
|
||||
int o = 0;
|
||||
int c = 0;
|
||||
for (Integer i : y.keySet()) {
|
||||
if (y.get(i) == 0) {
|
||||
o++;
|
||||
}
|
||||
if (y.get(i) == 1) {
|
||||
c++;
|
||||
if (c == 1) {
|
||||
fo = o;
|
||||
}
|
||||
o = 0;
|
||||
}
|
||||
}
|
||||
so = o;
|
||||
yc = new int[]{fo, so};
|
||||
|
||||
fo = 0;
|
||||
so = 0;
|
||||
o = 0;
|
||||
c = 0;
|
||||
for (Integer i : x.keySet()) {
|
||||
if (x.get(i) == 0) {
|
||||
o++;
|
||||
}
|
||||
if (x.get(i) == 1) {
|
||||
c++;
|
||||
if (c == 1) {
|
||||
fo = o;
|
||||
}
|
||||
o = 0;
|
||||
}
|
||||
}
|
||||
so = o;
|
||||
xc = new int[]{fo, so};
|
||||
|
||||
fo = 0;
|
||||
so = 0;
|
||||
o = 0;
|
||||
c = 0;
|
||||
for (Integer i : z.keySet()) {
|
||||
if (z.get(i) == 0) {
|
||||
o++;
|
||||
}
|
||||
if (z.get(i) == 1) {
|
||||
c++;
|
||||
if (c == 1) {
|
||||
fo = o;
|
||||
}
|
||||
o = 0;
|
||||
}
|
||||
}
|
||||
so = o;
|
||||
zc = new int[]{fo, so};
|
||||
|
||||
int h1, h2, w1, w2, v1 = 0, volume = objW * objH * objD;
|
||||
Map<Integer, Integer> blockLocationMap = new LinkedHashMap<>();
|
||||
boolean hasAir = false;
|
||||
int pos = 0;
|
||||
for (int i : originalBlockArray) {
|
||||
blockLocationMap.put(pos, i);
|
||||
pos++;
|
||||
}
|
||||
|
||||
|
||||
for (int h = 0; h < objH; h++) {
|
||||
for (int d = 0; d < objD; d++) {
|
||||
BlockData db = blockmap.get((int) originalBlockArray[fv.get()]);
|
||||
if(db.getAsString().contains("minecraft:air")) {
|
||||
a++;
|
||||
} else {
|
||||
b++;
|
||||
for (int w = 0; w < objW; w++) {
|
||||
BlockData bd = blockmap.get((int) originalBlockArray[v.get()]);
|
||||
if (!bd.getMaterial().isAir()) {
|
||||
object.setUnsigned(w, h, d, bd);
|
||||
}
|
||||
v.getAndAdd(1);
|
||||
}
|
||||
fv.getAndAdd(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
fv.set(0);
|
||||
|
||||
// Depth adjustments
|
||||
for (int d = 0; d < objD; d++) {
|
||||
if (b == 0) {
|
||||
z.put(d, (byte) 0);
|
||||
|
||||
try {
|
||||
object.write(new File(folder, schem.getName().replace(".schem", ".iob")));
|
||||
} catch (IOException e) {
|
||||
Iris.info(C.RED + "Failed to save: " + schem.getName());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (b > 0) {
|
||||
z.put(d, (byte) 1);
|
||||
}
|
||||
a = 0;
|
||||
b = 0;
|
||||
for (int h = 0; h < objH; h++) {
|
||||
for (int w = 0; w < objW; w++) {
|
||||
BlockData db = blockmap.get((int) originalBlockArray[fv.get()]);
|
||||
if(db.getAsString().contains("minecraft:air")) {
|
||||
a++;
|
||||
} else {
|
||||
b++;
|
||||
}
|
||||
fv.getAndAdd(1);
|
||||
if (sender.isPlayer()) {
|
||||
if (largeObject) {
|
||||
sender.sendMessage(C.IRIS + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob") + " in " + Form.duration(p.getMillis()));
|
||||
} else {
|
||||
sender.sendMessage(C.IRIS + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
|
||||
}
|
||||
}
|
||||
}
|
||||
fv.set(0);
|
||||
int CorrectObjH = getCorrectY(y, objH);
|
||||
int CorrectObjW = getCorrectX(x, objW);
|
||||
int CorrectObjD = getCorrectZ(z, objD);
|
||||
|
||||
//IrisObject object = new IrisObject(CorrectObjW, CorrectObjH, CorrectObjH);
|
||||
IrisObject object = new IrisObject(objW, objH, objD);
|
||||
Vector originalVector = new Vector(objW,objH,objD);
|
||||
|
||||
|
||||
int[] yc = null;
|
||||
int[] xc = null;
|
||||
int[] zc = null;
|
||||
|
||||
|
||||
int fo = 0;
|
||||
int so = 0;
|
||||
int o = 0;
|
||||
int c = 0;
|
||||
for (Integer i : y.keySet()) {
|
||||
if (y.get(i) == 0) {
|
||||
o++;
|
||||
}
|
||||
if (y.get(i) == 1) {
|
||||
c++;
|
||||
if (c == 1) {
|
||||
fo = o;
|
||||
}
|
||||
o = 0;
|
||||
}
|
||||
}
|
||||
so = o;
|
||||
yc = new int[]{fo, so};
|
||||
|
||||
fo = 0;
|
||||
so = 0;
|
||||
o = 0;
|
||||
c = 0;
|
||||
for (Integer i : x.keySet()) {
|
||||
if (x.get(i) == 0) {
|
||||
o++;
|
||||
}
|
||||
if (x.get(i) == 1) {
|
||||
c++;
|
||||
if (c == 1) {
|
||||
fo = o;
|
||||
}
|
||||
o = 0;
|
||||
}
|
||||
}
|
||||
so = o;
|
||||
xc = new int[]{fo, so};
|
||||
|
||||
fo = 0;
|
||||
so = 0;
|
||||
o = 0;
|
||||
c = 0;
|
||||
for (Integer i : z.keySet()) {
|
||||
if (z.get(i) == 0) {
|
||||
o++;
|
||||
}
|
||||
if (z.get(i) == 1) {
|
||||
c++;
|
||||
if (c == 1) {
|
||||
fo = o;
|
||||
}
|
||||
o = 0;
|
||||
}
|
||||
}
|
||||
so = o;
|
||||
zc = new int[]{fo, so};
|
||||
|
||||
int h1, h2, w1, w2, v1 = 0, volume = objW * objH * objD;
|
||||
Map<Integer, Integer> blockLocationMap = new LinkedHashMap<>();
|
||||
boolean hasAir = false;
|
||||
int pos = 0;
|
||||
for (int i : originalBlockArray) {
|
||||
blockLocationMap.put(pos, i);
|
||||
pos++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int h = 0; h < objH; h++) {
|
||||
for (int d = 0; d < objD; d++) {
|
||||
for (int w = 0; w < objW; w++) {
|
||||
BlockData bd = blockmap.get((int) originalBlockArray[v.get()]);
|
||||
if (!bd.getMaterial().isAir()) {
|
||||
object.setUnsigned(w, h, d, bd);
|
||||
}
|
||||
v.getAndAdd(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
object.write(new File(folder, schem.getName().replace(".schem", ".iob")));
|
||||
} catch (IOException e) {
|
||||
Iris.info(C.RED + "Failed to save: " + schem.getName());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (sender.isPlayer()) {
|
||||
if (largeObject) {
|
||||
sender.sendMessage(C.IRIS + "Converted "+ schem.getName() + " -> " + schem.getName().replace(".schem", ".iob") + " in " + Form.duration(p.getMillis()));
|
||||
Iris.info(C.GRAY + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob") + " in " + Form.duration(p.getMillis()));
|
||||
} else {
|
||||
sender.sendMessage(C.IRIS + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
|
||||
Iris.info(C.GRAY + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
|
||||
}
|
||||
// schem.delete();
|
||||
}
|
||||
if (largeObject) {
|
||||
Iris.info(C.GRAY + "Converted "+ schem.getName() + " -> " + schem.getName().replace(".schem", ".iob") + " in " + Form.duration(p.getMillis()));
|
||||
} else {
|
||||
Iris.info(C.GRAY + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
|
||||
} catch (Exception e) {
|
||||
Iris.info(C.RED + "Failed to convert: " + schem.getName());
|
||||
if (sender.isPlayer()) {
|
||||
sender.sendMessage(C.RED + "Failed to convert: " + schem.getName());
|
||||
}
|
||||
// schem.delete();
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Iris.info(C.RED + "Failed to convert: " + schem.getName());
|
||||
if (sender.isPlayer()) {
|
||||
sender.sendMessage(C.RED + "Failed to convert: " + schem.getName());
|
||||
}
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -356,7 +352,7 @@ public class IrisConverter {
|
||||
}
|
||||
if (y.get(i) == 1) {
|
||||
c++;
|
||||
if(c == 1){
|
||||
if (c == 1) {
|
||||
fo = o;
|
||||
}
|
||||
o = 0;
|
||||
@ -377,7 +373,7 @@ public class IrisConverter {
|
||||
}
|
||||
if (x.get(i) == 1) {
|
||||
c++;
|
||||
if(c == 1){
|
||||
if (c == 1) {
|
||||
fo = o;
|
||||
}
|
||||
o = 0;
|
||||
@ -398,7 +394,7 @@ public class IrisConverter {
|
||||
}
|
||||
if (z.get(i) == 1) {
|
||||
c++;
|
||||
if(c == 1){
|
||||
if (c == 1) {
|
||||
fo = o;
|
||||
}
|
||||
o = 0;
|
||||
|
@ -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,7 +97,8 @@ public class IrisCreator {
|
||||
yml.save(BUKKIT_YML);
|
||||
return true;
|
||||
}
|
||||
public static boolean worldLoaded(){
|
||||
|
||||
public static boolean worldLoaded() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ public class IrisCreator {
|
||||
}
|
||||
return finalAccess1.getEngine().getGenerated();
|
||||
};
|
||||
if(!benchmark) {
|
||||
if (!benchmark) {
|
||||
if (finalAccess1 == null) return;
|
||||
int req = finalAccess1.getSpawnChunks().join();
|
||||
|
||||
|
@ -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;
|
||||
@ -58,14 +57,14 @@ import java.util.Collections;
|
||||
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;
|
||||
private boolean finished = false;
|
||||
private Engine engine;
|
||||
public static boolean benchmarkInProgress = false;
|
||||
private final boolean headless;
|
||||
private final boolean gui;
|
||||
PrecisionStopwatch stopwatch;
|
||||
private IrisDimension IrisDimension;
|
||||
private int radius;
|
||||
private boolean finished = false;
|
||||
private Engine engine;
|
||||
|
||||
public IrisPackBenchmarking(IrisDimension dimension, int r, boolean headless, boolean gui) {
|
||||
instance = this;
|
||||
@ -114,14 +113,14 @@ public class IrisPackBenchmarking {
|
||||
File profilers = new File("plugins" + File.separator + "Iris" + File.separator + "packbenchmarks");
|
||||
profilers.mkdir();
|
||||
|
||||
File results = new File(profilers, IrisDimension.getName() + " " + LocalDateTime.now(Clock.systemDefaultZone()).toString().replace(':', '-') + ".txt");
|
||||
File results = new File(profilers, IrisDimension.getName() + " " + LocalDateTime.now(Clock.systemDefaultZone()).toString().replace(':', '-') + ".txt");
|
||||
results.getParentFile().mkdirs();
|
||||
KMap<String, Double> metrics = engine.getMetrics().pull();
|
||||
try (FileWriter writer = new FileWriter(results)) {
|
||||
writer.write("-----------------\n");
|
||||
writer.write("Results:\n");
|
||||
writer.write("Dimension: " + IrisDimension.getName() + "\n");
|
||||
writer.write("- Date of Benchmark: " + LocalDateTime.now(Clock.systemDefaultZone()) + "\n");
|
||||
writer.write("- Date of Benchmark: " + LocalDateTime.now(Clock.systemDefaultZone()) + "\n");
|
||||
writer.write("\n");
|
||||
writer.write("Metrics");
|
||||
for (String m : metrics.k()) {
|
||||
@ -129,7 +128,7 @@ public class IrisPackBenchmarking {
|
||||
writer.write("- " + m + ": " + i);
|
||||
}
|
||||
writer.write("- " + metrics);
|
||||
writer.write("Benchmark: " + LocalDateTime.now(Clock.systemDefaultZone()) + "\n");
|
||||
writer.write("Benchmark: " + LocalDateTime.now(Clock.systemDefaultZone()) + "\n");
|
||||
writer.write("- Total time: " + time + "\n");
|
||||
writer.write("- Average CPS: " + calculateAverage(cps) + "\n");
|
||||
writer.write(" - Median CPS: " + calculateMedian(cps) + "\n");
|
||||
@ -151,7 +150,8 @@ public class IrisPackBenchmarking {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private Engine createBenchmark(){
|
||||
|
||||
private Engine createBenchmark() {
|
||||
try {
|
||||
if (headless) {
|
||||
Iris.info("Using headless benchmark!");
|
||||
@ -184,17 +184,17 @@ public class IrisPackBenchmarking {
|
||||
}
|
||||
}
|
||||
|
||||
private void startBenchmark(){
|
||||
private void startBenchmark() {
|
||||
int x = 0;
|
||||
int z = 0;
|
||||
IrisToolbelt.pregenerate(PregenTask
|
||||
.builder()
|
||||
.gui(gui)
|
||||
.center(new Position2(x, z))
|
||||
.width(radius)
|
||||
.height(radius)
|
||||
.build(), headless ? new HeadlessPregenMethod(engine) : new HybridPregenMethod(engine.getWorld().realWorld(),
|
||||
IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism())), engine);
|
||||
IrisToolbelt.pregenerate(PregenTask
|
||||
.builder()
|
||||
.gui(gui)
|
||||
.center(new Position2(x, z))
|
||||
.width(radius)
|
||||
.height(radius)
|
||||
.build(), headless ? new HeadlessPregenMethod(engine) : new HybridPregenMethod(engine.getWorld().realWorld(),
|
||||
IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism())), engine);
|
||||
}
|
||||
|
||||
private double calculateAverage(KList<Integer> list) {
|
||||
|
@ -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;
|
||||
@ -72,7 +71,7 @@ public class IrisWorldDump {
|
||||
this.world = world;
|
||||
this.sender = sender;
|
||||
this.MCADirectory = new File(world.getWorldFolder(), "region");
|
||||
this.dumps = new File("plugins" + File.separator + "iris", "dumps");
|
||||
this.dumps = new File("plugins" + File.separator + "iris", "dumps");
|
||||
this.worldDump = new File(dumps, world.getName());
|
||||
this.mcaCacheSize = IrisSettings.get().getWorldDump().mcaCacheSize;
|
||||
this.regionsProcessed = new AtomicInteger(0);
|
||||
@ -131,41 +130,26 @@ public class IrisWorldDump {
|
||||
Iris.info("Processed: " + Form.f(processed) + " of " + Form.f(totalMaxChunks.get()) + " (%.0f%%) " + Form.f(chunksPerSecond.getAverage()) + "/s, ETA: " + Form.duration(eta, 2), percentage);
|
||||
|
||||
}, 1, 3, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
AtomicInteger f = new AtomicInteger();
|
||||
for (File mcaFile : MCADirectory.listFiles()) {
|
||||
if (mcaFile.getName().endsWith(".mca")) {
|
||||
executor.submit(() -> {
|
||||
for (File mcaFile : MCADirectory.listFiles()) {
|
||||
if (mcaFile.getName().endsWith(".mca")) {
|
||||
executor.submit(() -> {
|
||||
try {
|
||||
processMCARegion( MCAUtil.read(mcaFile));
|
||||
processMCARegion(MCAUtil.read(mcaFile));
|
||||
} catch (Exception e) {
|
||||
f.getAndIncrement();
|
||||
Iris.error("Failed to read mca file");
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processMCARegion(MCAFile mca) {
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import org.bukkit.util.Vector;
|
||||
import java.awt.*;
|
||||
|
||||
public class WandSelection {
|
||||
private static final Particle REDSTONE = E.getOrDefault(Particle.class, "REDSTONE", "DUST");
|
||||
private static final Particle REDSTONE = E.getOrDefault(Particle.class, "REDSTONE", "DUST");
|
||||
private final Cuboid c;
|
||||
private final Player p;
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
@ -286,7 +308,7 @@ public class IrisEngine implements Engine {
|
||||
data.getStatistics().setIrisCreationVersion(Iris.instance.getIrisVersion());
|
||||
data.getStatistics().setMCVersion(Iris.instance.getMCVersion());
|
||||
data.getStatistics().setIrisToUpgradedVersion(Iris.instance.getIrisVersion());
|
||||
if (data.getStatistics().getIrisCreationVersion() == -1 || data.getStatistics().getMCVersion() == -1 ) {
|
||||
if (data.getStatistics().getIrisCreationVersion() == -1 || data.getStatistics().getMCVersion() == -1) {
|
||||
Iris.error("Failed to setup Engine Data!");
|
||||
}
|
||||
IO.writeAll(f, new Gson().toJson(data));
|
||||
@ -532,7 +554,7 @@ public class IrisEngine implements Engine {
|
||||
|
||||
getMantle().getMantle().flag(x >> 4, z >> 4, MantleFlag.REAL, true);
|
||||
getMetrics().getTotal().put(p.getMilliseconds());
|
||||
addGenerated(x,z);
|
||||
addGenerated(x, z);
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
fail("Failed to generate " + x + ", " + z, e);
|
||||
@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
try {
|
||||
Bukkit.getPluginManager().callEvent(new IrisLootEvent(this, block, slot, tables));
|
||||
|
||||
if (!tables.isEmpty()){
|
||||
if (!tables.isEmpty()) {
|
||||
Iris.debug("IrisLootEvent has been accessed");
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}) {
|
||||
|
@ -60,7 +60,7 @@ public class HeightmapObjectPlacer implements IObjectPlacer {
|
||||
|
||||
@Override
|
||||
public boolean isCarved(int x, int y, int z) {
|
||||
return oplacer.isCarved(x,y,z);
|
||||
return oplacer.isCarved(x, y, z);
|
||||
}
|
||||
|
||||
public boolean isSolid(int param1Int1, int param1Int2, int param1Int3) {
|
||||
|
@ -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;
|
||||
@ -85,7 +87,7 @@ public class WorldObjectPlacer implements IObjectPlacer {
|
||||
try {
|
||||
Bukkit.getPluginManager().callEvent(new IrisLootEvent(engine, block, slot, tables));
|
||||
|
||||
if (!tables.isEmpty()){
|
||||
if (!tables.isEmpty()) {
|
||||
Iris.debug("IrisLootEvent has been accessed");
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
@ -78,7 +77,7 @@ public class PlannedStructure {
|
||||
|
||||
public boolean place(IObjectPlacer placer, Mantle e, Engine eng) {
|
||||
IrisObjectPlacement options = new IrisObjectPlacement();
|
||||
options.setRotation(IrisObjectRotation.of(0,0,0));
|
||||
options.setRotation(IrisObjectRotation.of(0, 0, 0));
|
||||
int startHeight = pieces.get(0).getPosition().getY();
|
||||
|
||||
boolean placed = false;
|
||||
|
@ -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,7 +178,8 @@ 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){
|
||||
|
||||
default int unloadTectonicPlate(int tectonicLimit) {
|
||||
return getMantle().unloadTectonicPlate(tectonicLimit);
|
||||
}
|
||||
|
||||
@ -195,32 +195,32 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
@ChunkCoordinates
|
||||
default void generateMatter(int x, int z, boolean multicore, ChunkContext context) {
|
||||
//synchronized (this) {
|
||||
if (!getEngine().getDimension().isUseMantle()) {
|
||||
return;
|
||||
}
|
||||
if (!getEngine().getDimension().isUseMantle()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int s = getRealRadius();
|
||||
BurstExecutor burst = burst().burst(multicore);
|
||||
MantleWriter writer = getMantle().write(this, x, z, s * 2);
|
||||
for (int i = -s; i <= s; i++) {
|
||||
for (int j = -s; j <= s; j++) {
|
||||
int xx = i + x;
|
||||
int zz = j + z;
|
||||
burst.queue(() -> {
|
||||
IrisContext.touch(getEngine().getContext());
|
||||
getMantle().raiseFlag(xx, zz, MantleFlag.PLANNED, () -> {
|
||||
MantleChunk mc = getMantle().getChunk(xx, zz);
|
||||
int s = getRealRadius();
|
||||
BurstExecutor burst = burst().burst(multicore);
|
||||
MantleWriter writer = getMantle().write(this, x, z, s * 2);
|
||||
for (int i = -s; i <= s; i++) {
|
||||
for (int j = -s; j <= s; j++) {
|
||||
int xx = i + x;
|
||||
int zz = j + z;
|
||||
burst.queue(() -> {
|
||||
IrisContext.touch(getEngine().getContext());
|
||||
getMantle().raiseFlag(xx, zz, MantleFlag.PLANNED, () -> {
|
||||
MantleChunk mc = getMantle().getChunk(xx, zz);
|
||||
|
||||
for (MantleComponent k : getComponents()) {
|
||||
generateMantleComponent(writer, xx, zz, k, mc, context);
|
||||
}
|
||||
});
|
||||
for (MantleComponent k : getComponents()) {
|
||||
generateMantleComponent(writer, xx, zz, k, mc, context);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
burst.complete();
|
||||
// }
|
||||
burst.complete();
|
||||
// }
|
||||
}
|
||||
|
||||
default void generateMantleComponent(MantleWriter writer, int x, int z, MantleComponent c, MantleChunk mc, ChunkContext context) {
|
||||
@ -261,7 +261,8 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
default int getLoadedRegionCount() {
|
||||
return getMantle().getLoadedRegionCount();
|
||||
}
|
||||
default long getLastUseMapMemoryUsage(){
|
||||
|
||||
default long getLastUseMapMemoryUsage() {
|
||||
return getMantle().LastUseMapMemoryUsage();
|
||||
}
|
||||
|
||||
@ -296,13 +297,15 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
}
|
||||
}
|
||||
|
||||
default long getToUnload(){
|
||||
default long getToUnload() {
|
||||
return getMantle().getToUnload().size();
|
||||
}
|
||||
default long getNotQueuedLoadedRegions(){
|
||||
|
||||
default long getNotQueuedLoadedRegions() {
|
||||
return getMantle().getLoadedRegions().size() - getMantle().getToUnload().size();
|
||||
}
|
||||
default double getTectonicDuration(){
|
||||
|
||||
default double getTectonicDuration() {
|
||||
return getMantle().getAdjustedIdleDuration().get();
|
||||
}
|
||||
}
|
@ -85,7 +85,7 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
|
||||
@ChunkCoordinates
|
||||
private boolean placeStructures(MantleWriter writer, long seed, int x, int z, KList<IrisJigsawStructurePlacement> structures,
|
||||
KSet<Position2> cachedRegions, KMap<String, KSet<Position2>> cache, KMap<Position2, Double> distanceCache) {
|
||||
KSet<Position2> cachedRegions, KMap<String, KSet<Position2>> cache, KMap<Position2, Double> distanceCache) {
|
||||
IrisJigsawStructurePlacement i = pick(structures, seed, x, z);
|
||||
if (i == null || checkMinDistances(i.collectMinDistances(), x, z, cachedRegions, cache, distanceCache))
|
||||
return false;
|
||||
@ -119,7 +119,7 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
double minDist = minDistances.get(structure);
|
||||
minDist = minDist * minDist;
|
||||
for (Position2 sPos : cache.get(structure)) {
|
||||
double dist = distanceCache.computeIfAbsent(sPos, position2 -> position2.distance(pos));
|
||||
double dist = distanceCache.computeIfAbsent(sPos, position2 -> position2.distance(pos));
|
||||
if (minDist > dist) return true;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
|
@ -39,14 +39,14 @@ public class IrisBiomeGeneratorLink {
|
||||
@RegistryListResource(IrisGenerator.class)
|
||||
@Desc("The generator id")
|
||||
private String generator = "default";
|
||||
@DependsOn({ "min", "max" })
|
||||
@DependsOn({"min", "max"})
|
||||
@Required
|
||||
@MinNumber(-2032) // TODO: WARNING HEIGHT
|
||||
@MaxNumber(2032) // TODO: WARNING HEIGHT
|
||||
@Desc("The min block value (value + fluidHeight)")
|
||||
@Getter(AccessLevel.NONE)
|
||||
private int min = 0;
|
||||
@DependsOn({ "min", "max" })
|
||||
@DependsOn({"min", "max"})
|
||||
@Required
|
||||
@MinNumber(-2032) // TODO: WARNING HEIGHT
|
||||
@MaxNumber(2032) // TODO: WARNING HEIGHT
|
||||
@ -80,7 +80,7 @@ public class IrisBiomeGeneratorLink {
|
||||
}
|
||||
}
|
||||
|
||||
return new int[] { min, max };
|
||||
return new int[]{min, max};
|
||||
}
|
||||
|
||||
private int calculateHeight(Engine engine, int option) {
|
||||
|
@ -82,7 +82,7 @@ public class IrisCavePlacer implements IRare {
|
||||
}
|
||||
|
||||
if (y == -1) {
|
||||
if(!breakSurface) {
|
||||
if (!breakSurface) {
|
||||
int eH = engine.getHeight(x, z);
|
||||
if (caveStartHeight.getMax() > eH) {
|
||||
caveStartHeight.setMax(eH);
|
||||
@ -92,7 +92,7 @@ public class IrisCavePlacer implements IRare {
|
||||
}
|
||||
|
||||
try {
|
||||
cave.generate(mantle, rng, engine, x + rng.nextInt(15), y, z + rng.nextInt(15), waterHint);
|
||||
cave.generate(mantle, rng, engine, x + rng.nextInt(15), y, z + rng.nextInt(15), waterHint);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
fail.set(true);
|
||||
|
@ -80,7 +80,7 @@ public class IrisDecorator {
|
||||
@DependsOn({"stackMin", "stackMax"})
|
||||
@Desc("""
|
||||
Changes stackMin and stackMin from being absolute block heights and instead uses them as a percentage to scale the stack based on the cave height
|
||||
|
||||
|
||||
Within a cave, setting them stackMin/max to 50 would make the stack 50% of the cave height""")
|
||||
private boolean scaleStack = false;
|
||||
@Required
|
||||
|
@ -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;
|
||||
|
@ -727,7 +727,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
Engine engine = rdata.getEngine();
|
||||
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
||||
for (int i = x - Math.floorDiv(w, 2) + (int) offset.getX(); i <= x + Math.floorDiv(w, 2) - (w % 2 == 0 ? 1 : 0) + (int) offset.getX(); i++) {
|
||||
for (int j = y - Math.floorDiv(h, 2) + (int) offset.getY(); j <= y + Math.floorDiv(h, 2) - (h % 2 == 0 ? 1 : 0) + (int) offset.getY(); j++) {
|
||||
for (int j = y - Math.floorDiv(h, 2) + (int) offset.getY(); j <= y + Math.floorDiv(h, 2) - (h % 2 == 0 ? 1 : 0) + (int) offset.getY(); j++) {
|
||||
for (int k = z - Math.floorDiv(d, 2) + (int) offset.getZ(); k <= z + Math.floorDiv(d, 2) - (d % 2 == 0 ? 1 : 0) + (int) offset.getX(); k++) {
|
||||
PlacedObject p = engine.getObjectPlacement(i, j, k);
|
||||
if (p == null) continue;
|
||||
|
@ -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;
|
||||
@ -140,14 +138,14 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
J.s(() -> {
|
||||
Engine engine1 = getEngine(event.getWorld());
|
||||
if (engine1 != null) {
|
||||
try {
|
||||
INMS.get().inject(event.getWorld().getSeed(), engine1, event.getWorld());
|
||||
try {
|
||||
INMS.get().inject(event.getWorld().getSeed(), engine1, event.getWorld());
|
||||
Iris.info("Injected Iris Biome Source into " + event.getWorld().getName());
|
||||
initialized = true;
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 10);
|
||||
} else {
|
||||
INMS.get().inject(event.getWorld().getSeed(), engine, event.getWorld());
|
||||
|
@ -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 record Status(int engineCount, long loadedChunks, int tectonicLimit,
|
||||
long tectonicPlates, long activeTectonicPlates,
|
||||
long queuedTectonicPlates,
|
||||
long minTectonicUnloadDuration,
|
||||
long maxTectonicUnloadDuration) {
|
||||
}
|
||||
|
||||
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) {}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -34,112 +34,112 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@Data
|
||||
public class IrisCustomData implements BlockData {
|
||||
private final @NonNull BlockData base;
|
||||
private final @NotNull Identifier custom;
|
||||
private final @NonNull BlockData base;
|
||||
private final @NotNull Identifier custom;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Material getMaterial() {
|
||||
return base.getMaterial();
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public Material getMaterial() {
|
||||
return base.getMaterial();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getAsString() {
|
||||
return base.getAsString();
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public String getAsString() {
|
||||
return base.getAsString();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getAsString(boolean b) {
|
||||
return base.getAsString(b);
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public String getAsString(boolean b) {
|
||||
return base.getAsString(b);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public BlockData merge(@NotNull BlockData blockData) {
|
||||
return new IrisCustomData(base.merge(blockData), custom);
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public BlockData merge(@NotNull BlockData blockData) {
|
||||
return new IrisCustomData(base.merge(blockData), custom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@Nullable BlockData blockData) {
|
||||
if (blockData instanceof IrisCustomData b)
|
||||
return custom.equals(b.custom) && base.matches(b.base);
|
||||
return base.matches(blockData);
|
||||
}
|
||||
@Override
|
||||
public boolean matches(@Nullable BlockData blockData) {
|
||||
if (blockData instanceof IrisCustomData b)
|
||||
return custom.equals(b.custom) && base.matches(b.base);
|
||||
return base.matches(blockData);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public BlockData clone() {
|
||||
return new IrisCustomData(base.clone(), custom);
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public BlockData clone() {
|
||||
return new IrisCustomData(base.clone(), custom);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public SoundGroup getSoundGroup() {
|
||||
return base.getSoundGroup();
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public SoundGroup getSoundGroup() {
|
||||
return base.getSoundGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightEmission() {
|
||||
return base.getLightEmission();
|
||||
}
|
||||
@Override
|
||||
public int getLightEmission() {
|
||||
return base.getLightEmission();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOccluding() {
|
||||
return base.isOccluding();
|
||||
}
|
||||
@Override
|
||||
public boolean isOccluding() {
|
||||
return base.isOccluding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresCorrectToolForDrops() {
|
||||
return base.requiresCorrectToolForDrops();
|
||||
}
|
||||
@Override
|
||||
public boolean requiresCorrectToolForDrops() {
|
||||
return base.requiresCorrectToolForDrops();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreferredTool(@NotNull ItemStack itemStack) {
|
||||
return base.isPreferredTool(itemStack);
|
||||
}
|
||||
@Override
|
||||
public boolean isPreferredTool(@NotNull ItemStack itemStack) {
|
||||
return base.isPreferredTool(itemStack);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PistonMoveReaction getPistonMoveReaction() {
|
||||
return base.getPistonMoveReaction();
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public PistonMoveReaction getPistonMoveReaction() {
|
||||
return base.getPistonMoveReaction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(@NotNull Block block) {
|
||||
return base.isSupported(block);
|
||||
}
|
||||
@Override
|
||||
public boolean isSupported(@NotNull Block block) {
|
||||
return base.isSupported(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(@NotNull Location location) {
|
||||
return base.isSupported(location);
|
||||
}
|
||||
@Override
|
||||
public boolean isSupported(@NotNull Location location) {
|
||||
return base.isSupported(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFaceSturdy(@NotNull BlockFace blockFace, @NotNull BlockSupport blockSupport) {
|
||||
return base.isFaceSturdy(blockFace, blockSupport);
|
||||
}
|
||||
@Override
|
||||
public boolean isFaceSturdy(@NotNull BlockFace blockFace, @NotNull BlockSupport blockSupport) {
|
||||
return base.isFaceSturdy(blockFace, blockSupport);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Material getPlacementMaterial() {
|
||||
return base.getPlacementMaterial();
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public Material getPlacementMaterial() {
|
||||
return base.getPlacementMaterial();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotate(@NotNull StructureRotation structureRotation) {
|
||||
base.rotate(structureRotation);
|
||||
}
|
||||
@Override
|
||||
public void rotate(@NotNull StructureRotation structureRotation) {
|
||||
base.rotate(structureRotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mirror(@NotNull Mirror mirror) {
|
||||
base.mirror(mirror);
|
||||
}
|
||||
@Override
|
||||
public void mirror(@NotNull Mirror mirror) {
|
||||
base.mirror(mirror);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return base.createBlockState();
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return base.createBlockState();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -29,26 +29,26 @@ import java.io.IOException;
|
||||
@Sliced
|
||||
public class IdentifierMatter extends RawMatter<Identifier> {
|
||||
|
||||
public IdentifierMatter() {
|
||||
this(1, 1, 1);
|
||||
}
|
||||
public IdentifierMatter() {
|
||||
this(1, 1, 1);
|
||||
}
|
||||
|
||||
public IdentifierMatter(int width, int height, int depth) {
|
||||
super(width, height, depth, Identifier.class);
|
||||
}
|
||||
public IdentifierMatter(int width, int height, int depth) {
|
||||
super(width, height, depth, Identifier.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Palette<Identifier> getGlobalPalette() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Palette<Identifier> getGlobalPalette() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNode(Identifier b, DataOutputStream dos) throws IOException {
|
||||
dos.writeUTF(b.toString());
|
||||
}
|
||||
@Override
|
||||
public void writeNode(Identifier b, DataOutputStream dos) throws IOException {
|
||||
dos.writeUTF(b.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier readNode(DataInputStream din) throws IOException {
|
||||
return Identifier.fromString(din.readUTF());
|
||||
}
|
||||
@Override
|
||||
public Identifier readNode(DataInputStream din) throws IOException {
|
||||
return Identifier.fromString(din.readUTF());
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
||||
@Sliced
|
||||
public class JigsawPieceMatter extends RawMatter<JigsawPieceContainer> {
|
||||
public JigsawPieceMatter() {
|
||||
this(1,1,1);
|
||||
this(1, 1, 1);
|
||||
}
|
||||
|
||||
public JigsawPieceMatter(int width, int height, int depth) {
|
||||
|
@ -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 {
|
||||
|
||||
@ -97,11 +94,11 @@ public class Hastebin {
|
||||
for (String disk : disks) {
|
||||
sb.append(" ").append(sb.append(disk)).append("\n");
|
||||
}
|
||||
sb.append(" -- == Interface Information == -- "+ "\n" );
|
||||
sb.append(" -- == Interface Information == -- " + "\n");
|
||||
for (String inter : interfaces) {
|
||||
sb.append(" ").append(inter).append("\n");
|
||||
}
|
||||
sb.append(" -- == Display Information == -- "+ "\n" );
|
||||
sb.append(" -- == Display Information == -- " + "\n");
|
||||
for (String display : displays) {
|
||||
sb.append(display).append("\n");
|
||||
}
|
||||
|
@ -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(){
|
||||
|
||||
public static long getProcessMemory() {
|
||||
long maxMemory = Runtime.getRuntime().maxMemory() / (1024 * 1024);
|
||||
return maxMemory;
|
||||
}
|
||||
|
||||
public static long getProcessUsedMemory() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
|
||||
@ -58,7 +56,7 @@ public class getHardware {
|
||||
return usedMemory / (1024 * 1024);
|
||||
}
|
||||
|
||||
public static long getAvailableProcessMemory(){
|
||||
public static long getAvailableProcessMemory() {
|
||||
long availableMemory = getHardware.getProcessMemory() - getHardware.getProcessUsedMemory();
|
||||
return availableMemory;
|
||||
}
|
||||
@ -125,7 +123,7 @@ public class getHardware {
|
||||
systemDisks.add(" - Mount: " + partition.getMount());
|
||||
systemDisks.add(" - Label: " + partition.getLabel());
|
||||
}
|
||||
systemDisks.add(C.DARK_GRAY + "-=" + C.BLUE +" Since Boot " + C.DARK_GRAY + "=- ");
|
||||
systemDisks.add(C.DARK_GRAY + "-=" + C.BLUE + " Since Boot " + C.DARK_GRAY + "=- ");
|
||||
systemDisks.add("- Total Reads: " + Form.memSize(disk.getReadBytes()));
|
||||
systemDisks.add("- Total Writes: " + Form.memSize(disk.getWriteBytes()));
|
||||
}
|
||||
|
@ -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);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user