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

View File

@@ -39,7 +39,6 @@ import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
@Data
public class IrisComplex implements DataProvider {
@@ -117,8 +116,7 @@ public class IrisComplex implements DataProvider {
generators = new KList<>();
focus = engine.getFocus();
if(focus != null)
{
if (focus != null) {
focus.setInferredType(InferredType.LAND);
}
@@ -216,31 +214,27 @@ public class IrisComplex implements DataProvider {
});
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
b -> focus)).convertAware2D((b, x,z) -> {
for(IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z))
{
IrisBiome bx = i.filter(x, z, b, rng);
b -> focus)).convertAware2D((b, x, z) -> {
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
IrisBiome bx = i.filter(x, z, b, rng);
if(bx != null)
{
bx.setInferredType(b.getInferredType());
return bx;
}
}
if (bx != null) {
bx.setInferredType(b.getInferredType());
return bx;
}
}
return b;
})
return b;
})
.cache2D(cacheSize) : heightStream
.convertAware2D((h, x, z) ->
fixBiomeType(h, baseBiomeStream.get(x, z),
regionStream.get(x, z), x, z, fluidHeight))
.convertAware2D((b, x,z) -> {
for(IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z))
{
.convertAware2D((b, x, z) -> {
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
IrisBiome bx = i.filter(x, z, b, rng);
if(bx != null)
{
if (bx != null) {
bx.setInferredType(b.getInferredType());
return bx;
}

View File

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

View File

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

View File

@@ -25,7 +25,10 @@ import com.volmit.iris.engine.actuator.IrisDecorantActuator;
import com.volmit.iris.engine.actuator.IrisTerrainIslandActuator;
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
import com.volmit.iris.engine.framework.*;
import com.volmit.iris.engine.modifier.*;
import com.volmit.iris.engine.modifier.IrisCaveModifier;
import com.volmit.iris.engine.modifier.IrisDepositModifier;
import com.volmit.iris.engine.modifier.IrisPostModifier;
import com.volmit.iris.engine.modifier.IrisRavineModifier;
import com.volmit.iris.util.scheduling.ChronoLatch;
import lombok.Getter;
import org.bukkit.block.Biome;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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