mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-17 22:32:04 +00:00
The engine is the framework
This commit is contained in:
@@ -30,7 +30,6 @@ import com.volmit.iris.core.link.OraxenLink;
|
|||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.core.tools.IrisWorlds;
|
|
||||||
import com.volmit.iris.engine.framework.EngineCompositeGenerator;
|
import com.volmit.iris.engine.framework.EngineCompositeGenerator;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiomeCustom;
|
import com.volmit.iris.engine.object.biome.IrisBiomeCustom;
|
||||||
|
|||||||
@@ -148,12 +148,12 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
|||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
v.add("&7&m------------------");
|
v.add("&7&m------------------");
|
||||||
KList<IrisFeaturePositional> f = new KList<>();
|
KList<IrisFeaturePositional> f = new KList<>();
|
||||||
f.add(engine.getFramework().getEngineParallax().forEachFeature(x, z));
|
f.add(engine.getEngineParallax().forEachFeature(x, z));
|
||||||
v.add(C.AQUA + "Engine" + C.GRAY + ": " + engine.getName() + " " + engine.getMinHeight() + "-" + engine.getMaxHeight());
|
v.add(C.AQUA + "Engine" + C.GRAY + ": " + engine.getName() + " " + engine.getMinHeight() + "-" + engine.getMaxHeight());
|
||||||
v.add(C.AQUA + "Region" + C.GRAY + ": " + engine.getRegion(x, z).getName());
|
v.add(C.AQUA + "Region" + C.GRAY + ": " + engine.getRegion(x, z).getName());
|
||||||
v.add(C.AQUA + "Biome" + C.GRAY + ": " + engine.getBiome(x, y, z).getName());
|
v.add(C.AQUA + "Biome" + C.GRAY + ": " + engine.getBiome(x, y, z).getName());
|
||||||
v.add(C.AQUA + "Height" + C.GRAY + ": " + Math.round(engine.getHeight(x, z)));
|
v.add(C.AQUA + "Height" + C.GRAY + ": " + Math.round(engine.getHeight(x, z)));
|
||||||
v.add(C.AQUA + "Slope" + C.GRAY + ": " + Form.f(engine.getFramework().getComplex().getSlopeStream().get(x, z), 2));
|
v.add(C.AQUA + "Slope" + C.GRAY + ": " + Form.f(engine.getComplex().getSlopeStream().get(x, z), 2));
|
||||||
v.add(C.AQUA + "Features" + C.GRAY + ": " + Form.f(f.size()));
|
v.add(C.AQUA + "Features" + C.GRAY + ": " + Form.f(f.size()));
|
||||||
v.add(C.AQUA + "Energy" + C.GRAY + ": " + Form.f(engine.getWorldManager().getEnergy(), 0));
|
v.add(C.AQUA + "Energy" + C.GRAY + ": " + Form.f(engine.getWorldManager().getEnergy(), 0));
|
||||||
v.add(C.AQUA + "Sat" + C.GRAY + ": " + Form.f(engine.getWorldManager().getEntityCount()) + "e / " + Form.f(engine.getWorldManager().getChunkCount()) + "c (" + Form.pc(engine.getWorldManager().getEntitySaturation(), 0) + ")");
|
v.add(C.AQUA + "Sat" + C.GRAY + ": " + Form.f(engine.getWorldManager().getEntityCount()) + "e / " + Form.f(engine.getWorldManager().getChunkCount()) + "c (" + Form.pc(engine.getWorldManager().getEntitySaturation(), 0) + ")");
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ import com.volmit.iris.core.command.object.CommandIrisObject;
|
|||||||
import com.volmit.iris.core.command.pregen.CommandIrisPregen;
|
import com.volmit.iris.core.command.pregen.CommandIrisPregen;
|
||||||
import com.volmit.iris.core.command.studio.CommandIrisStudio;
|
import com.volmit.iris.core.command.studio.CommandIrisStudio;
|
||||||
import com.volmit.iris.core.command.what.CommandIrisWhat;
|
import com.volmit.iris.core.command.what.CommandIrisWhat;
|
||||||
import com.volmit.iris.core.command.world.*;
|
import com.volmit.iris.core.command.world.CommandIrisCreate;
|
||||||
|
import com.volmit.iris.core.command.world.CommandIrisFix;
|
||||||
|
import com.volmit.iris.core.command.world.CommandIrisUpdateWorld;
|
||||||
|
import com.volmit.iris.core.command.world.CommandIrisVerify;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.Command;
|
import com.volmit.iris.util.plugin.Command;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class CommandIrisPregenPause extends MortarCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
public boolean handle(VolmitSender sender, String[] args) {
|
||||||
if (PregeneratorJob.pauseResume()){
|
if (PregeneratorJob.pauseResume()) {
|
||||||
sender.sendMessage("Paused/unpaused pregeneration task, now: " + (PregeneratorJob.isPaused() ? "Paused" : "Running") + ".");
|
sender.sendMessage("Paused/unpaused pregeneration task, now: " + (PregeneratorJob.isPaused() ? "Paused" : "Running") + ".");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("No active pregeneration tasks to pause/unpause.");
|
sender.sendMessage("No active pregeneration tasks to pause/unpause.");
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import com.volmit.iris.util.plugin.VolmitSender;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
|
|
||||||
public class CommandIrisPregenStart extends MortarCommand {
|
public class CommandIrisPregenStart extends MortarCommand {
|
||||||
|
|
||||||
@@ -53,7 +51,7 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
argus.forEach(p -> {
|
argus.forEach(p -> {
|
||||||
boolean hasArg = false;
|
boolean hasArg = false;
|
||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
if (!arg.contains("=") || !p.contains("=")){
|
if (!arg.contains("=") || !p.contains("=")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg.split("=")[0].equals(p.split("=")[0])) {
|
if (arg.split("=")[0].equals(p.split("=")[0])) {
|
||||||
@@ -61,7 +59,7 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasArg){
|
if (!hasArg) {
|
||||||
list.add(p);
|
list.add(p);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -74,12 +72,12 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasHere){
|
if (!hasHere) {
|
||||||
list.add("-here");
|
list.add("-here");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Iris worlds
|
// Add Iris worlds
|
||||||
if (Bukkit.getWorlds().isEmpty()){
|
if (Bukkit.getWorlds().isEmpty()) {
|
||||||
list.add("world=<name>");
|
list.add("world=<name>");
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getWorlds().forEach(w -> {
|
Bukkit.getWorlds().forEach(w -> {
|
||||||
@@ -114,21 +112,21 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
// Check all arguments
|
// Check all arguments
|
||||||
KList<String> failed = new KList<>();
|
KList<String> failed = new KList<>();
|
||||||
for (String a : args) {
|
for (String a : args) {
|
||||||
if (a.equals("-here")){
|
if (a.equals("-here")) {
|
||||||
here = true;
|
here = true;
|
||||||
} else if (a.contains("=")) {
|
} else if (a.contains("=")) {
|
||||||
String pre = a.split("=")[0];
|
String pre = a.split("=")[0];
|
||||||
String val = a.split("=")[1];
|
String val = a.split("=")[1];
|
||||||
if (pre.equals("world")){
|
if (pre.equals("world")) {
|
||||||
world = Bukkit.getWorld(val);
|
world = Bukkit.getWorld(val);
|
||||||
if (world == null){
|
if (world == null) {
|
||||||
failed.add(a + " (invalid world)");
|
failed.add(a + " (invalid world)");
|
||||||
sender.sendMessage("Entered world is " + val + ", but that world does not exist.");
|
sender.sendMessage("Entered world is " + val + ", but that world does not exist.");
|
||||||
sender.sendMessage("Cancelling the command.");
|
sender.sendMessage("Cancelling the command.");
|
||||||
sender.sendMessage(getDescription());
|
sender.sendMessage(getDescription());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (!isVal(val)){
|
} else if (!isVal(val)) {
|
||||||
failed.add(a + " (non-value)");
|
failed.add(a + " (non-value)");
|
||||||
} else {
|
} else {
|
||||||
switch (pre) {
|
switch (pre) {
|
||||||
@@ -152,15 +150,15 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Checking if a radius was specified or forgotten
|
// Checking if a radius was specified or forgotten
|
||||||
if (width == -1 || height == -1){
|
if (width == -1 || height == -1) {
|
||||||
sender.sendMessage("Radius not specified! Cancelling...");
|
sender.sendMessage("Radius not specified! Cancelling...");
|
||||||
sender.sendMessage(getDescription());
|
sender.sendMessage(getDescription());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// World specified & cancelling `-here` if it's another world
|
// World specified & cancelling `-here` if it's another world
|
||||||
if (world == null){
|
if (world == null) {
|
||||||
if (sender.isPlayer()){
|
if (sender.isPlayer()) {
|
||||||
world = sender.player().getWorld();
|
world = sender.player().getWorld();
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("Must specify world=<name> if sending from console! Cancelling...");
|
sender.sendMessage("Must specify world=<name> if sending from console! Cancelling...");
|
||||||
@@ -168,8 +166,8 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (sender.isPlayer()){
|
if (sender.isPlayer()) {
|
||||||
if (!world.equals(sender.player().getWorld())){
|
if (!world.equals(sender.player().getWorld())) {
|
||||||
if (here) {
|
if (here) {
|
||||||
sender.sendMessage("Ignoring `-here` because `world=` is specified!");
|
sender.sendMessage("Ignoring `-here` because `world=` is specified!");
|
||||||
here = false;
|
here = false;
|
||||||
@@ -179,7 +177,7 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Checking if -here is used
|
// Checking if -here is used
|
||||||
if (here){
|
if (here) {
|
||||||
if (sender.isPlayer()) {
|
if (sender.isPlayer()) {
|
||||||
x = sender.player().getLocation().getBlockX();
|
x = sender.player().getLocation().getBlockX();
|
||||||
z = sender.player().getLocation().getBlockZ();
|
z = sender.player().getLocation().getBlockZ();
|
||||||
@@ -207,14 +205,14 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
.append(z)
|
.append(z)
|
||||||
.append("\n")
|
.append("\n")
|
||||||
|
|
||||||
// Append failed args
|
// Append failed args
|
||||||
.append(failed.isEmpty() ? "(No failed arguments)\n" : "FAILED ARGS:\n");
|
.append(failed.isEmpty() ? "(No failed arguments)\n" : "FAILED ARGS:\n");
|
||||||
for (String s : failed) {
|
for (String s : failed) {
|
||||||
details.append(s).append("\n");
|
details.append(s).append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start pregen and append info to details
|
// Start pregen and append info to details
|
||||||
if (pregenerate(world, width, height, x, z)){
|
if (pregenerate(world, width, height, x, z)) {
|
||||||
details.append("Successfully started pregen");
|
details.append("Successfully started pregen");
|
||||||
} else {
|
} else {
|
||||||
details.append("Failed to start pregen. Doublecheck your arguments!");
|
details.append("Failed to start pregen. Doublecheck your arguments!");
|
||||||
@@ -228,14 +226,15 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Pregenerate a
|
* Pregenerate a
|
||||||
* @param world world with a
|
*
|
||||||
* @param width and
|
* @param world world with a
|
||||||
|
* @param width and
|
||||||
* @param height with center
|
* @param height with center
|
||||||
* @param x and
|
* @param x and
|
||||||
* @param z coords
|
* @param z coords
|
||||||
* @return true if successful
|
* @return true if successful
|
||||||
*/
|
*/
|
||||||
private boolean pregenerate(World world, int width, int height, int x, int z){
|
private boolean pregenerate(World world, int width, int height, int x, int z) {
|
||||||
try {
|
try {
|
||||||
IrisToolbelt.pregenerate(PregenTask
|
IrisToolbelt.pregenerate(PregenTask
|
||||||
.builder()
|
.builder()
|
||||||
@@ -243,7 +242,7 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
.width(width >> 9 + 1)
|
.width(width >> 9 + 1)
|
||||||
.height(height >> 9 + 1)
|
.height(height >> 9 + 1)
|
||||||
.build(), world);
|
.build(), world);
|
||||||
} catch (Throwable e){
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
@@ -254,6 +253,7 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
/**
|
/**
|
||||||
* Get the ingeger value from an argument that may contain `c` `chunks` `r` `regions` or `k`<br>
|
* Get the ingeger value from an argument that may contain `c` `chunks` `r` `regions` or `k`<br>
|
||||||
* "5r" returns 5 * 512 = 2560
|
* "5r" returns 5 * 512 = 2560
|
||||||
|
*
|
||||||
* @param arg the string argument to parse into a value
|
* @param arg the string argument to parse into a value
|
||||||
* @return the integer value result
|
* @return the integer value result
|
||||||
*/
|
*/
|
||||||
@@ -276,6 +276,7 @@ public class CommandIrisPregenStart extends MortarCommand {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the
|
* Checks if the
|
||||||
|
*
|
||||||
* @param arg string value
|
* @param arg string value
|
||||||
* @return is valid -> true
|
* @return is valid -> true
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,15 +2,9 @@ package com.volmit.iris.core.command.pregen;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
import com.volmit.iris.core.gui.PregeneratorJob;
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
|
||||||
import com.volmit.iris.core.pregenerator.methods.HybridPregenMethod;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.Position2;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
public class CommandIrisPregenStop extends MortarCommand {
|
public class CommandIrisPregenStop extends MortarCommand {
|
||||||
|
|
||||||
@@ -23,7 +17,7 @@ public class CommandIrisPregenStop extends MortarCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
public boolean handle(VolmitSender sender, String[] args) {
|
||||||
if (PregeneratorJob.shutdownInstance()){
|
if (PregeneratorJob.shutdownInstance()) {
|
||||||
sender.sendMessage("Stopped pregeneration task");
|
sender.sendMessage("Stopped pregeneration task");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("No active pregeneration tasks to stop");
|
sender.sendMessage("No active pregeneration tasks to stop");
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import com.volmit.iris.core.tools.IrisToolbelt;
|
|||||||
import com.volmit.iris.core.tools.IrisWorlds;
|
import com.volmit.iris.core.tools.IrisWorlds;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.IrisAccess;
|
import com.volmit.iris.engine.framework.IrisAccess;
|
||||||
import com.volmit.iris.engine.object.common.IrisScript;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@@ -61,9 +60,8 @@ public class CommandIrisStudioExecute extends MortarCommand {
|
|||||||
|
|
||||||
IrisAccess a = IrisToolbelt.access(sender.player().getWorld());
|
IrisAccess a = IrisToolbelt.access(sender.player().getWorld());
|
||||||
|
|
||||||
if(a != null)
|
if (a != null) {
|
||||||
{
|
((Engine) a.getEngineAccess(0)).getExecution().execute(args[0]);
|
||||||
((Engine)a.getEngineAccess(0)).getExecution().execute(args[0]);
|
|
||||||
Iris.info("Executed. See script output in console.");
|
Iris.info("Executed. See script output in console.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class CommandIrisWhatFeatures extends MortarCommand {
|
|||||||
|
|
||||||
if (IrisWorlds.isIrisWorld(c.getWorld())) {
|
if (IrisWorlds.isIrisWorld(c.getWorld())) {
|
||||||
int m = 1;
|
int m = 1;
|
||||||
for (IrisFeaturePositional i : ((Engine) IrisWorlds.access(c.getWorld()).getEngineAccess(p.getLocation().getBlockY())).getFramework().getEngineParallax().getFeaturesInChunk(c)) {
|
for (IrisFeaturePositional i : ((Engine) IrisWorlds.access(c.getWorld()).getEngineAccess(p.getLocation().getBlockY())).getEngineParallax().getFeaturesInChunk(c)) {
|
||||||
sender.sendMessage("#" + m++ + " " + new JSONObject(new Gson().toJson(i)).toString(4));
|
sender.sendMessage("#" + m++ + " " + new JSONObject(new Gson().toJson(i)).toString(4));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -55,13 +55,13 @@ public class CommandIrisFix extends MortarCommand {
|
|||||||
int viewDistance = args.length > 0 ? Integer.parseInt(args[0]) : -1;
|
int viewDistance = args.length > 0 ? Integer.parseInt(args[0]) : -1;
|
||||||
if (viewDistance <= 1) {
|
if (viewDistance <= 1) {
|
||||||
J.a(() -> {
|
J.a(() -> {
|
||||||
int fixed = a.getCompound().getDefaultEngine().getFramework().getEngineParallax().repairChunk(sender.player().getLocation().getChunk());
|
int fixed = a.getCompound().getDefaultEngine().getEngineParallax().repairChunk(sender.player().getLocation().getChunk());
|
||||||
sender.sendMessage("Fixed " + Form.f(fixed) + " blocks!");
|
sender.sendMessage("Fixed " + Form.f(fixed) + " blocks!");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
AtomicInteger v = new AtomicInteger();
|
AtomicInteger v = new AtomicInteger();
|
||||||
J.a(() -> {
|
J.a(() -> {
|
||||||
new Spiraler(viewDistance, viewDistance, (x, z) -> v.set(v.get() + a.getCompound().getDefaultEngine().getFramework().getEngineParallax().repairChunk(sender.player().getWorld().getChunkAt(x, z)))).drain();
|
new Spiraler(viewDistance, viewDistance, (x, z) -> v.set(v.get() + a.getCompound().getDefaultEngine().getEngineParallax().repairChunk(sender.player().getWorld().getChunkAt(x, z)))).drain();
|
||||||
sender.sendMessage("Fixed " + Form.f(v.get()) + " blocks in " + (viewDistance * viewDistance) + " chunks!");
|
sender.sendMessage("Fixed " + Form.f(v.get()) + " blocks in " + (viewDistance * viewDistance) + " chunks!");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,12 +191,12 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
BiFunction<Double, Double, Integer> colorFunction = (d, dx) -> Color.black.getRGB();
|
BiFunction<Double, Double, Integer> colorFunction = (d, dx) -> Color.black.getRGB();
|
||||||
|
|
||||||
switch (currentType) {
|
switch (currentType) {
|
||||||
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD -> colorFunction = (x, z) -> engine.getFramework().getComplex().getTrueBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
|
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD -> colorFunction = (x, z) -> engine.getComplex().getTrueBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
|
||||||
case BIOME_LAND -> colorFunction = (x, z) -> engine.getFramework().getComplex().getLandBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
|
case BIOME_LAND -> colorFunction = (x, z) -> engine.getComplex().getLandBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
|
||||||
case BIOME_SEA -> colorFunction = (x, z) -> engine.getFramework().getComplex().getSeaBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
|
case BIOME_SEA -> colorFunction = (x, z) -> engine.getComplex().getSeaBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
|
||||||
case REGION -> colorFunction = (x, z) -> engine.getFramework().getComplex().getRegionStream().get(x, z).getColor(engine.getFramework().getComplex(), currentType).getRGB();
|
case REGION -> colorFunction = (x, z) -> engine.getComplex().getRegionStream().get(x, z).getColor(engine.getComplex(), currentType).getRGB();
|
||||||
case CAVE_LAND -> colorFunction = (x, z) -> engine.getFramework().getComplex().getCaveBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
|
case CAVE_LAND -> colorFunction = (x, z) -> engine.getComplex().getCaveBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
|
||||||
case HEIGHT -> colorFunction = (x, z) -> Color.getHSBColor(engine.getFramework().getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
|
case HEIGHT -> colorFunction = (x, z) -> Color.getHSBColor(engine.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
|
||||||
}
|
}
|
||||||
|
|
||||||
return colorFunction.apply(wx, wz);
|
return colorFunction.apply(wx, wz);
|
||||||
@@ -629,8 +629,8 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderHoverOverlay(Graphics2D g, boolean detailed) {
|
private void renderHoverOverlay(Graphics2D g, boolean detailed) {
|
||||||
IrisBiome biome = engine.getFramework().getComplex().getTrueBiomeStream().get(getWorldX(hx), getWorldZ(hz));
|
IrisBiome biome = engine.getComplex().getTrueBiomeStream().get(getWorldX(hx), getWorldZ(hz));
|
||||||
IrisRegion region = engine.getFramework().getComplex().getRegionStream().get(getWorldX(hx), getWorldZ(hz));
|
IrisRegion region = engine.getComplex().getRegionStream().get(getWorldX(hx), getWorldZ(hz));
|
||||||
KList<String> l = new KList<>();
|
KList<String> l = new KList<>();
|
||||||
l.add("Biome: " + biome.getName());
|
l.add("Biome: " + biome.getName());
|
||||||
l.add("Region: " + region.getName() + "(" + region.getLoadKey() + ")");
|
l.add("Region: " + region.getName() + "(" + region.getLoadKey() + ")");
|
||||||
@@ -692,7 +692,7 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void open() {
|
private void open() {
|
||||||
IrisComplex complex = engine.getFramework().getComplex();
|
IrisComplex complex = engine.getComplex();
|
||||||
File r = null;
|
File r = null;
|
||||||
switch (currentType) {
|
switch (currentType) {
|
||||||
case BIOME, LAYER_LOAD, DECORATOR_LOAD, OBJECT_LOAD, HEIGHT -> r = complex.getTrueBiomeStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
|
case BIOME, LAYER_LOAD, DECORATOR_LOAD, OBJECT_LOAD, HEIGHT -> r = complex.getTrueBiomeStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
|
||||||
@@ -710,7 +710,7 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
int xx = (int) getWorldX(hx);
|
int xx = (int) getWorldX(hx);
|
||||||
int zz = (int) getWorldZ(hz);
|
int zz = (int) getWorldZ(hz);
|
||||||
double h = engine.getFramework().getComplex().getTrueHeightStream().get(xx, zz);
|
double h = engine.getComplex().getTrueHeightStream().get(xx, zz);
|
||||||
player.teleport(new Location(player.getWorld(), xx, h, zz));
|
player.teleport(new Location(player.getWorld(), xx, h, zz));
|
||||||
notify("Teleporting to " + xx + ", " + (int) h + ", " + zz);
|
notify("Teleporting to " + xx + ", " + (int) h + ", " + zz);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ public class IrisRenderer {
|
|||||||
BiFunction<Double, Double, Integer> colorFunction = (d, dx) -> Color.black.getRGB();
|
BiFunction<Double, Double, Integer> colorFunction = (d, dx) -> Color.black.getRGB();
|
||||||
|
|
||||||
switch (currentType) {
|
switch (currentType) {
|
||||||
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD -> colorFunction = (x, z) -> renderer.getFramework().getComplex().getTrueBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD -> colorFunction = (x, z) -> renderer.getComplex().getTrueBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
||||||
case BIOME_LAND -> colorFunction = (x, z) -> renderer.getFramework().getComplex().getLandBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
case BIOME_LAND -> colorFunction = (x, z) -> renderer.getComplex().getLandBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
||||||
case BIOME_SEA -> colorFunction = (x, z) -> renderer.getFramework().getComplex().getSeaBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
case BIOME_SEA -> colorFunction = (x, z) -> renderer.getComplex().getSeaBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
||||||
case REGION -> colorFunction = (x, z) -> renderer.getFramework().getComplex().getRegionStream().get(x, z).getColor(renderer.getFramework().getComplex(), currentType).getRGB();
|
case REGION -> colorFunction = (x, z) -> renderer.getComplex().getRegionStream().get(x, z).getColor(renderer.getComplex(), currentType).getRGB();
|
||||||
case CAVE_LAND -> colorFunction = (x, z) -> renderer.getFramework().getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
case CAVE_LAND -> colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
|
||||||
case HEIGHT -> colorFunction = (x, z) -> Color.getHSBColor(renderer.getFramework().getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
|
case HEIGHT -> colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
|
||||||
}
|
}
|
||||||
|
|
||||||
double x, z;
|
double x, z;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
|
|||||||
} else if (p.equalsIgnoreCase("terrain_slope")) {
|
} else if (p.equalsIgnoreCase("terrain_slope")) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
return ((Engine) a.getEngineAccess(l.getBlockY()))
|
return ((Engine) a.getEngineAccess(l.getBlockY()))
|
||||||
.getFramework().getComplex().getSlopeStream()
|
.getComplex().getSlopeStream()
|
||||||
.get(l.getX(), l.getZ()) + "";
|
.get(l.getX(), l.getZ()) + "";
|
||||||
}
|
}
|
||||||
} else if (p.equalsIgnoreCase("terrain_height")) {
|
} else if (p.equalsIgnoreCase("terrain_height")) {
|
||||||
|
|||||||
@@ -92,8 +92,7 @@ public class SchemaBuilder {
|
|||||||
o.put("type", getType(c));
|
o.put("type", getType(c));
|
||||||
JSONArray required = new JSONArray();
|
JSONArray required = new JSONArray();
|
||||||
|
|
||||||
if(c.isAssignableFrom(IrisRegistrant.class) || IrisRegistrant.class.isAssignableFrom(c))
|
if (c.isAssignableFrom(IrisRegistrant.class) || IrisRegistrant.class.isAssignableFrom(c)) {
|
||||||
{
|
|
||||||
for (Field k : IrisRegistrant.class.getDeclaredFields()) {
|
for (Field k : IrisRegistrant.class.getDeclaredFields()) {
|
||||||
k.setAccessible(true);
|
k.setAccessible(true);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import com.volmit.iris.engine.object.spawners.IrisSpawner;
|
|||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -81,49 +80,35 @@ public class IrisData {
|
|||||||
hotloaded();
|
hotloaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preprocessObject(IrisRegistrant t)
|
public void preprocessObject(IrisRegistrant t) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
IrisContext ctx = IrisContext.get();
|
IrisContext ctx = IrisContext.get();
|
||||||
Engine engine = this.engine;
|
Engine engine = this.engine;
|
||||||
|
|
||||||
if(engine == null && ctx != null && ctx.getEngine() != null)
|
if (engine == null && ctx != null && ctx.getEngine() != null) {
|
||||||
{
|
|
||||||
engine = ctx.getEngine();
|
engine = ctx.getEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(engine == null && t.getPreprocessors().isNotEmpty())
|
if (engine == null && t.getPreprocessors().isNotEmpty()) {
|
||||||
{
|
|
||||||
Iris.error("Failed to preprocess object " + t.getLoadKey() + " because there is no engine context here. (See stack below)");
|
Iris.error("Failed to preprocess object " + t.getLoadKey() + " because there is no engine context here. (See stack below)");
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
throw new RuntimeException();
|
||||||
}
|
} catch (Throwable ex) {
|
||||||
|
|
||||||
catch(Throwable ex)
|
|
||||||
{
|
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(engine != null && t.getPreprocessors().isNotEmpty())
|
if (engine != null && t.getPreprocessors().isNotEmpty()) {
|
||||||
{
|
synchronized (this) {
|
||||||
synchronized (this)
|
|
||||||
{
|
|
||||||
engine.getExecution().getAPI().setPreprocessorObject(t);
|
engine.getExecution().getAPI().setPreprocessorObject(t);
|
||||||
|
|
||||||
for(String i : t.getPreprocessors())
|
for (String i : t.getPreprocessors()) {
|
||||||
{
|
|
||||||
engine.getExecution().execute(i);
|
engine.getExecution().execute(i);
|
||||||
Iris.debug("Loader<" + C.GREEN + t.getTypeName() + C.LIGHT_PURPLE + "> iprocess " + C.YELLOW + t.getLoadKey() + C.LIGHT_PURPLE + " in <rainbow>" + i);
|
Iris.debug("Loader<" + C.GREEN + t.getTypeName() + C.LIGHT_PURPLE + "> iprocess " + C.YELLOW + t.getLoadKey() + C.LIGHT_PURPLE + " in <rainbow>" + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Throwable e) {
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
Iris.error("Failed to preprocess object!");
|
Iris.error("Failed to preprocess object!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -149,11 +134,9 @@ public class IrisData {
|
|||||||
ResourceLoader<T> r = null;
|
ResourceLoader<T> r = null;
|
||||||
if (registrant.equals(IrisObject.class)) {
|
if (registrant.equals(IrisObject.class)) {
|
||||||
r = (ResourceLoader<T>) new ObjectResourceLoader(dataFolder, this, rr.getFolderName(), rr.getTypeName());
|
r = (ResourceLoader<T>) new ObjectResourceLoader(dataFolder, this, rr.getFolderName(), rr.getTypeName());
|
||||||
}
|
} else if (registrant.equals(IrisScript.class)) {
|
||||||
else if (registrant.equals(IrisScript.class)) {
|
|
||||||
r = (ResourceLoader<T>) new ScriptResourceLoader(dataFolder, this, rr.getFolderName(), rr.getTypeName());
|
r = (ResourceLoader<T>) new ScriptResourceLoader(dataFolder, this, rr.getFolderName(), rr.getTypeName());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
r = new ResourceLoader<T>(dataFolder, this, rr.getFolderName(), rr.getTypeName(), registrant);
|
r = new ResourceLoader<T>(dataFolder, this, rr.getFolderName(), rr.getTypeName(), registrant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.volmit.iris.engine.object.annotations.ArrayType;
|
|||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
import com.volmit.iris.engine.object.common.IrisScript;
|
import com.volmit.iris.engine.object.common.IrisScript;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimensionIndex;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|||||||
@@ -20,20 +20,12 @@ package com.volmit.iris.core.project.loader;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.object.common.IrisScript;
|
import com.volmit.iris.engine.object.common.IrisScript;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.math.M;
|
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
public class ScriptResourceLoader extends ResourceLoader<IrisScript> {
|
public class ScriptResourceLoader extends ResourceLoader<IrisScript> {
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
objectChanceStream = ProceduralStream.ofDouble((x, z) -> {
|
objectChanceStream = ProceduralStream.ofDouble((x, z) -> {
|
||||||
if (engine.getDimension().hasFeatures(engine)) {
|
if (engine.getDimension().hasFeatures(engine)) {
|
||||||
AtomicDouble str = new AtomicDouble(1D);
|
AtomicDouble str = new AtomicDouble(1D);
|
||||||
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
for (IrisFeaturePositional i : engine.getEngineParallax().forEachFeature(x, z)) {
|
||||||
str.set(Math.min(str.get(), i.getObjectChanceModifier(x, z, rng, getData())));
|
str.set(Math.min(str.get(), i.getObjectChanceModifier(x, z, rng, getData())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
});
|
});
|
||||||
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
||||||
b -> focus)).convertAware2D((b, x, z) -> {
|
b -> focus)).convertAware2D((b, x, z) -> {
|
||||||
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
for (IrisFeaturePositional i : engine.getEngineParallax().forEachFeature(x, z)) {
|
||||||
IrisBiome bx = i.filter(x, z, b, rng);
|
IrisBiome bx = i.filter(x, z, b, rng);
|
||||||
|
|
||||||
if (bx != null) {
|
if (bx != null) {
|
||||||
@@ -257,7 +257,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
fixBiomeType(h, baseBiomeStream.get(x, z),
|
fixBiomeType(h, baseBiomeStream.get(x, z),
|
||||||
regionStream.get(x, z), x, z, fluidHeight))
|
regionStream.get(x, z), x, z, fluidHeight))
|
||||||
.convertAware2D((b, x, z) -> {
|
.convertAware2D((b, x, z) -> {
|
||||||
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
for (IrisFeaturePositional i : engine.getEngineParallax().forEachFeature(x, z)) {
|
||||||
IrisBiome bx = i.filter(x, z, b, rng);
|
IrisBiome bx = i.filter(x, z, b, rng);
|
||||||
|
|
||||||
if (bx != null) {
|
if (bx != null) {
|
||||||
@@ -271,7 +271,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
.cache2D(cacheSize);
|
.cache2D(cacheSize);
|
||||||
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
||||||
b -> focus)).convertAware2D((b, x, z) -> {
|
b -> focus)).convertAware2D((b, x, z) -> {
|
||||||
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
for (IrisFeaturePositional i : engine.getEngineParallax().forEachFeature(x, z)) {
|
||||||
IrisBiome bx = i.filter(x, z, b, rng);
|
IrisBiome bx = i.filter(x, z, b, rng);
|
||||||
|
|
||||||
if (bx != null) {
|
if (bx != null) {
|
||||||
@@ -287,7 +287,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
fixBiomeType(h, baseBiomeStream.get(x, z),
|
fixBiomeType(h, baseBiomeStream.get(x, z),
|
||||||
regionStream.get(x, z), x, z, fluidHeight))
|
regionStream.get(x, z), x, z, fluidHeight))
|
||||||
.convertAware2D((b, x, z) -> {
|
.convertAware2D((b, x, z) -> {
|
||||||
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
for (IrisFeaturePositional i : engine.getEngineParallax().forEachFeature(x, z)) {
|
||||||
IrisBiome bx = i.filter(x, z, b, rng);
|
IrisBiome bx = i.filter(x, z, b, rng);
|
||||||
|
|
||||||
if (bx != null) {
|
if (bx != null) {
|
||||||
@@ -330,17 +330,17 @@ public class IrisComplex implements DataProvider {
|
|||||||
int m = heightf;
|
int m = heightf;
|
||||||
|
|
||||||
if (engine.getDimension().isCarving() && engine.getDimension().getTerrainMode().equals(IrisTerrainMode.NORMAL)) {
|
if (engine.getDimension().isCarving() && engine.getDimension().getTerrainMode().equals(IrisTerrainMode.NORMAL)) {
|
||||||
if (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getFramework().getTerrainActuator()).getRng(), heightf)) {
|
if (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getTerrainActuator()).getRng(), heightf)) {
|
||||||
m--;
|
m--;
|
||||||
|
|
||||||
while (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getFramework().getTerrainActuator()).getRng(), heightf)) {
|
while (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getTerrainActuator()).getRng(), heightf)) {
|
||||||
m--;
|
m--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine.getDimension().isCaves()) {
|
if (engine.getDimension().isCaves()) {
|
||||||
KList<CaveResult> caves = ((IrisCaveModifier) engine.getFramework().getCaveModifier()).genCaves(rx, rz, 0, 0, null);
|
KList<CaveResult> caves = ((IrisCaveModifier) engine.getCaveModifier()).genCaves(rx, rz, 0, 0, null);
|
||||||
boolean again = true;
|
boolean again = true;
|
||||||
|
|
||||||
while (again) {
|
while (again) {
|
||||||
@@ -458,7 +458,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
AtomicDouble noise = new AtomicDouble(h + fluidHeight + overlayStream.get(x, z));
|
AtomicDouble noise = new AtomicDouble(h + fluidHeight + overlayStream.get(x, z));
|
||||||
|
|
||||||
if (features) {
|
if (features) {
|
||||||
List<IrisFeaturePositional> p = engine.getFramework().getEngineParallax().forEachFeature(x, z);
|
List<IrisFeaturePositional> p = engine.getEngineParallax().forEachFeature(x, z);
|
||||||
|
|
||||||
for (IrisFeaturePositional i : p) {
|
for (IrisFeaturePositional i : p) {
|
||||||
noise.set(i.filter(x, z, noise.get(), rng, getData()));
|
noise.set(i.filter(x, z, noise.get(), rng, getData()));
|
||||||
|
|||||||
@@ -20,9 +20,18 @@ package com.volmit.iris.engine;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
|
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
|
||||||
|
import com.volmit.iris.engine.actuator.IrisBiomeActuator;
|
||||||
|
import com.volmit.iris.engine.actuator.IrisDecorantActuator;
|
||||||
|
import com.volmit.iris.engine.actuator.IrisTerrainIslandActuator;
|
||||||
|
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.*;
|
import com.volmit.iris.engine.framework.*;
|
||||||
|
import com.volmit.iris.engine.modifier.IrisCaveModifier;
|
||||||
|
import com.volmit.iris.engine.modifier.IrisDepositModifier;
|
||||||
|
import com.volmit.iris.engine.modifier.IrisPostModifier;
|
||||||
|
import com.volmit.iris.engine.modifier.IrisRavineModifier;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiomePaletteLayer;
|
import com.volmit.iris.engine.object.biome.IrisBiomePaletteLayer;
|
||||||
import com.volmit.iris.engine.object.decoration.IrisDecorator;
|
import com.volmit.iris.engine.object.decoration.IrisDecorator;
|
||||||
@@ -35,10 +44,10 @@ import com.volmit.iris.util.documentation.ChunkCoordinates;
|
|||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import lombok.Getter;
|
import lombok.Data;
|
||||||
import lombok.Setter;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
@@ -48,57 +57,40 @@ import org.bukkit.generator.BlockPopulator;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
@Data
|
||||||
public class IrisEngine extends BlockPopulator implements Engine {
|
public class IrisEngine extends BlockPopulator implements Engine {
|
||||||
@Getter
|
|
||||||
private final EngineCompound compound;
|
private final EngineCompound compound;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineTarget target;
|
private final EngineTarget target;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final IrisContext context;
|
private final IrisContext context;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineFramework framework;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineEffects effects;
|
private final EngineEffects effects;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineExecutionEnvironment execution;
|
private final EngineExecutionEnvironment execution;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineWorldManager worldManager;
|
private final EngineWorldManager worldManager;
|
||||||
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
private volatile int parallelism;
|
private volatile int parallelism;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final int index;
|
private final int index;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineMetrics metrics;
|
private final EngineMetrics metrics;
|
||||||
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
private volatile int minHeight;
|
private volatile int minHeight;
|
||||||
private boolean failing;
|
private boolean failing;
|
||||||
private boolean closed;
|
private boolean closed;
|
||||||
private int cacheId;
|
private int cacheId;
|
||||||
private final int art;
|
private final int art;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private double maxBiomeObjectDensity;
|
private double maxBiomeObjectDensity;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private double maxBiomeLayerDensity;
|
private double maxBiomeLayerDensity;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private double maxBiomeDecoratorDensity;
|
private double maxBiomeDecoratorDensity;
|
||||||
|
private final IrisComplex complex;
|
||||||
|
private final EngineParallaxManager engineParallax;
|
||||||
|
private final EngineActuator<BlockData> terrainNormalActuator;
|
||||||
|
private final EngineActuator<BlockData> terrainIslandActuator;
|
||||||
|
private final EngineActuator<BlockData> decorantActuator;
|
||||||
|
private final EngineActuator<Biome> biomeActuator;
|
||||||
|
private final EngineModifier<BlockData> depositModifier;
|
||||||
|
private final EngineModifier<BlockData> caveModifier;
|
||||||
|
private final EngineModifier<BlockData> ravineModifier;
|
||||||
|
private final EngineModifier<BlockData> postModifier;
|
||||||
private final AtomicCache<IrisEngineData> engineData = new AtomicCache<>();
|
private final AtomicCache<IrisEngineData> engineData = new AtomicCache<>();
|
||||||
|
private final AtomicBoolean cleaning;
|
||||||
|
private final ChronoLatch cleanLatch;
|
||||||
|
|
||||||
public IrisEngine(EngineTarget target, EngineCompound compound, int index) {
|
public IrisEngine(EngineTarget target, EngineCompound compound, int index) {
|
||||||
execution = new IrisExecutionEnvironment(this);
|
execution = new IrisExecutionEnvironment(this);
|
||||||
@@ -107,7 +99,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
|||||||
this.target = target;
|
this.target = target;
|
||||||
getData().setEngine(this);
|
getData().setEngine(this);
|
||||||
getEngineData();
|
getEngineData();
|
||||||
this.framework = new IrisEngineFramework(this);
|
|
||||||
worldManager = new IrisWorldManager(this);
|
worldManager = new IrisWorldManager(this);
|
||||||
this.compound = compound;
|
this.compound = compound;
|
||||||
minHeight = 0;
|
minHeight = 0;
|
||||||
@@ -121,6 +112,20 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
|||||||
Iris.callEvent(new IrisEngineHotloadEvent(this));
|
Iris.callEvent(new IrisEngineHotloadEvent(this));
|
||||||
context = new IrisContext(this);
|
context = new IrisContext(this);
|
||||||
context.touch();
|
context.touch();
|
||||||
|
this.complex = new IrisComplex(this);
|
||||||
|
this.engineParallax = new IrisEngineParallax(this);
|
||||||
|
this.terrainNormalActuator = new IrisTerrainNormalActuator(this);
|
||||||
|
this.terrainIslandActuator = new IrisTerrainIslandActuator(this);
|
||||||
|
this.decorantActuator = new IrisDecorantActuator(this);
|
||||||
|
this.biomeActuator = new IrisBiomeActuator(this);
|
||||||
|
this.depositModifier = new IrisDepositModifier(this);
|
||||||
|
this.ravineModifier = new IrisRavineModifier(this);
|
||||||
|
this.caveModifier = new IrisCaveModifier(this);
|
||||||
|
this.postModifier = new IrisPostModifier(this);
|
||||||
|
cleaning = new AtomicBoolean(false);
|
||||||
|
cleanLatch = new ChronoLatch(Math.max(10000, Math.min(IrisSettings.get().getParallax()
|
||||||
|
.getParallaxChunkEvictionMS(), IrisSettings.get().getParallax().getParallaxRegionEvictionMS())));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -180,9 +185,16 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
|||||||
J.car(art);
|
J.car(art);
|
||||||
closed = true;
|
closed = true;
|
||||||
getWorldManager().close();
|
getWorldManager().close();
|
||||||
getFramework().close();
|
|
||||||
getTarget().close();
|
getTarget().close();
|
||||||
saveEngineData();
|
saveEngineData();
|
||||||
|
getEngineParallax().close();
|
||||||
|
getTerrainActuator().close();
|
||||||
|
getDecorantActuator().close();
|
||||||
|
getBiomeActuator().close();
|
||||||
|
getDepositModifier().close();
|
||||||
|
getRavineModifier().close();
|
||||||
|
getCaveModifier().close();
|
||||||
|
getPostModifier().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -192,7 +204,35 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recycle() {
|
public void recycle() {
|
||||||
getFramework().recycle();
|
if (!cleanLatch.flip()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cleaning.get()) {
|
||||||
|
cleanLatch.flipDown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cleaning.set(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
getParallax().cleanup();
|
||||||
|
getData().getObjectLoader().clean();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
Iris.error("Cleanup failed!");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
cleaning.lazySet(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public EngineActuator<BlockData> getTerrainActuator() {
|
||||||
|
return switch (getDimension().getTerrainMode()) {
|
||||||
|
case NORMAL -> getTerrainNormalActuator();
|
||||||
|
case ISLANDS -> getTerrainIslandActuator();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@@ -218,18 +258,18 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
|||||||
|
|
||||||
switch (getDimension().getTerrainMode()) {
|
switch (getDimension().getTerrainMode()) {
|
||||||
case NORMAL -> {
|
case NORMAL -> {
|
||||||
getFramework().getEngineParallax().generateParallaxArea(x >> 4, z >> 4);
|
getEngineParallax().generateParallaxArea(x >> 4, z >> 4);
|
||||||
getFramework().getTerrainActuator().actuate(x, z, vblocks, multicore);
|
getTerrainActuator().actuate(x, z, vblocks, multicore);
|
||||||
getFramework().getBiomeActuator().actuate(x, z, vbiomes, multicore);
|
getBiomeActuator().actuate(x, z, vbiomes, multicore);
|
||||||
getFramework().getCaveModifier().modify(x, z, vblocks, multicore);
|
getCaveModifier().modify(x, z, vblocks, multicore);
|
||||||
getFramework().getRavineModifier().modify(x, z, vblocks, multicore);
|
getRavineModifier().modify(x, z, vblocks, multicore);
|
||||||
getFramework().getPostModifier().modify(x, z, vblocks, multicore);
|
getPostModifier().modify(x, z, vblocks, multicore);
|
||||||
getFramework().getDecorantActuator().actuate(x, z, blocks, multicore);
|
getDecorantActuator().actuate(x, z, blocks, multicore);
|
||||||
getFramework().getEngineParallax().insertParallax(x >> 4, z >> 4, blocks);
|
getEngineParallax().insertParallax(x >> 4, z >> 4, blocks);
|
||||||
getFramework().getDepositModifier().modify(x, z, blocks, multicore);
|
getDepositModifier().modify(x, z, blocks, multicore);
|
||||||
}
|
}
|
||||||
case ISLANDS -> {
|
case ISLANDS -> {
|
||||||
getFramework().getTerrainActuator().actuate(x, z, vblocks, multicore);
|
getTerrainActuator().actuate(x, z, vblocks, multicore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,138 +0,0 @@
|
|||||||
/*
|
|
||||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
|
||||||
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.volmit.iris.engine;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.engine.actuator.IrisBiomeActuator;
|
|
||||||
import com.volmit.iris.engine.actuator.IrisDecorantActuator;
|
|
||||||
import com.volmit.iris.engine.actuator.IrisTerrainIslandActuator;
|
|
||||||
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
|
|
||||||
import com.volmit.iris.engine.framework.*;
|
|
||||||
import com.volmit.iris.engine.modifier.IrisCaveModifier;
|
|
||||||
import com.volmit.iris.engine.modifier.IrisDepositModifier;
|
|
||||||
import com.volmit.iris.engine.modifier.IrisPostModifier;
|
|
||||||
import com.volmit.iris.engine.modifier.IrisRavineModifier;
|
|
||||||
import com.volmit.iris.util.io.ReactiveFolder;
|
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
public class IrisEngineFramework implements EngineFramework {
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final Engine engine;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final IrisComplex complex;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
final EngineParallaxManager engineParallax;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineActuator<BlockData> terrainNormalActuator;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineActuator<BlockData> terrainIslandActuator;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineActuator<BlockData> decorantActuator;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineActuator<Biome> biomeActuator;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineModifier<BlockData> depositModifier;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineModifier<BlockData> caveModifier;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineModifier<BlockData> ravineModifier;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final EngineModifier<BlockData> postModifier;
|
|
||||||
|
|
||||||
private final AtomicBoolean cleaning;
|
|
||||||
private final ChronoLatch cleanLatch;
|
|
||||||
|
|
||||||
public IrisEngineFramework(Engine engine) {
|
|
||||||
this.engine = engine;
|
|
||||||
this.complex = new IrisComplex(getEngine());
|
|
||||||
this.engineParallax = new IrisEngineParallax(getEngine());
|
|
||||||
this.terrainNormalActuator = new IrisTerrainNormalActuator(getEngine());
|
|
||||||
this.terrainIslandActuator = new IrisTerrainIslandActuator(getEngine());
|
|
||||||
this.decorantActuator = new IrisDecorantActuator(getEngine());
|
|
||||||
this.biomeActuator = new IrisBiomeActuator(getEngine());
|
|
||||||
this.depositModifier = new IrisDepositModifier(getEngine());
|
|
||||||
this.ravineModifier = new IrisRavineModifier(getEngine());
|
|
||||||
this.caveModifier = new IrisCaveModifier(engine);
|
|
||||||
this.postModifier = new IrisPostModifier(engine);
|
|
||||||
cleaning = new AtomicBoolean(false);
|
|
||||||
cleanLatch = new ChronoLatch(Math.max(10000, Math.min(IrisSettings.get().getParallax().getParallaxChunkEvictionMS(), IrisSettings.get().getParallax().getParallaxRegionEvictionMS())));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void recycle() {
|
|
||||||
if (!cleanLatch.flip()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cleaning.get()) {
|
|
||||||
cleanLatch.flipDown();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cleaning.set(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
getEngine().getParallax().cleanup();
|
|
||||||
getData().getObjectLoader().clean();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
Iris.error("Cleanup failed!");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
cleaning.lazySet(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EngineActuator<BlockData> getTerrainActuator() {
|
|
||||||
return switch (getEngine().getDimension().getTerrainMode()) {
|
|
||||||
case NORMAL -> getTerrainNormalActuator();
|
|
||||||
case ISLANDS -> getTerrainIslandActuator();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
getEngineParallax().close();
|
|
||||||
getTerrainActuator().close();
|
|
||||||
getDecorantActuator().close();
|
|
||||||
getBiomeActuator().close();
|
|
||||||
getDepositModifier().close();
|
|
||||||
getRavineModifier().close();
|
|
||||||
getCaveModifier().close();
|
|
||||||
getPostModifier().close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,8 +30,7 @@ public class IrisEngineMantle implements EngineMantle {
|
|||||||
private final Engine engine;
|
private final Engine engine;
|
||||||
private final Mantle mantle;
|
private final Mantle mantle;
|
||||||
|
|
||||||
public IrisEngineMantle(Engine engine)
|
public IrisEngineMantle(Engine engine) {
|
||||||
{
|
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.mantle = new Mantle(new File(engine.getWorld().worldFolder(), "mantle/" + engine.getIndex()), engine.getTarget().getHeight());
|
this.mantle = new Mantle(new File(engine.getWorld().worldFolder(), "mantle/" + engine.getIndex()), engine.getTarget().getHeight());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
|
|||||||
import com.volmit.iris.engine.scripting.IrisScriptingAPI;
|
import com.volmit.iris.engine.scripting.IrisScriptingAPI;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.bsf.BSFEngine;
|
|
||||||
import org.apache.bsf.BSFException;
|
import org.apache.bsf.BSFException;
|
||||||
import org.apache.bsf.BSFManager;
|
import org.apache.bsf.BSFManager;
|
||||||
import org.apache.bsf.engines.javascript.JavaScriptEngine;
|
import org.apache.bsf.engines.javascript.JavaScriptEngine;
|
||||||
@@ -36,8 +35,7 @@ public class IrisExecutionEnvironment implements EngineExecutionEnvironment {
|
|||||||
private final IrisScriptingAPI api;
|
private final IrisScriptingAPI api;
|
||||||
private JavaScriptEngine javaScriptEngine;
|
private JavaScriptEngine javaScriptEngine;
|
||||||
|
|
||||||
public IrisExecutionEnvironment(Engine engine)
|
public IrisExecutionEnvironment(Engine engine) {
|
||||||
{
|
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.api = new IrisScriptingAPI(engine);
|
this.api = new IrisScriptingAPI(engine);
|
||||||
this.manager = new BSFManager();
|
this.manager = new BSFManager();
|
||||||
@@ -55,8 +53,7 @@ public class IrisExecutionEnvironment implements EngineExecutionEnvironment {
|
|||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execute(String script)
|
public void execute(String script) {
|
||||||
{
|
|
||||||
Iris.debug("Execute Script (void) " + C.DARK_GREEN + script);
|
Iris.debug("Execute Script (void) " + C.DARK_GREEN + script);
|
||||||
try {
|
try {
|
||||||
javaScriptEngine.exec("", 0, 0, getEngine().getData().getScriptLoader().load(script));
|
javaScriptEngine.exec("", 0, 0, getEngine().getData().getScriptLoader().load(script));
|
||||||
@@ -65,8 +62,7 @@ public class IrisExecutionEnvironment implements EngineExecutionEnvironment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object evaluate(String script)
|
public Object evaluate(String script) {
|
||||||
{
|
|
||||||
Iris.debug("Execute Script (for result) " + C.DARK_GREEN + script);
|
Iris.debug("Execute Script (for result) " + C.DARK_GREEN + script);
|
||||||
try {
|
try {
|
||||||
return javaScriptEngine.eval("", 0, 0, getEngine().getData().getScriptLoader().load(script));
|
return javaScriptEngine.eval("", 0, 0, getEngine().getData().getScriptLoader().load(script));
|
||||||
|
|||||||
@@ -87,13 +87,11 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
looper = new Looper() {
|
looper = new Looper() {
|
||||||
@Override
|
@Override
|
||||||
protected long loop() {
|
protected long loop() {
|
||||||
if(getEngine().isClosed())
|
if (getEngine().isClosed()) {
|
||||||
{
|
|
||||||
interrupt();
|
interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getDimension().isInfiniteEnergy())
|
if (getDimension().isInfiniteEnergy()) {
|
||||||
{
|
|
||||||
energy += 1000;
|
energy += 1000;
|
||||||
fixEnergy();
|
fixEnergy();
|
||||||
}
|
}
|
||||||
@@ -138,8 +136,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean onAsyncTick() {
|
private boolean onAsyncTick() {
|
||||||
if(getEngine().isClosed())
|
if (getEngine().isClosed()) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,13 +161,9 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cl.flip()) {
|
if (cl.flip()) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
J.s(() -> precount = getEngine().getWorld().realWorld().getEntities());
|
J.s(() -> precount = getEngine().getWorld().realWorld().getEntities());
|
||||||
}
|
} catch (Throwable e) {
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,7 +206,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
getData().getSpawnerLoader()
|
getData().getSpawnerLoader()
|
||||||
.loadAll(getDimension().getEntitySpawners())
|
.loadAll(getDimension().getEntitySpawners())
|
||||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn),
|
.shuffleCopy(RNG.r).stream().filter(this::canSpawn),
|
||||||
getData().getSpawnerLoader().streamAll(getEngine().getFramework().getEngineParallax()
|
getData().getSpawnerLoader().streamAll(getEngine().getEngineParallax()
|
||||||
.getFeaturesInChunk(c).stream()
|
.getFeaturesInChunk(c).stream()
|
||||||
.flatMap((o) -> o.getFeature().getEntitySpawners().stream()))
|
.flatMap((o) -> o.getFeature().getEntitySpawners().stream()))
|
||||||
.filter(this::canSpawn))
|
.filter(this::canSpawn))
|
||||||
@@ -241,13 +234,9 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
spawn(c, v);
|
spawn(c, v);
|
||||||
}
|
} catch (Throwable e) {
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
J.s(() -> spawn(c, v));
|
J.s(() -> spawn(c, v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.gui.components.RenderType;
|
import com.volmit.iris.core.gui.components.RenderType;
|
||||||
import com.volmit.iris.core.gui.components.Renderer;
|
import com.volmit.iris.core.gui.components.Renderer;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.engine.IrisComplex;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.engine.object.basic.IrisColor;
|
import com.volmit.iris.engine.object.basic.IrisColor;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
@@ -62,6 +63,26 @@ import java.util.Arrays;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootProvider, BlockUpdater, Renderer, Hotloadable {
|
public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootProvider, BlockUpdater, Renderer, Hotloadable {
|
||||||
|
IrisComplex getComplex();
|
||||||
|
|
||||||
|
void recycle();
|
||||||
|
|
||||||
|
EngineParallaxManager getEngineParallax();
|
||||||
|
|
||||||
|
EngineActuator<BlockData> getTerrainActuator();
|
||||||
|
|
||||||
|
EngineActuator<BlockData> getDecorantActuator();
|
||||||
|
|
||||||
|
EngineActuator<Biome> getBiomeActuator();
|
||||||
|
|
||||||
|
EngineModifier<BlockData> getCaveModifier();
|
||||||
|
|
||||||
|
EngineModifier<BlockData> getRavineModifier();
|
||||||
|
|
||||||
|
EngineModifier<BlockData> getDepositModifier();
|
||||||
|
|
||||||
|
EngineModifier<BlockData> getPostModifier();
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
IrisContext getContext();
|
IrisContext getContext();
|
||||||
@@ -81,19 +102,15 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
void setParallelism(int parallelism);
|
void setParallelism(int parallelism);
|
||||||
|
|
||||||
default UUID getBiomeID(int x, int z) {
|
default UUID getBiomeID(int x, int z) {
|
||||||
return getFramework().getComplex().getBaseBiomeIDStream().get(x, z);
|
return getComplex().getBaseBiomeIDStream().get(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getParallelism();
|
int getParallelism();
|
||||||
|
|
||||||
EngineTarget getTarget();
|
EngineTarget getTarget();
|
||||||
|
|
||||||
EngineFramework getFramework();
|
|
||||||
|
|
||||||
void setMinHeight(int min);
|
void setMinHeight(int min);
|
||||||
|
|
||||||
void recycle();
|
|
||||||
|
|
||||||
int getIndex();
|
int getIndex();
|
||||||
|
|
||||||
int getMinHeight();
|
int getMinHeight();
|
||||||
@@ -152,7 +169,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
IrisBiome biome = getSurfaceBiome((int) x, (int) z);
|
IrisBiome biome = getSurfaceBiome((int) x, (int) z);
|
||||||
int height = getHeight((int) x, (int) z);
|
int height = getHeight((int) x, (int) z);
|
||||||
double heightFactor = M.lerpInverse(0, getHeight(), height);
|
double heightFactor = M.lerpInverse(0, getHeight(), height);
|
||||||
Color irc = region.getColor(this.getFramework().getComplex(), RenderType.BIOME);
|
Color irc = region.getColor(this.getComplex(), RenderType.BIOME);
|
||||||
Color ibc = biome.getColor(this, RenderType.BIOME);
|
Color ibc = biome.getColor(this, RenderType.BIOME);
|
||||||
Color rc = irc != null ? irc : Color.GREEN.darker();
|
Color rc = irc != null ? irc : Color.GREEN.darker();
|
||||||
Color bc = ibc != null ? ibc : biome.isAquatic() ? Color.BLUE : Color.YELLOW;
|
Color bc = ibc != null ? ibc : biome.isAquatic() ? Color.BLUE : Color.YELLOW;
|
||||||
@@ -164,7 +181,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@Override
|
@Override
|
||||||
default IrisRegion getRegion(int x, int z) {
|
default IrisRegion getRegion(int x, int z) {
|
||||||
return getFramework().getComplex().getRegionStream().get(x, z);
|
return getComplex().getRegionStream().get(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -175,13 +192,13 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@Override
|
@Override
|
||||||
default IrisBiome getCaveBiome(int x, int z) {
|
default IrisBiome getCaveBiome(int x, int z) {
|
||||||
return getFramework().getComplex().getCaveBiomeStream().get(x, z);
|
return getComplex().getCaveBiomeStream().get(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@Override
|
@Override
|
||||||
default IrisBiome getSurfaceBiome(int x, int z) {
|
default IrisBiome getSurfaceBiome(int x, int z) {
|
||||||
return getFramework().getComplex().getTrueBiomeStream().get(x, z);
|
return getComplex().getTrueBiomeStream().get(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@@ -192,7 +209,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
default int getHeight(int x, int z, boolean ignoreFluid) {
|
default int getHeight(int x, int z, boolean ignoreFluid) {
|
||||||
return getFramework().getEngineParallax().getHighest(x, z, getData(), ignoreFluid);
|
return getEngineParallax().getHighest(x, z, getData(), ignoreFluid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@@ -326,7 +343,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
list.clear();
|
list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
list.addAll(r.getLootTables(getFramework().getComplex()));
|
list.addAll(r.getLootTables(getComplex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@@ -334,8 +351,8 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
default KList<IrisLootTable> getLootTables(RNG rng, Block b) {
|
default KList<IrisLootTable> getLootTables(RNG rng, Block b) {
|
||||||
int rx = b.getX();
|
int rx = b.getX();
|
||||||
int rz = b.getZ();
|
int rz = b.getZ();
|
||||||
double he = getFramework().getComplex().getHeightStream().get(rx, rz);
|
double he = getComplex().getHeightStream().get(rx, rz);
|
||||||
PlacedObject po = getFramework().getEngine().getObjectPlacement(rx, b.getY(), rz);
|
PlacedObject po = getObjectPlacement(rx, b.getY(), rz);
|
||||||
if (po != null && po.getPlacement() != null) {
|
if (po != null && po.getPlacement() != null) {
|
||||||
|
|
||||||
if (B.isStorageChest(b.getBlockData())) {
|
if (B.isStorageChest(b.getBlockData())) {
|
||||||
@@ -345,9 +362,9 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IrisRegion region = getFramework().getComplex().getRegionStream().get(rx, rz);
|
IrisRegion region = getComplex().getRegionStream().get(rx, rz);
|
||||||
IrisBiome biomeSurface = getFramework().getComplex().getTrueBiomeStream().get(rx, rz);
|
IrisBiome biomeSurface = getComplex().getTrueBiomeStream().get(rx, rz);
|
||||||
IrisBiome biomeUnder = b.getY() < he ? getFramework().getComplex().getCaveBiomeStream().get(rx, rz) : biomeSurface;
|
IrisBiome biomeUnder = b.getY() < he ? getComplex().getCaveBiomeStream().get(rx, rz) : biomeSurface;
|
||||||
KList<IrisLootTable> tables = new KList<>();
|
KList<IrisLootTable> tables = new KList<>();
|
||||||
double multiplier = 1D * getDimension().getLoot().getMultiplier() * region.getLoot().getMultiplier() * biomeSurface.getLoot().getMultiplier() * biomeUnder.getLoot().getMultiplier();
|
double multiplier = 1D * getDimension().getLoot().getMultiplier() * region.getLoot().getMultiplier() * biomeSurface.getLoot().getMultiplier() * biomeUnder.getLoot().getMultiplier();
|
||||||
injectTables(tables, getDimension().getLoot());
|
injectTables(tables, getDimension().getLoot());
|
||||||
|
|||||||
@@ -72,15 +72,11 @@ public interface EngineComponent {
|
|||||||
return getTarget().getWorld().seed();
|
return getTarget().getWorld().seed();
|
||||||
}
|
}
|
||||||
|
|
||||||
default EngineFramework getFramework() {
|
|
||||||
return getEngine().getFramework();
|
|
||||||
}
|
|
||||||
|
|
||||||
default int getParallelism() {
|
default int getParallelism() {
|
||||||
return getEngine().getParallelism();
|
return getEngine().getParallelism();
|
||||||
}
|
}
|
||||||
|
|
||||||
default IrisComplex getComplex() {
|
default IrisComplex getComplex() {
|
||||||
return getFramework().getComplex();
|
return getEngine().getComplex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ public interface EngineCompound extends Listener, Hotloadable, DataProvider {
|
|||||||
Engine e = getEngine(i);
|
Engine e = getEngine(i);
|
||||||
|
|
||||||
if (e.getDimension().isBedrock()) {
|
if (e.getDimension().isBedrock()) {
|
||||||
int m = ((IrisTerrainNormalActuator) e.getFramework().getTerrainActuator()).getLastBedrock();
|
int m = ((IrisTerrainNormalActuator) e.getTerrainActuator()).getLastBedrock();
|
||||||
|
|
||||||
if (f > m) {
|
if (f > m) {
|
||||||
f = m;
|
f = m;
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
|
||||||
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.volmit.iris.engine.framework;
|
|
||||||
|
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
|
||||||
import com.volmit.iris.engine.IrisComplex;
|
|
||||||
import com.volmit.iris.util.data.DataProvider;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
|
|
||||||
public interface EngineFramework extends DataProvider {
|
|
||||||
Engine getEngine();
|
|
||||||
|
|
||||||
IrisComplex getComplex();
|
|
||||||
|
|
||||||
EngineParallaxManager getEngineParallax();
|
|
||||||
|
|
||||||
default IrisData getData() {
|
|
||||||
return getComplex().getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
default void recycle() {
|
|
||||||
getEngine().getParallax().cleanup();
|
|
||||||
getData().getObjectLoader().clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
EngineActuator<BlockData> getTerrainActuator();
|
|
||||||
|
|
||||||
EngineActuator<BlockData> getDecorantActuator();
|
|
||||||
|
|
||||||
EngineActuator<Biome> getBiomeActuator();
|
|
||||||
|
|
||||||
EngineModifier<BlockData> getCaveModifier();
|
|
||||||
|
|
||||||
EngineModifier<BlockData> getRavineModifier();
|
|
||||||
|
|
||||||
EngineModifier<BlockData> getDepositModifier();
|
|
||||||
|
|
||||||
EngineModifier<BlockData> getPostModifier();
|
|
||||||
|
|
||||||
void close();
|
|
||||||
}
|
|
||||||
@@ -74,10 +74,6 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
|||||||
|
|
||||||
int getParallaxSize();
|
int getParallaxSize();
|
||||||
|
|
||||||
default EngineFramework getFramework() {
|
|
||||||
return getEngine().getFramework();
|
|
||||||
}
|
|
||||||
|
|
||||||
default ParallaxAccess getParallaxAccess() {
|
default ParallaxAccess getParallaxAccess() {
|
||||||
return getEngine().getParallax();
|
return getEngine().getParallax();
|
||||||
}
|
}
|
||||||
@@ -87,7 +83,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default IrisComplex getComplex() {
|
default IrisComplex getComplex() {
|
||||||
return getEngine().getFramework().getComplex();
|
return getEngine().getComplex();
|
||||||
}
|
}
|
||||||
|
|
||||||
default KList<IrisRegion> getAllRegions() {
|
default KList<IrisRegion> getAllRegions() {
|
||||||
@@ -214,13 +210,13 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
|||||||
KList<IrisFeaturePositional> pos = new KList<>();
|
KList<IrisFeaturePositional> pos = new KList<>();
|
||||||
|
|
||||||
for (IrisFeaturePositional i : getEngine().getDimension().getSpecificFeatures()) {
|
for (IrisFeaturePositional i : getEngine().getDimension().getSpecificFeatures()) {
|
||||||
if (i.shouldFilter((x << 4) + 8, (z << 4) + 8, getEngine().getFramework().getComplex().getRng(), getData())) {
|
if (i.shouldFilter((x << 4) + 8, (z << 4) + 8, getEngine().getComplex().getRng(), getData())) {
|
||||||
pos.add(i);
|
pos.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IrisFeaturePositional i : getParallaxAccess().getMetaR(x, z).getFeatures()) {
|
for (IrisFeaturePositional i : getParallaxAccess().getMetaR(x, z).getFeatures()) {
|
||||||
if (i.shouldFilter((x << 4) + 8, (z << 4) + 8, getEngine().getFramework().getComplex().getRng(), getData())) {
|
if (i.shouldFilter((x << 4) + 8, (z << 4) + 8, getEngine().getComplex().getRng(), getData())) {
|
||||||
pos.add(i);
|
pos.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,7 +238,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (IrisFeaturePositional i : getEngine().getDimension().getSpecificFeatures()) {
|
for (IrisFeaturePositional i : getEngine().getDimension().getSpecificFeatures()) {
|
||||||
if (i.shouldFilter(x, z, getEngine().getFramework().getComplex().getRng(), getData())) {
|
if (i.shouldFilter(x, z, getEngine().getComplex().getRng(), getData())) {
|
||||||
pos.add(i);
|
pos.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,7 +255,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
for (IrisFeaturePositional k : m.getFeatures()) {
|
for (IrisFeaturePositional k : m.getFeatures()) {
|
||||||
if (k.shouldFilter(x, z, getEngine().getFramework().getComplex().getRng(), getData())) {
|
if (k.shouldFilter(x, z, getEngine().getComplex().getRng(), getData())) {
|
||||||
pos.add(k);
|
pos.add(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
import com.volmit.iris.engine.IrisComplex;
|
import com.volmit.iris.engine.IrisComplex;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineFramework;
|
|
||||||
import com.volmit.iris.engine.framework.EngineTarget;
|
import com.volmit.iris.engine.framework.EngineTarget;
|
||||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
@@ -33,8 +32,7 @@ import com.volmit.iris.util.mantle.Mantle;
|
|||||||
import org.bukkit.block.TileState;
|
import org.bukkit.block.TileState;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
public interface EngineMantle extends IObjectPlacer
|
public interface EngineMantle extends IObjectPlacer {
|
||||||
{
|
|
||||||
BlockData AIR = B.get("AIR");
|
BlockData AIR = B.get("AIR");
|
||||||
|
|
||||||
Mantle getMantle();
|
Mantle getMantle();
|
||||||
@@ -65,7 +63,7 @@ public interface EngineMantle extends IObjectPlacer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void set(int x, int y, int z, BlockData d) {
|
default void set(int x, int y, int z, BlockData d) {
|
||||||
getMantle().set(x,y,z,d == null ? AIR : d);
|
getMantle().set(x, y, z, d == null ? AIR : d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -76,7 +74,7 @@ public interface EngineMantle extends IObjectPlacer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
default BlockData get(int x, int y, int z) {
|
default BlockData get(int x, int y, int z) {
|
||||||
BlockData block = getMantle().get(x,y,z,BlockData.class);
|
BlockData block = getMantle().get(x, y, z, BlockData.class);
|
||||||
|
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
return AIR;
|
return AIR;
|
||||||
@@ -110,8 +108,7 @@ public interface EngineMantle extends IObjectPlacer
|
|||||||
return getEngine().getDimension().isDebugSmartBore();
|
return getEngine().getDimension().isDebugSmartBore();
|
||||||
}
|
}
|
||||||
|
|
||||||
default void trim(long dur)
|
default void trim(long dur) {
|
||||||
{
|
|
||||||
getMantle().trim(dur);
|
getMantle().trim(dur);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,16 +128,11 @@ public interface EngineMantle extends IObjectPlacer
|
|||||||
return getEngine().getDimension();
|
return getEngine().getDimension();
|
||||||
}
|
}
|
||||||
|
|
||||||
default EngineFramework getFramework() {
|
|
||||||
return getEngine().getFramework();
|
|
||||||
}
|
|
||||||
|
|
||||||
default IrisComplex getComplex() {
|
default IrisComplex getComplex() {
|
||||||
return getFramework().getComplex();
|
return getEngine().getComplex();
|
||||||
}
|
}
|
||||||
|
|
||||||
default void close()
|
default void close() {
|
||||||
{
|
|
||||||
getMantle().close();
|
getMantle().close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,5 +19,5 @@
|
|||||||
package com.volmit.iris.engine.mantle;
|
package com.volmit.iris.engine.mantle;
|
||||||
|
|
||||||
public interface MantleSized {
|
public interface MantleSized {
|
||||||
public int getMaxChunkSize();
|
int getMaxChunkSize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
|
|
||||||
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
|
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
|
||||||
private void post(int currentPostX, int currentPostZ, Hunk<BlockData> currentData, int x, int z) {
|
private void post(int currentPostX, int currentPostZ, Hunk<BlockData> currentData, int x, int z) {
|
||||||
int h = getFramework().getEngineParallax().trueHeight(x, z);
|
int h = getEngine().getEngineParallax().trueHeight(x, z);
|
||||||
int ha = getFramework().getEngineParallax().trueHeight(x + 1, z);
|
int ha = getEngine().getEngineParallax().trueHeight(x + 1, z);
|
||||||
int hb = getFramework().getEngineParallax().trueHeight(x, z + 1);
|
int hb = getEngine().getEngineParallax().trueHeight(x, z + 1);
|
||||||
int hc = getFramework().getEngineParallax().trueHeight(x - 1, z);
|
int hc = getEngine().getEngineParallax().trueHeight(x - 1, z);
|
||||||
int hd = getFramework().getEngineParallax().trueHeight(x, z - 1);
|
int hd = getEngine().getEngineParallax().trueHeight(x, z - 1);
|
||||||
|
|
||||||
// Floating Nibs
|
// Floating Nibs
|
||||||
int g = 0;
|
int g = 0;
|
||||||
@@ -234,7 +234,7 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
IrisBiome cave = getComplex().getCaveBiomeStream().get(x, z);
|
IrisBiome cave = getComplex().getCaveBiomeStream().get(x, z);
|
||||||
|
|
||||||
if (cave != null) {
|
if (cave != null) {
|
||||||
for (CaveResult i : ((IrisCaveModifier) getFramework().getCaveModifier()).genCaves(x, z, 0, 0, null)) {
|
for (CaveResult i : ((IrisCaveModifier) getEngine().getCaveModifier()).genCaves(x, z, 0, 0, null)) {
|
||||||
if (i.getCeiling() >= currentData.getMax2DParallelism() || i.getFloor() < 0) {
|
if (i.getCeiling() >= currentData.getMax2DParallelism() || i.getFloor() < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,20 +21,17 @@ package com.volmit.iris.engine.object.common;
|
|||||||
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class IrisScript extends IrisRegistrant {
|
public class IrisScript extends IrisRegistrant {
|
||||||
private final String source;
|
private final String source;
|
||||||
|
|
||||||
public IrisScript()
|
public IrisScript() {
|
||||||
{
|
|
||||||
this("");
|
this("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisScript(String source)
|
public IrisScript(String source) {
|
||||||
{
|
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,8 +45,7 @@ public class IrisScript extends IrisRegistrant {
|
|||||||
return "Script";
|
return "Script";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,26 +169,19 @@ public class IrisEntity extends IrisRegistrant {
|
|||||||
public Entity spawn(Engine gen, Location at, RNG rng) {
|
public Entity spawn(Engine gen, Location at, RNG rng) {
|
||||||
Entity ee = doSpawn(at);
|
Entity ee = doSpawn(at);
|
||||||
|
|
||||||
if(!spawnerScript.isEmpty() && ee == null)
|
if (!spawnerScript.isEmpty() && ee == null) {
|
||||||
{
|
synchronized (this) {
|
||||||
synchronized (this)
|
|
||||||
{
|
|
||||||
gen.getExecution().getAPI().setLocation(at);
|
gen.getExecution().getAPI().setLocation(at);
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
ee = (Entity) gen.getExecution().evaluate(spawnerScript);
|
ee = (Entity) gen.getExecution().evaluate(spawnerScript);
|
||||||
}
|
} catch (Throwable ex) {
|
||||||
|
|
||||||
catch(Throwable ex)
|
|
||||||
{
|
|
||||||
Iris.error("You must return an Entity in your scripts to use entity scripts!");
|
Iris.error("You must return an Entity in your scripts to use entity scripts!");
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ee == null)
|
if (ee == null) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,15 +306,12 @@ public class IrisEntity extends IrisRegistrant {
|
|||||||
spawnEffect.apply(e);
|
spawnEffect.apply(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(postSpawnScripts.isNotEmpty())
|
if (postSpawnScripts.isNotEmpty()) {
|
||||||
{
|
synchronized (this) {
|
||||||
synchronized (this)
|
|
||||||
{
|
|
||||||
gen.getExecution().getAPI().setLocation(at);
|
gen.getExecution().getAPI().setLocation(at);
|
||||||
gen.getExecution().getAPI().setEntity(ee);
|
gen.getExecution().getAPI().setEntity(ee);
|
||||||
|
|
||||||
for(String i : postSpawnScripts)
|
for (String i : postSpawnScripts) {
|
||||||
{
|
|
||||||
gen.getExecution().execute(i);
|
gen.getExecution().execute(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,8 +321,7 @@ public class IrisEntity extends IrisRegistrant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Entity doSpawn(Location at) {
|
private Entity doSpawn(Location at) {
|
||||||
if(type.equals(EntityType.UNKNOWN))
|
if (type.equals(EntityType.UNKNOWN)) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.engine.IrisComplex;
|
import com.volmit.iris.engine.IrisComplex;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineFramework;
|
|
||||||
import com.volmit.iris.engine.modifier.IrisCaveModifier;
|
import com.volmit.iris.engine.modifier.IrisCaveModifier;
|
||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
@@ -86,12 +85,11 @@ public class IrisEntitySpawn implements IRare {
|
|||||||
Location l = switch (getReferenceSpawner().getGroup()) {
|
Location l = switch (getReferenceSpawner().getGroup()) {
|
||||||
case NORMAL -> new Location(c.getWorld(), x, hf + 1, z);
|
case NORMAL -> new Location(c.getWorld(), x, hf + 1, z);
|
||||||
case CAVE -> {
|
case CAVE -> {
|
||||||
IrisComplex comp = gen.getFramework().getComplex();
|
IrisComplex comp = gen.getComplex();
|
||||||
EngineFramework frame = gen.getFramework();
|
|
||||||
IrisBiome cave = comp.getCaveBiomeStream().get(x, z);
|
IrisBiome cave = comp.getCaveBiomeStream().get(x, z);
|
||||||
KList<Location> r = new KList<>();
|
KList<Location> r = new KList<>();
|
||||||
if (cave != null) {
|
if (cave != null) {
|
||||||
for (CaveResult i : ((IrisCaveModifier) frame.getCaveModifier()).genCaves(x, z)) {
|
for (CaveResult i : ((IrisCaveModifier) gen.getCaveModifier()).genCaves(x, z)) {
|
||||||
if (i.getCeiling() >= gen.getHeight() || i.getFloor() < 0 || i.getCeiling() - 2 <= i.getFloor()) {
|
if (i.getCeiling() >= gen.getHeight() || i.getFloor() < 0 || i.getCeiling() - 2 <= i.getFloor()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object.noise;
|
package com.volmit.iris.engine.object.noise;
|
||||||
|
|
||||||
import com.volmit.iris.engine.framework.EngineFramework;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
import com.volmit.iris.util.stream.ProceduralStream;
|
import com.volmit.iris.util.stream.ProceduralStream;
|
||||||
|
|
||||||
@@ -56,13 +56,13 @@ public enum IrisEngineStreamType {
|
|||||||
@Desc("Represents the identity of regions. Each region has a unique number (very large numbers)")
|
@Desc("Represents the identity of regions. Each region has a unique number (very large numbers)")
|
||||||
REGION_IDENTITY((f) -> f.getComplex().getRegionIdentityStream());
|
REGION_IDENTITY((f) -> f.getComplex().getRegionIdentityStream());
|
||||||
|
|
||||||
private final Function<EngineFramework, ProceduralStream<Double>> getter;
|
private final Function<Engine, ProceduralStream<Double>> getter;
|
||||||
|
|
||||||
IrisEngineStreamType(Function<EngineFramework, ProceduralStream<Double>> getter) {
|
IrisEngineStreamType(Function<Engine, ProceduralStream<Double>> getter) {
|
||||||
this.getter = getter;
|
this.getter = getter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProceduralStream<Double> get(EngineFramework engine) {
|
public ProceduralStream<Double> get(Engine engine) {
|
||||||
return getter.apply(engine);
|
return getter.apply(engine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object.noise;
|
package com.volmit.iris.engine.object.noise;
|
||||||
|
|
||||||
import com.volmit.iris.engine.framework.EngineFramework;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -26,28 +26,28 @@ import java.util.function.Function;
|
|||||||
@Desc("Represents a value from the engine")
|
@Desc("Represents a value from the engine")
|
||||||
public enum IrisEngineValueType {
|
public enum IrisEngineValueType {
|
||||||
@Desc("Represents actual height of the engine")
|
@Desc("Represents actual height of the engine")
|
||||||
ENGINE_HEIGHT((f) -> Double.valueOf(f.getEngine().getHeight())),
|
ENGINE_HEIGHT((f) -> Double.valueOf(f.getHeight())),
|
||||||
|
|
||||||
@Desc("Represents virtual bottom of the engine in the compound. If this engine is on top of another engine, it's min height would be at the maxHeight of the previous engine + 1")
|
@Desc("Represents virtual bottom of the engine in the compound. If this engine is on top of another engine, it's min height would be at the maxHeight of the previous engine + 1")
|
||||||
ENGINE_MIN_HEIGHT((f) -> Double.valueOf(f.getEngine().getMinHeight())),
|
ENGINE_MIN_HEIGHT((f) -> Double.valueOf(f.getMinHeight())),
|
||||||
|
|
||||||
@Desc("Represents virtual top of the engine in the compound. If this engine is below another engine, it's max height would be at the minHeight of the next engine - 1")
|
@Desc("Represents virtual top of the engine in the compound. If this engine is below another engine, it's max height would be at the minHeight of the next engine - 1")
|
||||||
ENGINE_MAX_HEIGHT((f) -> Double.valueOf(f.getEngine().getMaxHeight())),
|
ENGINE_MAX_HEIGHT((f) -> Double.valueOf(f.getMaxHeight())),
|
||||||
|
|
||||||
@Desc("Represents the position of the engine in the dimensional compound. The bottom (first) dimension stasts at 0. Each new dimension added stacks on top with n+1 for the id.")
|
@Desc("Represents the position of the engine in the dimensional compound. The bottom (first) dimension stasts at 0. Each new dimension added stacks on top with n+1 for the id.")
|
||||||
ENGINE_INDEX((f) -> Double.valueOf(f.getEngine().getIndex())),
|
ENGINE_INDEX((f) -> Double.valueOf(f.getIndex())),
|
||||||
|
|
||||||
@Desc("The fluid height defined in the dimension file")
|
@Desc("The fluid height defined in the dimension file")
|
||||||
FLUID_HEIGHT((f) -> Double.valueOf(f.getComplex().getFluidHeight())),
|
FLUID_HEIGHT((f) -> Double.valueOf(f.getComplex().getFluidHeight())),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final Function<EngineFramework, Double> getter;
|
private final Function<Engine, Double> getter;
|
||||||
|
|
||||||
IrisEngineValueType(Function<EngineFramework, Double> getter) {
|
IrisEngineValueType(Function<Engine, Double> getter) {
|
||||||
this.getter = getter;
|
this.getter = getter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double get(EngineFramework engine) {
|
public Double get(Engine engine) {
|
||||||
return getter.apply(engine);
|
return getter.apply(engine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ public class IrisExpressionLoad {
|
|||||||
|
|
||||||
public double getValue(RNG rng, IrisData data, double x, double z) {
|
public double getValue(RNG rng, IrisData data, double x, double z) {
|
||||||
if (engineValue != null) {
|
if (engineValue != null) {
|
||||||
return valueCache.aquire(() -> engineValue.get(data.getEngine().getFramework()));
|
return valueCache.aquire(() -> engineValue.get(data.getEngine()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engineStreamValue != null) {
|
if (engineStreamValue != null) {
|
||||||
return streamCache.aquire(() -> engineStreamValue.get(data.getEngine().getFramework())).get(x, z);
|
return streamCache.aquire(() -> engineStreamValue.get(data.getEngine())).get(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styleValue != null) {
|
if (styleValue != null) {
|
||||||
@@ -75,11 +75,11 @@ public class IrisExpressionLoad {
|
|||||||
|
|
||||||
public double getValue(RNG rng, IrisData data, double x, double y, double z) {
|
public double getValue(RNG rng, IrisData data, double x, double y, double z) {
|
||||||
if (engineValue != null) {
|
if (engineValue != null) {
|
||||||
return valueCache.aquire(() -> engineValue.get(data.getEngine().getFramework()));
|
return valueCache.aquire(() -> engineValue.get(data.getEngine()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engineStreamValue != null) {
|
if (engineStreamValue != null) {
|
||||||
return streamCache.aquire(() -> engineStreamValue.get(data.getEngine().getFramework())).get(x, z);
|
return streamCache.aquire(() -> engineStreamValue.get(data.getEngine())).get(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styleValue != null) {
|
if (styleValue != null) {
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ package com.volmit.iris.engine.scripting;
|
|||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import org.apache.bsf.BSFManager;
|
import org.apache.bsf.BSFManager;
|
||||||
|
|
||||||
public interface EngineExecutionEnvironment
|
public interface EngineExecutionEnvironment {
|
||||||
{
|
|
||||||
Engine getEngine();
|
Engine getEngine();
|
||||||
|
|
||||||
IrisScriptingAPI getAPI();
|
IrisScriptingAPI getAPI();
|
||||||
@@ -33,8 +32,7 @@ public interface EngineExecutionEnvironment
|
|||||||
|
|
||||||
Object evaluate(String script);
|
Object evaluate(String script);
|
||||||
|
|
||||||
default void close()
|
default void close() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.volmit.iris.core.project.loader.IrisData;
|
|||||||
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.engine.IrisComplex;
|
import com.volmit.iris.engine.IrisComplex;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineFramework;
|
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
import com.volmit.iris.engine.object.noise.IrisExpression;
|
import com.volmit.iris.engine.object.noise.IrisExpression;
|
||||||
@@ -41,70 +40,53 @@ public class IrisScriptingAPI {
|
|||||||
private Location location;
|
private Location location;
|
||||||
private Entity entity;
|
private Entity entity;
|
||||||
|
|
||||||
public IrisScriptingAPI(Engine engine)
|
public IrisScriptingAPI(Engine engine) {
|
||||||
{
|
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisData getData()
|
public IrisData getData() {
|
||||||
{
|
|
||||||
return getEngine().getData();
|
return getEngine().getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EngineFramework getFramework()
|
public IrisComplex getComplex() {
|
||||||
{
|
return getEngine().getComplex();
|
||||||
return getEngine().getFramework();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisComplex getComplex()
|
public long getSeed() {
|
||||||
{
|
|
||||||
return getFramework().getComplex();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getSeed()
|
|
||||||
{
|
|
||||||
return getEngine().getTarget().getWorld().seed();
|
return getEngine().getTarget().getWorld().seed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double expression(String expressionName, double x, double y, double z)
|
public double expression(String expressionName, double x, double y, double z) {
|
||||||
{
|
|
||||||
IrisExpression expression = getData().getExpressionLoader().load(expressionName);
|
IrisExpression expression = getData().getExpressionLoader().load(expressionName);
|
||||||
return expression.evaluate(getComplex().getRng(), x, y, z);
|
return expression.evaluate(getComplex().getRng(), x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double expression(String expressionName, double x, double z)
|
public double expression(String expressionName, double x, double z) {
|
||||||
{
|
|
||||||
IrisExpression expression = getData().getExpressionLoader().load(expressionName);
|
IrisExpression expression = getData().getExpressionLoader().load(expressionName);
|
||||||
return expression.evaluate(getComplex().getRng(), x, z);
|
return expression.evaluate(getComplex().getRng(), x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisBiome getBiomeAt(int x, int z)
|
public IrisBiome getBiomeAt(int x, int z) {
|
||||||
{
|
|
||||||
return getEngine().getSurfaceBiome(x, z);
|
return getEngine().getSurfaceBiome(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisDimension getDimension()
|
public IrisDimension getDimension() {
|
||||||
{
|
|
||||||
return getEngine().getDimension();
|
return getEngine().getDimension();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void info(String log)
|
public void info(String log) {
|
||||||
{
|
|
||||||
Iris.info(log);
|
Iris.info(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug(String log)
|
public void debug(String log) {
|
||||||
{
|
|
||||||
Iris.debug(log);
|
Iris.debug(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void warn(String log)
|
public void warn(String log) {
|
||||||
{
|
|
||||||
Iris.warn(log);
|
Iris.warn(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void error(String log)
|
public void error(String log) {
|
||||||
{
|
|
||||||
Iris.error(log);
|
Iris.error(log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import lombok.Data;
|
|||||||
public class IrisContext {
|
public class IrisContext {
|
||||||
private static ChronoLatch cl = new ChronoLatch(60000);
|
private static ChronoLatch cl = new ChronoLatch(60000);
|
||||||
private static KMap<Thread, IrisContext> context = new KMap<>();
|
private static KMap<Thread, IrisContext> context = new KMap<>();
|
||||||
|
private final Engine engine;
|
||||||
|
|
||||||
public static IrisContext get() {
|
public static IrisContext get() {
|
||||||
return context.get(Thread.currentThread());
|
return context.get(Thread.currentThread());
|
||||||
@@ -50,8 +51,6 @@ public class IrisContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Engine engine;
|
|
||||||
|
|
||||||
public void touch() {
|
public void touch() {
|
||||||
IrisContext.touch(this);
|
IrisContext.touch(this);
|
||||||
}
|
}
|
||||||
@@ -61,6 +60,6 @@ public class IrisContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IrisComplex getComplex() {
|
public IrisComplex getComplex() {
|
||||||
return engine.getFramework().getComplex();
|
return engine.getComplex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ReactiveFolder {
|
|||||||
|
|
||||||
if (checkCycle % 3 == 0 ? fw.checkModified() : fw.checkModifiedFast()) {
|
if (checkCycle % 3 == 0 ? fw.checkModified() : fw.checkModifiedFast()) {
|
||||||
for (File i : fw.getCreated()) {
|
for (File i : fw.getCreated()) {
|
||||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json")|| i.getName().endsWith(".js")) {
|
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".js")) {
|
||||||
modified = true;
|
modified = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public class ReactiveFolder {
|
|||||||
|
|
||||||
if (!modified) {
|
if (!modified) {
|
||||||
for (File i : fw.getChanged()) {
|
for (File i : fw.getChanged()) {
|
||||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json")|| i.getName().endsWith(".js")) {
|
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".js")) {
|
||||||
modified = true;
|
modified = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ public class ReactiveFolder {
|
|||||||
|
|
||||||
if (!modified) {
|
if (!modified) {
|
||||||
for (File i : fw.getDeleted()) {
|
for (File i : fw.getDeleted()) {
|
||||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json")|| i.getName().endsWith(".js")) {
|
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".js")) {
|
||||||
modified = true;
|
modified = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,7 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.mantle;
|
package com.volmit.iris.util.mantle;
|
||||||
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.collection.KMap;
|
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.data.Varint;
|
|
||||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||||
import com.volmit.iris.util.matter.IrisMatter;
|
import com.volmit.iris.util.matter.IrisMatter;
|
||||||
import com.volmit.iris.util.matter.Matter;
|
import com.volmit.iris.util.matter.Matter;
|
||||||
@@ -63,8 +60,7 @@ public class MantleChunk {
|
|||||||
int s = din.readByte();
|
int s = din.readByte();
|
||||||
int f = din.readByte();
|
int f = din.readByte();
|
||||||
|
|
||||||
for(int i = 0; i < f; i++)
|
for (int i = 0; i < f; i++) {
|
||||||
{
|
|
||||||
flags.add(din.readUTF());
|
flags.add(din.readUTF());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,21 +71,15 @@ public class MantleChunk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flag(String s, boolean f)
|
public void flag(String s, boolean f) {
|
||||||
{
|
if (f) {
|
||||||
if(f)
|
|
||||||
{
|
|
||||||
flags.add(s);
|
flags.add(s);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
flags.remove(s);
|
flags.remove(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFlagged(String s)
|
public boolean isFlagged(String s) {
|
||||||
{
|
|
||||||
return flags.contains(s);
|
return flags.contains(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,8 +152,7 @@ public class MantleChunk {
|
|||||||
dos.writeByte(sections.length());
|
dos.writeByte(sections.length());
|
||||||
dos.writeByte(flags.size());
|
dos.writeByte(flags.size());
|
||||||
|
|
||||||
for(String i : flags)
|
for (String i : flags) {
|
||||||
{
|
|
||||||
dos.writeUTF(i);
|
dos.writeUTF(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,10 +37,8 @@ public class ZoneMatter extends RawMatter<IrisFeaturePositional> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRaw(int x, int y, int z, IrisFeaturePositional t) {
|
public void setRaw(int x, int y, int z, IrisFeaturePositional t) {
|
||||||
for(int i = 0; i < getHeight(); i++)
|
for (int i = 0; i < getHeight(); i++) {
|
||||||
{
|
if (get(x, i, z) == null) {
|
||||||
if(get(x, i, z) == null)
|
|
||||||
{
|
|
||||||
super.setRaw(x, i, z, t);
|
super.setRaw(x, i, z, t);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user