Fixes + Nowhere

This commit is contained in:
Daniel Mills 2021-07-10 23:23:39 -04:00
parent 18d8f07242
commit 2e19dbe05f
14 changed files with 278 additions and 41 deletions

View File

@ -12,10 +12,7 @@ import com.volmit.iris.scaffold.data.DataProvider;
import com.volmit.iris.scaffold.engine.Engine;
import com.volmit.iris.scaffold.stream.ProceduralStream;
import com.volmit.iris.scaffold.stream.interpolation.Interpolated;
import com.volmit.iris.util.CaveResult;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.M;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.*;
import lombok.Data;
import org.bukkit.Material;
import org.bukkit.block.Biome;
@ -236,7 +233,6 @@ public class IrisComplex implements DataProvider
}, Interpolated.INT).cache2D(cacheSize);
//@done
}
private IrisRegion findRegion(IrisBiome focus, Engine engine) {
for(IrisRegion i : engine.getDimension().getAllRegions(engine))
{

View File

@ -18,11 +18,13 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
private static final BlockData CAVE_AIR = Material.CAVE_AIR.createBlockData();
@Getter
private final RNG rng;
private final boolean carving;
private final boolean hasUnder;
public IrisTerrainActuator(Engine engine) {
super(engine, "Terrain");
rng = new RNG(engine.getWorld().getSeed());
carving = getDimension().isCarving() && getDimension().getCarveLayers().isNotEmpty();
hasUnder = getDimension().getUndercarriage() != null && !getDimension().getUndercarriage().getGenerator().isFlat();
}
@ -66,7 +68,7 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
}
}
if(getDimension().isCarved(realX, i, realZ, rng, he))
if(carving && getDimension().isCarved(realX, i, realZ, rng, he))
{
continue;
}

View File

@ -1,5 +1,6 @@
package com.volmit.iris.generator.decorator;
import com.volmit.iris.Iris;
import com.volmit.iris.object.DecorationPart;
import com.volmit.iris.object.IrisBiome;
import com.volmit.iris.object.IrisDecorator;
@ -32,9 +33,17 @@ public abstract class IrisEngineDecorator extends EngineAssignedComponent implem
for(IrisDecorator i : biome.getDecorators())
{
if(i.getPartOf().equals(part) && i.getBlockData(biome, this.rng, realX, realZ, getData()) != null)
try
{
v.add(i);
if(i.getPartOf().equals(part) && i.getBlockData(biome, this.rng, realX, realZ, getData()) != null)
{
v.add(i);
}
}
catch(Throwable e)
{
Iris.error("PART OF: " + biome.getLoadFile().getAbsolutePath() + " HAS AN INVALID DECORATOR near 'partOf'!!!");
}
}

View File

