mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-27 02:59:06 +00:00
Cleanup
This commit is contained in:
@@ -30,13 +30,12 @@ import com.volmit.iris.core.link.OraxenLink;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.object.noise.NoiseStyle;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiomeCustom;
|
||||
import com.volmit.iris.engine.object.common.IrisWorld;
|
||||
import com.volmit.iris.engine.object.compat.IrisCompat;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
import com.volmit.iris.util.format.C;
|
||||
@@ -69,7 +68,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@@ -77,7 +75,6 @@ import java.io.*;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
public class Iris extends VolmitPlugin implements Listener {
|
||||
@@ -172,13 +169,9 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
}
|
||||
|
||||
public static void callEvent(Event e) {
|
||||
if(!e.isAsynchronous())
|
||||
{
|
||||
if (!e.isAsynchronous()) {
|
||||
J.s(() -> Bukkit.getPluginManager().callEvent(e));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
}
|
||||
}
|
||||
@@ -457,18 +450,13 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
|
||||
IrisDimension d = IrisData.loadAnyDimension(dimension);
|
||||
|
||||
if(d == null)
|
||||
{
|
||||
if (d == null) {
|
||||
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
||||
d = IrisData.loadAnyDimension(dimension);
|
||||
|
||||
if(d == null)
|
||||
{
|
||||
if (d == null) {
|
||||
throw new RuntimeException("Can't find dimension " + dimension + "!");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Iris.info("Resolved missing dimension, proceeding with generation.");
|
||||
}
|
||||
}
|
||||
@@ -482,7 +470,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
.maxHeight(256)
|
||||
.build();
|
||||
|
||||
return new BukkitChunkGenerator(w, false, new File(w.worldFolder(), "iris"), dimension);
|
||||
return new BukkitChunkGenerator(w, false, new File(w.worldFolder(), "iris"), dimension);
|
||||
}
|
||||
|
||||
public static void msg(String string) {
|
||||
@@ -727,13 +715,9 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
}
|
||||
|
||||
static {
|
||||
try
|
||||
{
|
||||
try {
|
||||
InstanceState.updateInstanceId();
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
} catch (Throwable e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.volmit.iris.core;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
||||
|
||||
@@ -20,7 +20,6 @@ package com.volmit.iris.core.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.IrisEngine;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.plugin.MortarCommand;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
@@ -42,7 +41,7 @@ public class CommandIrisDebugSpawnerBoost extends MortarCommand {
|
||||
@Override
|
||||
public boolean handle(VolmitSender sender, String[] args) {
|
||||
|
||||
IrisToolbelt.access(sender.player().getWorld()).getEngine().getWorldManager().chargeEnergy();
|
||||
IrisToolbelt.access(sender.player().getWorld()).getEngine().getWorldManager().chargeEnergy();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ package com.volmit.iris.core.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.IrisEngine;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.plugin.MortarCommand;
|
||||
|
||||
@@ -11,8 +11,6 @@ import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class CommandIrisPregenStart extends MortarCommand {
|
||||
|
||||
@@ -28,7 +26,7 @@ public class CommandIrisPregenStart extends MortarCommand {
|
||||
@Override
|
||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
||||
|
||||
if (args.length == 0){
|
||||
if (args.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,7 +79,7 @@ public class CommandIrisPregenStart extends MortarCommand {
|
||||
@Override
|
||||
public boolean handle(VolmitSender sender, String[] args) {
|
||||
|
||||
if (args.length == 0){
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage(getHelp());
|
||||
return true;
|
||||
}
|
||||
@@ -282,6 +280,7 @@ public class CommandIrisPregenStart extends MortarCommand {
|
||||
|
||||
/**
|
||||
* Get command help
|
||||
*
|
||||
* @return help string
|
||||
*/
|
||||
private String getHelp() {
|
||||
|
||||
@@ -22,8 +22,6 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.plugin.MortarCommand;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
@@ -60,12 +58,12 @@ public class CommandIrisStudioExecute extends MortarCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!sender.isPlayer() || !IrisToolbelt.isIrisWorld(sender.player().getWorld())){
|
||||
if (!sender.isPlayer() || !IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
||||
sender.sendMessage("To execute scripts you must be in an Iris world as a player");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0){
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage("You need to specify a script name (use auto-completions to see which are available)");
|
||||
return true;
|
||||
}
|
||||
@@ -74,7 +72,7 @@ public class CommandIrisStudioExecute extends MortarCommand {
|
||||
|
||||
try {
|
||||
IrisToolbelt.access(sender.player().getWorld()).getEngine().getExecution().execute(args[0]);
|
||||
} catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
sender.sendMessage("Failed to execute script " + args[0] + "!");
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.plugin.MortarCommand;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@@ -23,11 +23,8 @@ import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.plugin.MortarCommand;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class CommandIrisWhatFeatures extends MortarCommand {
|
||||
|
||||
if (IrisToolbelt.isIrisWorld(c.getWorld())) {
|
||||
int m = 1;
|
||||
for (IrisFeaturePositional i : ((Engine) IrisToolbelt.access(c.getWorld()).getEngine()).getMantle().getFeaturesInChunk(c)) {
|
||||
for (IrisFeaturePositional i : IrisToolbelt.access(c.getWorld()).getEngine().getMantle().getFeaturesInChunk(c)) {
|
||||
sender.sendMessage("#" + m++ + " " + new JSONObject(new Gson().toJson(i)).toString(4));
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -56,30 +56,30 @@ public class CommandIrisCreate extends MortarCommand {
|
||||
packsFolder.mkdirs();
|
||||
|
||||
for (String arg : args) {
|
||||
if (arg.equals("seed=")){
|
||||
if (arg.equals("seed=")) {
|
||||
list.add("seed=random");
|
||||
list.add("seed=1234");
|
||||
} else if (arg.startsWith("seed=")){
|
||||
} else if (arg.startsWith("seed=")) {
|
||||
seed = true;
|
||||
} else if (arg.equals("type=")){
|
||||
for (File dim : packsFolder.listFiles()){
|
||||
} else if (arg.equals("type=")) {
|
||||
for (File dim : packsFolder.listFiles()) {
|
||||
if (dim.isDirectory()) {
|
||||
list.add("type=" + dim.getName());
|
||||
}
|
||||
}
|
||||
type = true;
|
||||
} else if (arg.startsWith("type=")){
|
||||
} else if (arg.startsWith("type=")) {
|
||||
type = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!seed){
|
||||
if (!seed) {
|
||||
list.add("seed=random");
|
||||
list.add("seed=1234");
|
||||
}
|
||||
|
||||
if (!type){
|
||||
for (File dim : packsFolder.listFiles()){
|
||||
if (!type) {
|
||||
for (File dim : packsFolder.listFiles()) {
|
||||
if (dim.isDirectory()) {
|
||||
list.add("type=" + dim.getName());
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class CommandIrisCreate extends MortarCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dimension.getEnvironment() == null){
|
||||
if (dimension.getEnvironment() == null) {
|
||||
dimension.setEnvironment(World.Environment.NORMAL);
|
||||
}
|
||||
|
||||
@@ -149,10 +149,11 @@ public class CommandIrisCreate extends MortarCommand {
|
||||
|
||||
/**
|
||||
* Ran when world is created
|
||||
*
|
||||
* @param sender The sender to send updates to
|
||||
* @param world The created world
|
||||
* @param world The created world
|
||||
*/
|
||||
private void onDone(VolmitSender sender, World world){
|
||||
private void onDone(VolmitSender sender, World world) {
|
||||
sender.sendMessage(world.getName() + " Spawn Area generated.");
|
||||
sender.sendMessage("You must remember to either have multiverse installed or use the Bukkit method to load this world with the Iris Generator on startup.");
|
||||
sender.sendMessage("Wiki: https://volmitsoftware.gitbook.io/iris/getting-started");
|
||||
@@ -184,13 +185,14 @@ public class CommandIrisCreate extends MortarCommand {
|
||||
|
||||
/**
|
||||
* Create a world with either Multiverse (preferred, if supported) or NMS
|
||||
* @param sender The sender to send updates to
|
||||
*
|
||||
* @param sender The sender to send updates to
|
||||
* @param worldName The name of the world to create
|
||||
* @param dimension The dimension to create the world with
|
||||
* @param seed The seed to use to generate
|
||||
* @param seed The seed to use to generate
|
||||
* @return The created world
|
||||
*/
|
||||
private World createWorld(VolmitSender sender, String worldName, IrisDimension dimension, long seed){
|
||||
private World createWorld(VolmitSender sender, String worldName, IrisDimension dimension, long seed) {
|
||||
if (Iris.linkMultiverseCore.isSupported()) {
|
||||
return createMultiverseWorld(sender, worldName, dimension, seed);
|
||||
} else {
|
||||
@@ -200,15 +202,16 @@ public class CommandIrisCreate extends MortarCommand {
|
||||
|
||||
/**
|
||||
* Create a world with Multiverse
|
||||
* @param sender The sender to send updates to
|
||||
*
|
||||
* @param sender The sender to send updates to
|
||||
* @param worldName The name of the world to create
|
||||
* @param dimension The dimension to create the world with
|
||||
* @param seed The seed to use to generate
|
||||
* @param seed The seed to use to generate
|
||||
* @return The created world
|
||||
*/
|
||||
public World createMultiverseWorld(VolmitSender sender, String worldName, IrisDimension dimension, long seed){
|
||||
public World createMultiverseWorld(VolmitSender sender, String worldName, IrisDimension dimension, long seed) {
|
||||
|
||||
if (!Iris.linkMultiverseCore.isSupported()){
|
||||
if (!Iris.linkMultiverseCore.isSupported()) {
|
||||
sender.sendMessage("A world was attempted to be created with Multiverse but it is not supported!");
|
||||
return null;
|
||||
}
|
||||
@@ -231,13 +234,14 @@ public class CommandIrisCreate extends MortarCommand {
|
||||
|
||||
/**
|
||||
* Create a world using NMS
|
||||
* @param sender The sender to send updates to
|
||||
*
|
||||
* @param sender The sender to send updates to
|
||||
* @param worldName The name of the world to create
|
||||
* @param dimension The dimension to create the world with
|
||||
* @param seed The seed to use to generate
|
||||
* @param seed The seed to use to generate
|
||||
* @return The created world
|
||||
*/
|
||||
public World createNMSWorld(VolmitSender sender, String worldName, IrisDimension dimension, long seed){
|
||||
public World createNMSWorld(VolmitSender sender, String worldName, IrisDimension dimension, long seed) {
|
||||
|
||||
WorldCreator wc = new IrisWorldCreator()
|
||||
.dimension(dimension.getLoadKey())
|
||||
@@ -247,7 +251,7 @@ public class CommandIrisCreate extends MortarCommand {
|
||||
.create();
|
||||
PlatformChunkGenerator gen = (PlatformChunkGenerator) wc.generator();
|
||||
|
||||
if (gen == null){
|
||||
if (gen == null) {
|
||||
sender.sendMessage("Failed to create generator! Gen is null!");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.volmit.iris.core.command.world;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.nbt.mca.Chunk;
|
||||
import com.volmit.iris.util.nbt.mca.MCAFile;
|
||||
|
||||
@@ -21,9 +21,6 @@ package com.volmit.iris.core.edit;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.PlacedObject;
|
||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacement;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.math.BlockPosition;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
@@ -20,7 +20,6 @@ package com.volmit.iris.core.link;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.Location;
|
||||
@@ -90,7 +89,7 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("terrain_height")) {
|
||||
if (a != null) {
|
||||
return (int) Math.round(a.getEngine().getHeight(l.getBlockX(), l.getBlockZ())) + "";
|
||||
return Math.round(a.getEngine().getHeight(l.getBlockX(), l.getBlockZ())) + "";
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("world_mode")) {
|
||||
if (a != null) {
|
||||
|
||||
@@ -20,8 +20,8 @@ package com.volmit.iris.core.pregenerator.methods;
|
||||
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import lombok.Getter;
|
||||
|
||||
public class HeadlessPregenMethod implements PregeneratorMethod {
|
||||
|
||||
@@ -20,8 +20,8 @@ package com.volmit.iris.core.pregenerator.syndicate;
|
||||
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.core.pregenerator.syndicate.command.*;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
@@ -24,13 +24,9 @@ import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.core.project.loader.ResourceLoader;
|
||||
import com.volmit.iris.core.report.Report;
|
||||
import com.volmit.iris.core.report.ReportType;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.core.tools.IrisWorldCreator;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiomePaletteLayer;
|
||||
import com.volmit.iris.engine.object.block.IrisBlockData;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.engine.object.entity.IrisEntity;
|
||||
@@ -50,7 +46,6 @@ import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.json.JSONArray;
|
||||
import com.volmit.iris.util.json.JSONObject;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
|
||||
@@ -207,7 +207,7 @@ public class IrisCreator {
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generation Complete"));
|
||||
});
|
||||
|
||||
((HeadlessGenerator)finalAccess).getWorld().load();
|
||||
((HeadlessGenerator) finalAccess).getWorld().load();
|
||||
done.set(true);
|
||||
}
|
||||
}).get();
|
||||
|
||||
@@ -118,13 +118,13 @@ public class IrisToolbelt {
|
||||
* Start a pregenerator task. If the supplied generator is headless, headless mode is used,
|
||||
* otherwise Hybrid mode is used.
|
||||
*
|
||||
* @param task the scheduled task
|
||||
* @param gen the Iris Generator
|
||||
* @param task the scheduled task
|
||||
* @param gen the Iris Generator
|
||||
* @return the pregenerator job (already started)
|
||||
*/
|
||||
public static PregeneratorJob pregenerate(PregenTask task, PlatformChunkGenerator gen) {
|
||||
if (gen.isHeadless()) {
|
||||
return pregenerate(task, new HeadlessPregenMethod(((HeadlessGenerator)gen).getWorld(), (HeadlessGenerator) gen));
|
||||
return pregenerate(task, new HeadlessPregenMethod(((HeadlessGenerator) gen).getWorld(), (HeadlessGenerator) gen));
|
||||
}
|
||||
|
||||
return pregenerate(task, new HybridPregenMethod(gen.getEngine().getWorld().realWorld(), IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getPregenThreadCount())));
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
|
||||
package com.volmit.iris.core.tools;
|
||||
|
||||
import com.sun.jna.Platform;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.common.IrisWorld;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
@@ -89,7 +87,7 @@ public class IrisWorldCreator {
|
||||
.environment(findEnvironment())
|
||||
.build();
|
||||
ChunkGenerator g = new BukkitChunkGenerator(w, studio, studio
|
||||
? IrisData.loadAnyDimension(dimensionName).getLoader().getDataFolder():
|
||||
? IrisData.loadAnyDimension(dimensionName).getLoader().getDataFolder() :
|
||||
new File(w.worldFolder(), "iris/pack"), dimensionName);
|
||||
|
||||
return new WorldCreator(name)
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.google.common.util.concurrent.AtomicDouble;
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
|
||||
import com.volmit.iris.engine.actuator.IrisBiomeActuator;
|
||||
import com.volmit.iris.engine.actuator.IrisDecorantActuator;
|
||||
import com.volmit.iris.engine.actuator.IrisTerrainIslandActuator;
|
||||
@@ -41,7 +40,6 @@ import com.volmit.iris.engine.object.engine.IrisEngineData;
|
||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacement;
|
||||
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
|
||||
import com.volmit.iris.util.atomics.AtomicRollingSequence;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.context.IrisContext;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
@@ -49,8 +47,6 @@ import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.hunk.storage.AtomicDoubleHunk;
|
||||
import com.volmit.iris.util.hunk.storage.AtomicLongHunk;
|
||||
import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
@@ -123,7 +119,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
generated = new AtomicInteger(0);
|
||||
execution = new IrisExecutionEnvironment(this);
|
||||
// TODO: HEIGHT ------------------------------------------------------------------------------------------------------>
|
||||
Iris.info("Initializing Engine: " + target.getWorld().name() + "/" + target.getDimension().getLoadKey() + " (" + 256+ " height)");
|
||||
Iris.info("Initializing Engine: " + target.getWorld().name() + "/" + target.getDimension().getLoadKey() + " (" + 256 + " height)");
|
||||
metrics = new EngineMetrics(32);
|
||||
this.target = target;
|
||||
getData().setEngine(this);
|
||||
@@ -187,19 +183,17 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
|
||||
@Override
|
||||
public double getGeneratedPerSecond() {
|
||||
if(perSecondLatch.flip())
|
||||
{
|
||||
if (perSecondLatch.flip()) {
|
||||
double g = generated.get() - generatedLast.get();
|
||||
generatedLast.set(generated.get());
|
||||
|
||||
if(g == 0)
|
||||
{
|
||||
if (g == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
long dur = M.ms() - lastGPS.get();
|
||||
lastGPS.set(M.ms());
|
||||
perSecond.set(1000D / ((double)dur / g));
|
||||
perSecond.set(1000D / ((double) dur / g));
|
||||
}
|
||||
|
||||
return perSecond.get();
|
||||
@@ -250,7 +244,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
}
|
||||
|
||||
for (String j : timings.k()) {
|
||||
weights.put(getName() + "." + j, (wallClock / totalWeight) * timings.get(j));
|
||||
weights.put(getName() + "." + j, (wallClock / totalWeight) * timings.get(j));
|
||||
}
|
||||
|
||||
totals.put(getName(), wallClock);
|
||||
@@ -328,18 +322,18 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
|
||||
cleaning.set(true);
|
||||
|
||||
J.a(() -> {
|
||||
try {
|
||||
getMantle().trim();
|
||||
getData().getObjectLoader().clean();
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
Iris.error("Cleanup failed!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
J.a(() -> {
|
||||
try {
|
||||
getMantle().trim();
|
||||
getData().getObjectLoader().clean();
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
Iris.error("Cleanup failed!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
cleaning.lazySet(false);
|
||||
});
|
||||
cleaning.lazySet(false);
|
||||
});
|
||||
}
|
||||
|
||||
public EngineActuator<BlockData> getTerrainActuator() {
|
||||
@@ -372,14 +366,14 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
|
||||
switch (getDimension().getTerrainMode()) {
|
||||
case NORMAL -> {
|
||||
getMantle().generateMatter(x>>4, z>>4);
|
||||
getMantle().generateMatter(x >> 4, z >> 4);
|
||||
getTerrainActuator().actuate(x, z, vblocks, multicore);
|
||||
getBiomeActuator().actuate(x, z, vbiomes, multicore);
|
||||
getCaveModifier().modify(x, z, vblocks, multicore);
|
||||
getRavineModifier().modify(x, z, vblocks, multicore);
|
||||
getPostModifier().modify(x, z, vblocks, multicore);
|
||||
getDecorantActuator().actuate(x, z, blocks, multicore);
|
||||
getMantle().insertMatter(x>>4, z>>4, BlockData.class, blocks);
|
||||
getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks);
|
||||
getDepositModifier().modify(x, z, blocks, multicore);
|
||||
}
|
||||
case ISLANDS -> {
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.volmit.iris.engine;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||
import com.volmit.iris.engine.mantle.MantleComponent;
|
||||
import com.volmit.iris.engine.mantle.components.MantleFeatureComponent;
|
||||
import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
|
||||
@@ -287,10 +286,7 @@ public class IrisEngineMantle implements EngineMantle {
|
||||
z = Math.max(max, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.function.Function2;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import com.volmit.iris.util.mantle.MantleFlag;
|
||||
import com.volmit.iris.util.math.BlockPosition;
|
||||
import com.volmit.iris.util.math.M;
|
||||
@@ -129,8 +128,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
|
||||
void setMinHeight(int min);
|
||||
|
||||
default int getMinHeight()
|
||||
{
|
||||
default int getMinHeight() {
|
||||
return getTarget().getWorld().minHeight();
|
||||
}
|
||||
|
||||
@@ -245,7 +243,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
updateLighting(x, y, z, c);
|
||||
}
|
||||
}
|
||||
}, MantleFlag.UPDATE);
|
||||
}, MantleFlag.UPDATE);
|
||||
getMetrics().getUpdates().put(p.getMilliseconds());
|
||||
}
|
||||
|
||||
@@ -448,28 +446,23 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
|
||||
int getGenerated();
|
||||
|
||||
default <T> IrisPosition lookForStreamResult(T find, ProceduralStream<T> stream, Function2<T, T, Boolean> matcher, long timeout)
|
||||
{
|
||||
default <T> IrisPosition lookForStreamResult(T find, ProceduralStream<T> stream, Function2<T, T, Boolean> matcher, long timeout) {
|
||||
AtomicInteger checked = new AtomicInteger();
|
||||
AtomicLong time = new AtomicLong(M.ms());
|
||||
AtomicReference<IrisPosition> r = new AtomicReference<>();
|
||||
BurstExecutor b = burst().burst();
|
||||
|
||||
while(M.ms() - time.get() < timeout && r.get() == null)
|
||||
{
|
||||
while (M.ms() - time.get() < timeout && r.get() == null) {
|
||||
b.queue(() -> {
|
||||
for(int i = 0; i < 1000; i++)
|
||||
{
|
||||
if(M.ms() - time.get() > timeout)
|
||||
{
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
if (M.ms() - time.get() > timeout) {
|
||||
return;
|
||||
}
|
||||
|
||||
int x = RNG.r.i(-29999970, 29999970);
|
||||
int z = RNG.r.i(-29999970, 29999970);
|
||||
checked.incrementAndGet();
|
||||
if(matcher.apply(stream.get(x, z), find))
|
||||
{
|
||||
if (matcher.apply(stream.get(x, z), find)) {
|
||||
r.set(new IrisPosition(x, 120, z));
|
||||
time.set(0);
|
||||
}
|
||||
@@ -618,8 +611,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
|
||||
double getGeneratedPerSecond();
|
||||
|
||||
default int getHeight()
|
||||
{
|
||||
default int getHeight() {
|
||||
return getWorld().getHeight();
|
||||
}
|
||||
|
||||
@@ -633,12 +625,10 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
return getSurfaceBiome(x, z);
|
||||
}
|
||||
|
||||
default String getObjectPlacementKey(int x, int y, int z)
|
||||
{
|
||||
PlacedObject o = getObjectPlacement(x,y,z);
|
||||
default String getObjectPlacementKey(int x, int y, int z) {
|
||||
PlacedObject o = getObjectPlacement(x, y, z);
|
||||
|
||||
if(o != null && o.getObject() != null)
|
||||
{
|
||||
if (o != null && o.getObject() != null) {
|
||||
return o.getObject().getLoadKey() + "@" + o.getId();
|
||||
}
|
||||
|
||||
@@ -646,7 +636,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
}
|
||||
|
||||
default PlacedObject getObjectPlacement(int x, int y, int z) {
|
||||
String objectAt = getMantle().getMantle().get(x,y,z, String.class);
|
||||
String objectAt = getMantle().getMantle().get(x, y, z, String.class);
|
||||
|
||||
if (objectAt == null || objectAt.isEmpty()) {
|
||||
return null;
|
||||
|
||||
@@ -55,8 +55,7 @@ public abstract class EngineAssignedWorldManager extends EngineAssignedComponent
|
||||
|
||||
@EventHandler
|
||||
public void on(IrisEngineHotloadEvent e) {
|
||||
for(Player i : e.getEngine().getWorld().getPlayers())
|
||||
{
|
||||
for (Player i : e.getEngine().getWorld().getPlayers()) {
|
||||
i.playSound(i.getLocation(), Sound.ITEM_TRIDENT_RETURN, 1f, 1.6f);
|
||||
VolmitSender s = new VolmitSender(i);
|
||||
s.sendTitle(C.IRIS + "Engine " + C.AQUA + "<font:minecraft:uniform>Hotloaded", 70, 60, 410);
|
||||
|
||||
@@ -41,8 +41,7 @@ public class EngineTarget {
|
||||
IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getEngineThreadCount()));
|
||||
}
|
||||
|
||||
public int getHeight()
|
||||
{
|
||||
public int getHeight() {
|
||||
return world.maxHeight() - world.minHeight();
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class PlannedStructure {
|
||||
|
||||
int id = rng.i(0, Integer.MAX_VALUE);
|
||||
int h = vo.place(xx, height, zz, placer, options, rng, (b)
|
||||
-> e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id), null, getData());
|
||||
-> e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id), null, getData());
|
||||
|
||||
|
||||
for (IrisJigsawPieceConnector j : i.getAvailableConnectors()) {
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import com.volmit.iris.util.mantle.MantleFlag;
|
||||
@@ -46,7 +45,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
// TODO: MOVE PLACER OUT OF MATTER INTO ITS OWN THING
|
||||
@@ -156,28 +154,23 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
getMantle().close();
|
||||
}
|
||||
|
||||
default void saveAllNow()
|
||||
{
|
||||
default void saveAllNow() {
|
||||
getMantle().saveAll();
|
||||
}
|
||||
|
||||
default void save()
|
||||
{
|
||||
default void save() {
|
||||
|
||||
}
|
||||
|
||||
default void trim()
|
||||
{
|
||||
default void trim() {
|
||||
getMantle().trim(60000);
|
||||
}
|
||||
|
||||
default MultiBurst burst()
|
||||
{
|
||||
default MultiBurst burst() {
|
||||
return getEngine().burst();
|
||||
}
|
||||
|
||||
default int getRealRadius()
|
||||
{
|
||||
default int getRealRadius() {
|
||||
try {
|
||||
return (int) Math.ceil(getRadius().get() / 2D);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -191,8 +184,7 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
|
||||
|
||||
@ChunkCoordinates
|
||||
default void generateMatter(int x, int z)
|
||||
{
|
||||
default void generateMatter(int x, int z) {
|
||||
if (!getEngine().getDimension().isUseMantle()) {
|
||||
return;
|
||||
}
|
||||
@@ -217,14 +209,12 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
burst().burst(post);
|
||||
}
|
||||
|
||||
default void generateMantleComponent(int x, int z, MantleComponent c, Consumer<Runnable> post)
|
||||
{
|
||||
default void generateMantleComponent(int x, int z, MantleComponent c, Consumer<Runnable> post) {
|
||||
getMantle().raiseFlag(x, z, c.getFlag(), () -> c.generateLayer(x, z, post));
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
default <T> void insertMatter(int x, int z, Class<T> t, Hunk<T> blocks)
|
||||
{
|
||||
default <T> void insertMatter(int x, int z, Class<T> t, Hunk<T> blocks) {
|
||||
if (!getEngine().getDimension().isUseMantle()) {
|
||||
return;
|
||||
}
|
||||
@@ -233,23 +223,20 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
default void updateBlock(int x, int y, int z)
|
||||
{
|
||||
getMantle().flag(x>>4, z>>4, MantleFlag.UPDATE, true);
|
||||
getMantle().set(x,y,z,true);
|
||||
default void updateBlock(int x, int y, int z) {
|
||||
getMantle().flag(x >> 4, z >> 4, MantleFlag.UPDATE, true);
|
||||
getMantle().set(x, y, z, true);
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
default KList<IrisFeaturePositional> getFeaturesInChunk(Chunk c)
|
||||
{
|
||||
default KList<IrisFeaturePositional> getFeaturesInChunk(Chunk c) {
|
||||
return getFeaturesInChunk(c.getX(), c.getZ());
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
default KList<IrisFeaturePositional> getFeaturesInChunk(int x, int z)
|
||||
{
|
||||
default KList<IrisFeaturePositional> getFeaturesInChunk(int x, int z) {
|
||||
KList<IrisFeaturePositional> pos = new KList<>();
|
||||
getMantle().iterateChunk(x, z, IrisFeaturePositional.class, (a,b,c,f) -> pos.add(f), MantleFlag.FEATURE);
|
||||
getMantle().iterateChunk(x, z, IrisFeaturePositional.class, (a, b, c, f) -> pos.add(f), MantleFlag.FEATURE);
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.volmit.iris.util.mantle.MantleFlag;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public abstract class IrisMantleComponent implements MantleComponent{
|
||||
public abstract class IrisMantleComponent implements MantleComponent {
|
||||
private final EngineMantle engineMantle;
|
||||
private final MantleFlag flag;
|
||||
}
|
||||
|
||||
@@ -27,44 +27,35 @@ import com.volmit.iris.util.mantle.MantleFlag;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public interface MantleComponent
|
||||
{
|
||||
default int getRadius()
|
||||
{
|
||||
public interface MantleComponent {
|
||||
default int getRadius() {
|
||||
return getEngineMantle().getRealRadius();
|
||||
}
|
||||
|
||||
default IrisData getData()
|
||||
{
|
||||
default IrisData getData() {
|
||||
return getEngineMantle().getData();
|
||||
}
|
||||
|
||||
default IrisDimension getDimension()
|
||||
{
|
||||
default IrisDimension getDimension() {
|
||||
return getEngineMantle().getEngine().getDimension();
|
||||
}
|
||||
|
||||
default IrisComplex getComplex()
|
||||
{
|
||||
default IrisComplex getComplex() {
|
||||
return getEngineMantle().getComplex();
|
||||
}
|
||||
|
||||
default long seed()
|
||||
{
|
||||
default long seed() {
|
||||
return getEngineMantle().getEngine().getTarget().getWorld().seed();
|
||||
}
|
||||
|
||||
default BurstExecutor burst()
|
||||
{
|
||||
default BurstExecutor burst() {
|
||||
return getEngineMantle().getEngine().burst().burst();
|
||||
}
|
||||
|
||||
EngineMantle getEngineMantle();
|
||||
|
||||
default Mantle getMantle()
|
||||
{
|
||||
default Mantle getMantle() {
|
||||
return getEngineMantle().getMantle();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.mantle.MantleFlag;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
||||
@@ -33,13 +33,11 @@ import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.mantle.MantleFlag;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class MantleJigsawComponent extends IrisMantleComponent
|
||||
{
|
||||
public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
public MantleJigsawComponent(EngineMantle engineMantle) {
|
||||
super(engineMantle, MantleFlag.JIGSAW);
|
||||
}
|
||||
|
||||
@@ -31,11 +31,8 @@ import com.volmit.iris.engine.object.objects.IrisObjectPlacement;
|
||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.mantle.MantleFlag;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -111,12 +108,12 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
||||
f.setInterpolationRadius(objectPlacement.getVacuumInterpolationRadius());
|
||||
f.setInterpolator(objectPlacement.getVacuumInterpolationMethod());
|
||||
f.setStrength(1D);
|
||||
getMantle().set(xx,0,zz,new IrisFeaturePositional(xx, zz, f));
|
||||
getMantle().set(xx, 0, zz, new IrisFeaturePositional(xx, zz, f));
|
||||
}
|
||||
|
||||
for (IrisFeaturePotential j : objectPlacement.getAddFeatures()) {
|
||||
if (j.hasZone(rng, xx >> 4, zz >> 4)) {
|
||||
getMantle().set(xx,0,zz,new IrisFeaturePositional(xx, zz, j.getZone()));
|
||||
getMantle().set(xx, 0, zz, new IrisFeaturePositional(xx, zz, j.getZone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,10 +121,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
||||
|
||||
if (objectPlacement.usesFeatures()) {
|
||||
r.run();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
post.accept(r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.gui.components.RenderType;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.IrisComplex;
|
||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
|
||||
@@ -21,9 +21,9 @@ package com.volmit.iris.engine.object.common;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import lombok.Data;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@@ -81,9 +81,8 @@ public class IrisWorld {
|
||||
}
|
||||
|
||||
public void bind(World world) {
|
||||
if(hasRealWorld())
|
||||
{
|
||||
return;
|
||||
if (hasRealWorld()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bindWorld(this, world);
|
||||
|
||||
@@ -29,7 +29,6 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.minecraft.world.level.GeneratorAccess;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
@@ -19,21 +19,13 @@
|
||||
package com.volmit.iris.engine.platform;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.IrisEngine;
|
||||
import com.volmit.iris.engine.data.chunk.TerrainChunk;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.EngineTarget;
|
||||
import com.volmit.iris.engine.object.common.IrisWorld;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.io.ReactiveFolder;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.Looper;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -48,7 +40,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChunkGenerator {
|
||||
private final EngineProvider provider;
|
||||
@@ -61,8 +52,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
private final Looper hotloader;
|
||||
private final boolean studio;
|
||||
|
||||
public BukkitChunkGenerator(IrisWorld world, boolean studio, File dataLocation, String dimensionKey)
|
||||
{
|
||||
public BukkitChunkGenerator(IrisWorld world, boolean studio, File dataLocation, String dimensionKey) {
|
||||
populators = new KList<>();
|
||||
this.world = world;
|
||||
this.hotloadChecker = new ChronoLatch(1000, false);
|
||||
@@ -76,8 +66,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
this.hotloader = new Looper() {
|
||||
@Override
|
||||
protected long loop() {
|
||||
if(hotloadChecker.flip())
|
||||
{
|
||||
if (hotloadChecker.flip()) {
|
||||
folder.check();
|
||||
}
|
||||
|
||||
@@ -89,8 +78,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
hotloader.setName(getTarget().getWorld().name() + " Hotloader");
|
||||
}
|
||||
|
||||
public Engine getEngine()
|
||||
{
|
||||
public Engine getEngine() {
|
||||
return provider.getEngine();
|
||||
}
|
||||
|
||||
@@ -115,8 +103,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void initialize()
|
||||
{
|
||||
private void initialize() {
|
||||
provider.provideEngine(world, dimensionKey, dataLocation, isStudio(), (e) -> {
|
||||
populators.clear();
|
||||
populators.add((BlockPopulator) e);
|
||||
@@ -126,8 +113,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
|
||||
@Override
|
||||
public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
Iris.debug("Generated " + x + " " + z);
|
||||
PrecisionStopwatch ps = PrecisionStopwatch.start();
|
||||
TerrainChunk tc = TerrainChunk.create(world, biome);
|
||||
@@ -136,10 +122,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
this.world.bind(world);
|
||||
getEngine().generate(x * 16, z * 16, blocks, biomes, true);
|
||||
return tc.getRaw();
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
} catch (Throwable e) {
|
||||
Iris.error("======================================");
|
||||
e.printStackTrace();
|
||||
Iris.reportErrorChunk(x, z, e, "CHUNK");
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.volmit.iris.engine.framework.EngineTarget;
|
||||
import com.volmit.iris.engine.object.common.IrisWorld;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -51,13 +50,11 @@ public class EngineProvider {
|
||||
engine.get().whenComplete((e, x) -> Iris.callEvent(new IrisEngineHotloadEvent(e)));
|
||||
}
|
||||
|
||||
public Engine getEngine()
|
||||
{
|
||||
public Engine getEngine() {
|
||||
try {
|
||||
Engine e = engine.get().get();
|
||||
|
||||
if(e == null)
|
||||
{
|
||||
if (e == null) {
|
||||
throw new RuntimeException("NULL");
|
||||
}
|
||||
|
||||
@@ -72,12 +69,10 @@ public class EngineProvider {
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if(engine.get() != null && engine.get().isDone())
|
||||
{
|
||||
if (engine.get() != null && engine.get().isDone()) {
|
||||
Engine e = getEngine();
|
||||
|
||||
if(e != null)
|
||||
{
|
||||
if (e != null) {
|
||||
e.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,9 @@ import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||
import com.volmit.iris.engine.IrisEngine;
|
||||
import com.volmit.iris.engine.data.chunk.MCATerrainChunk;
|
||||
import com.volmit.iris.engine.data.chunk.TerrainChunk;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.EngineTarget;
|
||||
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
@@ -61,7 +59,8 @@ public class HeadlessGenerator implements PlatformChunkGenerator {
|
||||
burst = new MultiBurst("Iris Headless Generator", 9, IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getPregenThreadCount()));
|
||||
writer = new NBTWorld(world.getWorld().worldFolder());
|
||||
provider = new EngineProvider();
|
||||
provider.provideEngine(world.getWorld(), world.getDimension().getLoadKey(), world.getDimension().getLoader().getDataFolder(), isStudio(), (e) -> {});
|
||||
provider.provideEngine(world.getWorld(), world.getDimension().getLoadKey(), world.getDimension().getLoader().getDataFolder(), isStudio(), (e) -> {
|
||||
});
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
|
||||
@@ -24,21 +24,17 @@ import com.volmit.iris.engine.framework.EngineTarget;
|
||||
import com.volmit.iris.engine.framework.Hotloadable;
|
||||
import com.volmit.iris.util.data.DataProvider;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public interface PlatformChunkGenerator extends Hotloadable, DataProvider {
|
||||
Engine getEngine();
|
||||
|
||||
boolean isHeadless();
|
||||
|
||||
@Override
|
||||
default IrisData getData()
|
||||
{
|
||||
default IrisData getData() {
|
||||
return getEngine().getData();
|
||||
}
|
||||
|
||||
default EngineTarget getTarget()
|
||||
{
|
||||
default EngineTarget getTarget() {
|
||||
return getEngine().getTarget();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,109 +18,87 @@
|
||||
|
||||
package com.volmit.iris.util.collection;
|
||||
|
||||
public class StateList
|
||||
{
|
||||
private final KList<String> states;
|
||||
public class StateList {
|
||||
private final KList<String> states;
|
||||
|
||||
public StateList(String... states)
|
||||
{
|
||||
this.states = new KList<String>(states);
|
||||
public StateList(String... states) {
|
||||
this.states = new KList<String>(states);
|
||||
|
||||
if(getBits() > 64)
|
||||
{
|
||||
throw new RuntimeException("StateLists cannot exceed 64 bits! You are trying to use " + getBits() + " bits!");
|
||||
}
|
||||
}
|
||||
if (getBits() > 64) {
|
||||
throw new RuntimeException("StateLists cannot exceed 64 bits! You are trying to use " + getBits() + " bits!");
|
||||
}
|
||||
}
|
||||
|
||||
public StateList(Enum<?>... states)
|
||||
{
|
||||
this.states = new KList<Enum<?>>().convert(Enum::name);
|
||||
public StateList(Enum<?>... states) {
|
||||
this.states = new KList<Enum<?>>().convert(Enum::name);
|
||||
|
||||
if(getBits() > 64)
|
||||
{
|
||||
throw new RuntimeException("StateLists cannot exceed 64 bits! You are trying to use " + getBits() + " bits!");
|
||||
}
|
||||
}
|
||||
if (getBits() > 64) {
|
||||
throw new RuntimeException("StateLists cannot exceed 64 bits! You are trying to use " + getBits() + " bits!");
|
||||
}
|
||||
}
|
||||
|
||||
public long max()
|
||||
{
|
||||
return (long) (Math.pow(2, getBits()) - 1);
|
||||
}
|
||||
public long max() {
|
||||
return (long) (Math.pow(2, getBits()) - 1);
|
||||
}
|
||||
|
||||
public KList<String> getEnabled(long list)
|
||||
{
|
||||
KList<String> f = new KList<>();
|
||||
public KList<String> getEnabled(long list) {
|
||||
KList<String> f = new KList<>();
|
||||
|
||||
for(String i : states)
|
||||
{
|
||||
if(is(list, i))
|
||||
{
|
||||
f.add(i);
|
||||
}
|
||||
}
|
||||
for (String i : states) {
|
||||
if (is(list, i)) {
|
||||
f.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
public long of(String... enabledStates)
|
||||
{
|
||||
long b = 0;
|
||||
public long of(String... enabledStates) {
|
||||
long b = 0;
|
||||
|
||||
for(String i : enabledStates)
|
||||
{
|
||||
b |= getBit(i);
|
||||
}
|
||||
for (String i : enabledStates) {
|
||||
b |= getBit(i);
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
public long set(long list, String state, boolean enabled)
|
||||
{
|
||||
long bit = getBit(state);
|
||||
boolean is = is(list, state);
|
||||
public long set(long list, String state, boolean enabled) {
|
||||
long bit = getBit(state);
|
||||
boolean is = is(list, state);
|
||||
|
||||
if(enabled && !is)
|
||||
{
|
||||
return list | bit;
|
||||
}
|
||||
if (enabled && !is) {
|
||||
return list | bit;
|
||||
} else if (!enabled && is) {
|
||||
return list ^ bit;
|
||||
}
|
||||
|
||||
else if(!enabled && is)
|
||||
{
|
||||
return list ^ bit;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
public boolean is(long list, String state) {
|
||||
long bit = getBit(state);
|
||||
|
||||
public boolean is(long list, String state)
|
||||
{
|
||||
long bit = getBit(state);
|
||||
return bit > 0 && (list & bit) == bit;
|
||||
}
|
||||
|
||||
return bit > 0 && (list & bit) == bit;
|
||||
}
|
||||
public boolean hasBit(String state) {
|
||||
return getBit(state) > 0;
|
||||
}
|
||||
|
||||
public boolean hasBit(String state)
|
||||
{
|
||||
return getBit(state) > 0;
|
||||
}
|
||||
public long getBit(String state) {
|
||||
return getBit(states.indexOf(state));
|
||||
}
|
||||
|
||||
public long getBit(String state)
|
||||
{
|
||||
return getBit(states.indexOf(state));
|
||||
}
|
||||
public long getBit(int index) {
|
||||
return (long) (index < 0 ? -1 : Math.pow(2, index));
|
||||
}
|
||||
|
||||
public long getBit(int index)
|
||||
{
|
||||
return (long) (index < 0 ? -1 : Math.pow(2, index));
|
||||
}
|
||||
public int getBytes() {
|
||||
return getBits() == 0 ? 0 : ((getBits() >> 2) + 1);
|
||||
}
|
||||
|
||||
public int getBytes()
|
||||
{
|
||||
return getBits() == 0 ? 0 : ((getBits() >> 2) + 1);
|
||||
}
|
||||
|
||||
public int getBits()
|
||||
{
|
||||
return states.size();
|
||||
}
|
||||
public int getBits() {
|
||||
return states.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,13 +384,9 @@ public enum C {
|
||||
C o = C.getByChar(i);
|
||||
|
||||
if (hrad != 0 || srad != 0 || vrad != 0) {
|
||||
if(pulse > 0)
|
||||
{
|
||||
if (pulse > 0) {
|
||||
b.append(VolmitSender.pulse(spinToHex(o, hrad, srad, vrad), spinToHex(o, -hrad, -srad, -vrad), pulse));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
b.append("<gradient:")
|
||||
.append(spinToHex(o, hrad, srad, vrad))
|
||||
.append(":")
|
||||
|
||||
@@ -24,8 +24,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class InstanceState {
|
||||
public static int getInstanceId()
|
||||
{
|
||||
public static int getInstanceId() {
|
||||
try {
|
||||
return Integer.parseInt(IO.readAll(instanceFile()).trim());
|
||||
} catch (Throwable e) {
|
||||
@@ -35,8 +34,7 @@ public class InstanceState {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void updateInstanceId()
|
||||
{
|
||||
public static void updateInstanceId() {
|
||||
try {
|
||||
IO.writeAll(instanceFile(), RNG.r.imax() + "");
|
||||
} catch (IOException e) {
|
||||
@@ -44,8 +42,7 @@ public class InstanceState {
|
||||
}
|
||||
}
|
||||
|
||||
private static File instanceFile()
|
||||
{
|
||||
private static File instanceFile() {
|
||||
File f = new File("plugins/Iris/cache/instance");
|
||||
f.getParentFile().mkdirs();
|
||||
return f;
|
||||
|
||||
@@ -34,9 +34,7 @@ import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
import com.volmit.iris.util.parallel.HyperLock;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
@@ -44,7 +42,6 @@ import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
* The mantle can store any type of data slice anywhere and manage regions & IO on it's own.
|
||||
@@ -81,28 +78,23 @@ public class Mantle {
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
public void raiseFlag(int x, int z, MantleFlag flag, Runnable r)
|
||||
{
|
||||
if(!hasFlag(x, z, flag))
|
||||
{
|
||||
public void raiseFlag(int x, int z, MantleFlag flag, Runnable r) {
|
||||
if (!hasFlag(x, z, flag)) {
|
||||
flag(x, z, flag, true);
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
public void lowerFlag(int x, int z, MantleFlag flag, Runnable r)
|
||||
{
|
||||
if(hasFlag(x, z, flag))
|
||||
{
|
||||
public void lowerFlag(int x, int z, MantleFlag flag, Runnable r) {
|
||||
if (hasFlag(x, z, flag)) {
|
||||
flag(x, z, flag, false);
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
public void flag(int x, int z, MantleFlag flag, boolean flagged)
|
||||
{
|
||||
public void flag(int x, int z, MantleFlag flag, boolean flagged) {
|
||||
try {
|
||||
get(x >> 5, z >> 5).get().getOrCreate(x & 31, z & 31).flag(flag, flagged);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
@@ -111,12 +103,9 @@ public class Mantle {
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
public <T> void iterateChunk(int x, int z, Class<T> type, Consumer4<Integer, Integer, Integer, T> iterator, MantleFlag... requiredFlags)
|
||||
{
|
||||
for(MantleFlag i : requiredFlags)
|
||||
{
|
||||
if(!hasFlag(x, z, i))
|
||||
{
|
||||
public <T> void iterateChunk(int x, int z, Class<T> type, Consumer4<Integer, Integer, Integer, T> iterator, MantleFlag... requiredFlags) {
|
||||
for (MantleFlag i : requiredFlags) {
|
||||
if (!hasFlag(x, z, i)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -129,8 +118,7 @@ public class Mantle {
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
public boolean hasFlag(int x, int z, MantleFlag flag)
|
||||
{
|
||||
public boolean hasFlag(int x, int z, MantleFlag flag) {
|
||||
try {
|
||||
return get(x >> 5, z >> 5).get().getOrCreate(x & 31, z & 31).isFlagged(flag);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
@@ -274,7 +262,7 @@ public class Mantle {
|
||||
}
|
||||
|
||||
for (Long i : unload) {
|
||||
hyperLock.withLong(i, () ->{
|
||||
hyperLock.withLong(i, () -> {
|
||||
TectonicPlate m = loadedRegions.remove(i);
|
||||
lastUse.remove(i);
|
||||
|
||||
@@ -302,8 +290,7 @@ public class Mantle {
|
||||
Long k = key(x, z);
|
||||
TectonicPlate p = loadedRegions.get(k);
|
||||
|
||||
if(p != null)
|
||||
{
|
||||
if (p != null) {
|
||||
lastUse.put(k, M.ms());
|
||||
return CompletableFuture.completedFuture(p);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,6 @@
|
||||
|
||||
package com.volmit.iris.util.mantle;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
import com.volmit.iris.util.collection.StateList;
|
||||
import com.volmit.iris.util.data.Varint;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.function.Consumer4;
|
||||
import com.volmit.iris.util.matter.IrisMatter;
|
||||
@@ -52,8 +48,7 @@ public class MantleChunk {
|
||||
sections = new AtomicReferenceArray<>(sectionHeight);
|
||||
flags = new AtomicIntegerArray(MantleFlag.values().length);
|
||||
|
||||
for (int i = 0; i < flags.length(); i++)
|
||||
{
|
||||
for (int i = 0; i < flags.length(); i++) {
|
||||
flags.set(i, 0);
|
||||
}
|
||||
}
|
||||
@@ -70,8 +65,7 @@ public class MantleChunk {
|
||||
this(sectionHeight);
|
||||
int s = din.readByte();
|
||||
|
||||
for(int i = 0; i < flags.length(); i++)
|
||||
{
|
||||
for (int i = 0; i < flags.length(); i++) {
|
||||
flags.set(i, din.readBoolean() ? 1 : 0);
|
||||
}
|
||||
|
||||
@@ -176,38 +170,30 @@ public class MantleChunk {
|
||||
}
|
||||
|
||||
private void trimSlice(int i) {
|
||||
if(exists(i))
|
||||
{
|
||||
if (exists(i)) {
|
||||
Matter m = get(i);
|
||||
|
||||
if(m.getSliceMap().isEmpty())
|
||||
{
|
||||
if (m.getSliceMap().isEmpty()) {
|
||||
sections.set(i, null);
|
||||
}
|
||||
|
||||
else{
|
||||
} else {
|
||||
m.trimSlices();
|
||||
if(m.getSliceMap().isEmpty())
|
||||
{
|
||||
if (m.getSliceMap().isEmpty()) {
|
||||
sections.set(i, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public <T> void iterate(Class<T> type, Consumer4<Integer, Integer, Integer,T> iterator) {
|
||||
for(int i = 0; i < sections.length(); i++)
|
||||
{
|
||||
public <T> void iterate(Class<T> type, Consumer4<Integer, Integer, Integer, T> iterator) {
|
||||
for (int i = 0; i < sections.length(); i++) {
|
||||
int bs = (i << 4);
|
||||
Matter matter = get(i);
|
||||
|
||||
if(matter != null)
|
||||
{
|
||||
if (matter != null) {
|
||||
MatterSlice<T> t = matter.getSlice(type);
|
||||
|
||||
if(t != null)
|
||||
{
|
||||
t.iterateSync((a, b, c, f) -> iterator.accept(a,b + bs, c, f));
|
||||
if (t != null) {
|
||||
t.iterateSync((a, b, c, f) -> iterator.accept(a, b + bs, c, f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,9 @@ public enum MantleFlag {
|
||||
OBJECT,
|
||||
UPDATE,
|
||||
JIGSAW,
|
||||
FEATURE
|
||||
;
|
||||
static StateList getStateList()
|
||||
{
|
||||
FEATURE;
|
||||
|
||||
static StateList getStateList() {
|
||||
return new StateList(MantleFlag.values());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,10 +172,7 @@ public class TectonicPlate {
|
||||
if (chunk != null) {
|
||||
dos.writeBoolean(true);
|
||||
chunk.write(dos);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dos.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ import java.io.*;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
/**
|
||||
* When Red Matter isn't enough
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util.matter;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.data.cache.Cache;
|
||||
import com.volmit.iris.util.data.NibbleDataPalette;
|
||||
import com.volmit.iris.util.data.Varint;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import org.bukkit.Location;
|
||||
@@ -108,8 +106,7 @@ public interface MatterSlice<T> extends Hunk<T> {
|
||||
return readFrom(mediumType) != null;
|
||||
}
|
||||
|
||||
default int getBitsPer(int needed)
|
||||
{
|
||||
default int getBitsPer(int needed) {
|
||||
int target = 1;
|
||||
for (int i = 1; i < 8; i++) {
|
||||
if (Math.pow(2, i) > needed) {
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.volmit.iris.util.matter.slices;
|
||||
import com.volmit.iris.util.data.Varint;
|
||||
import com.volmit.iris.util.matter.Sliced;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
|
||||
@@ -127,8 +127,7 @@ public class HyperLock {
|
||||
}
|
||||
|
||||
public void lock(int x, int z) {
|
||||
if(!enabled)
|
||||
{
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -136,8 +135,7 @@ public class HyperLock {
|
||||
}
|
||||
|
||||
public void unlock(int x, int z) {
|
||||
if(!enabled)
|
||||
{
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ package com.volmit.iris.util.parallel;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.io.InstanceState;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
@@ -55,8 +54,7 @@ public class MultiBurst {
|
||||
heartbeat = new Looper() {
|
||||
@Override
|
||||
protected long loop() {
|
||||
if(instance != InstanceState.getInstanceId())
|
||||
{
|
||||
if (instance != InstanceState.getInstanceId()) {
|
||||
shutdownNow();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package com.volmit.iris.util.plugin;
|
||||
|
||||
import com.google.common.collect.Comparators;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
@@ -27,8 +26,6 @@ import org.bukkit.Sound;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,8 +28,6 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.transformation.inbuild.GradientTransformation;
|
||||
import net.kyori.adventure.text.minimessage.transformation.inbuild.RainbowTransformation;
|
||||
import net.kyori.adventure.title.Title;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -45,7 +43,6 @@ import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
@@ -193,95 +190,79 @@ public class VolmitSender implements CommandSender {
|
||||
s.sendMessage("========================================================");
|
||||
}
|
||||
|
||||
public void sendTitle(String title, String subtitle, int i, int s, int o)
|
||||
{
|
||||
public void sendTitle(String title, String subtitle, int i, int s, int o) {
|
||||
Iris.audiences.player(player()).showTitle(Title.title(
|
||||
createComponent(title),
|
||||
createComponent(subtitle),
|
||||
Title.Times.of(Duration.ofMillis(i), Duration.ofMillis(s), Duration.ofMillis(o))));
|
||||
}
|
||||
|
||||
public static long getTick()
|
||||
{
|
||||
public static long getTick() {
|
||||
return M.ms() / 16;
|
||||
}
|
||||
|
||||
public void sendProgress(double percent, String thing)
|
||||
{
|
||||
if(percent < 0)
|
||||
{
|
||||
public void sendProgress(double percent, String thing) {
|
||||
if (percent < 0) {
|
||||
int l = 44;
|
||||
int g = (int) (1D * l);
|
||||
sendTitle(C.IRIS + thing + " ", 0, 500, 250);
|
||||
sendActionNoProcessing("" + "" + pulse("#00ff80","#00373d",1D)+"<underlined> " + Form.repeat(" ", g) + "<reset>" + Form.repeat(" ", l - g));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
sendActionNoProcessing("" + "" + pulse("#00ff80", "#00373d", 1D) + "<underlined> " + Form.repeat(" ", g) + "<reset>" + Form.repeat(" ", l - g));
|
||||
} else {
|
||||
int l = 44;
|
||||
int g = (int) (percent * l);
|
||||
sendTitle(C.IRIS + thing + " " + C.BLUE + "<font:minecraft:uniform>" + Form.pc(percent, 0), 0, 500, 250);
|
||||
sendActionNoProcessing("" + "" + pulse("#00ff80","#00373d",1D)+"<underlined> " + Form.repeat(" ", g) + "<reset>" + Form.repeat(" ", l - g));
|
||||
sendActionNoProcessing("" + "" + pulse("#00ff80", "#00373d", 1D) + "<underlined> " + Form.repeat(" ", g) + "<reset>" + Form.repeat(" ", l - g));
|
||||
}
|
||||
}
|
||||
|
||||
public static String pulse(String colorA, String colorB, double speed)
|
||||
{
|
||||
public static String pulse(String colorA, String colorB, double speed) {
|
||||
return "<gradient:" + colorA + ":" + colorB + ":" + pulse(speed) + ">";
|
||||
}
|
||||
|
||||
public static String pulse(double speed) {
|
||||
return Form.f(invertSpread((((getTick()*15D * speed)%1000D)/1000D)), 3).replaceAll("\\Q,\\E", ".");
|
||||
return Form.f(invertSpread((((getTick() * 15D * speed) % 1000D) / 1000D)), 3).replaceAll("\\Q,\\E", ".");
|
||||
}
|
||||
|
||||
public static double invertSpread(double v) {
|
||||
return ((1D - v) * 2D) - 1D;
|
||||
}
|
||||
|
||||
public void sendAction(String action)
|
||||
{
|
||||
public void sendAction(String action) {
|
||||
Iris.audiences.player(player()).sendActionBar(createNoPrefixComponent(action));
|
||||
}
|
||||
|
||||
public void sendActionNoProcessing(String action)
|
||||
{
|
||||
public void sendActionNoProcessing(String action) {
|
||||
Iris.audiences.player(player()).sendActionBar(createNoPrefixComponentNoProcessing(action));
|
||||
}
|
||||
|
||||
public void sendTitle(String subtitle, int i, int s, int o)
|
||||
{
|
||||
public void sendTitle(String subtitle, int i, int s, int o) {
|
||||
Iris.audiences.player(player()).showTitle(Title.title(
|
||||
createNoPrefixComponent(" "),
|
||||
createNoPrefixComponent(subtitle),
|
||||
Title.Times.of(Duration.ofMillis(i), Duration.ofMillis(s), Duration.ofMillis(o))));
|
||||
}
|
||||
|
||||
private Component createNoPrefixComponent(String message)
|
||||
{
|
||||
private Component createNoPrefixComponent(String message) {
|
||||
String t = C.translateAlternateColorCodes('&', message);
|
||||
String a = C.aura(t, IrisSettings.get().getGeneral().getSpinh(), IrisSettings.get().getGeneral().getSpins(), IrisSettings.get().getGeneral().getSpinb(), 0.36);
|
||||
return MiniMessage.get().parse(a);
|
||||
}
|
||||
|
||||
private Component createNoPrefixComponentNoProcessing(String message)
|
||||
{
|
||||
private Component createNoPrefixComponentNoProcessing(String message) {
|
||||
return MiniMessage.get().parse(message);
|
||||
}
|
||||
|
||||
private Component createComponent(String message)
|
||||
{
|
||||
private Component createComponent(String message) {
|
||||
String t = C.translateAlternateColorCodes('&', getTag() + message);
|
||||
String a = C.aura(t, IrisSettings.get().getGeneral().getSpinh(), IrisSettings.get().getGeneral().getSpins(), IrisSettings.get().getGeneral().getSpinb());
|
||||
return MiniMessage.get().parse(a);
|
||||
}
|
||||
|
||||
public <T> void showWaiting(String passive, CompletableFuture<T> f)
|
||||
{
|
||||
public <T> void showWaiting(String passive, CompletableFuture<T> f) {
|
||||
AtomicInteger v = new AtomicInteger();
|
||||
AtomicReference<T> g = new AtomicReference<>();
|
||||
v.set(J.ar(() -> {
|
||||
if(f.isDone() && g.get() != null)
|
||||
{
|
||||
if (f.isDone() && g.get() != null) {
|
||||
J.car(v.get());
|
||||
sendAction(" ");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user