This commit is contained in:
Daniel Mills 2021-07-27 14:45:19 -04:00
parent 9a7dcc8c1a
commit d7cda90acd
64 changed files with 238 additions and 380 deletions

View File

@ -565,7 +565,7 @@ public class Iris extends VolmitPlugin implements Listener {
public static void reportErrorChunk(int x, int z, Throwable e, String extra) { public static void reportErrorChunk(int x, int z, Throwable e, String extra) {
if (IrisSettings.get().getGeneral().isDebug()) { if (IrisSettings.get().getGeneral().isDebug()) {
File f = instance.getDataFile("debug", "chunk-errors", "chunk."+ x + "." + z + ".txt"); File f = instance.getDataFile("debug", "chunk-errors", "chunk." + x + "." + z + ".txt");
if (!f.exists()) { if (!f.exists()) {
J.attempt(() -> { J.attempt(() -> {

View File

@ -21,7 +21,6 @@ package com.volmit.iris.core;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
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.EngineParallaxManager;
import com.volmit.iris.engine.framework.IrisAccess; import com.volmit.iris.engine.framework.IrisAccess;
import com.volmit.iris.engine.object.IrisFeaturePositional; import com.volmit.iris.engine.object.IrisFeaturePositional;
import com.volmit.iris.util.board.BoardManager; import com.volmit.iris.util.board.BoardManager;
@ -31,7 +30,6 @@ import com.volmit.iris.util.board.ScoreDirection;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.format.C; import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form; import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.RollingSequence; import com.volmit.iris.util.math.RollingSequence;
import com.volmit.iris.util.scheduling.ChronoLatch; import com.volmit.iris.util.scheduling.ChronoLatch;
import com.volmit.iris.util.scheduling.J; import com.volmit.iris.util.scheduling.J;
@ -106,8 +104,7 @@ public class IrisBoardManager implements BoardProvider, Listener {
int y = player.getLocation().getBlockY(); int y = player.getLocation().getBlockY();
int z = player.getLocation().getBlockZ(); int z = player.getLocation().getBlockZ();
if(g.getCompound() == null) if (g.getCompound() == null) {
{
v.add("Loading..."); v.add("Loading...");
return v; return v;
} }

View File

@ -21,10 +21,8 @@ package com.volmit.iris.core;
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.nms.INMS; import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.core.pregenerator.PregenTask;
import com.volmit.iris.core.report.Report; import com.volmit.iris.core.report.Report;
import com.volmit.iris.core.report.ReportType; import com.volmit.iris.core.report.ReportType;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.core.tools.IrisWorldCreator; import com.volmit.iris.core.tools.IrisWorldCreator;
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;
@ -53,7 +51,6 @@ import org.zeroturnaround.zip.ZipUtil;
import java.awt.*; import java.awt.*;
import java.io.File; import java.io.File;
import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
@ -77,12 +74,8 @@ public class IrisProject {
MultiBurst.burst.burst(collectFiles("json").convert((i) -> () -> { MultiBurst.burst.burst(collectFiles("json").convert((i) -> () -> {
try { try {
new JSONObject(IO.readAll(i)); new JSONObject(IO.readAll(i));
} } catch (Throwable e) {
synchronized (reports) {
catch(Throwable e)
{
synchronized (reports)
{
reports.add(Report.builder() reports.add(Report.builder()
.title("Invalid Json: " + i.getName()) .title("Invalid Json: " + i.getName())
.message(i.getAbsolutePath() + e.getMessage()) .message(i.getAbsolutePath() + e.getMessage())
@ -94,18 +87,14 @@ public class IrisProject {
})); }));
try { try {
if(activeProvider != null && activeProvider.getCompound() != null) if (activeProvider != null && activeProvider.getCompound() != null) {
{
for (int i = 0; i < getActiveProvider().getCompound().getSize(); i++) { for (int i = 0; i < getActiveProvider().getCompound().getSize(); i++) {
Engine e = getActiveProvider().getCompound().getEngine(i); Engine e = getActiveProvider().getCompound().getEngine(i);
IrisDimension dim = e.getDimension(); IrisDimension dim = e.getDimension();
reports.add(scanForErrors(dim)); reports.add(scanForErrors(dim));
} }
} }
} } catch (Throwable e) {
catch(Throwable e)
{
reports.add(Report.builder() reports.add(Report.builder()
.title("Failed to check all errors") .title("Failed to check all errors")
.message("There may be some json errors, correct those first") .message("There may be some json errors, correct those first")
@ -228,15 +217,12 @@ public class IrisProject {
KList<Report> reports = scanForErrors(); KList<Report> reports = scanForErrors();
sender.sendMessage("There are " + reports.size() + " problems detected with this project. See console!"); sender.sendMessage("There are " + reports.size() + " problems detected with this project. See console!");
Iris.error("==========================================================="); Iris.error("===========================================================");
for(Report i : reports) for (Report i : reports) {
{ if (i.getType().equals(ReportType.ERROR)) {
if(i.getType().equals(ReportType.ERROR))
{
hasError = true; hasError = true;
} }
switch (i.getType()) switch (i.getType()) {
{
case ERROR -> Iris.error(i.toString()); case ERROR -> Iris.error(i.toString());
case SEVERE_WARNING -> Iris.warn(i.toString()); case SEVERE_WARNING -> Iris.warn(i.toString());
case WARNING -> Iris.warn(i.toString()); case WARNING -> Iris.warn(i.toString());
@ -244,16 +230,12 @@ public class IrisProject {
} }
} }
Iris.error("==========================================================="); Iris.error("===========================================================");
} } catch (Throwable e) {
catch(Throwable e)
{
hasError = true; hasError = true;
e.printStackTrace(); e.printStackTrace();
} }
if(hasError) if (hasError) {
{
return; return;
} }
@ -499,22 +481,19 @@ public class IrisProject {
//TODO: EXPORT JIGSAW PIECES FROM STRUCTURES //TODO: EXPORT JIGSAW PIECES FROM STRUCTURES
dimension.getFeatures().forEach((i) -> { dimension.getFeatures().forEach((i) -> {
if (i.getZone().getCustomBiome() != null) if (i.getZone().getCustomBiome() != null) {
{
biomes.add(dm.getBiomeLoader().load(i.getZone().getCustomBiome())); biomes.add(dm.getBiomeLoader().load(i.getZone().getCustomBiome()));
} }
}); });
dimension.getSpecificFeatures().forEach((i) -> { dimension.getSpecificFeatures().forEach((i) -> {
if (i.getFeature().getCustomBiome() != null) if (i.getFeature().getCustomBiome() != null) {
{
biomes.add(dm.getBiomeLoader().load(i.getFeature().getCustomBiome())); biomes.add(dm.getBiomeLoader().load(i.getFeature().getCustomBiome()));
} }
}); });
dimension.getRegions().forEach((i) -> regions.add(dm.getRegionLoader().load(i))); dimension.getRegions().forEach((i) -> regions.add(dm.getRegionLoader().load(i)));
regions.forEach((r) -> { regions.forEach((r) -> {
r.getFeatures().forEach((i) -> { r.getFeatures().forEach((i) -> {
if (i.getZone().getCustomBiome() != null) if (i.getZone().getCustomBiome() != null) {
{
biomes.add(dm.getBiomeLoader().load(i.getZone().getCustomBiome())); biomes.add(dm.getBiomeLoader().load(i.getZone().getCustomBiome()));
} }
}); });
@ -529,12 +508,10 @@ public class IrisProject {
dimension.getEntitySpawnOverrides().forEach((sp) -> entities.add(dm.getEntityLoader().load(sp.getEntity()))); dimension.getEntitySpawnOverrides().forEach((sp) -> entities.add(dm.getEntityLoader().load(sp.getEntity())));
biomes.forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(dm.getEntityLoader().load(sp.getEntity())))); biomes.forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(dm.getEntityLoader().load(sp.getEntity()))));
for(int f = 0; f < IrisSettings.get().getGenerator().getMaxBiomeChildDepth(); f++) for (int f = 0; f < IrisSettings.get().getGenerator().getMaxBiomeChildDepth(); f++) {
{
biomes.copy().forEach((r) -> { biomes.copy().forEach((r) -> {
r.getFeatures().forEach((i) -> { r.getFeatures().forEach((i) -> {
if (i.getZone().getCustomBiome() != null) if (i.getZone().getCustomBiome() != null) {
{
biomes.add(dm.getBiomeLoader().load(i.getZone().getCustomBiome())); biomes.add(dm.getBiomeLoader().load(i.getZone().getCustomBiome()));
} }
}); });

View File

@ -20,12 +20,8 @@ package com.volmit.iris.core.command;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.format.C;
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 com.volmit.iris.util.scheduling.J;
import java.util.Arrays;
public class CommandIrisBitwise extends MortarCommand { public class CommandIrisBitwise extends MortarCommand {
public CommandIrisBitwise() { public CommandIrisBitwise() {
@ -43,19 +39,15 @@ public class CommandIrisBitwise extends MortarCommand {
@Override @Override
public boolean handle(VolmitSender sender, String[] args) { public boolean handle(VolmitSender sender, String[] args) {
if(args.length != 3) if (args.length != 3) {
{
sender.sendMessage("/iris bw " + getArgsUsage()); sender.sendMessage("/iris bw " + getArgsUsage());
} }
try try {
{ if (args[0].contains(",")) {
if(args[0].contains(","))
{
KList<Integer> r = new KList<>(); KList<Integer> r = new KList<>();
for(String i : args[0].split("\\Q,\\E")) for (String i : args[0].split("\\Q,\\E")) {
{
int a = Integer.parseInt(i); int a = Integer.parseInt(i);
String op = args[1]; String op = args[1];
int b = Integer.parseInt(args[2]); int b = Integer.parseInt(args[2]);
@ -75,15 +67,11 @@ public class CommandIrisBitwise extends MortarCommand {
} }
} }
} }
;
r.add(v); r.add(v);
sender.sendMessage("Result: " + r.toString(",")); sender.sendMessage("Result: " + r.toString(","));
} }
} } else {
else
{
int a = Integer.parseInt(args[0]); int a = Integer.parseInt(args[0]);
String op = args[1]; String op = args[1];
int b = Integer.parseInt(args[2]); int b = Integer.parseInt(args[2]);
@ -103,14 +91,10 @@ public class CommandIrisBitwise extends MortarCommand {
} }
} }
} }
;
sender.sendMessage("Result: " + v); sender.sendMessage("Result: " + v);
} }
} } catch (Throwable ignored) {
catch(Throwable ignored)
{
} }

View File

@ -46,9 +46,9 @@ public class CommandIrisJigsawPlace extends MortarCommand {
IrisDataManager data = IrisWorlds.access(sender.player().getWorld()).getData(); IrisDataManager data = IrisWorlds.access(sender.player().getWorld()).getData();
if (data == null) { if (data == null) {
sender.sendMessage("Tab complete options only work for jigsaw structures while in an Iris world."); sender.sendMessage("Tab complete options only work for jigsaw structures while in an Iris world.");
} else if(args.length == 0) { } else if (args.length == 0) {
list.add(data.getJigsawStructureLoader().getPossibleKeys()); list.add(data.getJigsawStructureLoader().getPossibleKeys());
}else if(args.length == 1) { } else if (args.length == 1) {
list.add(data.getJigsawStructureLoader().getPossibleKeys(args[0])); list.add(data.getJigsawStructureLoader().getPossibleKeys(args[0]));
} }
} }

View File

@ -33,8 +33,6 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.io.File;
public class CommandIrisObjectPaste extends MortarCommand { public class CommandIrisObjectPaste extends MortarCommand {
public CommandIrisObjectPaste() { public CommandIrisObjectPaste() {
super("paste", "pasta", "place", "p"); super("paste", "pasta", "place", "p");

View File

@ -19,10 +19,8 @@
package com.volmit.iris.core.command.studio; package com.volmit.iris.core.command.studio;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisDataManager;
import com.volmit.iris.core.IrisSettings; import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.gui.NoiseExplorerGUI; import com.volmit.iris.core.gui.NoiseExplorerGUI;
import com.volmit.iris.core.tools.IrisWorlds;
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;

View File

@ -43,9 +43,9 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand {
IrisDataManager data = IrisWorlds.access(sender.player().getWorld()).getData(); IrisDataManager data = IrisWorlds.access(sender.player().getWorld()).getData();
if (data == null) { if (data == null) {
sender.sendMessage("Issue when loading tab completions. No data found (?)"); sender.sendMessage("Issue when loading tab completions. No data found (?)");
} else if(args.length == 0) { } else if (args.length == 0) {
list.add(data.getGeneratorLoader().getPossibleKeys()); list.add(data.getGeneratorLoader().getPossibleKeys());
}else if(args.length == 1) { } else if (args.length == 1) {
list.add(data.getGeneratorLoader().getPossibleKeys(args[0])); list.add(data.getGeneratorLoader().getPossibleKeys(args[0]));
} }
} }

View File

@ -37,7 +37,6 @@ import org.bukkit.entity.Player;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
public class CommandIrisStudioGoto extends MortarCommand { public class CommandIrisStudioGoto extends MortarCommand {
public CommandIrisStudioGoto() { public CommandIrisStudioGoto() {
@ -53,10 +52,10 @@ public class CommandIrisStudioGoto extends MortarCommand {
IrisDataManager data = IrisWorlds.access(sender.player().getWorld()).getData(); IrisDataManager data = IrisWorlds.access(sender.player().getWorld()).getData();
if (data == null) { if (data == null) {
sender.sendMessage("Issue when loading tab completions. No data found (?)"); sender.sendMessage("Issue when loading tab completions. No data found (?)");
} else if(args.length == 0) { } else if (args.length == 0) {
list.add(data.getBiomeLoader().getPossibleKeys()); list.add(data.getBiomeLoader().getPossibleKeys());
list.add(data.getRegionLoader().getPossibleKeys()); list.add(data.getRegionLoader().getPossibleKeys());
}else if(args.length == 1) { } else if (args.length == 1) {
list.add(data.getBiomeLoader().getPossibleKeys(args[0])); list.add(data.getBiomeLoader().getPossibleKeys(args[0]));
list.add(data.getRegionLoader().getPossibleKeys(args[0])); list.add(data.getRegionLoader().getPossibleKeys(args[0]));
} }

View File

@ -63,12 +63,12 @@ public class CommandIrisStudioHotload extends MortarCommand {
} }
IrisAccess worldAccess = IrisWorlds.access(world); IrisAccess worldAccess = IrisWorlds.access(world);
if (worldAccess == null){ if (worldAccess == null) {
sender.sendMessage("Could not gain access to the world you are in"); sender.sendMessage("Could not gain access to the world you are in");
} else { } else {
worldAccess.hotload(); worldAccess.hotload();
} }
return true; return true;
} }

View File

@ -55,28 +55,21 @@ public class CommandIrisVerify extends MortarCommand {
File r = new File(folder, "region"); File r = new File(folder, "region");
BurstExecutor e = MultiBurst.burst.burst(r.listFiles().length); BurstExecutor e = MultiBurst.burst.burst(r.listFiles().length);
AtomicInteger f = new AtomicInteger(0); AtomicInteger f = new AtomicInteger(0);
for(File i : r.listFiles()) for (File i : r.listFiles()) {
{
e.queue(() -> { e.queue(() -> {
MCAFile file = null; MCAFile file = null;
try { try {
file = MCAUtil.read(i); file = MCAUtil.read(i);
int rx = Integer.valueOf(i.getName().split("\\Q.\\E")[1]); int rx = Integer.valueOf(i.getName().split("\\Q.\\E")[1]);
int rz = Integer.valueOf(i.getName().split("\\Q.\\E")[2]); int rz = Integer.valueOf(i.getName().split("\\Q.\\E")[2]);
for(int j = 0; j < 32; j++) for (int j = 0; j < 32; j++) {
{ for (int k = 0; k < 32; k++) {
for(int k = 0; k < 32; k++)
{
f.incrementAndGet(); f.incrementAndGet();
Chunk c = file.getChunk(j, k); Chunk c = file.getChunk(j, k);
if(c == null) if (c == null) {
{ sender.sendMessage("Found Missing Chunk " + i.getName() + ", chunk #" + j + "," + k + " (see " + (((rx << 5) << 4) + (j << 4)) + "," + (((rz << 5) << 4) + (k << 4)));
sender.sendMessage("Found Missing Chunk " + i.getName() + ", chunk #" + j + "," + k + " (see " + (((rx << 5)<<4)+(j<<4)) + "," + (((rz << 5)<<4)+(k<<4))); } else if (c.sectionCount() == 0) {
} sender.sendMessage("Found Missing Chunk (valid, but 0 sections) " + i.getName() + ", chunk #" + j + "," + k + " (see " + (((rx << 5) << 4) + (j << 4)) + "," + (((rz << 5) << 4) + (k << 4)));
else if(c.sectionCount() == 0)
{
sender.sendMessage("Found Missing Chunk (valid, but 0 sections) " + i.getName() + ", chunk #" + j + "," + k + " (see " + (((rx << 5)<<4)+(j<<4)) + "," + (((rz << 5)<<4)+(k<<4)));
} }
} }
} }

View File

@ -19,8 +19,6 @@
package com.volmit.iris.core.gui; package com.volmit.iris.core.gui;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.engine.hunk.Hunk;
import com.volmit.iris.engine.hunk.storage.ArrayHunk;
import com.volmit.iris.engine.noise.CNG; import com.volmit.iris.engine.noise.CNG;
import com.volmit.iris.engine.object.NoiseStyle; import com.volmit.iris.engine.object.NoiseStyle;
import com.volmit.iris.engine.parallel.BurstExecutor; import com.volmit.iris.engine.parallel.BurstExecutor;
@ -30,7 +28,6 @@ import com.volmit.iris.util.function.Function2;
import com.volmit.iris.util.math.M; import com.volmit.iris.util.math.M;
import com.volmit.iris.util.math.RNG; import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.math.RollingSequence; import com.volmit.iris.util.math.RollingSequence;
import com.volmit.iris.util.scheduling.GroupedExecutor;
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;
@ -179,29 +176,25 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener {
} }
if (img == null) { if (img == null) {
img = new BufferedImage(w/accuracy, h/accuracy, BufferedImage.TYPE_INT_RGB); img = new BufferedImage(w / accuracy, h / accuracy, BufferedImage.TYPE_INT_RGB);
} }
BurstExecutor e = gx.burst(w); BurstExecutor e = gx.burst(w);
for (int x = 0; x < w/accuracy; x ++) { for (int x = 0; x < w / accuracy; x++) {
int xx = x; int xx = x;
int finalAccuracy = accuracy; int finalAccuracy = accuracy;
e.queue(() -> { e.queue(() -> {
for (int z = 0; z < h/finalAccuracy; z++) { for (int z = 0; z < h / finalAccuracy; z++) {
double n = generator != null ? generator.apply(((xx*finalAccuracy) * ascale) + oxp, ((z*finalAccuracy) * ascale) + ozp) : cng.noise(((xx*finalAccuracy) * ascale) + oxp, ((z*finalAccuracy) * ascale) + ozp); double n = generator != null ? generator.apply(((xx * finalAccuracy) * ascale) + oxp, ((z * finalAccuracy) * ascale) + ozp) : cng.noise(((xx * finalAccuracy) * ascale) + oxp, ((z * finalAccuracy) * ascale) + ozp);
n = n > 1 ? 1 : n < 0 ? 0 : n; n = n > 1 ? 1 : n < 0 ? 0 : n;
try try {
{
Color color = colorMode ? Color.getHSBColor((float) (n), 1f - (float) (n * n * n * n * n * n), 1f - (float) n) : Color.getHSBColor(0f, 0f, (float) n); Color color = colorMode ? Color.getHSBColor((float) (n), 1f - (float) (n * n * n * n * n * n), 1f - (float) n) : Color.getHSBColor(0f, 0f, (float) n);
int rgb = color.getRGB(); int rgb = color.getRGB();
img.setRGB(xx, z, rgb); img.setRGB(xx, z, rgb);
} } catch (Throwable xxx) {
catch(Throwable xxx)
{
} }
} }
@ -209,7 +202,7 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener {
} }
e.complete(1000); e.complete(1000);
gg.drawImage(img, 0, 0, getParent().getWidth()*accuracy, getParent().getHeight()*accuracy, (img, infoflags, x, y, width, height) -> true); gg.drawImage(img, 0, 0, getParent().getWidth() * accuracy, getParent().getHeight() * accuracy, (img, infoflags, x, y, width, height) -> true);
} }
p.end(); p.end();

View File

@ -48,14 +48,14 @@ public class PregeneratorJob implements PregenListener {
private static final Color COLOR_GENERATED = parseColor("#34eb93"); private static final Color COLOR_GENERATED = parseColor("#34eb93");
private JFrame frame; private JFrame frame;
private final PregenTask task; private final PregenTask task;
private boolean saving; private final boolean saving;
private KList<Consumer<Double>> onProgress = new KList<>(); private final KList<Consumer<Double>> onProgress = new KList<>();
private KList<Runnable> whenDone = new KList<>(); private final KList<Runnable> whenDone = new KList<>();
private final IrisPregenerator pregenerator; private final IrisPregenerator pregenerator;
private PregenRenderer renderer; private PregenRenderer renderer;
private String[] info; private String[] info;
private Position2 min; private final Position2 min;
private Position2 max; private final Position2 max;
public PregeneratorJob(PregenTask task, PregeneratorMethod method) { public PregeneratorJob(PregenTask task, PregeneratorMethod method) {
instance = this; instance = this;

View File

@ -32,10 +32,9 @@ public class INMS {
//@builder //@builder
private static final KMap<String, Class<? extends INMSBinding>> bindings = new KMap<String, Class<? extends INMSBinding>>() private static final KMap<String, Class<? extends INMSBinding>> bindings = new KMap<String, Class<? extends INMSBinding>>()
.qput("v1_17_R1", NMSBinding17_1.class) .qput("v1_17_R1", NMSBinding17_1.class)
.qput("v1_16_R3", NMSBinding16_3 .class) .qput("v1_16_R3", NMSBinding16_3.class)
.qput("v1_16_R2", NMSBinding16_2.class) .qput("v1_16_R2", NMSBinding16_2.class)
.qput("v1_16_R1", NMSBinding16_1.class) .qput("v1_16_R1", NMSBinding16_1.class);
;
//@done //@done
private static final INMSBinding binding = bind(); private static final INMSBinding binding = bind();

View File

@ -21,7 +21,8 @@ package com.volmit.iris.core.nms.v16_1;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.nms.INMSBinding; import com.volmit.iris.core.nms.INMSBinding;
import com.volmit.iris.util.collection.KMap; import com.volmit.iris.util.collection.KMap;
import net.minecraft.server.v1_16_R1.*; import net.minecraft.server.v1_16_R1.BiomeBase;
import net.minecraft.server.v1_16_R1.IRegistryWritable;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;

View File

@ -24,23 +24,18 @@ import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
import java.lang.reflect.Method;
public class NMSBinding1X implements INMSBinding { public class NMSBinding1X implements INMSBinding {
private static final boolean supportsCustomHeight = testCustomHeight(); private static final boolean supportsCustomHeight = testCustomHeight();
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")
private static boolean testCustomHeight() { private static boolean testCustomHeight() {
try try {
{ if (World.class.getDeclaredMethod("getMaxHeight") != null && World.class.getDeclaredMethod("getMinHeight") != null)
if(World.class.getDeclaredMethod("getMaxHeight") != null && World.class.getDeclaredMethod("getMinHeight") != null); ;
{ {
return true; return true;
} }
} } catch (Throwable ignored) {
catch(Throwable ignored)
{
} }

View File

@ -38,15 +38,15 @@ import java.util.concurrent.atomic.AtomicInteger;
public class SyndicatePregenMethod implements PregeneratorMethod { public class SyndicatePregenMethod implements PregeneratorMethod {
@Getter @Getter
private String address; private final String address;
private String nickname; private String nickname;
private int port; private final int port;
private String password; private final String password;
private IrisDimension dimension; private final IrisDimension dimension;
private boolean ready = false; private boolean ready = false;
private File worldFolder; private final File worldFolder;
private UUID pack = UUID.randomUUID(); private final UUID pack = UUID.randomUUID();
private long seed; private final long seed;
public SyndicatePregenMethod(String nickname, File worldFolder, String address, int port, String password, IrisDimension dimension, long seed) { public SyndicatePregenMethod(String nickname, File worldFolder, String address, int port, String password, IrisDimension dimension, long seed) {
this.seed = seed; this.seed = seed;

View File

@ -29,10 +29,10 @@ import java.util.function.Consumer;
@Builder @Builder
public class SyndicateClient { public class SyndicateClient {
private String address; private final String address;
private int port; private final int port;
private SyndicateCommand command; private final SyndicateCommand command;
private Consumer<DataOutputStream> output; private final Consumer<DataOutputStream> output;
public void go(Consumer2<SyndicateCommand, DataInputStream> handler) throws Throwable { public void go(Consumer2<SyndicateCommand, DataInputStream> handler) throws Throwable {
Socket socket = new Socket(address, port); Socket socket = new Socket(address, port);

View File

@ -35,15 +35,15 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
public class SyndicateServer extends Thread implements PregenListener { public class SyndicateServer extends Thread implements PregenListener {
private int port; private final int port;
private String password; private final String password;
private boolean busy; private boolean busy;
private int tc; private final int tc;
private HeadlessGenerator generator; private HeadlessGenerator generator;
private ServerSocket server; private final ServerSocket server;
private File cache; private final File cache;
private UUID currentId = null; private UUID currentId = null;
private AtomicInteger g = new AtomicInteger(0); private final AtomicInteger g = new AtomicInteger(0);
private File lastGeneratedRegion = null; private File lastGeneratedRegion = null;
public SyndicateServer(File cache, int port, String password, int tc) throws IOException { public SyndicateServer(File cache, int port, String password, int tc) throws IOException {
@ -115,7 +115,7 @@ public class SyndicateServer extends Thread implements PregenListener {
fos.close(); fos.close();
ZipUtil.unpack(cacheload, cachestore); ZipUtil.unpack(cacheload, cachestore);
cacheload.deleteOnExit(); cacheload.deleteOnExit();
HeadlessWorld w = new HeadlessWorld("turbo/" + id.toString(), ((SyndicateInstallPack) command).getDimension(), ((SyndicateInstallPack) command).getSeed()); HeadlessWorld w = new HeadlessWorld("turbo/" + id, ((SyndicateInstallPack) command).getDimension(), ((SyndicateInstallPack) command).getSeed());
w.setStudio(true); w.setStudio(true);
generator = w.generate(); generator = w.generate();
return new SyndicateOK(); return new SyndicateOK();

View File

@ -38,7 +38,6 @@ import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer; import java.util.function.Consumer;
/** /**

View File

@ -39,7 +39,6 @@ import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
@Data @Data
public class IrisComplex implements DataProvider { public class IrisComplex implements DataProvider {
@ -117,8 +116,7 @@ public class IrisComplex implements DataProvider {
generators = new KList<>(); generators = new KList<>();
focus = engine.getFocus(); focus = engine.getFocus();
if(focus != null) if (focus != null) {
{
focus.setInferredType(InferredType.LAND); focus.setInferredType(InferredType.LAND);
} }
@ -216,31 +214,27 @@ 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.getFramework().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) {
{ bx.setInferredType(b.getInferredType());
bx.setInferredType(b.getInferredType()); return bx;
return bx; }
} }
}
return b; return b;
}) })
.cache2D(cacheSize) : heightStream .cache2D(cacheSize) : heightStream
.convertAware2D((h, x, z) -> .convertAware2D((h, x, z) ->
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.getFramework().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) {
{
bx.setInferredType(b.getInferredType()); bx.setInferredType(b.getInferredType());
return bx; return bx;
} }

View File

@ -26,7 +26,6 @@ import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
import com.volmit.iris.engine.object.IrisDecorator; import com.volmit.iris.engine.object.IrisDecorator;
import com.volmit.iris.engine.object.IrisObjectPlacement; import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.parallel.BurstExecutor; import com.volmit.iris.engine.parallel.BurstExecutor;
import com.volmit.iris.engine.parallel.MultiBurst;
import com.volmit.iris.util.documentation.ChunkCoordinates; import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.math.RNG; import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.scheduling.J; import com.volmit.iris.util.scheduling.J;
@ -169,13 +168,11 @@ public class IrisEngine extends BlockPopulator implements Engine {
// makes the biome stream, interpolation & noise engine run in parallel without mca // makes the biome stream, interpolation & noise engine run in parallel without mca
BurstExecutor b = burst().burst(16); BurstExecutor b = burst().burst(16);
for(int i = 0; i < vblocks.getWidth(); i++) for (int i = 0; i < vblocks.getWidth(); i++) {
{
int finalI = i; int finalI = i;
b.queue(() -> { b.queue(() -> {
for(int j = 0; j < vblocks.getDepth(); j++) for (int j = 0; j < vblocks.getDepth(); j++) {
{ getFramework().getComplex().getTrueBiomeStream().get(x + finalI, z + j);
getFramework().getComplex().getTrueBiomeStream().get(x+ finalI,z+j);
} }
}); });
} }

View File

@ -51,7 +51,7 @@ import java.util.List;
public class IrisEngineCompound implements EngineCompound { public class IrisEngineCompound implements EngineCompound {
@Getter @Getter
private IrisWorld world; private final IrisWorld world;
private final AtomicRollingSequence wallClock; private final AtomicRollingSequence wallClock;

View File

@ -25,7 +25,10 @@ import com.volmit.iris.engine.actuator.IrisDecorantActuator;
import com.volmit.iris.engine.actuator.IrisTerrainIslandActuator; import com.volmit.iris.engine.actuator.IrisTerrainIslandActuator;
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator; import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
import com.volmit.iris.engine.framework.*; import com.volmit.iris.engine.framework.*;
import com.volmit.iris.engine.modifier.*; 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.scheduling.ChronoLatch; import com.volmit.iris.util.scheduling.ChronoLatch;
import lombok.Getter; import lombok.Getter;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;

View File

@ -18,7 +18,6 @@
package com.volmit.iris.engine.actuator; package com.volmit.iris.engine.actuator;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.decorator.*; import com.volmit.iris.engine.decorator.*;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.EngineAssignedActuator; import com.volmit.iris.engine.framework.EngineAssignedActuator;

View File

@ -42,7 +42,7 @@ public class IrisTerrainIslandActuator extends EngineAssignedActuator<BlockData>
private final boolean carving; private final boolean carving;
private final boolean hasUnder; private final boolean hasUnder;
@Getter @Getter
private int lastBedrock = -1; private final int lastBedrock = -1;
public IrisTerrainIslandActuator(Engine engine) { public IrisTerrainIslandActuator(Engine engine) {
super(engine, "TerrainIsland"); super(engine, "TerrainIsland");

View File

@ -144,8 +144,7 @@ public class B {
BlockData bx = Bukkit.createBlockData(ix); BlockData bx = Bukkit.createBlockData(ix);
if(bx instanceof Leaves) if (bx instanceof Leaves) {
{
((Leaves) bx).setPersistent(true); ((Leaves) bx).setPersistent(true);
} }

View File

@ -33,13 +33,13 @@ import org.jetbrains.annotations.NotNull;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
public class MCATerrainChunk implements TerrainChunk { public class MCATerrainChunk implements TerrainChunk {
private NBTWorld writer; private final NBTWorld writer;
private BiomeBaseInjector injector; private final BiomeBaseInjector injector;
private int ox; private final int ox;
private int oz; private final int oz;
private int minHeight; private final int minHeight;
private int maxHeight; private final int maxHeight;
private Chunk mcaChunk; private final Chunk mcaChunk;
@Override @Override
public BiomeBaseInjector getBiomeBaseInjector() { public BiomeBaseInjector getBiomeBaseInjector() {

View File

@ -93,27 +93,19 @@ public class ResourceLoader<T extends IrisRegistrant> {
J.a(() -> Iris.warn("Couldn't Load " + resourceTypeName + " file: " + path.getPath() + ": " + e.getMessage())); J.a(() -> Iris.warn("Couldn't Load " + resourceTypeName + " file: " + path.getPath() + ": " + e.getMessage()));
} }
private KList<File> matchAllFiles(File root, Predicate<File> f) private KList<File> matchAllFiles(File root, Predicate<File> f) {
{
KList<File> fx = new KList<>(); KList<File> fx = new KList<>();
matchFiles(root, fx, f); matchFiles(root, fx, f);
return fx; return fx;
} }
private void matchFiles(File at, KList<File> files, Predicate<File> f) private void matchFiles(File at, KList<File> files, Predicate<File> f) {
{ if (at.isDirectory()) {
if(at.isDirectory()) for (File i : at.listFiles()) {
{
for(File i : at.listFiles())
{
matchFiles(i, files, f); matchFiles(i, files, f);
} }
} } else {
if (f.test(at)) {
else
{
if(f.test(at))
{
files.add(at); files.add(at);
} }
} }
@ -127,10 +119,8 @@ public class ResourceLoader<T extends IrisRegistrant> {
Iris.info("Building " + resourceTypeName + " Registry Lists"); Iris.info("Building " + resourceTypeName + " Registry Lists");
KSet<String> m = new KSet<>(); KSet<String> m = new KSet<>();
for(File i : getFolders()) for (File i : getFolders()) {
{ for (File j : matchAllFiles(i, (f) -> f.getName().endsWith(".json"))) {
for(File j : matchAllFiles(i, (f) -> f.getName().endsWith(".json")))
{
m.add(i.toURI().relativize(j.toURI()).getPath().replaceAll("\\Q.json\\E", "")); m.add(i.toURI().relativize(j.toURI()).getPath().replaceAll("\\Q.json\\E", ""));
} }
} }
@ -308,10 +298,8 @@ public class ResourceLoader<T extends IrisRegistrant> {
public KList<String> getPossibleKeys(String arg) { public KList<String> getPossibleKeys(String arg) {
KList<String> f = new KList<>(); KList<String> f = new KList<>();
for(String i : getPossibleKeys()) for (String i : getPossibleKeys()) {
{ if (i.equalsIgnoreCase(arg) || i.toLowerCase(Locale.ROOT).startsWith(arg.toLowerCase(Locale.ROOT)) || i.toLowerCase(Locale.ROOT).contains(arg.toLowerCase(Locale.ROOT)) || arg.toLowerCase(Locale.ROOT).contains(i.toLowerCase(Locale.ROOT))) {
if(i.equalsIgnoreCase(arg) || i.toLowerCase(Locale.ROOT).startsWith(arg.toLowerCase(Locale.ROOT)) || i.toLowerCase(Locale.ROOT).contains(arg.toLowerCase(Locale.ROOT)) || arg.toLowerCase(Locale.ROOT).contains(i.toLowerCase(Locale.ROOT)))
{
f.add(i); f.add(i);
} }
} }

View File

@ -634,8 +634,7 @@ public class Chunk {
} }
public void cleanupPalettesAndBlockStates() { public void cleanupPalettesAndBlockStates() {
for (int i = 0; i < sections.length(); i++) for (int i = 0; i < sections.length(); i++) {
{
Section section = sections.get(i); Section section = sections.get(i);
if (section != null) { if (section != null) {
section.cleanupPaletteAndBlockStates(); section.cleanupPaletteAndBlockStates();
@ -691,12 +690,10 @@ public class Chunk {
} }
public void runLighting() { public void runLighting() {
for(int s = 15; s >= 0; s--) for (int s = 15; s >= 0; s--) {
{
Section section = getSection(s); Section section = getSection(s);
if(section != null) if (section != null) {
{
section.runLighting(); section.runLighting();
} }
} }

View File

@ -25,7 +25,6 @@ import com.volmit.iris.engine.data.nbt.tag.ListTag;
import com.volmit.iris.engine.data.nbt.tag.LongArrayTag; import com.volmit.iris.engine.data.nbt.tag.LongArrayTag;
import com.volmit.iris.util.collection.KMap; import com.volmit.iris.util.collection.KMap;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -108,12 +107,9 @@ public class Section {
} }
public void runLighting() { public void runLighting() {
for(int x = 1; x < 14; x++) for (int x = 1; x < 14; x++) {
{ for (int z = 1; z < 14; z++) {
for(int z = 1; z < 14; z++) for (int y = 0; y < 16; y++) {
{
for(int y = 0; y < 16; y++)
{
} }
} }
@ -444,8 +440,7 @@ public class Section {
if (blockStates != null) { if (blockStates != null) {
long[] c = new long[blockStates.length()]; long[] c = new long[blockStates.length()];
for(int i = 0; i < c.length; i++) for (int i = 0; i < c.length; i++) {
{
c[i] = blockStates.get(i); c[i] = blockStates.get(i);
} }

View File

@ -45,7 +45,7 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
} else { } else {
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData()); int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
if (decorator.isScaleStack()) { if (decorator.isScaleStack()) {
stack = (int) Math.ceil((double)max * ((double)stack / 100)); stack = (int) Math.ceil((double) max * ((double) stack / 100));
} else stack = Math.min(max, stack); } else stack = Math.min(max, stack);
if (stack == 1) { if (stack == 1) {

View File

@ -18,7 +18,6 @@
package com.volmit.iris.engine.decorator; package com.volmit.iris.engine.decorator;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.cache.Cache; import com.volmit.iris.engine.cache.Cache;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.hunk.Hunk; import com.volmit.iris.engine.hunk.Hunk;
@ -47,7 +46,7 @@ public class IrisSeaFloorDecorator extends IrisEngineDecorator {
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData()); int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
if (decorator.isScaleStack()) { if (decorator.isScaleStack()) {
int maxStack = max - height; int maxStack = max - height;
stack = (int)Math.ceil((double)maxStack * ((double)stack / 100)); stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
} else stack = Math.min(stack, max - height); } else stack = Math.min(stack, max - height);
if (stack == 1) { if (stack == 1) {

View File

@ -18,7 +18,6 @@
package com.volmit.iris.engine.decorator; package com.volmit.iris.engine.decorator;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.cache.Cache; import com.volmit.iris.engine.cache.Cache;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.hunk.Hunk; import com.volmit.iris.engine.hunk.Hunk;
@ -47,7 +46,7 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData()); int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
if (decorator.isScaleStack()) { if (decorator.isScaleStack()) {
int maxStack = max - height; int maxStack = max - height;
stack = (int) Math.ceil((double)maxStack * ((double)stack / 100)); stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
} }
if (stack == 1) { if (stack == 1) {

View File

@ -51,7 +51,7 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData()); int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
if (decorator.isScaleStack()) { if (decorator.isScaleStack()) {
int maxStack = max - height; int maxStack = max - height;
stack = (int)Math.ceil((double)maxStack * ((double)stack / 100)); stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
} else stack = Math.min(max - height, stack); } else stack = Math.min(max - height, stack);
if (stack == 1) { if (stack == 1) {

View File

@ -79,7 +79,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData()); int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
if (decorator.isScaleStack()) { if (decorator.isScaleStack()) {
int maxStack = max - height; int maxStack = max - height;
stack = (int) Math.ceil((double)maxStack * ((double)stack / 100)); stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
} else stack = Math.min(height - max, stack); } else stack = Math.min(height - max, stack);
if (stack == 1) { if (stack == 1) {

View File

@ -38,23 +38,15 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.loot.LootContext;
import org.bukkit.loot.LootTable;
import org.bukkit.loot.Lootable;
import org.jetbrains.annotations.NotNull;
import java.awt.*; import java.awt.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Random;
public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootProvider, BlockUpdater, Renderer, Hotloadable { public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootProvider, BlockUpdater, Renderer, Hotloadable {
void close(); void close();

View File

@ -21,7 +21,6 @@ package com.volmit.iris.engine.framework;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisDataManager; import com.volmit.iris.core.IrisDataManager;
import com.volmit.iris.core.IrisSettings; import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.nms.BiomeBaseInjector;
import com.volmit.iris.core.nms.INMS; import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.core.pregenerator.PregenListener; import com.volmit.iris.core.pregenerator.PregenListener;
import com.volmit.iris.core.pregenerator.PregenTask; import com.volmit.iris.core.pregenerator.PregenTask;
@ -29,12 +28,10 @@ import com.volmit.iris.engine.IrisEngineCompound;
import com.volmit.iris.engine.data.B; import com.volmit.iris.engine.data.B;
import com.volmit.iris.engine.data.chunk.MCATerrainChunk; import com.volmit.iris.engine.data.chunk.MCATerrainChunk;
import com.volmit.iris.engine.data.chunk.TerrainChunk; import com.volmit.iris.engine.data.chunk.TerrainChunk;
import com.volmit.iris.engine.data.mca.MCAUtil;
import com.volmit.iris.engine.data.mca.NBTWorld; import com.volmit.iris.engine.data.mca.NBTWorld;
import com.volmit.iris.engine.data.nbt.tag.CompoundTag; import com.volmit.iris.engine.data.nbt.tag.CompoundTag;
import com.volmit.iris.engine.headless.HeadlessGenerator; import com.volmit.iris.engine.headless.HeadlessGenerator;
import com.volmit.iris.engine.hunk.Hunk; import com.volmit.iris.engine.hunk.Hunk;
import com.volmit.iris.engine.lighting.LightingChunk;
import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisPosition; import com.volmit.iris.engine.object.IrisPosition;
@ -61,7 +58,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -320,8 +316,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
// placeStrongholds(world.realWorld()); // placeStrongholds(world.realWorld());
// } // }
if(isStudio()) if (isStudio()) {
{
dim.installDataPack(() -> data, Iris.instance.getDatapacksFolder()); dim.installDataPack(() -> data, Iris.instance.getDatapacksFolder());
} }
} catch (Throwable e) { } catch (Throwable e) {
@ -458,8 +453,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
@NotNull @NotNull
@Override @Override
public ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) { public ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) {
try try {
{
PrecisionStopwatch ps = PrecisionStopwatch.start(); PrecisionStopwatch ps = PrecisionStopwatch.start();
TerrainChunk tc = TerrainChunk.create(world, biome); TerrainChunk tc = TerrainChunk.create(world, biome);
IrisWorld ww = (getComposite() == null || getComposite().getWorld() == null) ? IrisWorld.fromWorld(world) : getComposite().getWorld(); IrisWorld ww = (getComposite() == null || getComposite().getWorld() == null) ? IrisWorld.fromWorld(world) : getComposite().getWorld();
@ -477,10 +471,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
} }
return tc.getRaw(); return tc.getRaw();
} } catch (Throwable e) {
catch(Throwable e)
{
Iris.error("======================================"); Iris.error("======================================");
e.printStackTrace(); e.printStackTrace();
Iris.reportErrorChunk(x, z, e, "CHUNK"); Iris.reportErrorChunk(x, z, e, "CHUNK");
@ -488,10 +479,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
ChunkData d = Bukkit.createChunkData(world); ChunkData d = Bukkit.createChunkData(world);
for(int i = 0; i < 16; i++) for (int i = 0; i < 16; i++) {
{ for (int j = 0; j < 16; j++) {
for(int j = 0; j < 16; j++)
{
d.setBlock(i, 0, j, ERROR_BLOCK); d.setBlock(i, 0, j, ERROR_BLOCK);
} }
} }
@ -542,8 +531,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
@Override @Override
public void directWriteChunk(IrisWorld w, int x, int z, NBTWorld writer) { public void directWriteChunk(IrisWorld w, int x, int z, NBTWorld writer) {
try try {
{int ox = x << 4; int ox = x << 4;
int oz = z << 4; int oz = z << 4;
com.volmit.iris.engine.data.mca.Chunk chunk = writer.getChunk(x, z); com.volmit.iris.engine.data.mca.Chunk chunk = writer.getChunk(x, z);
generateChunkRawData(w, x, z, MCATerrainChunk.builder() generateChunkRawData(w, x, z, MCATerrainChunk.builder()
@ -552,20 +541,15 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
.injector((xx, yy, zz, biomeBase) -> chunk.setBiomeAt(ox + xx, yy, oz + zz, .injector((xx, yy, zz, biomeBase) -> chunk.setBiomeAt(ox + xx, yy, oz + zz,
INMS.get().getTrueBiomeBaseId(biomeBase))) INMS.get().getTrueBiomeBaseId(biomeBase)))
.build()).run(); .build()).run();
} } catch (Throwable e) {
catch(Throwable e)
{
Iris.error("======================================"); Iris.error("======================================");
e.printStackTrace(); e.printStackTrace();
Iris.reportErrorChunk(x, z, e, "MCA"); Iris.reportErrorChunk(x, z, e, "MCA");
Iris.error("======================================"); Iris.error("======================================");
com.volmit.iris.engine.data.mca.Chunk chunk = writer.getChunk(x, z); com.volmit.iris.engine.data.mca.Chunk chunk = writer.getChunk(x, z);
CompoundTag c = NBTWorld.getCompound(ERROR_BLOCK); CompoundTag c = NBTWorld.getCompound(ERROR_BLOCK);
for(int i = 0; i < 16; i++) for (int i = 0; i < 16; i++) {
{ for (int j = 0; j < 16; j++) {
for(int j = 0; j < 16; j++)
{
chunk.setBlockStateAt(i, 0, j, c, false); chunk.setBlockStateAt(i, 0, j, c, false);
} }
} }

View File

@ -41,12 +41,10 @@ import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.documentation.ChunkCoordinates; import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.format.Form; import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.function.Consumer4; import com.volmit.iris.util.function.Consumer4;
import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.RNG; import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.scheduling.IrisLock; import com.volmit.iris.util.scheduling.IrisLock;
import com.volmit.iris.util.scheduling.J; import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.PrecisionStopwatch; import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import io.lumine.xikage.mythicmobs.utils.serialize.ChunkPosition;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot; import org.bukkit.ChunkSnapshot;
import org.bukkit.block.TileState; import org.bukkit.block.TileState;
@ -572,7 +570,8 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
} }
default void place(RNG rng, int x, int forceY, int z, IrisObjectPlacement objectPlacement) { default void place(RNG rng, int x, int forceY, int z, IrisObjectPlacement objectPlacement) {
placing: for (int i = 0; i < objectPlacement.getDensity(); i++) { placing:
for (int i = 0; i < objectPlacement.getDensity(); i++) {
IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng)); IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng));
if (v == null) { if (v == null) {
return; return;
@ -603,10 +602,8 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
f.setInterpolator(objectPlacement.getVacuumInterpolationMethod()); f.setInterpolator(objectPlacement.getVacuumInterpolationMethod());
f.setStrength(1D); f.setStrength(1D);
for(IrisFeaturePositional j : rw.getFeatures()) for (IrisFeaturePositional j : rw.getFeatures()) {
{ if (j.getX() == xx && j.getZ() == zz) {
if(j.getX() == xx && j.getZ() == zz)
{
continue placing; continue placing;
} }
} }

View File

@ -21,7 +21,6 @@ package com.volmit.iris.engine.hunk.io;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.engine.hunk.Hunk; import com.volmit.iris.engine.hunk.Hunk;
import com.volmit.iris.engine.object.tile.TileData; import com.volmit.iris.engine.object.tile.TileData;
import com.volmit.iris.engine.parallel.BurstExecutor;
import com.volmit.iris.engine.parallel.MultiBurst; import com.volmit.iris.engine.parallel.MultiBurst;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap; import com.volmit.iris.util.collection.KMap;

View File

@ -245,7 +245,8 @@ public class PlannedStructure {
} }
private boolean generateRotatedPiece(PlannedPiece piece, IrisJigsawPieceConnector pieceConnector, IrisJigsawPiece idea, IrisObjectRotation rotation) { private boolean generateRotatedPiece(PlannedPiece piece, IrisJigsawPieceConnector pieceConnector, IrisJigsawPiece idea, IrisObjectRotation rotation) {
if (!idea.getPlacementOptions().getRotation().isEnabled()) rotation = piece.getRotation(); //Inherit parent rotation if (!idea.getPlacementOptions().getRotation().isEnabled())
rotation = piece.getRotation(); //Inherit parent rotation
PlannedPiece test = new PlannedPiece(this, piece.getPosition(), idea, rotation); PlannedPiece test = new PlannedPiece(this, piece.getPosition(), idea, rotation);

View File

@ -24,7 +24,6 @@ import com.bergerkiller.bukkit.common.wrappers.BlockData;
import com.bergerkiller.bukkit.common.wrappers.ChunkSection; import com.bergerkiller.bukkit.common.wrappers.ChunkSection;
import com.bergerkiller.generated.net.minecraft.server.NibbleArrayHandle; import com.bergerkiller.generated.net.minecraft.server.NibbleArrayHandle;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.util.data.NibbleArray;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;

View File

@ -22,8 +22,7 @@ public class CloverNoise implements NoiseGenerator {
private final Noise2D n2; private final Noise2D n2;
private final Noise3D n3; private final Noise3D n3;
public CloverNoise(long seed) public CloverNoise(long seed) {
{
n2 = new CloverNoise.Noise2D(seed); n2 = new CloverNoise.Noise2D(seed);
n3 = new CloverNoise.Noise3D(seed); n3 = new CloverNoise.Noise3D(seed);
} }
@ -40,9 +39,8 @@ public class CloverNoise implements NoiseGenerator {
@Override @Override
public double noise(double x, double y, double z) { public double noise(double x, double y, double z) {
if(z == 0) if (z == 0) {
{ return n2.noise(x, y);
return n2.noise(x,y);
} }
return n3.noise(x, y, z); return n3.noise(x, y, z);
@ -52,10 +50,11 @@ public class CloverNoise implements NoiseGenerator {
* Java implementation of 2D Clover Noise. See https://github.com/ValgoBoi/clover-noise * Java implementation of 2D Clover Noise. See https://github.com/ValgoBoi/clover-noise
*/ */
public static class Noise2D { public static class Noise2D {
private long seed; private final long seed;
/** /**
* Constructs a new 2D Clover Noise generator with a specific seed. * Constructs a new 2D Clover Noise generator with a specific seed.
*
* @param seed The seed for the noise generator. * @param seed The seed for the noise generator.
*/ */
public Noise2D(long seed) { public Noise2D(long seed) {
@ -109,6 +108,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 2D Clover Noise at a specific point. * Generates 2D Clover Noise at a specific point.
*
* @param p The point to generate noise at. * @param p The point to generate noise at.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -205,6 +205,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 2D Clover Noise at a specific point. * Generates 2D Clover Noise at a specific point.
*
* @param x The x coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point. * @param y The y coordinate of the point.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
@ -215,7 +216,8 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates fractal 2D Clover Noise at a specific point. * Generates fractal 2D Clover Noise at a specific point.
* @param p The point to generate noise at. *
* @param p The point to generate noise at.
* @param iterations The number of iterations for the fractal noise. * @param iterations The number of iterations for the fractal noise.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -236,8 +238,9 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates fractal 2D Clover Noise at a specific point. * Generates fractal 2D Clover Noise at a specific point.
* @param x The x coordinate of the point. *
* @param y The y coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point.
* @param iterations The number of iterations for the fractal noise. * @param iterations The number of iterations for the fractal noise.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -249,6 +252,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates curl 2D Clover Noise at a specific point. * Generates curl 2D Clover Noise at a specific point.
*
* @param p The point to generate noise at. * @param p The point to generate noise at.
* @return The value of curl noise, a normalized 2D vector. * @return The value of curl noise, a normalized 2D vector.
*/ */
@ -262,6 +266,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates curl 2D Clover Noise at a specific point. * Generates curl 2D Clover Noise at a specific point.
*
* @param x The x coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point. * @param y The y coordinate of the point.
* @return The value of curl noise, a normalized 2D vector. * @return The value of curl noise, a normalized 2D vector.
@ -272,7 +277,8 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates fractal curl 2D Clover Noise at a specific point. * Generates fractal curl 2D Clover Noise at a specific point.
* @param p The point to generate noise at. *
* @param p The point to generate noise at.
* @param iterations The number of iterations for the fractal noise. * @param iterations The number of iterations for the fractal noise.
* @return The value of curl noise, a normalized 2D vector. * @return The value of curl noise, a normalized 2D vector.
*/ */
@ -286,8 +292,9 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates fractal curl 2D Clover Noise at a specific point. * Generates fractal curl 2D Clover Noise at a specific point.
* @param x The x coordinate of the point. *
* @param y The y coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point.
* @param iterations The number of iterations for the fractal noise. * @param iterations The number of iterations for the fractal noise.
* @return The value of curl noise, a normalized 2D vector. * @return The value of curl noise, a normalized 2D vector.
*/ */
@ -297,6 +304,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 2D Frost Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/frost.md * Generates 2D Frost Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/frost.md
*
* @param p The point to generate noise at. * @param p The point to generate noise at.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -311,6 +319,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 2D Frost Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/frost.md * Generates 2D Frost Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/frost.md
*
* @param x The x coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point. * @param y The y coordinate of the point.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
@ -321,6 +330,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 2D Marble Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/marble.md * Generates 2D Marble Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/marble.md
*
* @param p The point to generate noise at. * @param p The point to generate noise at.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -345,6 +355,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 2D Marble Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/marble.md * Generates 2D Marble Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/marble.md
*
* @param x The x coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point. * @param y The y coordinate of the point.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
@ -355,7 +366,7 @@ public class CloverNoise implements NoiseGenerator {
} }
public static class Noise3D { public static class Noise3D {
private long seed; private final long seed;
public Noise3D(long seed) { public Noise3D(long seed) {
this.seed = seed; this.seed = seed;
@ -469,6 +480,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 3D Clover Noise at a specific point. * Generates 3D Clover Noise at a specific point.
*
* @param p The point to generate noise at. * @param p The point to generate noise at.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -663,6 +675,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 3D Clover Noise at a specific point. * Generates 3D Clover Noise at a specific point.
*
* @param x The x coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point. * @param y The y coordinate of the point.
* @param z The z coordinate of the point. * @param z The z coordinate of the point.
@ -674,7 +687,8 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates fractal 3D Clover Noise at a specific point. * Generates fractal 3D Clover Noise at a specific point.
* @param p The point to generate noise at. *
* @param p The point to generate noise at.
* @param iterations The number of iterations for the fractal noise. * @param iterations The number of iterations for the fractal noise.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -695,9 +709,10 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates fractal 3D Clover Noise at a specific point. * Generates fractal 3D Clover Noise at a specific point.
* @param x The x coordinate of the point. *
* @param y The y coordinate of the point. * @param x The x coordinate of the point.
* @param z The z coordinate of the point. * @param y The y coordinate of the point.
* @param z The z coordinate of the point.
* @param iterations The number of iterations for the fractal noise. * @param iterations The number of iterations for the fractal noise.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -709,6 +724,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates curl 3D Clover Noise at a specific point. * Generates curl 3D Clover Noise at a specific point.
*
* @param p The point to generate noise at. * @param p The point to generate noise at.
* @return The value of curl noise, a normalized 3D vector. * @return The value of curl noise, a normalized 3D vector.
*/ */
@ -723,6 +739,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates curl 3D Clover Noise at a specific point. * Generates curl 3D Clover Noise at a specific point.
*
* @param x The x coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point. * @param y The y coordinate of the point.
* @param z The z coordinate of the point. * @param z The z coordinate of the point.
@ -734,7 +751,8 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates fractal curl 3D Clover Noise at a specific point. * Generates fractal curl 3D Clover Noise at a specific point.
* @param p The point to generate noise at. *
* @param p The point to generate noise at.
* @param iterations The number of iterations for the fractal noise. * @param iterations The number of iterations for the fractal noise.
* @return The value of curl noise, a normalized 3D vector. * @return The value of curl noise, a normalized 3D vector.
*/ */
@ -749,9 +767,10 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates fractal curl 3D Clover Noise at a specific point. * Generates fractal curl 3D Clover Noise at a specific point.
* @param x The x coordinate of the point. *
* @param y The y coordinate of the point. * @param x The x coordinate of the point.
* @param z The z coordinate of the point. * @param y The y coordinate of the point.
* @param z The z coordinate of the point.
* @param iterations The number of iterations for the fractal noise. * @param iterations The number of iterations for the fractal noise.
* @return The value of curl noise, a normalized 3D vector. * @return The value of curl noise, a normalized 3D vector.
*/ */
@ -761,6 +780,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 3D Frost Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/frost.md * Generates 3D Frost Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/frost.md
*
* @param p The point to generate noise at. * @param p The point to generate noise at.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -775,6 +795,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 3D Frost Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/frost.md * Generates 3D Frost Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/frost.md
*
* @param x The x coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point. * @param y The y coordinate of the point.
* @param z The z coordinate of the point. * @param z The z coordinate of the point.
@ -786,6 +807,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 3D Marble Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/marble.md * Generates 3D Marble Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/marble.md
*
* @param p The point to generate noise at. * @param p The point to generate noise at.
* @return The value of noise, from 0 to 1. * @return The value of noise, from 0 to 1.
*/ */
@ -810,6 +832,7 @@ public class CloverNoise implements NoiseGenerator {
/** /**
* Generates 3D Marble Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/marble.md * Generates 3D Marble Noise at a specific point. See https://github.com/ValgoBoi/clover-noise/blob/master/variations/marble.md
*
* @param x The x coordinate of the point. * @param x The x coordinate of the point.
* @param y The y coordinate of the point. * @param y The y coordinate of the point.
* @param z The z coordinate of the point. * @param z The z coordinate of the point.

View File

@ -18,7 +18,6 @@
package com.volmit.iris.engine.noise; package com.volmit.iris.engine.noise;
import com.google.common.util.concurrent.AtomicDouble;
import com.volmit.iris.engine.interpolation.InterpolationMethod; import com.volmit.iris.engine.interpolation.InterpolationMethod;
import com.volmit.iris.engine.interpolation.IrisInterpolation; import com.volmit.iris.engine.interpolation.IrisInterpolation;
import com.volmit.iris.util.function.NoiseProvider; import com.volmit.iris.util.function.NoiseProvider;
@ -40,16 +39,15 @@ public class InterpolatedNoise implements NoiseGenerator {
@Override @Override
public double noise(double x, double z) { public double noise(double x, double z) {
return IrisInterpolation.getNoise(method, (int)x, (int)z, 32, p); return IrisInterpolation.getNoise(method, (int) x, (int) z, 32, p);
} }
@Override @Override
public double noise(double x, double y, double z) { public double noise(double x, double y, double z) {
if(z == 0) if (z == 0) {
{
return noise(x, y); return noise(x, y);
} }
return IrisInterpolation.getNoise(method, (int)x, (int)z, 32, p); return IrisInterpolation.getNoise(method, (int) x, (int) z, 32, p);
} }
} }

View File

@ -92,7 +92,7 @@ public class IrisEntityInitialSpawn {
private Entity spawn100(Engine g, Location at) { private Entity spawn100(Engine g, Location at) {
try { try {
return getRealEntity(g).spawn(g, at.clone().add(0.5, 1, 0.5), rng.aquire(() -> new RNG(g.getTarget().getWorld().seed() + 4))); return getRealEntity(g).spawn(g, at.clone().add(0.5, 1, 0.5), rng.aquire(() -> new RNG(g.getTarget().getWorld().seed() + 4)));
} catch (Throwable e){ } catch (Throwable e) {
Iris.reportError(e); Iris.reportError(e);
Iris.debug("Failed to retrieve real entity @ " + at); Iris.debug("Failed to retrieve real entity @ " + at);
return null; return null;

View File

@ -87,9 +87,8 @@ public class IrisFeature {
return actualRadius.aquire(() -> { return actualRadius.aquire(() -> {
double o = 0; double o = 0;
if(fractureRadius != null) if (fractureRadius != null) {
{ o += fractureRadius.getMaxFractureDistance();
o+=fractureRadius.getMaxFractureDistance();
} }
return o + IrisInterpolation.getRealRadius(getInterpolator(), getInterpolationRadius()); return o + IrisInterpolation.getRealRadius(getInterpolator(), getInterpolationRadius());

View File

@ -22,8 +22,6 @@ import com.google.gson.Gson;
import com.volmit.iris.engine.cache.AtomicCache; import com.volmit.iris.engine.cache.AtomicCache;
import com.volmit.iris.engine.interpolation.IrisInterpolation; import com.volmit.iris.engine.interpolation.IrisInterpolation;
import com.volmit.iris.engine.object.annotations.Desc; import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MaxNumber;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.Required; import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.function.NoiseProvider; import com.volmit.iris.util.function.NoiseProvider;
import com.volmit.iris.util.math.M; import com.volmit.iris.util.math.M;
@ -123,12 +121,9 @@ public class IrisFeaturePositional {
return M.lerp(1, getFeature().getObjectChance(), getStrength(x, z, rng)); return M.lerp(1, getFeature().getObjectChance(), getStrength(x, z, rng));
} }
public IrisBiome filter(double x, double z, IrisBiome biome, RNG rng) public IrisBiome filter(double x, double z, IrisBiome biome, RNG rng) {
{ if (getFeature().getCustomBiome() != null) {
if(getFeature().getCustomBiome() != null) if (getStrength(x, z, rng) >= getFeature().getBiomeStrengthThreshold()) {
{
if(getStrength(x, z, rng) >= getFeature().getBiomeStrengthThreshold())
{
IrisBiome b = biome.getLoader().getBiomeLoader().load(getFeature().getCustomBiome()); IrisBiome b = biome.getLoader().getBiomeLoader().load(getFeature().getCustomBiome());
b.setInferredType(biome.getInferredType()); b.setInferredType(biome.getInferredType());
return b; return b;
@ -158,16 +153,16 @@ public class IrisFeaturePositional {
} }
public double distance(double x, double z, RNG rng) { public double distance(double x, double z, RNG rng) {
double mul = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().getMultiplier()/2 : 1; double mul = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().getMultiplier() / 2 : 1;
double mod = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().create(rng).fitDouble(-mul, mul, x, z) : 0; double mod = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().create(rng).fitDouble(-mul, mul, x, z) : 0;
return Math.sqrt(Math.pow(this.x - (x + mod), 2) + Math.pow(this.z - (z + mod), 2)); return Math.sqrt(Math.pow(this.x - (x + mod), 2) + Math.pow(this.z - (z + mod), 2));
} }
public double distance2(double x, double z, RNG rng) { public double distance2(double x, double z, RNG rng) {
double mul = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().getMultiplier()/2 : 1; double mul = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().getMultiplier() / 2 : 1;
double mod = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().create(rng).fitDouble(-mul, mul, x, z) : 0; double mod = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().create(rng).fitDouble(-mul, mul, x, z) : 0;
return Math.pow(this.x - (x+mod), 2) + Math.pow(this.z - (z+mod), 2); return Math.pow(this.x - (x + mod), 2) + Math.pow(this.z - (z + mod), 2);
} }
private NoiseProvider getNoiseProvider(RNG rng) { private NoiseProvider getNoiseProvider(RNG rng) {

View File

@ -18,27 +18,13 @@
package com.volmit.iris.engine.object; package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisDataManager;
import com.volmit.iris.engine.cache.AtomicCache;
import com.volmit.iris.engine.data.DataProvider;
import com.volmit.iris.engine.noise.CNG;
import com.volmit.iris.engine.object.annotations.*; import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.io.IO;
import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.bukkit.Material;
import org.bukkit.World.Environment;
import org.bukkit.block.data.BlockData;
import java.io.File;
import java.io.IOException;
@SuppressWarnings("DefaultAnnotationParam") @SuppressWarnings("DefaultAnnotationParam")
@Accessors(chain = true) @Accessors(chain = true)

View File

@ -18,12 +18,11 @@
package com.volmit.iris.engine.object; package com.volmit.iris.engine.object;
import com.volmit.iris.engine.cache.AtomicCache; import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.interpolation.IrisInterpolation; import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.noise.CNG; import com.volmit.iris.engine.object.annotations.RegistryListBiome;
import com.volmit.iris.engine.object.annotations.*; import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;

View File

@ -18,8 +18,10 @@
package com.volmit.iris.engine.object; package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*; import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.RegistryListBiome;
import com.volmit.iris.engine.object.annotations.Required;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;

View File

@ -18,7 +18,10 @@
package com.volmit.iris.engine.object; package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*; import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.RegistryListRegion;
import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@ -18,7 +18,10 @@
package com.volmit.iris.engine.object; package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*; import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.RegistryListRegion;
import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@ -21,11 +21,7 @@ package com.volmit.iris.engine.object;
import com.volmit.iris.engine.cache.AtomicCache; import com.volmit.iris.engine.cache.AtomicCache;
import com.volmit.iris.engine.interpolation.IrisInterpolation; import com.volmit.iris.engine.interpolation.IrisInterpolation;
import com.volmit.iris.engine.noise.CNG; import com.volmit.iris.engine.noise.CNG;
import com.volmit.iris.engine.object.annotations.ArrayType; import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MaxNumber;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.RNG; import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

View File

@ -44,7 +44,6 @@ import org.bukkit.block.TileState;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged; import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Leaves; import org.bukkit.block.data.type.Leaves;
import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.util.BlockVector; import org.bukkit.util.BlockVector;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -582,8 +581,7 @@ public class IrisObject extends IrisRegistrant {
int lowest = Integer.MAX_VALUE; int lowest = Integer.MAX_VALUE;
y += yrand; y += yrand;
readLock.lock(); readLock.lock();
try try {
{
for (BlockVector g : getBlocks().keySet()) { for (BlockVector g : getBlocks().keySet()) {
BlockData d; BlockData d;
TileData<? extends TileState> tile = null; TileData<? extends TileState> tile = null;
@ -621,12 +619,9 @@ public class IrisObject extends IrisRegistrant {
if (j.isExact() ? k.matches(data) : k.getMaterial().equals(data.getMaterial())) { if (j.isExact() ? k.matches(data) : k.getMaterial().equals(data.getMaterial())) {
BlockData newData = j.getReplace(rng, i.getX() + x, i.getY() + y, i.getZ() + z, rdata).clone(); BlockData newData = j.getReplace(rng, i.getX() + x, i.getY() + y, i.getZ() + z, rdata).clone();
if (newData.getMaterial() == data.getMaterial()) if (newData.getMaterial() == data.getMaterial()) {
{
data = data.merge(newData); data = data.merge(newData);
} } else {
else
{
data = newData; data = newData;
} }
} }
@ -680,10 +675,7 @@ public class IrisObject extends IrisRegistrant {
} }
} }
} }
} } catch (Throwable e) {
catch(Throwable e)
{
Iris.reportError(e); Iris.reportError(e);
} }
readLock.unlock(); readLock.unlock();

View File

@ -64,8 +64,7 @@ public class IrisObjectRotation {
} }
public IrisObject rotateCopy(IrisObject e) { public IrisObject rotateCopy(IrisObject e) {
if(e == null) if (e == null) {
{
return null; return null;
} }

View File

@ -1,6 +1,8 @@
package com.volmit.iris.engine.object; package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*; import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@ -24,10 +24,11 @@ public class IrisTreeSize {
/** /**
* Does the size match * Does the size match
*
* @param size the size to check match * @param size the size to check match
* @return true if it matches (fits within width and depth) * @return true if it matches (fits within width and depth)
*/ */
public boolean doesMatch(IrisTreeSize size){ public boolean doesMatch(IrisTreeSize size) {
return (width == size.getWidth() && depth == size.getDepth()) || (depth == size.getWidth() && width == size.getDepth()); return (width == size.getWidth() && depth == size.getDepth()) || (depth == size.getWidth() && width == size.getDepth());
} }
} }

View File

@ -25,6 +25,7 @@ import com.volmit.iris.engine.object.IrisFeaturePositional;
import com.volmit.iris.util.oldnbt.CompoundTag; import com.volmit.iris.util.oldnbt.CompoundTag;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
@ -49,8 +50,7 @@ public class ParallaxChunkMeta {
dos.writeInt(parallaxChunkMeta.count); dos.writeInt(parallaxChunkMeta.count);
dos.writeInt(parallaxChunkMeta.features.size()); dos.writeInt(parallaxChunkMeta.features.size());
for(IrisFeaturePositional i : parallaxChunkMeta.features) for (IrisFeaturePositional i : parallaxChunkMeta.features) {
{
dos.writeUTF(gson.toJson(i)); dos.writeUTF(gson.toJson(i));
} }
} }
@ -70,8 +70,7 @@ public class ParallaxChunkMeta {
pcm.setFeatures(new CopyOnWriteArrayList<>()); pcm.setFeatures(new CopyOnWriteArrayList<>());
int c = din.readInt(); int c = din.readInt();
for(int i = 0; i < c; i++) for (int i = 0; i < c; i++) {
{
pcm.getFeatures().add(gson.fromJson(din.readUTF(), IrisFeaturePositional.class)); pcm.getFeatures().add(gson.fromJson(din.readUTF(), IrisFeaturePositional.class));
} }

View File

@ -28,14 +28,11 @@ import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.documentation.ChunkCoordinates; import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.documentation.RegionCoordinates; import com.volmit.iris.util.documentation.RegionCoordinates;
import com.volmit.iris.util.format.C; import com.volmit.iris.util.format.C;
import com.volmit.iris.util.plugin.Command;
import com.volmit.iris.util.scheduling.J;
import org.bukkit.block.TileState; import org.bukkit.block.TileState;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.CompletableFuture;
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
public class ParallaxWorld implements ParallaxAccess { public class ParallaxWorld implements ParallaxAccess {

View File

@ -19,7 +19,6 @@
package com.volmit.iris.engine.stream.utility; package com.volmit.iris.engine.stream.utility;
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap; import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
import com.volmit.iris.engine.IrisComplex;
import com.volmit.iris.engine.cache.Cache; import com.volmit.iris.engine.cache.Cache;
import com.volmit.iris.engine.stream.BasicStream; import com.volmit.iris.engine.stream.BasicStream;
import com.volmit.iris.engine.stream.ProceduralStream; import com.volmit.iris.engine.stream.ProceduralStream;

View File

@ -100,9 +100,8 @@ public class NibbleArray implements Writable {
} }
} }
public byte get(int x, int y, int z) public byte get(int x, int y, int z) {
{ return get(index(x, y, z));
return get(index(x,y,z));
} }
public int index(int x, int y, int z) { public int index(int x, int y, int z) {
@ -111,9 +110,8 @@ public class NibbleArray implements Writable {
private transient int bitIndex, byteIndex, bitInByte; private transient int bitIndex, byteIndex, bitInByte;
public void set(int x, int y, int z, int nibble) public void set(int x, int y, int z, int nibble) {
{ set(index(x, y, z), nibble);
set(index(x,y,z), nibble);
} }
public void set(int index, int nibble) { public void set(int index, int nibble) {

View File

@ -323,9 +323,7 @@ public class IO {
public static void writeAll(File f, Object c) throws IOException { public static void writeAll(File f, Object c) throws IOException {
try { try {
f.getParentFile().mkdirs(); f.getParentFile().mkdirs();
} } catch (Throwable ignored) {
catch(Throwable ignored)
{
} }

View File

@ -92,13 +92,12 @@ public class BlockPosition {
return var3; return var3;
} }
public Block toBlock(World world) public Block toBlock(World world) {
{ return world.getBlockAt(x, y, z);
return world.getBlockAt(x,y,z);
} }
public BlockPosition add(int x, int y, int z) { public BlockPosition add(int x, int y, int z) {
return new BlockPosition(x,y,z); return new BlockPosition(x, y, z);
} }
public void min(BlockPosition i) { public void min(BlockPosition i) {

View File

@ -18,11 +18,6 @@
package com.volmit.iris.util.math; package com.volmit.iris.util.math;
import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
public class Position2 { public class Position2 {
private int x; private int x;
private int z; private int z;