@ -80,6 +80,13 @@ public class CNG
return signatureThick(rng, t).fractureWith(signature(rng.nextParallelRNG(4956)), 93);
}
public static CNG signatureDoubleFast(RNG rng, NoiseType t, NoiseType f)
{
return signatureThickFast(rng, t, f)
.fractureWith(signatureFast(rng.nextParallelRNG(4956), t, f), 93);
}
public static CNG signature(RNG rng, NoiseType t)
{
// @NoArgsConstructor
@ -87,6 +94,33 @@ public class CNG
// @done
}
public static CNG signaturePerlin(RNG rng)
{
return signaturePerlin(rng, NoiseType.PERLIN);
}
public static CNG signaturePerlin(RNG rng, NoiseType t)
{
// @NoArgsConstructor
return new CNG(rng.nextParallelRNG(124996), t, 1D, 1)
.fractureWith(new CNG(rng.nextParallelRNG(18), NoiseType.PERLIN, 1, 1).scale(1.25), 250)
.bake();
// @done
}
public static CNG signatureFast(RNG rng, NoiseType t, NoiseType f)
{
// @NoArgsConstructor
return new CNG(rng.nextParallelRNG(17), t, 1D, 1)
.fractureWith(new CNG(rng.nextParallelRNG(18), f, 1, 1)
.scale(0.9)
.fractureWith(new CNG(rng.nextParallelRNG(20), f, 1, 1)
.scale(0.21)
.fractureWith(new CNG(rng.nextParallelRNG(20), f, 1, 1).scale(0.9), 620), 145), 44)
.bake();
// @done
}
public static CNG signatureThick(RNG rng, NoiseType t)
{
// @NoArgsConstructor
@ -94,6 +128,17 @@ public class CNG
// @done
}
public static CNG signatureThickFast(RNG rng, NoiseType t, NoiseType f)
{
// @NoArgsConstructor
return new CNG(rng.nextParallelRNG(133), t, 1D, 1)
.fractureWith(new CNG(rng.nextParallelRNG(18), f, 1, 1)
.scale(0.5).fractureWith(new CNG(rng.nextParallelRNG(20), f, 1, 1)
.scale(0.11).fractureWith(new CNG(rng.nextParallelRNG(20), f, 1, 1)
.scale(0.4), 620), 145), 44).bake();
// @done
}
public static CNG signatureHalf(RNG rng, NoiseType t)
{
// @NoArgsConstructor
@ -101,6 +146,16 @@ public class CNG
// @done
}
public static CNG signatureHalfFast(RNG rng, NoiseType t, NoiseType f)
{
// @NoArgsConstructor
return new CNG(rng.nextParallelRNG(127), t, 1D, 1)
.fractureWith(new CNG(rng.nextParallelRNG(18),f, 1, 1).scale(0.9)
.fractureWith(new CNG(rng.nextParallelRNG(20), f, 1, 1).scale(0.21)
.fractureWith(new CNG(rng.nextParallelRNG(20), f, 1, 1).scale(0.9), 420), 99), 22).bake();
// @done
}
public CNG(RNG random)
{
this(random, 1);

View File

@ -81,7 +81,7 @@ public class FastNoiseDouble
private long m_seed = 1337;
private double m_frequency = (double) 0.01;
private Longerp m_longerp = Longerp.Linear;
public Longerp m_longerp = Longerp.Linear;
private NoiseType m_noiseType = NoiseType.Simplex;
private long m_octaves = 3;
@ -1087,22 +1087,20 @@ public class FastNoiseDouble
long x1 = x0 + 1;
long y1 = y0 + 1;
double xs, ys;
switch(m_longerp)
{
default:
case Linear:
double xs = 0, ys = 0;
switch (m_longerp) {
case Linear -> {
xs = x - x0;
ys = y - y0;
break;
case Hermite:
}
case Hermite -> {
xs = longerpHermiteFunc(x - x0);
ys = longerpHermiteFunc(y - y0);
break;
case Qulongic:
}
case Qulongic -> {
xs = longerpQulongicFunc(x - x0);
ys = longerpQulongicFunc(y - y0);
break;
}
}
double xd0 = x - x0;

View File

@ -1,22 +1,22 @@
package com.volmit.iris.generator.noise;
public enum NoiseType {
WHITE(seed -> new WhiteNoise(seed)),
SIMPLEX(seed -> new SimplexNoise(seed)),
PERLIN(seed -> new PerlinNoise(seed)),
FRACTAL_BILLOW_SIMPLEX(seed -> new FractalBillowSimplexNoise(seed)),
FRACTAL_BILLOW_PERLIN(seed -> new FractalBillowPerlinNoise(seed)),
FRACTAL_FBM_SIMPLEX(seed -> new FractalFBMSimplexNoise(seed)),
FRACTAL_RIGID_MULTI_SIMPLEX(seed -> new FractalRigidMultiSimplexNoise(seed)),
FLAT(seed -> new FlatNoise(seed)),
CELLULAR(seed -> new CellularNoise(seed)),
GLOB(seed -> new GlobNoise(seed)),
CUBIC(seed -> new CubicNoise(seed)),
FRACTAL_CUBIC(seed -> new FractalCubicNoise(seed)),
CELLULAR_HEIGHT(seed -> new CellHeightNoise(seed)),
VASCULAR(seed -> new VascularNoise(seed));
WHITE(WhiteNoise::new),
SIMPLEX(SimplexNoise::new),
PERLIN(seed -> new PerlinNoise(seed).hermite()),
FRACTAL_BILLOW_SIMPLEX(FractalBillowSimplexNoise::new),
FRACTAL_BILLOW_PERLIN(FractalBillowPerlinNoise::new),
FRACTAL_FBM_SIMPLEX(FractalFBMSimplexNoise::new),
FRACTAL_RIGID_MULTI_SIMPLEX(FractalRigidMultiSimplexNoise::new),
FLAT(FlatNoise::new),
CELLULAR(CellularNoise::new),
GLOB(GlobNoise::new),
CUBIC(CubicNoise::new),
FRACTAL_CUBIC(FractalCubicNoise::new),
CELLULAR_HEIGHT(CellHeightNoise::new),
VASCULAR(VascularNoise::new);
private NoiseFactory f;
private final NoiseFactory f;
private NoiseType(NoiseFactory f) {
this.f = f;

View File

@ -86,4 +86,13 @@ public class PerlinNoise implements NoiseGenerator, OctaveNoise
{
octaves = o;
}
public NoiseGenerator hermite() {
n.m_longerp = FastNoiseDouble.Longerp.Hermite;
return this;
}
public NoiseGenerator quad() {
n.m_longerp = FastNoiseDouble.Longerp.Qulongic;
return this;
}
}

View File

@ -3,18 +3,18 @@ package com.volmit.iris.manager;
import com.google.gson.Gson;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.manager.report.Report;
import com.volmit.iris.manager.report.ReportType;
import com.volmit.iris.nms.INMS;
import com.volmit.iris.object.*;
import com.volmit.iris.scaffold.IrisWorldCreator;
import com.volmit.iris.scaffold.engine.Engine;
import com.volmit.iris.scaffold.engine.IrisAccess;
import com.volmit.iris.util.*;
import lombok.Data;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*;
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.zeroturnaround.zip.ZipUtil;
import java.awt.*;
@ -36,6 +36,102 @@ public class IrisProject
this.name = path.getName();
}
public KList<Report> scanForErrors()
{
KList<Report> reports = new KList<>();
IrisDataManager data = new IrisDataManager(path);
for(int i = 0; i < getActiveProvider().getCompound().getSize(); i++)
{
Engine e = getActiveProvider().getCompound().getEngine(i);
IrisDimension dim = e.getDimension();
reports.add(scanForErrors(dim));
}
return reports;
}
private KList<Report> scanForErrors(IrisDimension dim) {
KList<Report> reports = new KList<>();
if(dim.getFocus() != null && !dim.getFocus().isEmpty())
{
reports.add(Report.builder()
.type(ReportType.NOTICE)
.title("Focus Mode is Enabled")
.message("Make sure to disable this before pushing")
.suggestion("Turn off focus mode")
.build());
}
for(IrisRegion i : dim.getAllRegions(getActiveProvider()))
{
scanForErrors(i);
}
return reports;
}
private KList<Report> scanForErrors(IrisRegion region) {
KList<Report> reports = new KList<>();
if(region.getRarity() > 60)
{
reports.add(Report.builder()
.type(ReportType.WARNING)
.title("Region " + region.getName() + " has a rarity of " + region.getRarity())
.message("The region rarity higher than 60 can cause performance issues")
.suggestion("Scale all rarities down by 50% all at once, then repeat until all rarities are below 60")
.build());
}
for(IrisBiome i : region.getAllBiomes(getActiveProvider()))
{
reports.add(scanForErrors(i));
}
return reports;
}
private KList<Report> scanForErrors(IrisBiome biome) {
KList<Report> reports = new KList<>();
for(IrisObjectPlacement i : biome.getObjects())
{
reports.add(scanForErrors(biome, i));
}
for(IrisBiomePaletteLayer i : biome.getLayers())
{
reports.add(scanForErrors(biome, i));
}
for(IrisBiomePaletteLayer i : biome.getSeaLayers())
{
reports.add(scanForErrorsSeaLayers(biome, i));
}
return reports;
}
private KList<Report> scanForErrors(IrisBiome biome, IrisObjectPlacement i) {
KList<Report> reports = new KList<>();
return reports;
}
private KList<Report> scanForErrors(IrisBiome biome, IrisBiomePaletteLayer i) {
KList<Report> reports = new KList<>();
return reports;
}
private KList<Report> scanForErrorsSeaLayers(IrisBiome biome, IrisBiomePaletteLayer i) {
KList<Report> reports = new KList<>();
return reports;
}
public boolean isOpen()
{
return activeProvider != null;

View File

@ -76,7 +76,7 @@ public class CommandIrisStudioProfile extends MortarCommand
{
CNG c = i.create(new RNG(i.hashCode()));
for(int j = 0; j < 3000; j++)
for(int j = 0; j < 30000; j++)
{
c.noise(j, j + 1000, j * j);
c.noise(j, -j);
@ -84,7 +84,7 @@ public class CommandIrisStudioProfile extends MortarCommand
PrecisionStopwatch px = PrecisionStopwatch.start();
for(int j = 0; j < 100000; j++)
for(int j = 0; j < 1000000; j++)
{
c.noise(j, j + 1000, j * j);
c.noise(j, -j);

View File

@ -0,0 +1,23 @@
package com.volmit.iris.manager.report;
import lombok.Builder;
import java.io.File;
@Builder
public class Report
{
@Builder.Default
private ReportType type = ReportType.NOTICE;
@Builder.Default
private String title = "Problem...";
@Builder.Default
private String message = "No Message";
@Builder.Default
private String suggestion = "No Suggestion";
public String toString()
{
return type.toString() + ": " + title + ": " + message + ": Suggestion: " + suggestion;
}
}

View File

@ -0,0 +1,8 @@
package com.volmit.iris.manager.report;
public enum ReportType {
ERROR,
SEVERE_WARNING,
WARNING,
NOTICE,
}

View File

@ -51,7 +51,7 @@ public class IrisRegion extends IrisRegistrant implements IRare
private KList<IrisEntityInitialSpawn> entityInitialSpawns = new KList<>();
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(128)
@DontObfuscate
@Desc("The rarity of the region")
private int rarity = 1;

View File

@ -20,6 +20,38 @@ public enum NoiseStyle
@DontObfuscate
IRIS(rng -> CNG.signature(rng).scale(1)),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE(rng -> CNG.signaturePerlin(rng).scale(0.776).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_CELLULAR(rng -> CNG.signaturePerlin(rng, NoiseType.CELLULAR).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_SIMPLEX(rng -> CNG.signaturePerlin(rng, NoiseType.SIMPLEX).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_GLOB(rng -> CNG.signaturePerlin(rng, NoiseType.GLOB).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_VASCULAR(rng -> CNG.signaturePerlin(rng, NoiseType.VASCULAR).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_CUBIC(rng -> CNG.signaturePerlin(rng, NoiseType.CUBIC).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_SUPERFRACTAL(rng -> CNG.signaturePerlin(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_FRACTAL(rng -> CNG.signaturePerlin(rng, NoiseType.FRACTAL_BILLOW_PERLIN).scale(1).bake()),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_DOUBLE(rng -> CNG.signatureDouble(rng).scale(1)),
@ -58,7 +90,7 @@ public enum NoiseStyle
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN(rng -> new CNG(rng, NoiseType.PERLIN, 1D, 1).scale(1.47)),
PERLIN(rng -> new CNG(rng, NoiseType.PERLIN, 1D, 1).scale(1.15)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate

View File

@ -1002,6 +1002,15 @@ public interface Hunk<T>
{
if(x < 0 || x >= getWidth() || y < 0 || y >= getHeight() || z < 0 || z >= getDepth())
{
try
{
throw new RuntimeException();
}
catch(Throwable e)
{
e.printStackTrace();
}
Iris.warn(x + "," + y + "," + z + " does not fit within size " + getWidth() + "," + getHeight() + "," + getDepth() + " (0,0,0 to " + (getWidth() - 1) + "," + (getHeight() - 1) + "," + (getDepth() - 1) + ")");
}
}