mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-02 07:56:48 +00:00
Totally stable optimizations that wont cause any problems at all.
This commit is contained in:
parent
886553a923
commit
7d423fa49d
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -23,7 +23,7 @@ A clear and concise description of what you expected to happen.
|
|||||||
**Screenshots or Video Recordings**
|
**Screenshots or Video Recordings**
|
||||||
If applicable, add screenshots or video recordings to help explain your problem.
|
If applicable, add screenshots or video recordings to help explain your problem.
|
||||||
|
|
||||||
**Server and Plugin Informations**
|
**Server and Plugin Information**
|
||||||
- Installed plugins:
|
- Installed plugins:
|
||||||
- Iris Version:
|
- Iris Version:
|
||||||
- Server Platform and Version [eg: PaperSpigot 1.16.3 #240]:
|
- Server Platform and Version [eg: PaperSpigot 1.16.3 #240]:
|
||||||
|
@ -41,14 +41,15 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
|
@SuppressWarnings("CanBeFinal")
|
||||||
public class Iris extends VolmitPlugin implements Listener {
|
public class Iris extends VolmitPlugin implements Listener {
|
||||||
public static KList<GroupedExecutor> executors = new KList<>();
|
public static KList<GroupedExecutor> executors = new KList<>();
|
||||||
public static Iris instance;
|
public static Iris instance;
|
||||||
@ -142,7 +143,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
if (tc <= 0) {
|
if (tc <= 0) {
|
||||||
int p = Runtime.getRuntime().availableProcessors();
|
int p = Runtime.getRuntime().availableProcessors();
|
||||||
|
|
||||||
return p > 16 ? 16 : p < 4 ? 4 : p;
|
return p > 16 ? 16 : Math.max(p, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tc;
|
return tc;
|
||||||
@ -153,7 +154,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
int v = Integer.parseInt(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
|
int v = Integer.parseInt(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
|
||||||
|
|
||||||
return v >= 15;
|
return v >= 15;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +166,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
int v = Integer.parseInt(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
|
int v = Integer.parseInt(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
|
||||||
|
|
||||||
return v >= 14;
|
return v >= 14;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +178,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
int v = Integer.parseInt(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
|
int v = Integer.parseInt(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
|
||||||
|
|
||||||
return v >= 15;
|
return v >= 15;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,19 +288,9 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
J.s(() -> {
|
J.s(() -> {
|
||||||
Metrics m = new Metrics(Iris.instance, 8757);
|
Metrics m = new Metrics(Iris.instance, 8757);
|
||||||
|
|
||||||
m.addCustomChart(new Metrics.SingleLineChart("custom_dimensions", new Callable<Integer>() {
|
m.addCustomChart(new Metrics.SingleLineChart("custom_dimensions", ProjectManager::countUniqueDimensions));
|
||||||
@Override
|
|
||||||
public Integer call() throws Exception {
|
|
||||||
return ProjectManager.countUniqueDimensions();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
m.addCustomChart(new Metrics.SimplePie("using_custom_dimensions", new Callable<String>() {
|
m.addCustomChart(new Metrics.SimplePie("using_custom_dimensions", () -> ProjectManager.countUniqueDimensions() > 0 ? "Active Projects" : "No Projects"));
|
||||||
@Override
|
|
||||||
public String call() throws Exception {
|
|
||||||
return ProjectManager.countUniqueDimensions() > 0 ? "Active Projects" : "No Projects";
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,7 +310,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
public ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, String id) {
|
||||||
String dimension = IrisSettings.get().getGenerator().getDefaultWorldType();
|
String dimension = IrisSettings.get().getGenerator().getDefaultWorldType();
|
||||||
|
|
||||||
if (id != null && !id.isEmpty()) {
|
if (id != null && !id.isEmpty()) {
|
||||||
|
@ -25,6 +25,7 @@ import lombok.Data;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SuppressWarnings("SynchronizeOnNonFinalField")
|
||||||
@Data
|
@Data
|
||||||
public class IrisSettings {
|
public class IrisSettings {
|
||||||
public static transient IrisSettings settings;
|
public static transient IrisSettings settings;
|
||||||
@ -43,6 +44,7 @@ public class IrisSettings {
|
|||||||
return getStudio().isStudio();
|
return getStudio().isStudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public boolean isUseServerLaunchedGuis() {
|
public boolean isUseServerLaunchedGuis() {
|
||||||
return getGui().isUseServerLaunchedGuis();
|
return getGui().isUseServerLaunchedGuis();
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Throwable xe) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,16 +43,14 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
|
|||||||
|
|
||||||
private boolean injectBiome(Hunk<Biome> h, int x, int y, int z, Object bb) {
|
private boolean injectBiome(Hunk<Biome> h, int x, int y, int z, Object bb) {
|
||||||
try {
|
try {
|
||||||
if (h instanceof BiomeGridHunkView) {
|
if (h instanceof BiomeGridHunkView hh) {
|
||||||
BiomeGridHunkView hh = (BiomeGridHunkView) h;
|
|
||||||
ChunkGenerator.BiomeGrid g = hh.getChunk();
|
ChunkGenerator.BiomeGrid g = hh.getChunk();
|
||||||
if (g instanceof TerrainChunk) {
|
if (g instanceof TerrainChunk) {
|
||||||
((TerrainChunk) g).getBiomeBaseInjector().setBiome(x, y, z, bb);
|
((TerrainChunk) g).getBiomeBaseInjector().setBiome(x, y, z, bb);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
hh.forceBiomeBaseInto(x, y, z, bb);
|
hh.forceBiomeBaseInto(x, y, z, bb);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -41,7 +41,7 @@ public abstract class IrisEngineDecorator extends EngineAssignedComponent implem
|
|||||||
public IrisEngineDecorator(Engine engine, String name, DecorationPart part) {
|
public IrisEngineDecorator(Engine engine, String name, DecorationPart part) {
|
||||||
super(engine, name + " Decorator");
|
super(engine, name + " Decorator");
|
||||||
this.part = part;
|
this.part = part;
|
||||||
this.rng = new RNG(getSeed() + 29356788 - (part.ordinal() * 10439677));
|
this.rng = new RNG(getSeed() + 29356788 - (part.ordinal() * 10439677L));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IrisDecorator getDecorator(IrisBiome biome, double realX, double realZ) {
|
protected IrisDecorator getDecorator(IrisBiome biome, double realX, double realZ) {
|
||||||
|
@ -59,7 +59,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
((Bisected) bd).setHalf(Bisected.Half.TOP);
|
((Bisected) bd).setHalf(Bisected.Half.TOP);
|
||||||
try {
|
try {
|
||||||
data.set(x, height + 2, z, bd);
|
data.set(x, height + 2, z, bd);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
bd = bd.clone();
|
bd = bd.clone();
|
||||||
|
@ -60,6 +60,7 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
getEngine().getMetrics().getPost().put(p.getMilliseconds());
|
getEngine().getMetrics().getPost().put(p.getMilliseconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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 = getFramework().getEngineParallax().trueHeight(x, z);
|
||||||
|
@ -27,6 +27,7 @@ import com.volmit.iris.util.*;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
public class IrisRavineModifier extends EngineAssignedModifier<BlockData> {
|
public class IrisRavineModifier extends EngineAssignedModifier<BlockData> {
|
||||||
private static final BlockData CAVE_AIR = B.get("CAVE_AIR");
|
private static final BlockData CAVE_AIR = B.get("CAVE_AIR");
|
||||||
private static final BlockData LAVA = B.get("LAVA");
|
private static final BlockData LAVA = B.get("LAVA");
|
||||||
@ -70,7 +71,7 @@ public class IrisRavineModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
|
|
||||||
private final float[] ravineCache = new float[1024];
|
private final float[] ravineCache = new float[1024];
|
||||||
|
|
||||||
private void doRavine(long seed, int tx, int tz, ChunkPosition pos, double sx, double sy, double sz, float f, float f2, float f3, int n3, int n4, double d4, RNG bbx, Hunk<BlockData> terrain) {
|
private void doRavine(long seed, int tx, int tz, ChunkPosition pos, double sx, double sy, double sz, float f, float f2, float f3, @SuppressWarnings("SameParameterValue") int n3, @SuppressWarnings("SameParameterValue") int n4, @SuppressWarnings("SameParameterValue") double d4, RNG bbx, Hunk<BlockData> terrain) {
|
||||||
int n5;
|
int n5;
|
||||||
RNG random = new RNG(seed);
|
RNG random = new RNG(seed);
|
||||||
double x = tx * 16 + 8;
|
double x = tx * 16 + 8;
|
||||||
@ -214,7 +215,7 @@ public class IrisRavineModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockPosition cSet(BlockPosition bb, double var0, double var2, double var4) {
|
private BlockPosition cSet(BlockPosition bb, double var0, @SuppressWarnings("SameParameterValue") double var2, double var4) {
|
||||||
bb.setX(MathHelper.floor(var0));
|
bb.setX(MathHelper.floor(var0));
|
||||||
bb.setY(MathHelper.floor(var2));
|
bb.setY(MathHelper.floor(var2));
|
||||||
bb.setZ(MathHelper.floor(var4));
|
bb.setZ(MathHelper.floor(var4));
|
||||||
|
@ -66,7 +66,7 @@ public class CNG {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ProceduralStream<Double> stream(double min, double max) {
|
public ProceduralStream<Double> stream(double min, double max) {
|
||||||
return new FittedStream<Double>(stream(), min, max);
|
return new FittedStream<>(stream(), min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CNG signature(RNG rng) {
|
public static CNG signature(RNG rng) {
|
||||||
@ -304,7 +304,7 @@ public class CNG {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return v.get(fit(0, v.size() - 1, dim));
|
return v.get(fit(0, v.size() - 1, dim));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +183,7 @@ public class FastNoiseDouble {
|
|||||||
m_gradientPerturbAmp = gradientPerturbAmp / 0.45;
|
m_gradientPerturbAmp = gradientPerturbAmp / 0.45;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ClassCanBeRecord")
|
||||||
private static class Double2 {
|
private static class Double2 {
|
||||||
public final double x, y;
|
public final double x, y;
|
||||||
|
|
||||||
@ -192,6 +193,7 @@ public class FastNoiseDouble {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ClassCanBeRecord")
|
||||||
private static class Double3 {
|
private static class Double3 {
|
||||||
public final double x, y, z;
|
public final double x, y, z;
|
||||||
|
|
||||||
@ -358,21 +360,21 @@ public class FastNoiseDouble {
|
|||||||
hash &= 31;
|
hash &= 31;
|
||||||
double a = yd, b = zd, c = wd; // X,Y,Z
|
double a = yd, b = zd, c = wd; // X,Y,Z
|
||||||
switch ((int) hash >> 3) { // OR, DEPENDING ON HIGH ORDER 2 BITS:
|
switch ((int) hash >> 3) { // OR, DEPENDING ON HIGH ORDER 2 BITS:
|
||||||
case 1:
|
case 1 -> {
|
||||||
a = wd;
|
a = wd;
|
||||||
b = xd;
|
b = xd;
|
||||||
c = yd;
|
c = yd;
|
||||||
break; // W,X,Y
|
} // W,X,Y
|
||||||
case 2:
|
case 2 -> {
|
||||||
a = zd;
|
a = zd;
|
||||||
b = wd;
|
b = wd;
|
||||||
c = xd;
|
c = xd;
|
||||||
break; // Z,W,X
|
} // Z,W,X
|
||||||
case 3:
|
case 3 -> {
|
||||||
a = yd;
|
a = yd;
|
||||||
b = zd;
|
b = zd;
|
||||||
c = wd;
|
c = wd;
|
||||||
break; // Y,Z,W
|
} // Y,Z,W
|
||||||
}
|
}
|
||||||
return ((hash & 4) == 0 ? -a : a) + ((hash & 2) == 0 ? -b : b) + ((hash & 1) == 0 ? -c : c);
|
return ((hash & 4) == 0 ? -a : a) + ((hash & 2) == 0 ? -b : b) + ((hash & 1) == 0 ? -c : c);
|
||||||
}
|
}
|
||||||
@ -386,66 +388,42 @@ public class FastNoiseDouble {
|
|||||||
case Value:
|
case Value:
|
||||||
return SingleValue(m_seed, x, y, z);
|
return SingleValue(m_seed, x, y, z);
|
||||||
case ValueFractal:
|
case ValueFractal:
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleValueFractalFBM(x, y, z);
|
||||||
return SingleValueFractalFBM(x, y, z);
|
case Billow -> SingleValueFractalBillow(x, y, z);
|
||||||
case Billow:
|
case RigidMulti -> SingleValueFractalRigidMulti(x, y, z);
|
||||||
return SingleValueFractalBillow(x, y, z);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleValueFractalRigidMulti(x, y, z);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case Perlin:
|
case Perlin:
|
||||||
return SinglePerlin(m_seed, x, y, z);
|
return SinglePerlin(m_seed, x, y, z);
|
||||||
case PerlinFractal:
|
case PerlinFractal:
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SinglePerlinFractalFBM(x, y, z);
|
||||||
return SinglePerlinFractalFBM(x, y, z);
|
case Billow -> SinglePerlinFractalBillow(x, y, z);
|
||||||
case Billow:
|
case RigidMulti -> SinglePerlinFractalRigidMulti(x, y, z);
|
||||||
return SinglePerlinFractalBillow(x, y, z);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SinglePerlinFractalRigidMulti(x, y, z);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case Simplex:
|
case Simplex:
|
||||||
return SingleSimplex(m_seed, x, y, z);
|
return SingleSimplex(m_seed, x, y, z);
|
||||||
case SimplexFractal:
|
case SimplexFractal:
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleSimplexFractalFBM(x, y, z);
|
||||||
return SingleSimplexFractalFBM(x, y, z);
|
case Billow -> SingleSimplexFractalBillow(x, y, z);
|
||||||
case Billow:
|
case RigidMulti -> SingleSimplexFractalRigidMulti(x, y, z);
|
||||||
return SingleSimplexFractalBillow(x, y, z);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleSimplexFractalRigidMulti(x, y, z);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case Cellular:
|
case Cellular:
|
||||||
switch (m_cellularReturnType) {
|
return switch (m_cellularReturnType) {
|
||||||
case CellValue:
|
case CellValue, NoiseLookup, Distance -> SingleCellular(x, y, z);
|
||||||
case NoiseLookup:
|
default -> SingleCellular2Edge(x, y, z);
|
||||||
case Distance:
|
};
|
||||||
return SingleCellular(x, y, z);
|
|
||||||
default:
|
|
||||||
return SingleCellular2Edge(x, y, z);
|
|
||||||
}
|
|
||||||
case WhiteNoise:
|
case WhiteNoise:
|
||||||
return GetWhiteNoise(x, y, z);
|
return GetWhiteNoise(x, y, z);
|
||||||
case Cubic:
|
case Cubic:
|
||||||
return SingleCubic(m_seed, x, y, z);
|
return SingleCubic(m_seed, x, y, z);
|
||||||
case CubicFractal:
|
case CubicFractal:
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleCubicFractalFBM(x, y, z);
|
||||||
return SingleCubicFractalFBM(x, y, z);
|
case Billow -> SingleCubicFractalBillow(x, y, z);
|
||||||
case Billow:
|
case RigidMulti -> SingleCubicFractalRigidMulti(x, y, z);
|
||||||
return SingleCubicFractalBillow(x, y, z);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleCubicFractalRigidMulti(x, y, z);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -459,66 +437,42 @@ public class FastNoiseDouble {
|
|||||||
case Value:
|
case Value:
|
||||||
return SingleValue(m_seed, x, y);
|
return SingleValue(m_seed, x, y);
|
||||||
case ValueFractal:
|
case ValueFractal:
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleValueFractalFBM(x, y);
|
||||||
return SingleValueFractalFBM(x, y);
|
case Billow -> SingleValueFractalBillow(x, y);
|
||||||
case Billow:
|
case RigidMulti -> SingleValueFractalRigidMulti(x, y);
|
||||||
return SingleValueFractalBillow(x, y);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleValueFractalRigidMulti(x, y);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case Perlin:
|
case Perlin:
|
||||||
return SinglePerlin(m_seed, x, y);
|
return SinglePerlin(m_seed, x, y);
|
||||||
case PerlinFractal:
|
case PerlinFractal:
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SinglePerlinFractalFBM(x, y);
|
||||||
return SinglePerlinFractalFBM(x, y);
|
case Billow -> SinglePerlinFractalBillow(x, y);
|
||||||
case Billow:
|
case RigidMulti -> SinglePerlinFractalRigidMulti(x, y);
|
||||||
return SinglePerlinFractalBillow(x, y);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SinglePerlinFractalRigidMulti(x, y);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case Simplex:
|
case Simplex:
|
||||||
return SingleSimplex(m_seed, x, y);
|
return SingleSimplex(m_seed, x, y);
|
||||||
case SimplexFractal:
|
case SimplexFractal:
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleSimplexFractalFBM(x, y);
|
||||||
return SingleSimplexFractalFBM(x, y);
|
case Billow -> SingleSimplexFractalBillow(x, y);
|
||||||
case Billow:
|
case RigidMulti -> SingleSimplexFractalRigidMulti(x, y);
|
||||||
return SingleSimplexFractalBillow(x, y);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleSimplexFractalRigidMulti(x, y);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case Cellular:
|
case Cellular:
|
||||||
switch (m_cellularReturnType) {
|
return switch (m_cellularReturnType) {
|
||||||
case CellValue:
|
case CellValue, NoiseLookup, Distance -> SingleCellular(x, y);
|
||||||
case NoiseLookup:
|
default -> SingleCellular2Edge(x, y);
|
||||||
case Distance:
|
};
|
||||||
return SingleCellular(x, y);
|
|
||||||
default:
|
|
||||||
return SingleCellular2Edge(x, y);
|
|
||||||
}
|
|
||||||
case WhiteNoise:
|
case WhiteNoise:
|
||||||
return GetWhiteNoise(x, y);
|
return GetWhiteNoise(x, y);
|
||||||
case Cubic:
|
case Cubic:
|
||||||
return SingleCubic(m_seed, x, y);
|
return SingleCubic(m_seed, x, y);
|
||||||
case CubicFractal:
|
case CubicFractal:
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleCubicFractalFBM(x, y);
|
||||||
return SingleCubicFractalFBM(x, y);
|
case Billow -> SingleCubicFractalBillow(x, y);
|
||||||
case Billow:
|
case RigidMulti -> SingleCubicFractalRigidMulti(x, y);
|
||||||
return SingleCubicFractalBillow(x, y);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleCubicFractalRigidMulti(x, y);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -574,16 +528,11 @@ public class FastNoiseDouble {
|
|||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
z *= m_frequency;
|
z *= m_frequency;
|
||||||
|
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleValueFractalFBM(x, y, z);
|
||||||
return SingleValueFractalFBM(x, y, z);
|
case Billow -> SingleValueFractalBillow(x, y, z);
|
||||||
case Billow:
|
case RigidMulti -> SingleValueFractalRigidMulti(x, y, z);
|
||||||
return SingleValueFractalBillow(x, y, z);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleValueFractalRigidMulti(x, y, z);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SingleValueFractalFBM(double x, double y, double z) {
|
private double SingleValueFractalFBM(double x, double y, double z) {
|
||||||
@ -651,22 +600,21 @@ public class FastNoiseDouble {
|
|||||||
|
|
||||||
double xs, ys, zs;
|
double xs, ys, zs;
|
||||||
switch (m_longerp) {
|
switch (m_longerp) {
|
||||||
default:
|
case Linear -> {
|
||||||
case Linear:
|
|
||||||
xs = x - x0;
|
xs = x - x0;
|
||||||
ys = y - y0;
|
ys = y - y0;
|
||||||
zs = z - z0;
|
zs = z - z0;
|
||||||
break;
|
}
|
||||||
case Hermite:
|
case Hermite -> {
|
||||||
xs = longerpHermiteFunc(x - x0);
|
xs = longerpHermiteFunc(x - x0);
|
||||||
ys = longerpHermiteFunc(y - y0);
|
ys = longerpHermiteFunc(y - y0);
|
||||||
zs = longerpHermiteFunc(z - z0);
|
zs = longerpHermiteFunc(z - z0);
|
||||||
break;
|
}
|
||||||
case Qulongic:
|
case Qulongic -> {
|
||||||
xs = longerpQulongicFunc(x - x0);
|
xs = longerpQulongicFunc(x - x0);
|
||||||
ys = longerpQulongicFunc(y - y0);
|
ys = longerpQulongicFunc(y - y0);
|
||||||
zs = longerpQulongicFunc(z - z0);
|
zs = longerpQulongicFunc(z - z0);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double xf00 = lerp(valCoord3D(seed, x0, y0, z0), valCoord3D(seed, x1, y0, z0), xs);
|
double xf00 = lerp(valCoord3D(seed, x0, y0, z0), valCoord3D(seed, x1, y0, z0), xs);
|
||||||
@ -684,16 +632,11 @@ public class FastNoiseDouble {
|
|||||||
x *= m_frequency;
|
x *= m_frequency;
|
||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
|
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleValueFractalFBM(x, y);
|
||||||
return SingleValueFractalFBM(x, y);
|
case Billow -> SingleValueFractalBillow(x, y);
|
||||||
case Billow:
|
case RigidMulti -> SingleValueFractalRigidMulti(x, y);
|
||||||
return SingleValueFractalBillow(x, y);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleValueFractalRigidMulti(x, y);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SingleValueFractalFBM(double x, double y) {
|
private double SingleValueFractalFBM(double x, double y) {
|
||||||
@ -755,19 +698,18 @@ public class FastNoiseDouble {
|
|||||||
|
|
||||||
double xs, ys;
|
double xs, ys;
|
||||||
switch (m_longerp) {
|
switch (m_longerp) {
|
||||||
default:
|
case Linear -> {
|
||||||
case Linear:
|
|
||||||
xs = x - x0;
|
xs = x - x0;
|
||||||
ys = y - y0;
|
ys = y - y0;
|
||||||
break;
|
}
|
||||||
case Hermite:
|
case Hermite -> {
|
||||||
xs = longerpHermiteFunc(x - x0);
|
xs = longerpHermiteFunc(x - x0);
|
||||||
ys = longerpHermiteFunc(y - y0);
|
ys = longerpHermiteFunc(y - y0);
|
||||||
break;
|
}
|
||||||
case Qulongic:
|
case Qulongic -> {
|
||||||
xs = longerpQulongicFunc(x - x0);
|
xs = longerpQulongicFunc(x - x0);
|
||||||
ys = longerpQulongicFunc(y - y0);
|
ys = longerpQulongicFunc(y - y0);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double xf0 = lerp(valCoord2D(seed, x0, y0), valCoord2D(seed, x1, y0), xs);
|
double xf0 = lerp(valCoord2D(seed, x0, y0), valCoord2D(seed, x1, y0), xs);
|
||||||
@ -782,16 +724,11 @@ public class FastNoiseDouble {
|
|||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
z *= m_frequency;
|
z *= m_frequency;
|
||||||
|
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SinglePerlinFractalFBM(x, y, z);
|
||||||
return SinglePerlinFractalFBM(x, y, z);
|
case Billow -> SinglePerlinFractalBillow(x, y, z);
|
||||||
case Billow:
|
case RigidMulti -> SinglePerlinFractalRigidMulti(x, y, z);
|
||||||
return SinglePerlinFractalBillow(x, y, z);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SinglePerlinFractalRigidMulti(x, y, z);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SinglePerlinFractalFBM(double x, double y, double z) {
|
private double SinglePerlinFractalFBM(double x, double y, double z) {
|
||||||
@ -859,22 +796,21 @@ public class FastNoiseDouble {
|
|||||||
|
|
||||||
double xs, ys, zs;
|
double xs, ys, zs;
|
||||||
switch (m_longerp) {
|
switch (m_longerp) {
|
||||||
default:
|
case Linear -> {
|
||||||
case Linear:
|
|
||||||
xs = x - x0;
|
xs = x - x0;
|
||||||
ys = y - y0;
|
ys = y - y0;
|
||||||
zs = z - z0;
|
zs = z - z0;
|
||||||
break;
|
}
|
||||||
case Hermite:
|
case Hermite -> {
|
||||||
xs = longerpHermiteFunc(x - x0);
|
xs = longerpHermiteFunc(x - x0);
|
||||||
ys = longerpHermiteFunc(y - y0);
|
ys = longerpHermiteFunc(y - y0);
|
||||||
zs = longerpHermiteFunc(z - z0);
|
zs = longerpHermiteFunc(z - z0);
|
||||||
break;
|
}
|
||||||
case Qulongic:
|
case Qulongic -> {
|
||||||
xs = longerpQulongicFunc(x - x0);
|
xs = longerpQulongicFunc(x - x0);
|
||||||
ys = longerpQulongicFunc(y - y0);
|
ys = longerpQulongicFunc(y - y0);
|
||||||
zs = longerpQulongicFunc(z - z0);
|
zs = longerpQulongicFunc(z - z0);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double xd0 = x - x0;
|
double xd0 = x - x0;
|
||||||
@ -899,16 +835,11 @@ public class FastNoiseDouble {
|
|||||||
x *= m_frequency;
|
x *= m_frequency;
|
||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
|
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SinglePerlinFractalFBM(x, y);
|
||||||
return SinglePerlinFractalFBM(x, y);
|
case Billow -> SinglePerlinFractalBillow(x, y);
|
||||||
case Billow:
|
case RigidMulti -> SinglePerlinFractalRigidMulti(x, y);
|
||||||
return SinglePerlinFractalBillow(x, y);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SinglePerlinFractalRigidMulti(x, y);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SinglePerlinFractalFBM(double x, double y) {
|
private double SinglePerlinFractalFBM(double x, double y) {
|
||||||
@ -1002,16 +933,11 @@ public class FastNoiseDouble {
|
|||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
z *= m_frequency;
|
z *= m_frequency;
|
||||||
|
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleSimplexFractalFBM(x, y, z);
|
||||||
return SingleSimplexFractalFBM(x, y, z);
|
case Billow -> SingleSimplexFractalBillow(x, y, z);
|
||||||
case Billow:
|
case RigidMulti -> SingleSimplexFractalRigidMulti(x, y, z);
|
||||||
return SingleSimplexFractalBillow(x, y, z);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleSimplexFractalRigidMulti(x, y, z);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SingleSimplexFractalFBM(double x, double y, double z) {
|
private double SingleSimplexFractalFBM(double x, double y, double z) {
|
||||||
@ -1189,16 +1115,11 @@ public class FastNoiseDouble {
|
|||||||
x *= m_frequency;
|
x *= m_frequency;
|
||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
|
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleSimplexFractalFBM(x, y);
|
||||||
return SingleSimplexFractalFBM(x, y);
|
case Billow -> SingleSimplexFractalBillow(x, y);
|
||||||
case Billow:
|
case RigidMulti -> SingleSimplexFractalRigidMulti(x, y);
|
||||||
return SingleSimplexFractalBillow(x, y);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleSimplexFractalRigidMulti(x, y);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SingleSimplexFractalFBM(double x, double y) {
|
private double SingleSimplexFractalFBM(double x, double y) {
|
||||||
@ -1421,16 +1342,11 @@ public class FastNoiseDouble {
|
|||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
z *= m_frequency;
|
z *= m_frequency;
|
||||||
|
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleCubicFractalFBM(x, y, z);
|
||||||
return SingleCubicFractalFBM(x, y, z);
|
case Billow -> SingleCubicFractalBillow(x, y, z);
|
||||||
case Billow:
|
case RigidMulti -> SingleCubicFractalRigidMulti(x, y, z);
|
||||||
return SingleCubicFractalBillow(x, y, z);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleCubicFractalRigidMulti(x, y, z);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SingleCubicFractalFBM(double x, double y, double z) {
|
private double SingleCubicFractalFBM(double x, double y, double z) {
|
||||||
@ -1519,16 +1435,11 @@ public class FastNoiseDouble {
|
|||||||
x *= m_frequency;
|
x *= m_frequency;
|
||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
|
|
||||||
switch (m_fractalType) {
|
return switch (m_fractalType) {
|
||||||
case FBM:
|
case FBM -> SingleCubicFractalFBM(x, y);
|
||||||
return SingleCubicFractalFBM(x, y);
|
case Billow -> SingleCubicFractalBillow(x, y);
|
||||||
case Billow:
|
case RigidMulti -> SingleCubicFractalRigidMulti(x, y);
|
||||||
return SingleCubicFractalBillow(x, y);
|
};
|
||||||
case RigidMulti:
|
|
||||||
return SingleCubicFractalRigidMulti(x, y);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SingleCubicFractalFBM(double x, double y) {
|
private double SingleCubicFractalFBM(double x, double y) {
|
||||||
@ -1614,14 +1525,10 @@ public class FastNoiseDouble {
|
|||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
z *= m_frequency;
|
z *= m_frequency;
|
||||||
|
|
||||||
switch (m_cellularReturnType) {
|
return switch (m_cellularReturnType) {
|
||||||
case CellValue:
|
case CellValue, NoiseLookup, Distance -> SingleCellular(x, y, z);
|
||||||
case NoiseLookup:
|
default -> SingleCellular2Edge(x, y, z);
|
||||||
case Distance:
|
};
|
||||||
return SingleCellular(x, y, z);
|
|
||||||
default:
|
|
||||||
return SingleCellular2Edge(x, y, z);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SingleCellular(double x, double y, double z) {
|
private double SingleCellular(double x, double y, double z) {
|
||||||
@ -1783,34 +1690,24 @@ public class FastNoiseDouble {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_cellularReturnType) {
|
return switch (m_cellularReturnType) {
|
||||||
case Distance2:
|
case Distance2 -> distance2 - 1;
|
||||||
return distance2 - 1;
|
case Distance2Add -> distance2 + distance - 1;
|
||||||
case Distance2Add:
|
case Distance2Sub -> distance2 - distance - 1;
|
||||||
return distance2 + distance - 1;
|
case Distance2Mul -> distance2 * distance - 1;
|
||||||
case Distance2Sub:
|
case Distance2Div -> distance / distance2 - 1;
|
||||||
return distance2 - distance - 1;
|
default -> 0;
|
||||||
case Distance2Mul:
|
};
|
||||||
return distance2 * distance - 1;
|
|
||||||
case Distance2Div:
|
|
||||||
return distance / distance2 - 1;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double GetCellular(double x, double y) {
|
public double GetCellular(double x, double y) {
|
||||||
x *= m_frequency;
|
x *= m_frequency;
|
||||||
y *= m_frequency;
|
y *= m_frequency;
|
||||||
|
|
||||||
switch (m_cellularReturnType) {
|
return switch (m_cellularReturnType) {
|
||||||
case CellValue:
|
case CellValue, NoiseLookup, Distance -> SingleCellular(x, y);
|
||||||
case NoiseLookup:
|
default -> SingleCellular2Edge(x, y);
|
||||||
case Distance:
|
};
|
||||||
return SingleCellular(x, y);
|
|
||||||
default:
|
|
||||||
return SingleCellular2Edge(x, y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double SingleCellular(double x, double y) {
|
private double SingleCellular(double x, double y) {
|
||||||
@ -1949,20 +1846,14 @@ public class FastNoiseDouble {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_cellularReturnType) {
|
return switch (m_cellularReturnType) {
|
||||||
case Distance2:
|
case Distance2 -> distance2 - 1;
|
||||||
return distance2 - 1;
|
case Distance2Add -> distance2 + distance - 1;
|
||||||
case Distance2Add:
|
case Distance2Sub -> distance2 - distance - 1;
|
||||||
return distance2 + distance - 1;
|
case Distance2Mul -> distance2 * distance - 1;
|
||||||
case Distance2Sub:
|
case Distance2Div -> distance / distance2 - 1;
|
||||||
return distance2 - distance - 1;
|
default -> 0;
|
||||||
case Distance2Mul:
|
};
|
||||||
return distance2 * distance - 1;
|
|
||||||
case Distance2Div:
|
|
||||||
return distance / distance2 - 1;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GradientPerturb(Vector3f v3) {
|
public void GradientPerturb(Vector3f v3) {
|
||||||
@ -1997,22 +1888,21 @@ public class FastNoiseDouble {
|
|||||||
|
|
||||||
double xs, ys, zs;
|
double xs, ys, zs;
|
||||||
switch (m_longerp) {
|
switch (m_longerp) {
|
||||||
default:
|
case Linear -> {
|
||||||
case Linear:
|
|
||||||
xs = xf - x0;
|
xs = xf - x0;
|
||||||
ys = yf - y0;
|
ys = yf - y0;
|
||||||
zs = zf - z0;
|
zs = zf - z0;
|
||||||
break;
|
}
|
||||||
case Hermite:
|
case Hermite -> {
|
||||||
xs = longerpHermiteFunc(xf - x0);
|
xs = longerpHermiteFunc(xf - x0);
|
||||||
ys = longerpHermiteFunc(yf - y0);
|
ys = longerpHermiteFunc(yf - y0);
|
||||||
zs = longerpHermiteFunc(zf - z0);
|
zs = longerpHermiteFunc(zf - z0);
|
||||||
break;
|
}
|
||||||
case Qulongic:
|
case Qulongic -> {
|
||||||
xs = longerpQulongicFunc(xf - x0);
|
xs = longerpQulongicFunc(xf - x0);
|
||||||
ys = longerpQulongicFunc(yf - y0);
|
ys = longerpQulongicFunc(yf - y0);
|
||||||
zs = longerpQulongicFunc(zf - z0);
|
zs = longerpQulongicFunc(zf - z0);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Double3 vec0 = CELL_3D[(int) hash3D(seed, x0, y0, z0) & 255];
|
Double3 vec0 = CELL_3D[(int) hash3D(seed, x0, y0, z0) & 255];
|
||||||
@ -2081,19 +1971,18 @@ public class FastNoiseDouble {
|
|||||||
|
|
||||||
double xs, ys;
|
double xs, ys;
|
||||||
switch (m_longerp) {
|
switch (m_longerp) {
|
||||||
default:
|
case Linear -> {
|
||||||
case Linear:
|
|
||||||
xs = xf - x0;
|
xs = xf - x0;
|
||||||
ys = yf - y0;
|
ys = yf - y0;
|
||||||
break;
|
}
|
||||||
case Hermite:
|
case Hermite -> {
|
||||||
xs = longerpHermiteFunc(xf - x0);
|
xs = longerpHermiteFunc(xf - x0);
|
||||||
ys = longerpHermiteFunc(yf - y0);
|
ys = longerpHermiteFunc(yf - y0);
|
||||||
break;
|
}
|
||||||
case Qulongic:
|
case Qulongic -> {
|
||||||
xs = longerpQulongicFunc(xf - x0);
|
xs = longerpQulongicFunc(xf - x0);
|
||||||
ys = longerpQulongicFunc(yf - y0);
|
ys = longerpQulongicFunc(yf - y0);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Double2 vec0 = CELL_2D[(int) hash2D(seed, x0, y0) & 255];
|
Double2 vec0 = CELL_2D[(int) hash2D(seed, x0, y0) & 255];
|
||||||
|
@ -46,46 +46,44 @@ public class ConversionManager {
|
|||||||
converters = new KList<>();
|
converters = new KList<>();
|
||||||
|
|
||||||
J.s(() ->
|
J.s(() ->
|
||||||
{
|
J.attemptAsync(() ->
|
||||||
J.attemptAsync(() ->
|
{
|
||||||
{
|
if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
|
converters.add(new Converter() {
|
||||||
converters.add(new Converter() {
|
@Override
|
||||||
@Override
|
public String getOutExtension() {
|
||||||
public String getOutExtension() {
|
return "iob";
|
||||||
return "iob";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInExtension() {
|
public String getInExtension() {
|
||||||
return "schem";
|
return "schem";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void convert(File in, File out) {
|
public void convert(File in, File out) {
|
||||||
SKConversion.convertSchematic(in, out);
|
SKConversion.convertSchematic(in, out);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
converters.add(new Converter() {
|
converters.add(new Converter() {
|
||||||
@Override
|
@Override
|
||||||
public String getOutExtension() {
|
public String getOutExtension() {
|
||||||
return "iob";
|
return "iob";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInExtension() {
|
public String getInExtension() {
|
||||||
return "schematic";
|
return "schematic";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void convert(File in, File out) {
|
public void convert(File in, File out) {
|
||||||
SKConversion.convertSchematic(in, out);
|
SKConversion.convertSchematic(in, out);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}), 5);
|
||||||
}, 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toPoolName(String poolReference) {
|
private String toPoolName(String poolReference) {
|
||||||
@ -136,22 +134,22 @@ public class ConversionManager {
|
|||||||
|
|
||||||
if (compound.containsKey("blocks") && compound.containsKey("palette") && compound.containsKey("size")) {
|
if (compound.containsKey("blocks") && compound.containsKey("palette") && compound.containsKey("size")) {
|
||||||
String id = in.toURI().relativize(folder.toURI()).getPath() + file.getName().split("\\Q.\\E")[0];
|
String id = in.toURI().relativize(folder.toURI()).getPath() + file.getName().split("\\Q.\\E")[0];
|
||||||
ListTag<IntTag> size = (ListTag<IntTag>) compound.getListTag("size");
|
@SuppressWarnings("unchecked") ListTag<IntTag> size = (ListTag<IntTag>) compound.getListTag("size");
|
||||||
int w = size.get(0).asInt();
|
int w = size.get(0).asInt();
|
||||||
int h = size.get(1).asInt();
|
int h = size.get(1).asInt();
|
||||||
int d = size.get(2).asInt();
|
int d = size.get(2).asInt();
|
||||||
KList<BlockData> palette = new KList<>();
|
KList<BlockData> palette = new KList<>();
|
||||||
ListTag<CompoundTag> paletteList = (ListTag<CompoundTag>) compound.getListTag("palette");
|
@SuppressWarnings("unchecked") ListTag<CompoundTag> paletteList = (ListTag<CompoundTag>) compound.getListTag("palette");
|
||||||
for (int i = 0; i < paletteList.size(); i++) {
|
for (int i = 0; i < paletteList.size(); i++) {
|
||||||
CompoundTag cp = paletteList.get(i);
|
CompoundTag cp = paletteList.get(i);
|
||||||
palette.add(DirectWorldWriter.getBlockData(cp));
|
palette.add(DirectWorldWriter.getBlockData(cp));
|
||||||
}
|
}
|
||||||
IrisJigsawPiece piece = new IrisJigsawPiece();
|
IrisJigsawPiece piece = new IrisJigsawPiece();
|
||||||
IrisObject object = new IrisObject(w, h, d);
|
IrisObject object = new IrisObject(w, h, d);
|
||||||
ListTag<CompoundTag> blockList = (ListTag<CompoundTag>) compound.getListTag("blocks");
|
@SuppressWarnings("unchecked") ListTag<CompoundTag> blockList = (ListTag<CompoundTag>) compound.getListTag("blocks");
|
||||||
for (int i = 0; i < blockList.size(); i++) {
|
for (int i = 0; i < blockList.size(); i++) {
|
||||||
CompoundTag cp = blockList.get(i);
|
CompoundTag cp = blockList.get(i);
|
||||||
ListTag<IntTag> pos = (ListTag<IntTag>) cp.getListTag("pos");
|
@SuppressWarnings("unchecked") ListTag<IntTag> pos = (ListTag<IntTag>) cp.getListTag("pos");
|
||||||
int x = pos.get(0).asInt();
|
int x = pos.get(0).asInt();
|
||||||
int y = pos.get(1).asInt();
|
int y = pos.get(1).asInt();
|
||||||
int z = pos.get(2).asInt();
|
int z = pos.get(2).asInt();
|
||||||
|
@ -35,8 +35,8 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
|||||||
|
|
||||||
private final BoardManager manager;
|
private final BoardManager manager;
|
||||||
private String mem = "...";
|
private String mem = "...";
|
||||||
public RollingSequence hits = new RollingSequence(20);
|
public final RollingSequence hits = new RollingSequence(20);
|
||||||
public RollingSequence tp = new RollingSequence(100);
|
public final RollingSequence tp = new RollingSequence(100);
|
||||||
private final ChronoLatch cl = new ChronoLatch(1000);
|
private final ChronoLatch cl = new ChronoLatch(1000);
|
||||||
|
|
||||||
|
|
||||||
@ -105,9 +105,9 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
|||||||
parallaxRegions += g.getCompound().getEngine(i).getParallax().getRegionCount();
|
parallaxRegions += g.getCompound().getEngine(i).getParallax().getRegionCount();
|
||||||
parallaxChunks += g.getCompound().getEngine(i).getParallax().getChunkCount();
|
parallaxChunks += g.getCompound().getEngine(i).getParallax().getChunkCount();
|
||||||
loadedObjects += g.getCompound().getData().getObjectLoader().getSize();
|
loadedObjects += g.getCompound().getData().getObjectLoader().getSize();
|
||||||
memoryGuess += g.getCompound().getData().getObjectLoader().getTotalStorage() * 225;
|
memoryGuess += g.getCompound().getData().getObjectLoader().getTotalStorage() * 225L;
|
||||||
memoryGuess += parallaxChunks * 3500;
|
memoryGuess += parallaxChunks * 3500L;
|
||||||
memoryGuess += parallaxRegions * 1700000;
|
memoryGuess += parallaxRegions * 1700000L;
|
||||||
}
|
}
|
||||||
|
|
||||||
tp.put(0); // TODO: CHUNK SPEED
|
tp.put(0); // TODO: CHUNK SPEED
|
||||||
|
@ -41,6 +41,7 @@ import java.io.IOException;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
@Data
|
@Data
|
||||||
public class IrisProject {
|
public class IrisProject {
|
||||||
private File path;
|
private File path;
|
||||||
@ -122,21 +123,18 @@ public class IrisProject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private KList<Report> scanForErrors(IrisBiome biome, IrisObjectPlacement i) {
|
private KList<Report> scanForErrors(IrisBiome biome, IrisObjectPlacement i) {
|
||||||
KList<Report> reports = new KList<>();
|
|
||||||
|
|
||||||
return reports;
|
return new KList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private KList<Report> scanForErrors(IrisBiome biome, IrisBiomePaletteLayer i) {
|
private KList<Report> scanForErrors(IrisBiome biome, IrisBiomePaletteLayer i) {
|
||||||
KList<Report> reports = new KList<>();
|
|
||||||
|
|
||||||
return reports;
|
return new KList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private KList<Report> scanForErrorsSeaLayers(IrisBiome biome, IrisBiomePaletteLayer i) {
|
private KList<Report> scanForErrorsSeaLayers(IrisBiome biome, IrisBiomePaletteLayer i) {
|
||||||
KList<Report> reports = new KList<>();
|
|
||||||
|
|
||||||
return reports;
|
return new KList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOpen() {
|
public boolean isOpen() {
|
||||||
|
@ -30,7 +30,6 @@ import org.zeroturnaround.zip.ZipUtil;
|
|||||||
import org.zeroturnaround.zip.commons.FileUtils;
|
import org.zeroturnaround.zip.commons.FileUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ public class ProjectManager {
|
|||||||
if (m != null) {
|
if (m != null) {
|
||||||
try {
|
try {
|
||||||
IO.copyFile(m, ignore);
|
IO.copyFile(m, ignore);
|
||||||
} catch (IOException e) {
|
} catch (IOException ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +62,8 @@ public class ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int countUniqueDimensions() {
|
public static int countUniqueDimensions() {
|
||||||
int vv = counter.aquire(() -> {
|
|
||||||
|
return counter.aquire(() -> {
|
||||||
int v = 0;
|
int v = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -82,8 +82,6 @@ public class ProjectManager {
|
|||||||
|
|
||||||
return v;
|
return v;
|
||||||
});
|
});
|
||||||
|
|
||||||
return vv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisDimension installIntoWorld(MortarSender sender, String type, File folder) {
|
public IrisDimension installIntoWorld(MortarSender sender, String type, File folder) {
|
||||||
@ -106,7 +104,7 @@ public class ProjectManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
FileUtils.copyDirectory(f, irispack);
|
FileUtils.copyDirectory(f, irispack);
|
||||||
} catch (IOException e) {
|
} catch (IOException ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,12 +190,13 @@ public class ProjectManager {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
"Issue when unpacking. Please check/do the following:" +
|
"""
|
||||||
"\n1. Do you have a functioning internet connection?" +
|
Issue when unpacking. Please check/do the following:
|
||||||
"\n2. Did the download corrupt?" +
|
1. Do you have a functioning internet connection?
|
||||||
"\n3. Try deleting the */plugins/iris/packs folder and re-download." +
|
2. Did the download corrupt?
|
||||||
"\n4. Download the pack from the GitHub repo: https://github.com/IrisDimensions/overworld" +
|
3. Try deleting the */plugins/iris/packs folder and re-download.
|
||||||
"\n5. Contact support (if all other options do not help)"
|
4. Download the pack from the GitHub repo: https://github.com/IrisDimensions/overworld
|
||||||
|
5. Contact support (if all other options do not help)"""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
File dir = null;
|
File dir = null;
|
||||||
@ -352,12 +351,7 @@ public class ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileUtils.copyDirectory(importPack, newPack, new FileFilter() {
|
FileUtils.copyDirectory(importPack, newPack, pathname -> !pathname.getAbsolutePath().contains(".git"), false);
|
||||||
@Override
|
|
||||||
public boolean accept(File pathname) {
|
|
||||||
return !pathname.getAbsolutePath().contains(".git");
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -127,7 +127,7 @@ public class WandManager implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Location lv = new Location(d[0].getWorld(), j, k, l).clone().add(0.5, 0.5, 0.5).clone().add(push);
|
Location lv = new Location(d[0].getWorld(), j, k, l).clone().add(0.5, 0.5, 0.5).clone().add(push);
|
||||||
Color color = Color.getHSBColor((float) (0.5f + (Math.sin((j + k + l + (p.getTicksLived() / 2)) / 20f) / 2)), 1, 1);
|
Color color = Color.getHSBColor((float) (0.5f + (Math.sin((j + k + l + (p.getTicksLived() / 2f)) / 20f) / 2)), 1, 1);
|
||||||
int r = color.getRed();
|
int r = color.getRed();
|
||||||
int g = color.getGreen();
|
int g = color.getGreen();
|
||||||
int b = color.getBlue();
|
int b = color.getBlue();
|
||||||
|
@ -47,6 +47,7 @@ public class CommandIrisDownload extends MortarCommand {
|
|||||||
for (String i : args) {
|
for (String i : args) {
|
||||||
if (i.equals("-t") || i.equals("--trim")) {
|
if (i.equals("-t") || i.equals("--trim")) {
|
||||||
trim = true;
|
trim = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class CommandIrisObjectContract extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amt = args.length == 1 ? Integer.valueOf(args[0]) : 1;
|
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
||||||
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
Location a2 = b[1].clone();
|
Location a2 = b[1].clone();
|
||||||
|
@ -59,7 +59,7 @@ public class CommandIrisObjectExpand extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amt = args.length == 1 ? Integer.valueOf(args[0]) : 1;
|
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
||||||
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
Location a2 = b[1].clone();
|
Location a2 = b[1].clone();
|
||||||
|
@ -79,6 +79,7 @@ public class CommandIrisObjectPaste extends MortarCommand {
|
|||||||
for (String i : args) {
|
for (String i : args) {
|
||||||
if (i.equalsIgnoreCase("-edit")) {
|
if (i.equalsIgnoreCase("-edit")) {
|
||||||
intoWand = true;
|
intoWand = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ public class CommandIrisObjectSave extends MortarCommand {
|
|||||||
for (String i : args) {
|
for (String i : args) {
|
||||||
if (i.equals("-o")) {
|
if (i.equals("-o")) {
|
||||||
overwrite = true;
|
overwrite = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class CommandIrisObjectShift extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amt = args.length == 1 ? Integer.valueOf(args[0]) : 1;
|
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
||||||
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
Location a2 = b[1].clone();
|
Location a2 = b[1].clone();
|
||||||
|
@ -90,7 +90,7 @@ public class CommandIrisStudioLoot extends MortarCommand {
|
|||||||
|
|
||||||
boolean fast = ffast;
|
boolean fast = ffast;
|
||||||
boolean add = fadd;
|
boolean add = fadd;
|
||||||
O<Integer> ta = new O<Integer>();
|
O<Integer> ta = new O<>();
|
||||||
ta.set(-1);
|
ta.set(-1);
|
||||||
|
|
||||||
ta.set(Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, () ->
|
ta.set(Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, () ->
|
||||||
|
@ -58,6 +58,7 @@ public class CommandIrisStudioPackage extends MortarCommand {
|
|||||||
for (String i : args) {
|
for (String i : args) {
|
||||||
if (i.equalsIgnoreCase("-o")) {
|
if (i.equalsIgnoreCase("-o")) {
|
||||||
o = true;
|
o = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,12 +113,7 @@ public class CommandIrisStudioProfile extends MortarCommand {
|
|||||||
in.setFunction(i);
|
in.setFunction(i);
|
||||||
in.setHorizontalScale(8);
|
in.setHorizontalScale(8);
|
||||||
|
|
||||||
NoiseProvider np = new NoiseProvider() {
|
NoiseProvider np = (x, z) -> Math.random();
|
||||||
@Override
|
|
||||||
public double noise(double x, double z) {
|
|
||||||
return Math.random();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int j = 0; j < 3000; j++) {
|
for (int j = 0; j < 3000; j++) {
|
||||||
in.interpolate(j, -j, np);
|
in.interpolate(j, -j, np);
|
||||||
|
@ -63,7 +63,7 @@ public class CommandIrisWhatBiome extends MortarCommand {
|
|||||||
if (p.getLocation().getBlock().getBiome().equals(Biome.CUSTOM)) {
|
if (p.getLocation().getBlock().getBiome().equals(Biome.CUSTOM)) {
|
||||||
try {
|
try {
|
||||||
sender.sendMessage("Data Pack Biome: " + INMS.get().getTrueBiomeBaseKey(p.getLocation()) + " (ID: " + INMS.get().getTrueBiomeBaseId(INMS.get().getTrueBiomeBase(p.getLocation())) + ")");
|
sender.sendMessage("Data Pack Biome: " + INMS.get().getTrueBiomeBaseKey(p.getLocation()) + " (ID: " + INMS.get().getTrueBiomeBaseId(INMS.get().getTrueBiomeBase(p.getLocation())) + ")");
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ public class CommandIrisWhatObjects extends MortarCommand {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(MortarSender sender, String[] args) {
|
public boolean handle(MortarSender sender, String[] args) {
|
||||||
if (sender.isPlayer()) {
|
if (sender.isPlayer()) {
|
||||||
@ -78,7 +79,7 @@ public class CommandIrisWhatObjects extends MortarCommand {
|
|||||||
int cz = l.getChunk().getZ();
|
int cz = l.getChunk().getZ();
|
||||||
new Spiraler(3, 3, (x, z) -> chunks.addIfMissing(world.getChunkAt(x + cx, z + cz))).drain();
|
new Spiraler(3, 3, (x, z) -> chunks.addIfMissing(world.getChunkAt(x + cx, z + cz))).drain();
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,6 +219,7 @@ public class CommandIrisWhatObjects extends MortarCommand {
|
|||||||
|
|
||||||
objects.compute(n1, (k1, v1) ->
|
objects.compute(n1, (k1, v1) ->
|
||||||
{
|
{
|
||||||
|
//noinspection ReplaceNullCheck
|
||||||
if (v1 == null) {
|
if (v1 == null) {
|
||||||
return new KMap<>();
|
return new KMap<>();
|
||||||
}
|
}
|
||||||
|
@ -60,24 +60,28 @@ public class CommandIrisCreate extends MortarCommand {
|
|||||||
|
|
||||||
String pre = split[0].toLowerCase();
|
String pre = split[0].toLowerCase();
|
||||||
|
|
||||||
if (pre.equals("type")) {
|
switch (pre) {
|
||||||
for (String s : Iris.proj.getListing(true).keySet()) {
|
case "type" -> {
|
||||||
list.add("type=" + s);
|
for (String s : Iris.proj.getListing(true).keySet()) {
|
||||||
|
list.add("type=" + s);
|
||||||
|
}
|
||||||
|
if (!list.contains("type=overworld")) {
|
||||||
|
list.contains("type=overworld");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!list.contains("type=overworld")) {
|
case "seed" -> {
|
||||||
list.contains("type=overworld");
|
list.add("seed=1337");
|
||||||
|
list.add("seed=" + new Random().nextInt());
|
||||||
|
list.add("seed=random");
|
||||||
|
}
|
||||||
|
case "pregen" -> {
|
||||||
|
list.add("500");
|
||||||
|
list.add("1000");
|
||||||
|
list.add("2000");
|
||||||
|
list.add("5k");
|
||||||
|
list.add("10k");
|
||||||
|
list.add("25k");
|
||||||
}
|
}
|
||||||
} else if (pre.equals("seed")) {
|
|
||||||
list.add("seed=1337");
|
|
||||||
list.add("seed=" + new Random().nextInt());
|
|
||||||
list.add("seed=random");
|
|
||||||
} else if (pre.equals("pregen")) {
|
|
||||||
list.add("500");
|
|
||||||
list.add("1000");
|
|
||||||
list.add("2000");
|
|
||||||
list.add("5k");
|
|
||||||
list.add("10k");
|
|
||||||
list.add("25k");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,13 +133,13 @@ public class CommandIrisCreate extends MortarCommand {
|
|||||||
sender.sendMessage("You must remember to either have multiverse installed or use the Bukkit method, otherwise the world will go corrupt!");
|
sender.sendMessage("You must remember to either have multiverse installed or use the Bukkit method, otherwise the world will go corrupt!");
|
||||||
sender.sendMessage("Wiki: https://volmitsoftware.gitbook.io/iris/getting-started");
|
sender.sendMessage("Wiki: https://volmitsoftware.gitbook.io/iris/getting-started");
|
||||||
|
|
||||||
O<Boolean> b = new O<Boolean>();
|
O<Boolean> b = new O<>();
|
||||||
b.set(true);
|
b.set(true);
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
if (sender.isPlayer()) {
|
||||||
try {
|
try {
|
||||||
sender.player().teleport(world.get().getSpawnLocation());
|
sender.player().teleport(world.get().getSpawnLocation());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,9 +152,7 @@ public class CommandIrisCreate extends MortarCommand {
|
|||||||
sender.sendMessage("Expect server lag during this time. Use '/iris pregen stop' to cancel");
|
sender.sendMessage("Expect server lag during this time. Use '/iris pregen stop' to cancel");
|
||||||
|
|
||||||
new Pregenerator(world.get(), size, () ->
|
new Pregenerator(world.get(), size, () ->
|
||||||
{
|
b.set(true));
|
||||||
b.set(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
World ww = world.get();
|
World ww = world.get();
|
||||||
|
@ -47,7 +47,7 @@ public class CommandIrisFix extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int viewDistance = args.length > 0 ? Integer.valueOf(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().getFramework().getEngineParallax().repairChunk(sender.player().getLocation().getChunk());
|
||||||
|
@ -33,10 +33,11 @@ public class CommandIrisPregen extends MortarCommand {
|
|||||||
public CommandIrisPregen() {
|
public CommandIrisPregen() {
|
||||||
super("pregen", "preg", "p");
|
super("pregen", "preg", "p");
|
||||||
setDescription(
|
setDescription(
|
||||||
"Pregen this world with optional parameters: " +
|
"""
|
||||||
"\n'1k' = 1000 by 1000 blocks, '1c' = 1 by 1 chunks, and '1r' = 32 by 32 chunks." +
|
Pregen this world with optional parameters:\s
|
||||||
"\nIf you are using the console or want to pregen a world you're not in:" +
|
'1k' = 1000 by 1000 blocks, '1c' = 1 by 1 chunks, and '1r' = 32 by 32 chunks.
|
||||||
"\nalso specify the name of the world. E.g. /ir pregen 5k world"
|
If you are using the console or want to pregen a world you're not in:
|
||||||
|
also specify the name of the world. E.g. /ir pregen 5k world"""
|
||||||
);
|
);
|
||||||
requiresPermission(Iris.perm.studio);
|
requiresPermission(Iris.perm.studio);
|
||||||
setCategory("Pregen");
|
setCategory("Pregen");
|
||||||
|
@ -48,6 +48,7 @@ public class CommandIrisUpdateWorld extends MortarCommand {
|
|||||||
for (String i : args) {
|
for (String i : args) {
|
||||||
if (i.equalsIgnoreCase("--fresh-download")) {
|
if (i.equalsIgnoreCase("--fresh-download")) {
|
||||||
fresh = true;
|
fresh = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class CommandLocate extends MortarCommand implements Listener {
|
public class CommandLocate extends MortarCommand implements Listener {
|
||||||
CommandLocate instance;
|
final CommandLocate instance;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) {
|
||||||
|
@ -28,6 +28,7 @@ import org.bukkit.entity.FallingBlock;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
@SuppressWarnings("InstantiationOfUtilityClass")
|
||||||
public class BlockSignal {
|
public class BlockSignal {
|
||||||
public static void of(Block block, int ticks) {
|
public static void of(Block block, int ticks) {
|
||||||
new BlockSignal(block, ticks);
|
new BlockSignal(block, ticks);
|
||||||
|
@ -23,6 +23,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
@SuppressWarnings("ClassCanBeRecord")
|
||||||
public class BukkitBlockEditor implements BlockEditor {
|
public class BukkitBlockEditor implements BlockEditor {
|
||||||
private final World world;
|
private final World world;
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import lombok.Data;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
@Data
|
@Data
|
||||||
public class DustRevealer {
|
public class DustRevealer {
|
||||||
private final ParallaxAccess parallax;
|
private final ParallaxAccess parallax;
|
||||||
|
@ -62,7 +62,6 @@ public class WEBlockEditor implements BlockEditor {
|
|||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
es.close();
|
es.close();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,6 +24,7 @@ import org.bukkit.Material;
|
|||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
@SuppressWarnings("ClassCanBeRecord")
|
||||||
public class IrisRenderer {
|
public class IrisRenderer {
|
||||||
private final Renderer renderer;
|
private final Renderer renderer;
|
||||||
|
|
||||||
|
@ -32,12 +32,10 @@ import java.awt.event.MouseMotionListener;
|
|||||||
import java.awt.event.MouseWheelEvent;
|
import java.awt.event.MouseWheelEvent;
|
||||||
import java.awt.event.MouseWheelListener;
|
import java.awt.event.MouseWheelListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ThreadFactory;
|
|
||||||
|
|
||||||
public class IrisVision extends JPanel implements MouseWheelListener {
|
public class IrisVision extends JPanel implements MouseWheelListener {
|
||||||
private static final long serialVersionUID = 2094606939770332040L;
|
private static final long serialVersionUID = 2094606939770332040L;
|
||||||
@ -63,38 +61,32 @@ public class IrisVision extends JPanel implements MouseWheelListener {
|
|||||||
private final KMap<BlockPosition, BufferedImage> fastpositions = new KMap<>();
|
private final KMap<BlockPosition, BufferedImage> fastpositions = new KMap<>();
|
||||||
private final KSet<BlockPosition> working = new KSet<>();
|
private final KSet<BlockPosition> working = new KSet<>();
|
||||||
private final KSet<BlockPosition> workingfast = new KSet<>();
|
private final KSet<BlockPosition> workingfast = new KSet<>();
|
||||||
private final ExecutorService e = Executors.newFixedThreadPool(8, new ThreadFactory() {
|
private final ExecutorService e = Executors.newFixedThreadPool(8, r -> {
|
||||||
@Override
|
tid++;
|
||||||
public Thread newThread(Runnable r) {
|
Thread t = new Thread(r);
|
||||||
tid++;
|
t.setName("Iris HD Renderer " + tid);
|
||||||
Thread t = new Thread(r);
|
t.setPriority(Thread.MIN_PRIORITY);
|
||||||
t.setName("Iris HD Renderer " + tid);
|
t.setUncaughtExceptionHandler((et, e) ->
|
||||||
t.setPriority(Thread.MIN_PRIORITY);
|
{
|
||||||
t.setUncaughtExceptionHandler((et, e) ->
|
Iris.info("Exception encountered in " + et.getName());
|
||||||
{
|
e.printStackTrace();
|
||||||
Iris.info("Exception encountered in " + et.getName());
|
});
|
||||||
e.printStackTrace();
|
|
||||||
});
|
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
private final ExecutorService eh = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), new ThreadFactory() {
|
private final ExecutorService eh = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), r -> {
|
||||||
@Override
|
tid++;
|
||||||
public Thread newThread(Runnable r) {
|
Thread t = new Thread(r);
|
||||||
tid++;
|
t.setName("Iris Renderer " + tid);
|
||||||
Thread t = new Thread(r);
|
t.setPriority(Thread.NORM_PRIORITY);
|
||||||
t.setName("Iris Renderer " + tid);
|
t.setUncaughtExceptionHandler((et, e) ->
|
||||||
t.setPriority(Thread.NORM_PRIORITY);
|
{
|
||||||
t.setUncaughtExceptionHandler((et, e) ->
|
Iris.info("Exception encountered in " + et.getName());
|
||||||
{
|
e.printStackTrace();
|
||||||
Iris.info("Exception encountered in " + et.getName());
|
});
|
||||||
e.printStackTrace();
|
|
||||||
});
|
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
public IrisVision() {
|
public IrisVision() {
|
||||||
@ -241,12 +233,7 @@ public class IrisVision extends JPanel implements MouseWheelListener {
|
|||||||
BufferedImage t = getTile(gg, iscale, Math.floorDiv((posX / iscale) + i, iscale) * iscale, Math.floorDiv((posZ / iscale) + j, iscale) * iscale, m);
|
BufferedImage t = getTile(gg, iscale, Math.floorDiv((posX / iscale) + i, iscale) * iscale, Math.floorDiv((posZ / iscale) + j, iscale) * iscale, m);
|
||||||
|
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
g.drawImage(t, i - ((posX / iscale) % (iscale)), j - ((posZ / iscale) % (iscale)), iscale, iscale, new ImageObserver() {
|
g.drawImage(t, i - ((posX / iscale) % (iscale)), j - ((posZ / iscale) % (iscale)), iscale, iscale, (img, infoflags, x, y, width, height) -> true);
|
||||||
@Override
|
|
||||||
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,7 +285,7 @@ public class IrisVision extends JPanel implements MouseWheelListener {
|
|||||||
if (file != null) {
|
if (file != null) {
|
||||||
try {
|
try {
|
||||||
frame.setIconImage(ImageIO.read(file));
|
frame.setIconImage(ImageIO.read(file));
|
||||||
} catch (IOException e) {
|
} catch (IOException ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,9 +293,7 @@ public class IrisVision extends JPanel implements MouseWheelListener {
|
|||||||
|
|
||||||
public static void launch(IrisAccess g, int i) {
|
public static void launch(IrisAccess g, int i) {
|
||||||
J.a(() ->
|
J.a(() ->
|
||||||
{
|
createAndShowGUI((x, z) -> g.getEngineAccess(i).draw(x, z), i, g.getCompound().getWorld()));
|
||||||
createAndShowGUI((x, z) -> g.getEngineAccess(i).draw(x, z), i, g.getCompound().getWorld());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||||
@ -321,6 +306,6 @@ public class IrisVision extends JPanel implements MouseWheelListener {
|
|||||||
positions.clear();
|
positions.clear();
|
||||||
fastpositions.clear();
|
fastpositions.clear();
|
||||||
mscale = mscale + ((0.044 * mscale) * notches);
|
mscale = mscale + ((0.044 * mscale) * notches);
|
||||||
mscale = mscale < 0.00001 ? 0.00001 : mscale;
|
mscale = Math.max(mscale, 0.00001);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,12 +37,16 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
|
|||||||
private static final long serialVersionUID = 2094606939770332040L;
|
private static final long serialVersionUID = 2094606939770332040L;
|
||||||
|
|
||||||
static JComboBox<String> combo;
|
static JComboBox<String> combo;
|
||||||
|
@SuppressWarnings("CanBeFinal")
|
||||||
RollingSequence r = new RollingSequence(90);
|
RollingSequence r = new RollingSequence(90);
|
||||||
|
@SuppressWarnings("CanBeFinal")
|
||||||
boolean colorMode = true;
|
boolean colorMode = true;
|
||||||
double scale = 1;
|
double scale = 1;
|
||||||
|
@SuppressWarnings("CanBeFinal")
|
||||||
static boolean hd = false;
|
static boolean hd = false;
|
||||||
static double ascale = 10;
|
static double ascale = 10;
|
||||||
CNG cng = NoiseStyle.STATIC.create(new RNG(RNG.r.nextLong()));
|
CNG cng = NoiseStyle.STATIC.create(new RNG(RNG.r.nextLong()));
|
||||||
|
@SuppressWarnings("CanBeFinal")
|
||||||
GroupedExecutor gx = new GroupedExecutor(Runtime.getRuntime().availableProcessors(), Thread.MAX_PRIORITY, "Iris Renderer");
|
GroupedExecutor gx = new GroupedExecutor(Runtime.getRuntime().availableProcessors(), Thread.MAX_PRIORITY, "Iris Renderer");
|
||||||
ReentrantLock l = new ReentrantLock();
|
ReentrantLock l = new ReentrantLock();
|
||||||
int[][] co;
|
int[][] co;
|
||||||
@ -57,6 +61,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
|
|||||||
double mz = 0;
|
double mz = 0;
|
||||||
static double mxx = 0;
|
static double mxx = 0;
|
||||||
static double mzz = 0;
|
static double mzz = 0;
|
||||||
|
@SuppressWarnings("CanBeFinal")
|
||||||
static boolean down = false;
|
static boolean down = false;
|
||||||
double lx = Double.MAX_VALUE; //MouseX
|
double lx = Double.MAX_VALUE; //MouseX
|
||||||
double lz = Double.MAX_VALUE; //MouseY
|
double lz = Double.MAX_VALUE; //MouseY
|
||||||
@ -154,8 +159,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
|
|||||||
accuracy = down ? accuracy * 4 : accuracy;
|
accuracy = down ? accuracy * 4 : accuracy;
|
||||||
int v = 1000;
|
int v = 1000;
|
||||||
|
|
||||||
if (g instanceof Graphics2D) {
|
if (g instanceof Graphics2D gg) {
|
||||||
Graphics2D gg = (Graphics2D) g;
|
|
||||||
|
|
||||||
if (getParent().getWidth() != w || getParent().getHeight() != h) {
|
if (getParent().getWidth() != w || getParent().getHeight() != h) {
|
||||||
w = getParent().getWidth();
|
w = getParent().getWidth();
|
||||||
@ -250,8 +254,8 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
|
|||||||
JFrame frame = new JFrame("Noise Explorer");
|
JFrame frame = new JFrame("Noise Explorer");
|
||||||
NoiseExplorer nv = new NoiseExplorer();
|
NoiseExplorer nv = new NoiseExplorer();
|
||||||
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||||
KList<String> li = new KList<NoiseStyle>(NoiseStyle.values()).toStringList();
|
KList<String> li = new KList<>(NoiseStyle.values()).toStringList();
|
||||||
combo = new JComboBox<String>(li.toArray(new String[li.size()]));
|
combo = new JComboBox<>(li.toArray(new String[0]));
|
||||||
combo.setSelectedItem("STATIC");
|
combo.setSelectedItem("STATIC");
|
||||||
combo.setFocusable(false);
|
combo.setFocusable(false);
|
||||||
combo.addActionListener(e -> {
|
combo.addActionListener(e -> {
|
||||||
@ -284,7 +288,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void launch() {
|
public static void launch() {
|
||||||
EventQueue.invokeLater(() -> createAndShowGUI());
|
EventQueue.invokeLater(NoiseExplorer::createAndShowGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class HandScrollListener extends MouseAdapter {
|
static class HandScrollListener extends MouseAdapter {
|
||||||
|
@ -40,8 +40,7 @@ public class BKLink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Plugin getBK() {
|
public Plugin getBK() {
|
||||||
Plugin p = Bukkit.getPluginManager().getPlugin("BKCommonLib");
|
|
||||||
|
|
||||||
return p;
|
return Bukkit.getPluginManager().getPlugin("BKCommonLib");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,21 +30,8 @@ public class CitizensLink {
|
|||||||
return getCitizens() != null;
|
return getCitizens() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Entity spawn(EntityType type, String npcType, Location a)
|
|
||||||
// {
|
|
||||||
// if(!supported())
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// NPC npc = CitizensAPI.getNPCRegistry().createNPC(type, "");
|
|
||||||
// npc.spawn(a);
|
|
||||||
// return npc.getEntity();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public Plugin getCitizens() {
|
public Plugin getCitizens() {
|
||||||
Plugin p = Bukkit.getPluginManager().getPlugin("Citizens");
|
|
||||||
|
|
||||||
return p;
|
return Bukkit.getPluginManager().getPlugin("Citizens");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,9 +118,8 @@ public class MultiverseCoreLink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Plugin getMultiverse() {
|
public Plugin getMultiverse() {
|
||||||
Plugin p = Bukkit.getPluginManager().getPlugin("Multiverse-Core");
|
|
||||||
|
|
||||||
return p;
|
return Bukkit.getPluginManager().getPlugin("Multiverse-Core");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String envName(World.Environment environment) {
|
public String envName(World.Environment environment) {
|
||||||
@ -128,15 +127,12 @@ public class MultiverseCoreLink {
|
|||||||
return "normal";
|
return "normal";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (environment) {
|
return switch (environment) {
|
||||||
case NORMAL:
|
case NORMAL -> "normal";
|
||||||
return "normal";
|
case NETHER -> "nether";
|
||||||
case NETHER:
|
case THE_END -> "end";
|
||||||
return "nether";
|
default -> environment.toString().toLowerCase();
|
||||||
case THE_END:
|
};
|
||||||
return "end";
|
|
||||||
}
|
|
||||||
|
|
||||||
return environment.toString().toLowerCase();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,12 +55,11 @@ public class MythicMobsLink {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return v.toArray(new String[v.size()]);
|
return v.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plugin getMythicMobs() {
|
public Plugin getMythicMobs() {
|
||||||
Plugin p = Bukkit.getPluginManager().getPlugin("MythicMobs");
|
|
||||||
|
|
||||||
return p;
|
return Bukkit.getPluginManager().getPlugin("MythicMobs");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,7 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
return getCustomBiomeRegistry().d(ResourceKey.a(IRegistry.aO, new MinecraftKey(mckey)));
|
return getCustomBiomeRegistry().d(ResourceKey.a(IRegistry.aO, new MinecraftKey(mckey)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
||||||
@Override
|
@Override
|
||||||
public String getKeyForBiomeBase(Object biomeBase) {
|
public String getKeyForBiomeBase(Object biomeBase) {
|
||||||
return getCustomBiomeRegistry().c((BiomeBase) biomeBase).get().a().toString();
|
return getCustomBiomeRegistry().c((BiomeBase) biomeBase).get().a().toString();
|
||||||
@ -125,6 +126,7 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
try {
|
try {
|
||||||
Method f = from.getClass().getDeclaredMethod(name, classify(par));
|
Method f = from.getClass().getDeclaredMethod(name, classify(par));
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
|
//noinspection unchecked
|
||||||
return (T) f.invoke(from, par);
|
return (T) f.invoke(from, par);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -137,6 +139,7 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
try {
|
try {
|
||||||
Method f = from.getDeclaredMethod(name, classify(par));
|
Method f = from.getDeclaredMethod(name, classify(par));
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
|
//noinspection unchecked
|
||||||
return (T) f.invoke(null, par);
|
return (T) f.invoke(null, par);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -149,6 +152,7 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
try {
|
try {
|
||||||
Field f = from.getClass().getDeclaredField(name);
|
Field f = from.getClass().getDeclaredField(name);
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
|
//noinspection unchecked
|
||||||
return (T) f.get(from);
|
return (T) f.get(from);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -161,6 +165,7 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
try {
|
try {
|
||||||
Field f = t.getDeclaredField(name);
|
Field f = t.getDeclaredField(name);
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
|
//noinspection unchecked
|
||||||
return (T) f.get(null);
|
return (T) f.get(null);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -176,11 +181,13 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
if (v != null) {
|
if (v != null) {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
//noinspection unchecked
|
||||||
v = org.bukkit.craftbukkit.v1_17_R1.block.CraftBlock.biomeToBiomeBase((IRegistry<BiomeBase>) registry, biome);
|
v = org.bukkit.craftbukkit.v1_17_R1.block.CraftBlock.biomeToBiomeBase((IRegistry<BiomeBase>) registry, biome);
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
// Ok so there is this new biome name called "CUSTOM" in Paper's new releases.
|
// Ok so there is this new biome name called "CUSTOM" in Paper's new releases.
|
||||||
// But, this does NOT exist within CraftBukkit which makes it return an error.
|
// But, this does NOT exist within CraftBukkit which makes it return an error.
|
||||||
// So, we will just return the ID that the plains biome returns instead.
|
// So, we will just return the ID that the plains biome returns instead.
|
||||||
|
//noinspection unchecked
|
||||||
return org.bukkit.craftbukkit.v1_17_R1.block.CraftBlock.biomeToBiomeBase((IRegistry<BiomeBase>) registry, Biome.PLAINS);
|
return org.bukkit.craftbukkit.v1_17_R1.block.CraftBlock.biomeToBiomeBase((IRegistry<BiomeBase>) registry, Biome.PLAINS);
|
||||||
}
|
}
|
||||||
baseBiomeCache.put(biome, v);
|
baseBiomeCache.put(biome, v);
|
||||||
@ -204,7 +211,7 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
@Override
|
@Override
|
||||||
public int countCustomBiomes() {
|
public int countCustomBiomes() {
|
||||||
AtomicInteger a = new AtomicInteger(0);
|
AtomicInteger a = new AtomicInteger(0);
|
||||||
getCustomBiomeRegistry().d().stream().forEach((i) -> {
|
getCustomBiomeRegistry().d().forEach((i) -> {
|
||||||
MinecraftKey k = i.getKey().a();
|
MinecraftKey k = i.getKey().a();
|
||||||
|
|
||||||
if (k.getNamespace().equals("minecraft")) {
|
if (k.getNamespace().equals("minecraft")) {
|
||||||
|
@ -34,10 +34,12 @@ public enum CarvingMode {
|
|||||||
|
|
||||||
ANYWHERE;
|
ANYWHERE;
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public boolean supportsCarving() {
|
public boolean supportsCarving() {
|
||||||
return this.equals(ANYWHERE) || this.equals(CARVING_ONLY);
|
return this.equals(ANYWHERE) || this.equals(CARVING_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public boolean supportsSurface() {
|
public boolean supportsSurface() {
|
||||||
return this.equals(ANYWHERE) || this.equals(SURFACE_ONLY);
|
return this.equals(ANYWHERE) || this.equals(SURFACE_ONLY);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import org.bukkit.block.data.BlockData;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -166,15 +167,15 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
|
|
||||||
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
|
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
|
||||||
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
||||||
private KList<IrisBiomePaletteLayer> seaLayers = new KList<IrisBiomePaletteLayer>();
|
private KList<IrisBiomePaletteLayer> seaLayers = new KList<>();
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisDecorator.class)
|
@ArrayType(min = 1, type = IrisDecorator.class)
|
||||||
@Desc("Decorators are used for things like tall grass, bisected flowers, and even kelp or cactus (random heights)")
|
@Desc("Decorators are used for things like tall grass, bisected flowers, and even kelp or cactus (random heights)")
|
||||||
private KList<IrisDecorator> decorators = new KList<IrisDecorator>();
|
private KList<IrisDecorator> decorators = new KList<>();
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
||||||
@Desc("Objects define what schematics (iob files) iris will place in this biome")
|
@Desc("Objects define what schematics (iob files) iris will place in this biome")
|
||||||
private KList<IrisObjectPlacement> objects = new KList<IrisObjectPlacement>();
|
private KList<IrisObjectPlacement> objects = new KList<>();
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@ArrayType(min = 1, type = IrisBiomeGeneratorLink.class)
|
@ArrayType(min = 1, type = IrisBiomeGeneratorLink.class)
|
||||||
@ -307,9 +308,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
|
|
||||||
public CNG getBiomeGenerator(RNG random) {
|
public CNG getBiomeGenerator(RNG random) {
|
||||||
return biomeGenerator.aquire(() ->
|
return biomeGenerator.aquire(() ->
|
||||||
{
|
biomeStyle.create(random.nextParallelRNG(213949 + 228888 + getRarity() + getName().length())));
|
||||||
return biomeStyle.create(random.nextParallelRNG(213949 + 228888 + getRarity() + getName().length()));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CNG getChildrenGenerator(RNG random, int sig, double scale) {
|
public CNG getChildrenGenerator(RNG random, int sig, double scale) {
|
||||||
@ -403,7 +402,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
for (int i = 0; i < maxDepth; i++) {
|
for (int i = 0; i < maxDepth; i++) {
|
||||||
int offset = (255 - height) - i;
|
int offset = (255 - height) - i;
|
||||||
int index = offset % data.size();
|
int index = offset % data.size();
|
||||||
real.add(data.get(index < 0 ? 0 : index));
|
real.add(data.get(Math.max(index, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return real;
|
return real;
|
||||||
@ -521,6 +520,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
return isSea() || isLake() || isRiver();
|
return isSea() || isLake() || isRiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public boolean isShore() {
|
public boolean isShore() {
|
||||||
if (inferredType == null) {
|
if (inferredType == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -569,12 +569,11 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
if (limit > 0) {
|
if (limit > 0) {
|
||||||
for (String i : getChildren()) {
|
for (String i : getChildren()) {
|
||||||
IrisBiome b = g.getData().getBiomeLoader().load(i);
|
IrisBiome b = g.getData().getBiomeLoader().load(i);
|
||||||
int l = limit;
|
m.addAll(b.getAllChildren(g, limit));
|
||||||
m.addAll(b.getAllChildren(g, l));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new KList<String>(m);
|
return new KList<>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Test
|
//TODO: Test
|
||||||
|
@ -60,7 +60,7 @@ public class IrisBiomeMutation {
|
|||||||
@RegistryListObject
|
@RegistryListObject
|
||||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
||||||
@Desc("Objects define what schematics (iob files) iris will place in this biome mutation")
|
@Desc("Objects define what schematics (iob files) iris will place in this biome mutation")
|
||||||
private KList<IrisObjectPlacement> objects = new KList<IrisObjectPlacement>();
|
private KList<IrisObjectPlacement> objects = new KList<>();
|
||||||
|
|
||||||
private final transient AtomicCache<KList<String>> sideACache = new AtomicCache<>();
|
private final transient AtomicCache<KList<String>> sideACache = new AtomicCache<>();
|
||||||
private final transient AtomicCache<KList<String>> sideBCache = new AtomicCache<>();
|
private final transient AtomicCache<KList<String>> sideBCache = new AtomicCache<>();
|
||||||
@ -77,24 +77,26 @@ public class IrisBiomeMutation {
|
|||||||
KSet<String> r = new KSet<>();
|
KSet<String> r = new KSet<>();
|
||||||
|
|
||||||
for (String i : s) {
|
for (String i : s) {
|
||||||
String q = i;
|
|
||||||
|
|
||||||
if (q.startsWith("^")) {
|
if (i.startsWith("^")) {
|
||||||
r.addAll(xg.getData().getRegionLoader().load(q.substring(1)).getLandBiomes());
|
r.addAll(xg.getData().getRegionLoader().load(i.substring(1)).getLandBiomes());
|
||||||
continue;
|
} else if (i.startsWith("*")) {
|
||||||
} else if (q.startsWith("*")) {
|
String name = i.substring(1);
|
||||||
String name = q.substring(1);
|
|
||||||
r.addAll(xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7));
|
r.addAll(xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7));
|
||||||
} else if (q.startsWith("!")) {
|
} else if (i.startsWith("!")) {
|
||||||
r.remove(q.substring(1));
|
r.remove(i.substring(1));
|
||||||
} else if (q.startsWith("!*")) {
|
} else if (i.startsWith("!*")) {
|
||||||
String name = q.substring(2);
|
String name = i.substring(2);
|
||||||
r.removeAll(xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7));
|
|
||||||
|
for(String g : xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7))
|
||||||
|
{
|
||||||
|
r.remove(g);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
r.add(q);
|
r.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new KList<String>(r);
|
return new KList<>(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,9 @@ import lombok.NoArgsConstructor;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -77,8 +80,8 @@ public class IrisBlockData extends IrisRegistrant {
|
|||||||
|
|
||||||
KList<String> r = new KList<>();
|
KList<String> r = new KList<>();
|
||||||
|
|
||||||
for (String i : data.keySet()) {
|
for (Map.Entry<String, Object> entry : data.entrySet()) {
|
||||||
r.add(i + "=" + filter(data.get(i).toString()));
|
r.add(entry.getKey() + "=" + filter(entry.getValue().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return "[" + r.toString(",") + "]";
|
return "[" + r.toString(",") + "]";
|
||||||
@ -194,13 +197,13 @@ public class IrisBlockData extends IrisRegistrant {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return Integer.valueOf(string);
|
return Integer.valueOf(string);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return Double.valueOf(string).intValue();
|
return Double.valueOf(string).intValue();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class IrisBlockDrops {
|
|||||||
@Required
|
@Required
|
||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("The blocks that drop loot")
|
@Desc("The blocks that drop loot")
|
||||||
private KList<IrisBlockData> blocks = new KList<IrisBlockData>();
|
private KList<IrisBlockData> blocks = new KList<>();
|
||||||
|
|
||||||
|
|
||||||
@Desc("If exact blocks is set to true, minecraft:barrel[axis=x] will only drop for that axis. When exact is false (default) any barrel will drop the defined drops.")
|
@Desc("If exact blocks is set to true, minecraft:barrel[axis=x] will only drop for that axis. When exact is false (default) any barrel will drop the defined drops.")
|
||||||
|
@ -65,7 +65,7 @@ public class IrisColor {
|
|||||||
String v = (hex.startsWith("#") ? hex : "#" + hex).trim();
|
String v = (hex.startsWith("#") ? hex : "#" + hex).trim();
|
||||||
try {
|
try {
|
||||||
return Color.decode(v);
|
return Color.decode(v);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,8 +89,8 @@ public class IrisColor {
|
|||||||
int g = 0;
|
int g = 0;
|
||||||
int b = 0;
|
int b = 0;
|
||||||
|
|
||||||
for (int i = 0; i < c.length; i++) {
|
for (Color value : c) {
|
||||||
int rgb = c[i].getRGB();
|
int rgb = value.getRGB();
|
||||||
int a1 = (rgb >> 24 & 0xff);
|
int a1 = (rgb >> 24 & 0xff);
|
||||||
int r1 = ((rgb & 0xff0000) >> 16);
|
int r1 = ((rgb & 0xff0000) >> 16);
|
||||||
int g1 = ((rgb & 0xff00) >> 8);
|
int g1 = ((rgb & 0xff00) >> 8);
|
||||||
|
@ -167,8 +167,6 @@ public class IrisCompat {
|
|||||||
}
|
}
|
||||||
} catch (JsonSyntaxException e) {
|
} catch (JsonSyntaxException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
|
@ -83,7 +83,7 @@ public class IrisDecorator {
|
|||||||
|
|
||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("The palette of blocks used at the very top of a 'stackMax' of higher than 1. For example, bamboo tops.")
|
@Desc("The palette of blocks used at the very top of a 'stackMax' of higher than 1. For example, bamboo tops.")
|
||||||
private KList<IrisBlockData> topPalette = new KList<IrisBlockData>();
|
private KList<IrisBlockData> topPalette = new KList<>();
|
||||||
|
|
||||||
@DependsOn("topPalette")
|
@DependsOn("topPalette")
|
||||||
@MinNumber(0.01)
|
@MinNumber(0.01)
|
||||||
@ -107,9 +107,7 @@ public class IrisDecorator {
|
|||||||
|
|
||||||
public CNG getHeightGenerator(RNG rng, IrisDataManager data) {
|
public CNG getHeightGenerator(RNG rng, IrisDataManager data) {
|
||||||
return heightGenerator.aquire(() ->
|
return heightGenerator.aquire(() ->
|
||||||
{
|
heightVariance.create(rng.nextParallelRNG(getBlockData(data).size() + stackMax + stackMin)));
|
||||||
return heightVariance.create(rng.nextParallelRNG(getBlockData(data).size() + stackMax + stackMin));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CNG getGenerator(RNG rng, IrisDataManager data) {
|
public CNG getGenerator(RNG rng, IrisDataManager data) {
|
||||||
@ -223,6 +221,7 @@ public class IrisDecorator {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public boolean isStacking() {
|
public boolean isStacking() {
|
||||||
return getStackMax() > 1;
|
return getStackMax() > 1;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ public class IrisDepositGenerator {
|
|||||||
@Required
|
@Required
|
||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("The palette of blocks to be used in this deposit generator")
|
@Desc("The palette of blocks to be used in this deposit generator")
|
||||||
private KList<IrisBlockData> palette = new KList<IrisBlockData>();
|
private KList<IrisBlockData> palette = new KList<>();
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(64)
|
@MaxNumber(64)
|
||||||
|
@ -36,6 +36,7 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ -483,12 +484,14 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
if (write) {
|
if (write) {
|
||||||
File mcm = new File(datapacks, "iris/pack.mcmeta");
|
File mcm = new File(datapacks, "iris/pack.mcmeta");
|
||||||
try {
|
try {
|
||||||
IO.writeAll(mcm, "{\n" +
|
IO.writeAll(mcm, """
|
||||||
" \"pack\": {\n" +
|
{
|
||||||
" \"description\": \"Iris Data Pack. This pack contains all installed Iris Packs' resources.\",\n" +
|
"pack": {
|
||||||
" \"pack_format\": 7\n" +
|
"description": "Iris Data Pack. This pack contains all installed Iris Packs' resources.",
|
||||||
" }\n" +
|
"pack_format": 7
|
||||||
"}\n");
|
}
|
||||||
|
}
|
||||||
|
""");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -25,6 +25,8 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.block.data.type.Jigsaw;
|
import org.bukkit.block.data.type.Jigsaw;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directions
|
* Directions
|
||||||
*
|
*
|
||||||
@ -47,35 +49,15 @@ public enum IrisDirection {
|
|||||||
private final CuboidDirection f;
|
private final CuboidDirection f;
|
||||||
|
|
||||||
public static IrisDirection getDirection(BlockFace f) {
|
public static IrisDirection getDirection(BlockFace f) {
|
||||||
switch (f) {
|
return switch (f) {
|
||||||
case DOWN:
|
case DOWN -> DOWN_NEGATIVE_Y;
|
||||||
return DOWN_NEGATIVE_Y;
|
case EAST, EAST_NORTH_EAST, EAST_SOUTH_EAST -> EAST_POSITIVE_X;
|
||||||
case EAST:
|
case NORTH, NORTH_NORTH_WEST, NORTH_EAST, NORTH_NORTH_EAST, NORTH_WEST -> NORTH_NEGATIVE_Z;
|
||||||
case EAST_NORTH_EAST:
|
case SELF, UP -> UP_POSITIVE_Y;
|
||||||
case EAST_SOUTH_EAST:
|
case SOUTH, SOUTH_EAST, SOUTH_SOUTH_EAST, SOUTH_SOUTH_WEST, SOUTH_WEST -> SOUTH_POSITIVE_Z;
|
||||||
return EAST_POSITIVE_X;
|
case WEST, WEST_NORTH_WEST, WEST_SOUTH_WEST -> WEST_NEGATIVE_X;
|
||||||
case NORTH:
|
};
|
||||||
case NORTH_NORTH_WEST:
|
|
||||||
case NORTH_EAST:
|
|
||||||
case NORTH_NORTH_EAST:
|
|
||||||
case NORTH_WEST:
|
|
||||||
return NORTH_NEGATIVE_Z;
|
|
||||||
case SELF:
|
|
||||||
case UP:
|
|
||||||
return UP_POSITIVE_Y;
|
|
||||||
case SOUTH:
|
|
||||||
case SOUTH_EAST:
|
|
||||||
case SOUTH_SOUTH_EAST:
|
|
||||||
case SOUTH_SOUTH_WEST:
|
|
||||||
case SOUTH_WEST:
|
|
||||||
return SOUTH_POSITIVE_Z;
|
|
||||||
case WEST:
|
|
||||||
case WEST_NORTH_WEST:
|
|
||||||
case WEST_SOUTH_WEST:
|
|
||||||
return WEST_NEGATIVE_X;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DOWN_NEGATIVE_Y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IrisDirection fromJigsawBlock(String direction) {
|
public static IrisDirection fromJigsawBlock(String direction) {
|
||||||
@ -90,46 +72,26 @@ public enum IrisDirection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static IrisDirection getDirection(Jigsaw.Orientation orientation) {
|
public static IrisDirection getDirection(Jigsaw.Orientation orientation) {
|
||||||
switch (orientation) {
|
return switch (orientation) {
|
||||||
case DOWN_EAST:
|
case DOWN_EAST, UP_EAST, EAST_UP -> EAST_POSITIVE_X;
|
||||||
case UP_EAST:
|
case DOWN_NORTH, UP_NORTH, NORTH_UP -> NORTH_NEGATIVE_Z;
|
||||||
case EAST_UP:
|
case DOWN_SOUTH, UP_SOUTH, SOUTH_UP -> SOUTH_POSITIVE_Z;
|
||||||
return EAST_POSITIVE_X;
|
case DOWN_WEST, UP_WEST, WEST_UP -> WEST_NEGATIVE_X;
|
||||||
case DOWN_NORTH:
|
};
|
||||||
case UP_NORTH:
|
|
||||||
case NORTH_UP:
|
|
||||||
return NORTH_NEGATIVE_Z;
|
|
||||||
case DOWN_SOUTH:
|
|
||||||
case UP_SOUTH:
|
|
||||||
case SOUTH_UP:
|
|
||||||
return SOUTH_POSITIVE_Z;
|
|
||||||
case DOWN_WEST:
|
|
||||||
case UP_WEST:
|
|
||||||
case WEST_UP:
|
|
||||||
return WEST_NEGATIVE_X;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case DOWN_NEGATIVE_Y:
|
case DOWN_NEGATIVE_Y -> "Down";
|
||||||
return "Down";
|
case EAST_POSITIVE_X -> "East";
|
||||||
case EAST_POSITIVE_X:
|
case NORTH_NEGATIVE_Z -> "North";
|
||||||
return "East";
|
case SOUTH_POSITIVE_Z -> "South";
|
||||||
case NORTH_NEGATIVE_Z:
|
case UP_POSITIVE_Y -> "Up";
|
||||||
return "North";
|
case WEST_NEGATIVE_X -> "West";
|
||||||
case SOUTH_POSITIVE_Z:
|
};
|
||||||
return "South";
|
|
||||||
case UP_POSITIVE_Y:
|
|
||||||
return "Up";
|
|
||||||
case WEST_NEGATIVE_X:
|
|
||||||
return "West";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "?";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVertical() {
|
public boolean isVertical() {
|
||||||
@ -209,9 +171,10 @@ public enum IrisDirection {
|
|||||||
public Vector angle(Vector initial, IrisDirection d) {
|
public Vector angle(Vector initial, IrisDirection d) {
|
||||||
calculatePermutations();
|
calculatePermutations();
|
||||||
|
|
||||||
for (GBiset<IrisDirection, IrisDirection> i : permute.keySet()) {
|
for (Map.Entry<GBiset<IrisDirection, IrisDirection>, DOP> entry : permute.entrySet()) {
|
||||||
|
GBiset<IrisDirection, IrisDirection> i = entry.getKey();
|
||||||
if (i.getA().equals(this) && i.getB().equals(d)) {
|
if (i.getA().equals(this) && i.getB().equals(d)) {
|
||||||
return permute.get(i).op(initial);
|
return entry.getValue().op(initial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,11 +297,11 @@ public enum IrisDirection {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
permute = new KMap<GBiset<IrisDirection, IrisDirection>, DOP>();
|
permute = new KMap<>();
|
||||||
|
|
||||||
for (IrisDirection i : udnews()) {
|
for (IrisDirection i : udnews()) {
|
||||||
for (IrisDirection j : udnews()) {
|
for (IrisDirection j : udnews()) {
|
||||||
GBiset<IrisDirection, IrisDirection> b = new GBiset<IrisDirection, IrisDirection>(i, j);
|
GBiset<IrisDirection, IrisDirection> b = new GBiset<>(i, j);
|
||||||
|
|
||||||
if (i.equals(j)) {
|
if (i.equals(j)) {
|
||||||
permute.put(b, new DOP("DIRECT") {
|
permute.put(b, new DOP("DIRECT") {
|
||||||
@ -418,37 +381,23 @@ public enum IrisDirection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockFace getFace() {
|
public BlockFace getFace() {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case DOWN_NEGATIVE_Y:
|
case DOWN_NEGATIVE_Y -> BlockFace.DOWN;
|
||||||
return BlockFace.DOWN;
|
case EAST_POSITIVE_X -> BlockFace.EAST;
|
||||||
case EAST_POSITIVE_X:
|
case NORTH_NEGATIVE_Z -> BlockFace.NORTH;
|
||||||
return BlockFace.EAST;
|
case SOUTH_POSITIVE_Z -> BlockFace.SOUTH;
|
||||||
case NORTH_NEGATIVE_Z:
|
case UP_POSITIVE_Y -> BlockFace.UP;
|
||||||
return BlockFace.NORTH;
|
case WEST_NEGATIVE_X -> BlockFace.WEST;
|
||||||
case SOUTH_POSITIVE_Z:
|
};
|
||||||
return BlockFace.SOUTH;
|
|
||||||
case UP_POSITIVE_Y:
|
|
||||||
return BlockFace.UP;
|
|
||||||
case WEST_NEGATIVE_X:
|
|
||||||
return BlockFace.WEST;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Axis getAxis() {
|
public Axis getAxis() {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case DOWN_NEGATIVE_Y:
|
case DOWN_NEGATIVE_Y, UP_POSITIVE_Y -> Axis.Y;
|
||||||
case UP_POSITIVE_Y:
|
case EAST_POSITIVE_X, WEST_NEGATIVE_X -> Axis.X;
|
||||||
return Axis.Y;
|
case NORTH_NEGATIVE_Z, SOUTH_POSITIVE_Z -> Axis.Z;
|
||||||
case EAST_POSITIVE_X:
|
};
|
||||||
case WEST_NEGATIVE_X:
|
|
||||||
return Axis.X;
|
|
||||||
case NORTH_NEGATIVE_Z:
|
|
||||||
case SOUTH_POSITIVE_Z:
|
|
||||||
return Axis.Z;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ public class IrisEffect {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,9 +212,7 @@ public class IrisEffect {
|
|||||||
if (sound != null) {
|
if (sound != null) {
|
||||||
Location part = p.getLocation().clone().add(RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance));
|
Location part = p.getLocation().clone().add(RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance));
|
||||||
|
|
||||||
J.s(() -> {
|
J.s(() -> p.playSound(part, getSound(), (float) volume, (float) RNG.r.d(minPitch, maxPitch)));
|
||||||
p.playSound(part, getSound(), (float) volume, (float) RNG.r.d(minPitch, maxPitch));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (particleEffect != null) {
|
if (particleEffect != null) {
|
||||||
@ -223,23 +221,19 @@ public class IrisEffect {
|
|||||||
part.setY(Math.round(g.getHeight(part.getBlockX(), part.getBlockZ())) + 1);
|
part.setY(Math.round(g.getHeight(part.getBlockX(), part.getBlockZ())) + 1);
|
||||||
part.add(RNG.r.d(), 0, RNG.r.d());
|
part.add(RNG.r.d(), 0, RNG.r.d());
|
||||||
if (extra != 0) {
|
if (extra != 0) {
|
||||||
J.s(() -> {
|
J.s(() -> p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset),
|
||||||
p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset),
|
part.getZ(),
|
||||||
part.getZ(),
|
particleCount,
|
||||||
particleCount,
|
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
|
||||||
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
|
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
|
||||||
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
|
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ,
|
||||||
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ,
|
extra));
|
||||||
extra);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
J.s(() -> {
|
J.s(() -> p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset), part.getZ(),
|
||||||
p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset), part.getZ(),
|
particleCount,
|
||||||
particleCount,
|
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
|
||||||
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
|
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
|
||||||
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
|
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ));
|
||||||
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,18 +244,14 @@ public class IrisEffect {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
J.s(() -> {
|
J.s(() -> p.removePotionEffect(getRealType()));
|
||||||
p.removePotionEffect(getRealType());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
J.s(() -> {
|
J.s(() -> p.addPotionEffect(new PotionEffect(getRealType(),
|
||||||
p.addPotionEffect(new PotionEffect(getRealType(),
|
RNG.r.i(Math.min(potionTicksMax, potionTicksMin),
|
||||||
RNG.r.i(Math.min(potionTicksMax, potionTicksMin),
|
Math.max(potionTicksMax, potionTicksMin)),
|
||||||
Math.max(potionTicksMax, potionTicksMin)),
|
getPotionStrength(),
|
||||||
getPotionStrength(),
|
true, false, false)));
|
||||||
true, false, false));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class IrisEnchantment {
|
|||||||
}
|
}
|
||||||
meta.addEnchant(getEnchant(), getLevel(rng), true);
|
meta.addEnchant(getEnchant(), getLevel(rng), true);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ import java.util.Collection;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -286,7 +287,7 @@ public class IrisEntity extends IrisRegistrant {
|
|||||||
J.s(() -> ae.set(doSpawn(at)));
|
J.s(() -> ae.set(doSpawn(at)));
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
|
|
||||||
while (ae == null) {
|
while (ae.get() == null) {
|
||||||
J.sleep(3);
|
J.sleep(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import lombok.experimental.Accessors;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -96,7 +97,7 @@ public class IrisGenerator extends IrisRegistrant {
|
|||||||
|
|
||||||
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
|
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
|
||||||
@Desc("The list of noise gens this gen contains.")
|
@Desc("The list of noise gens this gen contains.")
|
||||||
private KList<IrisNoiseGenerator> composite = new KList<IrisNoiseGenerator>();
|
private KList<IrisNoiseGenerator> composite = new KList<>();
|
||||||
|
|
||||||
|
|
||||||
@Desc("The noise gen for cliff height.")
|
@Desc("The noise gen for cliff height.")
|
||||||
|
@ -62,7 +62,7 @@ public class IrisGeneratorStyle {
|
|||||||
@Desc("The exponent")
|
@Desc("The exponent")
|
||||||
private double exponent = 1;
|
private double exponent = 1;
|
||||||
|
|
||||||
private final transient AtomicCache<CNG> cng = new AtomicCache<CNG>();
|
private final transient AtomicCache<CNG> cng = new AtomicCache<>();
|
||||||
|
|
||||||
public IrisGeneratorStyle(NoiseStyle s) {
|
public IrisGeneratorStyle(NoiseStyle s) {
|
||||||
this.style = s;
|
this.style = s;
|
||||||
@ -87,6 +87,7 @@ public class IrisGeneratorStyle {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public boolean isFlat() {
|
public boolean isFlat() {
|
||||||
return style.equals(NoiseStyle.FLAT);
|
return style.equals(NoiseStyle.FLAT);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import org.bukkit.util.BlockVector;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -25,6 +25,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -25,6 +25,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -27,6 +27,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -27,6 +27,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -124,8 +124,7 @@ public class IrisLoot {
|
|||||||
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
||||||
ItemMeta m = is.getItemMeta();
|
ItemMeta m = is.getItemMeta();
|
||||||
|
|
||||||
if (getType().getMaxDurability() > 0 && m instanceof Damageable) {
|
if (getType().getMaxDurability() > 0 && m instanceof Damageable d) {
|
||||||
Damageable d = (Damageable) m;
|
|
||||||
int max = getType().getMaxDurability();
|
int max = getType().getMaxDurability();
|
||||||
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
|
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
|
||||||
}
|
}
|
||||||
@ -186,7 +185,7 @@ public class IrisLoot {
|
|||||||
|
|
||||||
is.setItemMeta(m);
|
is.setItemMeta(m);
|
||||||
return is;
|
return is;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,8 +207,7 @@ public class IrisLoot {
|
|||||||
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
||||||
ItemMeta m = is.getItemMeta();
|
ItemMeta m = is.getItemMeta();
|
||||||
|
|
||||||
if (getType().getMaxDurability() > 0 && m instanceof Damageable) {
|
if (getType().getMaxDurability() > 0 && m instanceof Damageable d) {
|
||||||
Damageable d = (Damageable) m;
|
|
||||||
int max = getType().getMaxDurability();
|
int max = getType().getMaxDurability();
|
||||||
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
|
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
|
||||||
}
|
}
|
||||||
@ -261,7 +259,7 @@ public class IrisLoot {
|
|||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
is.setItemMeta(m);
|
is.setItemMeta(m);
|
||||||
return is;
|
return is;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import lombok.experimental.Accessors;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -138,7 +138,7 @@ public class IrisNoiseGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public KList<IrisNoiseGenerator> getAllComposites() {
|
public KList<IrisNoiseGenerator> getAllComposites() {
|
||||||
KList<IrisNoiseGenerator> g = new KList<IrisNoiseGenerator>();
|
KList<IrisNoiseGenerator> g = new KList<>();
|
||||||
|
|
||||||
g.add(this);
|
g.add(this);
|
||||||
|
|
||||||
|
@ -38,12 +38,10 @@ import org.bukkit.util.BlockVector;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ -214,7 +212,7 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
center = new BlockVector(w / 2, h / 2, d / 2);
|
center = new BlockVector(w / 2, h / 2, d / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings({"resource", "RedundantSuppression"})
|
||||||
public static BlockVector sampleSize(File file) throws IOException {
|
public static BlockVector sampleSize(File file) throws IOException {
|
||||||
FileInputStream in = new FileInputStream(file);
|
FileInputStream in = new FileInputStream(file);
|
||||||
DataInputStream din = new DataInputStream(in);
|
DataInputStream din = new DataInputStream(in);
|
||||||
@ -811,23 +809,24 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
if (getD() == 2) {
|
if (getD() == 2) {
|
||||||
center = center.setZ(center.getBlockZ() + 0.5);
|
center = center.setZ(center.getBlockZ() + 0.5);
|
||||||
}
|
}
|
||||||
HashMap<BlockVector, BlockData> placeBlock = new HashMap();
|
@SuppressWarnings({"unchecked", "rawtypes"}) HashMap<BlockVector, BlockData> placeBlock = new HashMap();
|
||||||
|
|
||||||
IrisObject oo = new IrisObject((int) Math.ceil((w * scale) + (scale * 2)), (int) Math.ceil((h * scale) + (scale * 2)), (int) Math.ceil((d * scale) + (scale * 2)));
|
IrisObject oo = new IrisObject((int) Math.ceil((w * scale) + (scale * 2)), (int) Math.ceil((h * scale) + (scale * 2)), (int) Math.ceil((d * scale) + (scale * 2)));
|
||||||
|
|
||||||
for (BlockVector i : blocks.keySet()) {
|
for (Map.Entry<BlockVector, BlockData> entry : blocks.entrySet()) {
|
||||||
BlockData bd = blocks.get(i);
|
BlockData bd = entry.getValue();
|
||||||
placeBlock.put(i.clone().add(HALF).subtract(center)
|
placeBlock.put(entry.getKey().clone().add(HALF).subtract(center)
|
||||||
.multiply(scale).toBlockVector(), bd);
|
.multiply(scale).toBlockVector(), bd);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BlockVector v : placeBlock.keySet()) {
|
for (Map.Entry<BlockVector, BlockData> entry : placeBlock.entrySet()) {
|
||||||
|
BlockVector v = entry.getKey();
|
||||||
if (scale > 1) {
|
if (scale > 1) {
|
||||||
for (BlockVector vec : blocksBetweenTwoPoints(v.clone().add(center), v.clone().add(center).add(sm1))) {
|
for (BlockVector vec : blocksBetweenTwoPoints(v.clone().add(center), v.clone().add(center).add(sm1))) {
|
||||||
oo.getBlocks().put(vec, placeBlock.get(v));
|
oo.getBlocks().put(vec, entry.getValue());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
oo.setUnsigned(v.getBlockX(), v.getBlockY(), v.getBlockZ(), placeBlock.get(v));
|
oo.setUnsigned(v.getBlockX(), v.getBlockY(), v.getBlockZ(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -943,14 +942,14 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
|
|
||||||
double d = Double.MAX_VALUE;
|
double d = Double.MAX_VALUE;
|
||||||
|
|
||||||
for (BlockVector i : blocks.keySet()) {
|
for (Map.Entry<BlockVector, BlockData> entry : blocks.entrySet()) {
|
||||||
BlockData dat = blocks.get(i);
|
BlockData dat = entry.getValue();
|
||||||
|
|
||||||
if (dat.getMaterial().isAir()) {
|
if (dat.getMaterial().isAir()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
double dx = i.distanceSquared(vv);
|
double dx = entry.getKey().distanceSquared(vv);
|
||||||
|
|
||||||
if (dx < d) {
|
if (dx < d) {
|
||||||
d = dx;
|
d = dx;
|
||||||
|
@ -177,9 +177,7 @@ public class IrisObjectPlacement {
|
|||||||
|
|
||||||
public CNG getSurfaceWarp(RNG rng) {
|
public CNG getSurfaceWarp(RNG rng) {
|
||||||
return surfaceWarp.aquire(() ->
|
return surfaceWarp.aquire(() ->
|
||||||
{
|
getWarp().create(rng));
|
||||||
return getWarp().create(rng);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double warp(RNG rng, double x, double y, double z) {
|
public double warp(RNG rng, double x, double y, double z) {
|
||||||
@ -212,10 +210,10 @@ public class IrisObjectPlacement {
|
|||||||
|
|
||||||
private transient AtomicCache<TableCache> cache = new AtomicCache<>();
|
private transient AtomicCache<TableCache> cache = new AtomicCache<>();
|
||||||
|
|
||||||
private class TableCache {
|
private static class TableCache {
|
||||||
transient WeightedRandom<IrisLootTable> global = new WeightedRandom<>();
|
final transient WeightedRandom<IrisLootTable> global = new WeightedRandom<>();
|
||||||
transient KMap<Material, WeightedRandom<IrisLootTable>> basic = new KMap<>();
|
final transient KMap<Material, WeightedRandom<IrisLootTable>> basic = new KMap<>();
|
||||||
transient KMap<Material, KMap<BlockData, WeightedRandom<IrisLootTable>>> exact = new KMap<>();
|
final transient KMap<Material, KMap<BlockData, WeightedRandom<IrisLootTable>>> exact = new KMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private TableCache getCache(IrisDataManager manager) {
|
private TableCache getCache(IrisDataManager manager) {
|
||||||
|
@ -190,47 +190,29 @@ public class IrisObjectRotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockFace faceForAxis(Axis axis) {
|
public BlockFace faceForAxis(Axis axis) {
|
||||||
switch (axis) {
|
return switch (axis) {
|
||||||
case X:
|
case X -> BlockFace.EAST;
|
||||||
return BlockFace.EAST;
|
case Y -> BlockFace.UP;
|
||||||
case Y:
|
case Z -> BlockFace.NORTH;
|
||||||
return BlockFace.UP;
|
};
|
||||||
case Z:
|
|
||||||
return BlockFace.NORTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
return BlockFace.NORTH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Axis axisFor(BlockFace f) {
|
public Axis axisFor(BlockFace f) {
|
||||||
switch (f) {
|
return switch (f) {
|
||||||
case NORTH:
|
case NORTH, SOUTH -> Axis.Z;
|
||||||
case SOUTH:
|
case EAST, WEST -> Axis.X;
|
||||||
return Axis.Z;
|
default -> Axis.Y;
|
||||||
case EAST:
|
};
|
||||||
case WEST:
|
|
||||||
return Axis.X;
|
|
||||||
case UP:
|
|
||||||
case DOWN:
|
|
||||||
return Axis.Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Axis.Y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Axis axisFor2D(BlockFace f) {
|
public Axis axisFor2D(BlockFace f) {
|
||||||
switch (f) {
|
return switch (f) {
|
||||||
case NORTH:
|
case EAST, WEST, UP, DOWN -> Axis.X;
|
||||||
case SOUTH:
|
default -> Axis.Z;
|
||||||
return Axis.Z;
|
};
|
||||||
case EAST:
|
|
||||||
case WEST:
|
|
||||||
case UP:
|
|
||||||
case DOWN:
|
|
||||||
return Axis.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Axis.Z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockData rotate(BlockData dd, int spinxx, int spinyy, int spinzz) {
|
public BlockData rotate(BlockData dd, int spinxx, int spinyy, int spinzz) {
|
||||||
@ -244,8 +226,7 @@ public class IrisObjectRotation {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d instanceof Directional) {
|
if (d instanceof Directional g) {
|
||||||
Directional g = ((Directional) d);
|
|
||||||
BlockFace f = g.getFacing();
|
BlockFace f = g.getFacing();
|
||||||
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
||||||
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||||
@ -256,8 +237,7 @@ public class IrisObjectRotation {
|
|||||||
} else if (!g.getMaterial().isSolid()) {
|
} else if (!g.getMaterial().isSolid()) {
|
||||||
d = null;
|
d = null;
|
||||||
}
|
}
|
||||||
} else if (d instanceof Rotatable) {
|
} else if (d instanceof Rotatable g) {
|
||||||
Rotatable g = ((Rotatable) d);
|
|
||||||
BlockFace f = g.getRotation();
|
BlockFace f = g.getRotation();
|
||||||
|
|
||||||
BlockVector bv = new BlockVector(f.getModX(), 0, f.getModZ());
|
BlockVector bv = new BlockVector(f.getModX(), 0, f.getModZ());
|
||||||
@ -275,9 +255,8 @@ public class IrisObjectRotation {
|
|||||||
if (!a.equals(((Orientable) d).getAxis()) && ((Orientable) d).getAxes().contains(a)) {
|
if (!a.equals(((Orientable) d).getAxis()) && ((Orientable) d).getAxes().contains(a)) {
|
||||||
((Orientable) d).setAxis(a);
|
((Orientable) d).setAxis(a);
|
||||||
}
|
}
|
||||||
} else if (d instanceof MultipleFacing) {
|
} else if (d instanceof MultipleFacing g) {
|
||||||
List<BlockFace> faces = new KList<>();
|
List<BlockFace> faces = new KList<>();
|
||||||
MultipleFacing g = (MultipleFacing) d;
|
|
||||||
|
|
||||||
for (BlockFace i : g.getFaces()) {
|
for (BlockFace i : g.getFaces()) {
|
||||||
BlockVector bv = new BlockVector(i.getModX(), i.getModY(), i.getModZ());
|
BlockVector bv = new BlockVector(i.getModX(), i.getModY(), i.getModZ());
|
||||||
@ -296,9 +275,8 @@ public class IrisObjectRotation {
|
|||||||
for (BlockFace i : faces) {
|
for (BlockFace i : faces) {
|
||||||
g.setFace(i, true);
|
g.setFace(i, true);
|
||||||
}
|
}
|
||||||
} else if (d.getMaterial().equals(Material.NETHER_PORTAL) && d instanceof Orientable) {
|
} else if (d.getMaterial().equals(Material.NETHER_PORTAL) && d instanceof Orientable g) {
|
||||||
//TODO: Fucks up logs
|
//TODO: Fucks up logs
|
||||||
Orientable g = ((Orientable) d);
|
|
||||||
BlockFace f = faceForAxis(g.getAxis());
|
BlockFace f = faceForAxis(g.getAxis());
|
||||||
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
||||||
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||||
@ -306,7 +284,7 @@ public class IrisObjectRotation {
|
|||||||
Axis a = !g.getAxes().contains(Axis.Y) ? axisFor(t) : axisFor2D(t);
|
Axis a = !g.getAxes().contains(Axis.Y) ? axisFor(t) : axisFor2D(t);
|
||||||
((Orientable) d).setAxis(a);
|
((Orientable) d).setAxis(a);
|
||||||
}
|
}
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,6 +409,7 @@ public class IrisObjectRotation {
|
|||||||
return enabled && zAxis.isEnabled();
|
return enabled && zAxis.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public boolean canRotate() {
|
public boolean canRotate() {
|
||||||
return canRotateX() || canRotateY() || canRotateZ();
|
return canRotateX() || canRotateY() || canRotateZ();
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ public class IrisPotionEffect {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -29,6 +29,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -81,7 +82,7 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
|||||||
|
|
||||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
||||||
@Desc("Objects define what schematics (iob files) iris will place in this region")
|
@Desc("Objects define what schematics (iob files) iris will place in this region")
|
||||||
private KList<IrisObjectPlacement> objects = new KList<IrisObjectPlacement>();
|
private KList<IrisObjectPlacement> objects = new KList<>();
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("The min shore height")
|
@Desc("The min shore height")
|
||||||
@ -311,7 +312,7 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
|||||||
public KList<String> getRidgeBiomeKeys() {
|
public KList<String> getRidgeBiomeKeys() {
|
||||||
return cacheRidge.aquire(() ->
|
return cacheRidge.aquire(() ->
|
||||||
{
|
{
|
||||||
KList<String> cacheRidge = new KList<String>();
|
KList<String> cacheRidge = new KList<>();
|
||||||
ridgeBiomes.forEach((i) -> cacheRidge.add(i.getBiome()));
|
ridgeBiomes.forEach((i) -> cacheRidge.add(i.getBiome()));
|
||||||
|
|
||||||
return cacheRidge;
|
return cacheRidge;
|
||||||
@ -321,7 +322,7 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
|||||||
public KList<String> getSpotBiomeKeys() {
|
public KList<String> getSpotBiomeKeys() {
|
||||||
return cacheSpot.aquire(() ->
|
return cacheSpot.aquire(() ->
|
||||||
{
|
{
|
||||||
KList<String> cacheSpot = new KList<String>();
|
KList<String> cacheSpot = new KList<>();
|
||||||
spotBiomes.forEach((i) -> cacheSpot.add(i.getBiome()));
|
spotBiomes.forEach((i) -> cacheSpot.add(i.getBiome()));
|
||||||
return cacheSpot;
|
return cacheSpot;
|
||||||
});
|
});
|
||||||
@ -329,9 +330,7 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
|||||||
|
|
||||||
public CNG getShoreHeightGenerator() {
|
public CNG getShoreHeightGenerator() {
|
||||||
return shoreHeightGenerator.aquire(() ->
|
return shoreHeightGenerator.aquire(() ->
|
||||||
{
|
CNG.signature(new RNG((long) (getName().length() + getLandBiomeZoom() + getLandBiomes().size() + 3458612))));
|
||||||
return CNG.signature(new RNG((long) (getName().length() + getLandBiomeZoom() + getLandBiomes().size() + 3458612)));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getShoreHeight(double x, double z) {
|
public double getShoreHeight(double x, double z) {
|
||||||
|
@ -46,6 +46,7 @@ public class IrisSlopeClip {
|
|||||||
return minimumSlope <= 0 && maximumSlope >= 10;
|
return minimumSlope <= 0 && maximumSlope >= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public boolean isValid(double slope) {
|
public boolean isValid(double slope) {
|
||||||
if (isDefault()) {
|
if (isDefault()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -38,7 +38,7 @@ import java.util.List;
|
|||||||
public class TileBanner implements TileData<Banner> {
|
public class TileBanner implements TileData<Banner> {
|
||||||
public static final int id = 2;
|
public static final int id = 2;
|
||||||
|
|
||||||
private List<Pattern> patterns = new ArrayList<Pattern>();
|
private List<Pattern> patterns = new ArrayList<>();
|
||||||
private DyeColor baseColor;
|
private DyeColor baseColor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -65,6 +65,7 @@ public class TileBanner implements TileData<Banner> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileBanner clone() {
|
public TileBanner clone() {
|
||||||
|
TileBanner tileBanner = (TileBanner) super.clone();
|
||||||
TileBanner ts = new TileBanner();
|
TileBanner ts = new TileBanner();
|
||||||
ts.setBaseColor(getBaseColor());
|
ts.setBaseColor(getBaseColor());
|
||||||
ts.setPatterns(getPatterns());
|
ts.setPatterns(getPatterns());
|
||||||
@ -95,9 +96,10 @@ public class TileBanner implements TileData<Banner> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void toNBT(CompoundTag tag) {
|
public void toNBT(CompoundTag tag) {
|
||||||
ListTag<CompoundTag> listTag = (ListTag<CompoundTag>) ListTag.createUnchecked(CompoundTag.class);
|
@SuppressWarnings("unchecked") ListTag<CompoundTag> listTag = (ListTag<CompoundTag>) ListTag.createUnchecked(CompoundTag.class);
|
||||||
for (Pattern p : patterns) {
|
for (Pattern p : patterns) {
|
||||||
CompoundTag pattern = new CompoundTag();
|
CompoundTag pattern = new CompoundTag();
|
||||||
pattern.putString("Pattern", p.getPattern().getIdentifier());
|
pattern.putString("Pattern", p.getPattern().getIdentifier());
|
||||||
@ -108,43 +110,9 @@ public class TileBanner implements TileData<Banner> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBanner(Material material) {
|
public boolean isBanner(Material material) {
|
||||||
switch (material) {
|
return switch (material) {
|
||||||
|
case RED_BANNER, RED_WALL_BANNER, ORANGE_BANNER, ORANGE_WALL_BANNER, YELLOW_BANNER, YELLOW_WALL_BANNER, LIME_BANNER, LIME_WALL_BANNER, GREEN_BANNER, GREEN_WALL_BANNER, CYAN_BANNER, CYAN_WALL_BANNER, LIGHT_BLUE_BANNER, LIGHT_BLUE_WALL_BANNER, BLUE_BANNER, BLUE_WALL_BANNER, PURPLE_BANNER, PURPLE_WALL_BANNER, MAGENTA_BANNER, MAGENTA_WALL_BANNER, PINK_BANNER, PINK_WALL_BANNER, WHITE_BANNER, WHITE_WALL_BANNER, LIGHT_GRAY_BANNER, LIGHT_GRAY_WALL_BANNER, GRAY_BANNER, GRAY_WALL_BANNER, BLACK_BANNER, BLACK_WALL_BANNER, BROWN_BANNER, BROWN_WALL_BANNER -> true;
|
||||||
case RED_BANNER:
|
default -> false;
|
||||||
case RED_WALL_BANNER:
|
};
|
||||||
case ORANGE_BANNER:
|
|
||||||
case ORANGE_WALL_BANNER:
|
|
||||||
case YELLOW_BANNER:
|
|
||||||
case YELLOW_WALL_BANNER:
|
|
||||||
case LIME_BANNER:
|
|
||||||
case LIME_WALL_BANNER:
|
|
||||||
case GREEN_BANNER:
|
|
||||||
case GREEN_WALL_BANNER:
|
|
||||||
case CYAN_BANNER:
|
|
||||||
case CYAN_WALL_BANNER:
|
|
||||||
case LIGHT_BLUE_BANNER:
|
|
||||||
case LIGHT_BLUE_WALL_BANNER:
|
|
||||||
case BLUE_BANNER:
|
|
||||||
case BLUE_WALL_BANNER:
|
|
||||||
case PURPLE_BANNER:
|
|
||||||
case PURPLE_WALL_BANNER:
|
|
||||||
case MAGENTA_BANNER:
|
|
||||||
case MAGENTA_WALL_BANNER:
|
|
||||||
case PINK_BANNER:
|
|
||||||
case PINK_WALL_BANNER:
|
|
||||||
case WHITE_BANNER:
|
|
||||||
case WHITE_WALL_BANNER:
|
|
||||||
case LIGHT_GRAY_BANNER:
|
|
||||||
case LIGHT_GRAY_WALL_BANNER:
|
|
||||||
case GRAY_BANNER:
|
|
||||||
case GRAY_WALL_BANNER:
|
|
||||||
case BLACK_BANNER:
|
|
||||||
case BLACK_WALL_BANNER:
|
|
||||||
case BROWN_BANNER:
|
|
||||||
case BROWN_WALL_BANNER:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
public interface TileData<T extends TileState> extends Cloneable {
|
public interface TileData<T extends TileState> extends Cloneable {
|
||||||
|
|
||||||
KList<TileData<? extends TileState>> registry = setup();
|
KList<TileData<? extends TileState>> registry = setup();
|
||||||
@ -45,7 +46,7 @@ public interface TileData<T extends TileState> extends Cloneable {
|
|||||||
|
|
||||||
static TileData<? extends TileState> read(DataInputStream s) throws Throwable {
|
static TileData<? extends TileState> read(DataInputStream s) throws Throwable {
|
||||||
int id = s.readShort();
|
int id = s.readShort();
|
||||||
TileData<? extends TileState> d = registry.get(id).getClass().getConstructor().newInstance();
|
@SuppressWarnings("unchecked") TileData<? extends TileState> d = registry.get(id).getClass().getConstructor().newInstance();
|
||||||
d.fromBinary(s);
|
d.fromBinary(s);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@ -62,7 +63,7 @@ public interface TileData<T extends TileState> extends Cloneable {
|
|||||||
|
|
||||||
if (i.isApplicable(data)) {
|
if (i.isApplicable(data)) {
|
||||||
try {
|
try {
|
||||||
TileData<? extends TileState> s = i.getClass().getConstructor().newInstance();
|
@SuppressWarnings("unchecked") TileData<? extends TileState> s = i.getClass().getConstructor().newInstance();
|
||||||
s.fromBukkitTry(block.getState());
|
s.fromBukkitTry(block.getState());
|
||||||
return s;
|
return s;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
@ -84,6 +85,7 @@ public interface TileData<T extends TileState> extends Cloneable {
|
|||||||
|
|
||||||
default boolean toBukkitTry(BlockState t) {
|
default boolean toBukkitTry(BlockState t) {
|
||||||
try {
|
try {
|
||||||
|
//noinspection unchecked
|
||||||
toBukkit((T) t);
|
toBukkit((T) t);
|
||||||
return true;
|
return true;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
@ -95,6 +97,7 @@ public interface TileData<T extends TileState> extends Cloneable {
|
|||||||
|
|
||||||
default boolean fromBukkitTry(BlockState t) {
|
default boolean fromBukkitTry(BlockState t) {
|
||||||
try {
|
try {
|
||||||
|
//noinspection unchecked
|
||||||
fromBukkit((T) t);
|
fromBukkit((T) t);
|
||||||
return true;
|
return true;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -68,6 +68,7 @@ public class TileSign implements TileData<Sign> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileSign clone() {
|
public TileSign clone() {
|
||||||
|
TileSign tileSign = (TileSign) super.clone();
|
||||||
TileSign ts = new TileSign();
|
TileSign ts = new TileSign();
|
||||||
ts.setDyeColor(getDyeColor());
|
ts.setDyeColor(getDyeColor());
|
||||||
ts.setLine1(getLine1());
|
ts.setLine1(getLine1());
|
||||||
|
@ -57,6 +57,7 @@ public class TileSpawner implements TileData<CreatureSpawner> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileSpawner clone() {
|
public TileSpawner clone() {
|
||||||
|
TileSpawner tileSpawner = (TileSpawner) super.clone();
|
||||||
TileSpawner ts = new TileSpawner();
|
TileSpawner ts = new TileSpawner();
|
||||||
ts.setEntityType(getEntityType());
|
ts.setEntityType(getEntityType());
|
||||||
return ts;
|
return ts;
|
||||||
@ -75,7 +76,7 @@ public class TileSpawner implements TileData<CreatureSpawner> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toNBT(CompoundTag tag) {
|
public void toNBT(CompoundTag tag) {
|
||||||
ListTag<CompoundTag> potentials = (ListTag<CompoundTag>) ListTag.createUnchecked(CompoundTag.class);
|
@SuppressWarnings("unchecked") ListTag<CompoundTag> potentials = (ListTag<CompoundTag>) ListTag.createUnchecked(CompoundTag.class);
|
||||||
CompoundTag t = new CompoundTag();
|
CompoundTag t = new CompoundTag();
|
||||||
CompoundTag ent = new CompoundTag();
|
CompoundTag ent = new CompoundTag();
|
||||||
ent.putString("id", entityType.getKey().toString());
|
ent.putString("id", entityType.getKey().toString());
|
||||||
|
@ -39,6 +39,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@SuppressWarnings("EmptyMethod")
|
||||||
public class DirectWorldWriter {
|
public class DirectWorldWriter {
|
||||||
private final File worldFolder;
|
private final File worldFolder;
|
||||||
private final Map<Long, MCAFile> writeBuffer;
|
private final Map<Long, MCAFile> writeBuffer;
|
||||||
@ -156,7 +157,7 @@ public class DirectWorldWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return getBlockData(tag);
|
return getBlockData(tag);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return B.get("AIR");
|
return B.get("AIR");
|
||||||
|
@ -39,7 +39,6 @@ import java.awt.*;
|
|||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.KeyListener;
|
import java.awt.event.KeyListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -295,44 +294,40 @@ public class Pregenerator implements Listener {
|
|||||||
int mcaoz = z << 5;
|
int mcaoz = z << 5;
|
||||||
if (PaperLib.isPaper()) {
|
if (PaperLib.isPaper()) {
|
||||||
method.set("PaperAsync (Slow)");
|
method.set("PaperAsync (Slow)");
|
||||||
mcaIteration.accept(mcaox, mcaoz, (ii, jj) -> {
|
mcaIteration.accept(mcaox, mcaoz, (ii, jj) -> e.queue(() -> {
|
||||||
e.queue(() -> {
|
try {
|
||||||
try {
|
CompletableFuture<Chunk> cc = PaperLib.getChunkAtAsync(world, ii, jj);
|
||||||
CompletableFuture<Chunk> cc = PaperLib.getChunkAtAsync(world, ii, jj);
|
draw(ii, jj, COLOR_MCA_GENERATE_SLOW_ASYNC);
|
||||||
draw(ii, jj, COLOR_MCA_GENERATE_SLOW_ASYNC);
|
cc.join();
|
||||||
cc.join();
|
draw(ii, jj, COLOR_MCA_GENERATED);
|
||||||
draw(ii, jj, COLOR_MCA_GENERATED);
|
generated.getAndIncrement();
|
||||||
generated.getAndIncrement();
|
vcax.set(ii);
|
||||||
vcax.set(ii);
|
vcaz.set(jj);
|
||||||
vcaz.set(jj);
|
} catch (Throwable ex) {
|
||||||
} catch (Throwable ex) {
|
draw(ii, jj, COLOR_ERROR);
|
||||||
draw(ii, jj, COLOR_ERROR);
|
ChunkPosition pos = new ChunkPosition(ii, jj);
|
||||||
ChunkPosition pos = new ChunkPosition(ii, jj);
|
errors.add(pos);
|
||||||
errors.add(pos);
|
totalChunks.addAndGet(1024);
|
||||||
totalChunks.addAndGet(1024);
|
mcaDefer.add(new ChunkPosition(pos.getX() >> 5, pos.getZ() >> 5));
|
||||||
mcaDefer.add(new ChunkPosition(pos.getX() >> 5, pos.getZ() >> 5));
|
Iris.warn("Hole Detected in Chunk: " + pos.getX() + ", " + pos.getZ() + " (at block " + (pos.getX() << 4) + ", " + lowestBedrock + ", " + (pos.getZ() << 4) + ")");
|
||||||
Iris.warn("Hole Detected in Chunk: " + pos.getX() + ", " + pos.getZ() + " (at block " + (pos.getX() << 4) + ", " + lowestBedrock + ", " + (pos.getZ() << 4) + ")");
|
}
|
||||||
}
|
}));
|
||||||
});
|
|
||||||
});
|
|
||||||
e.complete();
|
e.complete();
|
||||||
} else {
|
} else {
|
||||||
AtomicInteger m = new AtomicInteger();
|
AtomicInteger m = new AtomicInteger();
|
||||||
method.set("Spigot (Very Slow)");
|
method.set("Spigot (Very Slow)");
|
||||||
KList<Runnable> q = new KList<>();
|
KList<Runnable> q = new KList<>();
|
||||||
mcaIteration.accept(mcaox, mcaoz, (ii, jj) -> {
|
mcaIteration.accept(mcaox, mcaoz, (ii, jj) -> q.add(() -> {
|
||||||
q.add(() -> {
|
draw(ii, jj, COLOR_MCA_GENERATE_SLOW);
|
||||||
draw(ii, jj, COLOR_MCA_GENERATE_SLOW);
|
world.getChunkAt(ii, jj).load(true);
|
||||||
world.getChunkAt(ii, jj).load(true);
|
Chunk c = world.getChunkAt(ii, jj);
|
||||||
Chunk c = world.getChunkAt(ii, jj);
|
draw(ii, jj, COLOR_MCA_GENERATED);
|
||||||
draw(ii, jj, COLOR_MCA_GENERATED);
|
checkForError(c);
|
||||||
checkForError(c);
|
m.getAndIncrement();
|
||||||
m.getAndIncrement();
|
generated.getAndIncrement();
|
||||||
generated.getAndIncrement();
|
vcax.set(ii);
|
||||||
vcax.set(ii);
|
vcaz.set(jj);
|
||||||
vcaz.set(jj);
|
}));
|
||||||
});
|
|
||||||
});
|
|
||||||
ChronoLatch tick = new ChronoLatch(1000);
|
ChronoLatch tick = new ChronoLatch(1000);
|
||||||
new SR(0) {
|
new SR(0) {
|
||||||
@Override
|
@Override
|
||||||
@ -348,7 +343,7 @@ public class Pregenerator implements Listener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
q.pop().run();
|
q.pop().run();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -524,18 +519,13 @@ public class Pregenerator implements Listener {
|
|||||||
while (order.isNotEmpty()) {
|
while (order.isNotEmpty()) {
|
||||||
try {
|
try {
|
||||||
order.pop().run();
|
order.pop().run();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l.unlock();
|
l.unlock();
|
||||||
|
|
||||||
g.drawImage(image, 0, 0, getParent().getWidth(), getParent().getHeight(), new ImageObserver() {
|
g.drawImage(image, 0, 0, getParent().getWidth(), getParent().getHeight(), (img, infoflags, x, y, width, height) -> true);
|
||||||
@Override
|
|
||||||
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
g.setColor(Color.WHITE);
|
g.setColor(Color.WHITE);
|
||||||
g.setFont(new Font("Hevetica", Font.BOLD, 28));
|
g.setFont(new Font("Hevetica", Font.BOLD, 28));
|
||||||
@ -575,11 +565,7 @@ public class Pregenerator implements Listener {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private static MCAPregenGui createAndShowGUI(Pregenerator j) throws HeadlessException {
|
private static MCAPregenGui createAndShowGUI(Pregenerator j) throws HeadlessException {
|
||||||
JFrame frame;
|
JFrame frame;
|
||||||
try {
|
frame = new JFrame("Pregen View");
|
||||||
frame = new JFrame("Pregen View");
|
|
||||||
} catch (HeadlessException e) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
MCAPregenGui nv = new MCAPregenGui();
|
MCAPregenGui nv = new MCAPregenGui();
|
||||||
frame.addKeyListener(nv);
|
frame.addKeyListener(nv);
|
||||||
nv.l = new ReentrantLock();
|
nv.l = new ReentrantLock();
|
||||||
@ -602,7 +588,7 @@ public class Pregenerator implements Listener {
|
|||||||
if (file != null) {
|
if (file != null) {
|
||||||
try {
|
try {
|
||||||
frame.setIconImage(ImageIO.read(file));
|
frame.setIconImage(ImageIO.read(file));
|
||||||
} catch (IOException e) {
|
} catch (IOException ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
public class IrisWorlds {
|
public class IrisWorlds {
|
||||||
private static final KMap<String, IrisAccess> provisioned = new KMap<>();
|
private static final KMap<String, IrisAccess> provisioned = new KMap<>();
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ public class AtomicCache<T> {
|
|||||||
|
|
||||||
if (this.t != null && M.ms() - a > 1000) {
|
if (this.t != null && M.ms() - a > 1000) {
|
||||||
if (this.t != null) {
|
if (this.t != null) {
|
||||||
|
//noinspection NonAtomicOperationOnVolatileField
|
||||||
validations++;
|
validations++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +101,7 @@ public class AtomicCache<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (M.ms() - a > 1000) {
|
if (M.ms() - a > 1000) {
|
||||||
|
//noinspection NonAtomicOperationOnVolatileField
|
||||||
validations++;
|
validations++;
|
||||||
return this.t;
|
return this.t;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,8 @@
|
|||||||
package com.volmit.iris.scaffold.cache;
|
package com.volmit.iris.scaffold.cache;
|
||||||
|
|
||||||
public interface Multicache {
|
public interface Multicache {
|
||||||
@SuppressWarnings("hiding")
|
|
||||||
<V> Cache<V> getCache(int id);
|
<V> Cache<V> getCache(int id);
|
||||||
|
|
||||||
@SuppressWarnings("hiding")
|
|
||||||
<V> Cache<V> createCache();
|
<V> Cache<V> createCache();
|
||||||
}
|
}
|
||||||
|
|
@ -58,8 +58,8 @@ public class DataPalette<T> {
|
|||||||
synchronized (palette) {
|
synchronized (palette) {
|
||||||
dos.writeShort(getPalette().size() + Short.MIN_VALUE);
|
dos.writeShort(getPalette().size() + Short.MIN_VALUE);
|
||||||
|
|
||||||
for (int i = 0; i < palette.size(); i++) {
|
for (T t : palette) {
|
||||||
adapter.write(palette.get(i), dos);
|
adapter.write(t, dos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,23 +20,23 @@ package com.volmit.iris.scaffold.data.mca;
|
|||||||
|
|
||||||
public class LoadFlags {
|
public class LoadFlags {
|
||||||
|
|
||||||
public static long BIOMES = 0x0001;
|
public static final long BIOMES = 0x0001;
|
||||||
public static long HEIGHTMAPS = 0x0002;
|
public static final long HEIGHTMAPS = 0x0002;
|
||||||
public static long CARVING_MASKS = 0x0004;
|
public static final long CARVING_MASKS = 0x0004;
|
||||||
public static long ENTITIES = 0x0008;
|
public static final long ENTITIES = 0x0008;
|
||||||
public static long TILE_ENTITIES = 0x0010;
|
public static final long TILE_ENTITIES = 0x0010;
|
||||||
public static long TILE_TICKS = 0x0040;
|
public static final long TILE_TICKS = 0x0040;
|
||||||
public static long LIQUID_TICKS = 0x0080;
|
public static final long LIQUID_TICKS = 0x0080;
|
||||||
public static long TO_BE_TICKED = 0x0100;
|
public static final long TO_BE_TICKED = 0x0100;
|
||||||
public static long POST_PROCESSING = 0x0200;
|
public static final long POST_PROCESSING = 0x0200;
|
||||||
public static long STRUCTURES = 0x0400;
|
public static final long STRUCTURES = 0x0400;
|
||||||
public static long BLOCK_LIGHTS = 0x0800;
|
public static final long BLOCK_LIGHTS = 0x0800;
|
||||||
public static long BLOCK_STATES = 0x1000;
|
public static final long BLOCK_STATES = 0x1000;
|
||||||
public static long SKY_LIGHT = 0x2000;
|
public static final long SKY_LIGHT = 0x2000;
|
||||||
public static long LIGHTS = 0x4000;
|
public static final long LIGHTS = 0x4000;
|
||||||
public static long LIQUIDS_TO_BE_TICKED = 0x8000;
|
public static final long LIQUIDS_TO_BE_TICKED = 0x8000;
|
||||||
|
|
||||||
public static long ALL_DATA = 0xffffffffffffffffL;
|
public static final long ALL_DATA = 0xffffffffffffffffL;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import com.volmit.iris.scaffold.data.nbt.tag.CompoundTag;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
|
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
public class MCAFile {
|
public class MCAFile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,7 +81,7 @@ public class MCAFile {
|
|||||||
raf.seek(4096 + i * 4);
|
raf.seek(4096 + i * 4);
|
||||||
int timestamp = raf.readInt();
|
int timestamp = raf.readInt();
|
||||||
Chunk chunk = new Chunk(timestamp);
|
Chunk chunk = new Chunk(timestamp);
|
||||||
raf.seek(4096 * offset + 4); //+4: skip data size
|
raf.seek(4096L * offset + 4); //+4: skip data size
|
||||||
chunk.deserialize(raf, loadFlags);
|
chunk.deserialize(raf, loadFlags);
|
||||||
chunks[i] = chunk;
|
chunks[i] = chunk;
|
||||||
}
|
}
|
||||||
@ -131,7 +132,7 @@ public class MCAFile {
|
|||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
raf.seek(4096 * globalOffset);
|
raf.seek(4096L * globalOffset);
|
||||||
lastWritten = chunk.serialize(raf, chunkXOffset + cx, chunkZOffset + cz);
|
lastWritten = chunk.serialize(raf, chunkXOffset + cx, chunkZOffset + cz);
|
||||||
|
|
||||||
if (lastWritten == 0) {
|
if (lastWritten == 0) {
|
||||||
@ -142,14 +143,14 @@ public class MCAFile {
|
|||||||
|
|
||||||
int sectors = (lastWritten >> 12) + (lastWritten % 4096 == 0 ? 0 : 1);
|
int sectors = (lastWritten >> 12) + (lastWritten % 4096 == 0 ? 0 : 1);
|
||||||
|
|
||||||
raf.seek(index * 4);
|
raf.seek(index * 4L);
|
||||||
raf.writeByte(globalOffset >>> 16);
|
raf.writeByte(globalOffset >>> 16);
|
||||||
raf.writeByte(globalOffset >> 8 & 0xFF);
|
raf.writeByte(globalOffset >> 8 & 0xFF);
|
||||||
raf.writeByte(globalOffset & 0xFF);
|
raf.writeByte(globalOffset & 0xFF);
|
||||||
raf.writeByte(sectors);
|
raf.writeByte(sectors);
|
||||||
|
|
||||||
// write timestamp
|
// write timestamp
|
||||||
raf.seek(index * 4 + 4096);
|
raf.seek(index * 4L + 4096);
|
||||||
raf.writeInt(changeLastUpdate ? timestamp : chunk.getLastMCAUpdate());
|
raf.writeInt(changeLastUpdate ? timestamp : chunk.getLastMCAUpdate());
|
||||||
|
|
||||||
globalOffset += sectors;
|
globalOffset += sectors;
|
||||||
@ -158,7 +159,7 @@ public class MCAFile {
|
|||||||
|
|
||||||
// padding
|
// padding
|
||||||
if (lastWritten % 4096 != 0) {
|
if (lastWritten % 4096 != 0) {
|
||||||
raf.seek(globalOffset * 4096 - 1);
|
raf.seek(globalOffset * 4096L - 1);
|
||||||
raf.write(0);
|
raf.write(0);
|
||||||
}
|
}
|
||||||
return chunksWritten;
|
return chunksWritten;
|
||||||
|
@ -105,10 +105,11 @@ public class Section {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ClassCanBeRecord")
|
||||||
private static class PaletteIndex {
|
private static class PaletteIndex {
|
||||||
|
|
||||||
CompoundTag data;
|
final CompoundTag data;
|
||||||
int index;
|
final int index;
|
||||||
|
|
||||||
PaletteIndex(CompoundTag data, int index) {
|
PaletteIndex(CompoundTag data, int index) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
@ -139,7 +140,7 @@ public class Section {
|
|||||||
int index = getBlockIndex(blockX, blockY, blockZ);
|
int index = getBlockIndex(blockX, blockY, blockZ);
|
||||||
int paletteIndex = getPaletteIndex(index);
|
int paletteIndex = getPaletteIndex(index);
|
||||||
return palette.get(paletteIndex);
|
return palette.get(paletteIndex);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import java.util.regex.Pattern;
|
|||||||
/**
|
/**
|
||||||
* SNBTWriter creates an SNBT String.
|
* SNBTWriter creates an SNBT String.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("ClassCanBeRecord")
|
||||||
public final class SNBTWriter implements MaxDepthIO {
|
public final class SNBTWriter implements MaxDepthIO {
|
||||||
|
|
||||||
private static final Pattern NON_QUOTE_PATTERN = Pattern.compile("[a-zA-Z_.+\\-]+");
|
private static final Pattern NON_QUOTE_PATTERN = Pattern.compile("[a-zA-Z_.+\\-]+");
|
||||||
|
@ -66,6 +66,7 @@ public class StringPointer {
|
|||||||
throw parseException("missing end quote");
|
throw parseException("missing end quote");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public boolean nextArrayElement() {
|
public boolean nextArrayElement() {
|
||||||
skipWhitespace();
|
skipWhitespace();
|
||||||
if (hasNext() && currentChar() == ',') {
|
if (hasNext() && currentChar() == ',') {
|
||||||
|
@ -54,7 +54,7 @@ public abstract class ArrayTag<T> extends Tag<T> {
|
|||||||
return arrayToString("", "");
|
return arrayToString("", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String arrayToString(String prefix, String suffix) {
|
protected String arrayToString(@SuppressWarnings("SameParameterValue") String prefix, @SuppressWarnings("SameParameterValue") String suffix) {
|
||||||
StringBuilder sb = new StringBuilder("[").append(prefix).append("".equals(prefix) ? "" : ";");
|
StringBuilder sb = new StringBuilder("[").append(prefix).append("".equals(prefix) ? "" : ";");
|
||||||
for (int i = 0; i < length(); i++) {
|
for (int i = 0; i < length(); i++) {
|
||||||
sb.append(i == 0 ? "" : ",").append(Array.get(getValue(), i)).append(suffix);
|
sb.append(i == 0 ? "" : ",").append(Array.get(getValue(), i)).append(suffix);
|
||||||
|
@ -24,6 +24,7 @@ import com.volmit.iris.util.KMap;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
public class CompoundTag extends Tag<Map<String, Tag<?>>> implements Iterable<Map.Entry<String, Tag<?>>>, Comparable<CompoundTag>, MaxDepthIO {
|
public class CompoundTag extends Tag<Map<String, Tag<?>>> implements Iterable<Map.Entry<String, Tag<?>>>, Comparable<CompoundTag>, MaxDepthIO {
|
||||||
|
|
||||||
public static final byte ID = 10;
|
public static final byte ID = 10;
|
||||||
|
@ -31,6 +31,7 @@ import java.util.function.Consumer;
|
|||||||
* The type of an empty untyped {@link ListTag} can be set by using any of the {@code add()}
|
* The type of an empty untyped {@link ListTag} can be set by using any of the {@code add()}
|
||||||
* methods or any of the {@code as...List()} methods.
|
* methods or any of the {@code as...List()} methods.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
public class ListTag<T extends Tag<?>> extends Tag<List<T>> implements Iterable<T>, Comparable<ListTag<T>>, MaxDepthIO {
|
public class ListTag<T extends Tag<?>> extends Tag<List<T>> implements Iterable<T>, Comparable<ListTag<T>>, MaxDepthIO {
|
||||||
|
|
||||||
public static final byte ID = 9;
|
public static final byte ID = 9;
|
||||||
@ -68,7 +69,7 @@ public class ListTag<T extends Tag<?>> extends Tag<List<T>> implements Iterable<
|
|||||||
* @param initialCapacity The initial capacity of the returned List
|
* @param initialCapacity The initial capacity of the returned List
|
||||||
* @return An instance of {@link List} with an initial capacity of 3
|
* @return An instance of {@link List} with an initial capacity of 3
|
||||||
*/
|
*/
|
||||||
private static <T> List<T> createEmptyValue(int initialCapacity) {
|
private static <T> List<T> createEmptyValue(@SuppressWarnings("SameParameterValue") int initialCapacity) {
|
||||||
return new KList<>(initialCapacity);
|
return new KList<>(initialCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
package com.volmit.iris.scaffold.data.nbt.tag;
|
package com.volmit.iris.scaffold.data.nbt.tag;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -27,6 +29,7 @@ import java.util.Set;
|
|||||||
* A decorator for the Set returned by CompoundTag#entrySet()
|
* A decorator for the Set returned by CompoundTag#entrySet()
|
||||||
* that disallows setting null values.
|
* that disallows setting null values.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("ClassCanBeRecord")
|
||||||
class NonNullEntrySet<K, V> implements Set<Map.Entry<K, V>> {
|
class NonNullEntrySet<K, V> implements Set<Map.Entry<K, V>> {
|
||||||
|
|
||||||
private final Set<Map.Entry<K, V>> set;
|
private final Set<Map.Entry<K, V>> set;
|
||||||
@ -61,7 +64,7 @@ class NonNullEntrySet<K, V> implements Set<Map.Entry<K, V>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T[] toArray(T[] a) {
|
public <T> T[] toArray(@NotNull T[] a) {
|
||||||
return set.toArray(a);
|
return set.toArray(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,22 +79,22 @@ class NonNullEntrySet<K, V> implements Set<Map.Entry<K, V>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsAll(Collection<?> c) {
|
public boolean containsAll(@NotNull Collection<?> c) {
|
||||||
return set.containsAll(c);
|
return set.containsAll(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addAll(Collection<? extends Map.Entry<K, V>> c) {
|
public boolean addAll(@NotNull Collection<? extends Map.Entry<K, V>> c) {
|
||||||
return set.addAll(c);
|
return set.addAll(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean retainAll(Collection<?> c) {
|
public boolean retainAll(@NotNull Collection<?> c) {
|
||||||
return set.retainAll(c);
|
return set.retainAll(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeAll(Collection<?> c) {
|
public boolean removeAll(@NotNull Collection<?> c) {
|
||||||
return set.removeAll(c);
|
return set.removeAll(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,6 +148,7 @@ class NonNullEntrySet<K, V> implements Set<Map.Entry<K, V>> {
|
|||||||
return entry.setValue(value);
|
return entry.setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
return entry.equals(o);
|
return entry.equals(o);
|
||||||
|
@ -67,6 +67,7 @@ public abstract class Tag<T> implements Cloneable {
|
|||||||
temp.put("\t", "\\\\t");
|
temp.put("\t", "\\\\t");
|
||||||
temp.put("\r", "\\\\r");
|
temp.put("\r", "\\\\r");
|
||||||
temp.put("\"", "\\\\\"");
|
temp.put("\"", "\\\\\"");
|
||||||
|
//noinspection Java9CollectionFactory
|
||||||
ESCAPE_CHARACTERS = Collections.unmodifiableMap(temp);
|
ESCAPE_CHARACTERS = Collections.unmodifiableMap(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +191,6 @@ public abstract class Tag<T> implements Cloneable {
|
|||||||
*
|
*
|
||||||
* @return A clone of this Tag.
|
* @return A clone of this Tag.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException")
|
|
||||||
public abstract Tag<T> clone();
|
public abstract Tag<T> clone();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -202,7 +202,8 @@ public abstract class Tag<T> implements Cloneable {
|
|||||||
* the end of the string.
|
* the end of the string.
|
||||||
* @return The escaped string.
|
* @return The escaped string.
|
||||||
*/
|
*/
|
||||||
protected static String escapeString(String s, boolean lenient) {
|
@SuppressWarnings("StringBufferMayBeStringBuilder")
|
||||||
|
protected static String escapeString(String s, @SuppressWarnings("SameParameterValue") boolean lenient) {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
Matcher m = ESCAPE_PATTERN.matcher(s);
|
Matcher m = ESCAPE_PATTERN.matcher(s);
|
||||||
while (m.find()) {
|
while (m.find()) {
|
||||||
|
@ -113,9 +113,8 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
IrisColor ibc = biome.getColor();
|
IrisColor ibc = biome.getColor();
|
||||||
Color rc = irc != null ? irc.getColor() : Color.GREEN.darker();
|
Color rc = irc != null ? irc.getColor() : Color.GREEN.darker();
|
||||||
Color bc = ibc != null ? ibc.getColor() : biome.isAquatic() ? Color.BLUE : Color.YELLOW;
|
Color bc = ibc != null ? ibc.getColor() : biome.isAquatic() ? Color.BLUE : Color.YELLOW;
|
||||||
Color f = IrisColor.blend(rc, bc, bc, Color.getHSBColor(0, 0, (float) heightFactor));
|
|
||||||
|
|
||||||
return f;
|
return IrisColor.blend(rc, bc, bc, Color.getHSBColor(0, 0, (float) heightFactor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -213,11 +212,10 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
|
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
KList<IrisLootTable> tables = getLootTables(rx, block);
|
KList<IrisLootTable> tables = getLootTables(rx, block);
|
||||||
InventorySlotType slott = slot;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InventoryHolder m = (InventoryHolder) block.getState();
|
InventoryHolder m = (InventoryHolder) block.getState();
|
||||||
addItems(false, m.getInventory(), rx, tables, slott, x, y, z, 15);
|
addItems(false, m.getInventory(), rx, tables, slot, x, y, z, 15);
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -256,7 +254,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
|||||||
try {
|
try {
|
||||||
Arrays.parallelSort(nitems, (a, b) -> rng.nextInt());
|
Arrays.parallelSort(nitems, (a, b) -> rng.nextInt());
|
||||||
break;
|
break;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
new MortarSender(i, Iris.instance.getTag()).sendMessage("Dimension Hotloaded");
|
new MortarSender(i, Iris.instance.getTag()).sendMessage("Dimension Hotloaded");
|
||||||
i.playSound(i.getLocation(), Sound.ITEM_BOTTLE_FILL, 1f, 1.25f);
|
i.playSound(i.getLocation(), Sound.ITEM_BOTTLE_FILL, 1f, 1.25f);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -131,7 +131,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
J.a(() -> hotloader.check());
|
J.a(() -> hotloader.check());
|
||||||
getComposite().clean();
|
getComposite().clean();
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +315,6 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
/**
|
/**
|
||||||
* Place strongholds in the world
|
* Place strongholds in the world
|
||||||
*
|
*
|
||||||
* @param world
|
|
||||||
*/
|
*/
|
||||||
public void placeStrongholds(World world) {
|
public void placeStrongholds(World world) {
|
||||||
EngineData metadata = getComposite().getEngineMetadata();
|
EngineData metadata = getComposite().getEngineMetadata();
|
||||||
@ -330,7 +329,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
Class<?> clazz = Class.forName("net.minecraft.world.level.chunk.ChunkGenerator");
|
Class<?> clazz = Class.forName("net.minecraft.world.level.chunk.ChunkGenerator");
|
||||||
Class<?> clazzSG = Class.forName("net.minecraft.world.level.levelgen.feature.StructureGenerator");
|
Class<?> clazzSG = Class.forName("net.minecraft.world.level.levelgen.feature.StructureGenerator");
|
||||||
Class<?> clazzBP = Class.forName("net.minecraft.core.BlockPosition");
|
Class<?> clazzBP = Class.forName("net.minecraft.core.BlockPosition");
|
||||||
Constructor bpCon = clazzBP.getConstructor(int.class, int.class, int.class);
|
@SuppressWarnings("rawtypes") Constructor bpCon = clazzBP.getConstructor(int.class, int.class, int.class);
|
||||||
|
|
||||||
//By default, we place 9 strongholds. One near 0,0 and 8 all around it at about 10_000 blocks out
|
//By default, we place 9 strongholds. One near 0,0 and 8 all around it at about 10_000 blocks out
|
||||||
int[][] coords = {{0, 0}, {7000, -7000}, {10000, 0}, {7000, 7000}, {0, 10000}, {-7000, 7000}, {-10000, 0}, {-7000, -7000}, {0, -10000}};
|
int[][] coords = {{0, 0}, {7000, -7000}, {10000, 0}, {7000, 7000}, {0, 10000}, {-7000, 7000}, {-10000, 0}, {-7000, -7000}, {0, -10000}};
|
||||||
@ -358,7 +357,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
CompletableFuture<Void> all = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()]));
|
CompletableFuture<Void> all = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
||||||
all.thenAccept((_void) -> { //Once all futures for all 9 strongholds have completed
|
all.thenAccept((_void) -> { //Once all futures for all 9 strongholds have completed
|
||||||
for (CompletableFuture<Object> future : futures) {
|
for (CompletableFuture<Object> future : futures) {
|
||||||
try {
|
try {
|
||||||
@ -407,7 +406,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
/**
|
/**
|
||||||
* Get BlockPosition for nearest stronghold from the provided position
|
* Get BlockPosition for nearest stronghold from the provided position
|
||||||
*/
|
*/
|
||||||
private Object getBP(Class<?> clazz, Class<?> clazzSG, Class<?> clazzBP, Object nmsWorld, Object pos, Object chunkGenerator) throws NoSuchFieldException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
|
private Object getBP(Class<?> clazz, Class<?> clazzSG, Class<?> clazzBP, Object nmsWorld, Object pos, Object chunkGenerator) throws NoSuchFieldException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
|
||||||
final String stronghold = "k"; //1.17_01 mapping
|
final String stronghold = "k"; //1.17_01 mapping
|
||||||
|
|
||||||
Object structureGeneratorStronghold = clazzSG.getDeclaredField(stronghold).get(null);
|
Object structureGeneratorStronghold = clazzSG.getDeclaredField(stronghold).get(null);
|
||||||
@ -418,14 +417,13 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
int.class,
|
int.class,
|
||||||
boolean.class
|
boolean.class
|
||||||
);
|
);
|
||||||
Object nearestPOS = getNearestGeneratedFeature.invoke(chunkGenerator,
|
return getNearestGeneratedFeature.invoke(chunkGenerator,
|
||||||
nmsWorld,
|
nmsWorld,
|
||||||
structureGeneratorStronghold,
|
structureGeneratorStronghold,
|
||||||
pos,
|
pos,
|
||||||
100,
|
100,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
return nearestPOS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getDataFolder(World world) {
|
private File getDataFolder(World world) {
|
||||||
@ -466,6 +464,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
int oz = z << 4;
|
int oz = z << 4;
|
||||||
com.volmit.iris.scaffold.data.mca.Chunk cc = writer.getChunk(x, z);
|
com.volmit.iris.scaffold.data.mca.Chunk cc = writer.getChunk(x, z);
|
||||||
BiomeBaseInjector injector = (xx, yy, zz, biomeBase) -> cc.setBiomeAt(ox + xx, yy, oz + zz, INMS.get().getTrueBiomeBaseId(biomeBase));
|
BiomeBaseInjector injector = (xx, yy, zz, biomeBase) -> cc.setBiomeAt(ox + xx, yy, oz + zz, INMS.get().getTrueBiomeBaseId(biomeBase));
|
||||||
|
//noinspection deprecation
|
||||||
generateChunkRawData(w, x, z, new TerrainChunk() {
|
generateChunkRawData(w, x, z, new TerrainChunk() {
|
||||||
@Override
|
@Override
|
||||||
public BiomeBaseInjector getBiomeBaseInjector() {
|
public BiomeBaseInjector getBiomeBaseInjector() {
|
||||||
@ -477,11 +476,13 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int z) {
|
public Biome getBiome(int x, int z) {
|
||||||
return Biome.THE_VOID;
|
return Biome.THE_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int y, int z) {
|
public Biome getBiome(int x, int y, int z) {
|
||||||
return Biome.THE_VOID;
|
return Biome.THE_VOID;
|
||||||
@ -519,6 +520,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
cc.setBlockStateAt(xx, y, zz, DirectWorldWriter.getCompound(blockData), false);
|
cc.setBlockStateAt(xx, y, zz, DirectWorldWriter.getCompound(blockData), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public BlockData getBlockData(int x, int y, int z) {
|
public BlockData getBlockData(int x, int y, int z) {
|
||||||
if (y > getMaxHeight()) {
|
if (y > getMaxHeight()) {
|
||||||
@ -772,6 +774,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
int zz = z * 16;
|
int zz = z * 16;
|
||||||
BiomeBaseInjector inj = (a, b, c, d) -> {
|
BiomeBaseInjector inj = (a, b, c, d) -> {
|
||||||
};
|
};
|
||||||
|
//noinspection deprecation
|
||||||
generateChunkRawData(getComposite().getWorld(), x, z, new TerrainChunk() {
|
generateChunkRawData(getComposite().getWorld(), x, z, new TerrainChunk() {
|
||||||
@Override
|
@Override
|
||||||
public BiomeBaseInjector getBiomeBaseInjector() {
|
public BiomeBaseInjector getBiomeBaseInjector() {
|
||||||
@ -783,11 +786,13 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int z) {
|
public Biome getBiome(int x, int z) {
|
||||||
return Biome.THE_VOID;
|
return Biome.THE_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int y, int z) {
|
public Biome getBiome(int x, int y, int z) {
|
||||||
return Biome.THE_VOID;
|
return Biome.THE_VOID;
|
||||||
@ -820,6 +825,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public BlockData getBlockData(int x, int y, int z) {
|
public BlockData getBlockData(int x, int y, int z) {
|
||||||
return Iris.edit.get(compound.getWorld(), x + xx, y, z + zz);
|
return Iris.edit.get(compound.getWorld(), x + xx, y, z + zz);
|
||||||
@ -949,7 +955,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
dim.getDimensionalComposite().forEach((m) -> IrisDataManager.loadAnyDimension(m.getDimension()).getAllAnyBiomes().forEach((i) -> v.put(i.getLoadKey(), i)));
|
dim.getDimensionalComposite().forEach((m) -> IrisDataManager.loadAnyDimension(m.getDimension()).getAllAnyBiomes().forEach((i) -> v.put(i.getLoadKey(), i)));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ public interface EngineCompound extends Listener, Hotloadable, DataProvider {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
dim.getDimensionalComposite().forEach((m) -> getData().getDimensionLoader().load(m.getDimension()).getAllBiomes(this).forEach((i) -> v.put(i.getLoadKey(), i)));
|
dim.getDimensionalComposite().forEach((m) -> getData().getDimensionLoader().load(m.getDimension()).getAllBiomes(this).forEach((i) -> v.put(i.getLoadKey(), i)));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user