Merge remote-tracking branch 'origin/master'

This commit is contained in:
cyberpwn
2021-09-04 14:05:52 -04:00
79 changed files with 623 additions and 740 deletions

View File

@@ -18,6 +18,7 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.engine.framework.Engine;
@@ -65,7 +66,6 @@ public class IrisCave extends IrisRegistrant {
return "Cave";
}
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
generate(writer, rng, engine, x, y, z, -1);
}
@@ -73,42 +73,34 @@ public class IrisCave extends IrisRegistrant {
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int waterHint) {
double girth = getWorm().getGirth().get(rng, x, z, engine.getData());
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z,
(at) -> {});
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z, (at) -> {});
int highestWater = Math.max(waterHint, -1);
boolean water = false;
if(highestWater == -1)
{
for(IrisPosition i : points)
{
if (highestWater == -1) {
for (IrisPosition i : points) {
double yy = i.getY() + girth;
int th = engine.getHeight(x, z, true);
if(yy > th && th < engine.getDimension().getFluidHeight())
{
highestWater = Math.max(highestWater, (int)yy);
water = true;
if (yy > th && th < engine.getDimension().getFluidHeight()) {
highestWater = Math.max(highestWater, (int) yy);
break;
}
}
}
else
{
water = true;
}
int h = Math.min(Math.max(highestWater, waterHint), engine.getDimension().getFluidHeight());
int h = Math.min(Math.max(highestWater, waterHint), engine.getDimension().getFluidHeight());
for(IrisPosition i : points)
{
for (IrisPosition i : points) {
fork.doCarving(writer, rng, engine, i.getX(), i.getY(), i.getZ(), h);
}
MatterCavern c = new MatterCavern(true, customBiome, (byte) 0);
MatterCavern w = new MatterCavern(true, customBiome, (byte) 1);
writer.setLineConsumer(points,
girth, true,
(xf, yf, zf) -> new MatterCavern(true, customBiome, yf <= h));
girth, true,
(xf, yf, zf) -> yf <= h ? w : c);
}
@Override

View File

@@ -62,6 +62,7 @@ public class IrisCavePlacer implements IRare {
public IrisCave getRealCave(IrisData data) {
return caveCache.aquire(() -> data.getCaveLoader().load(getCave()));
}
public void generateCave(MantleWriter mantle, RNG rng, Engine engine, int x, int y, int z) {
generateCave(mantle, rng, engine, x, y, z, -1);
}
@@ -101,8 +102,7 @@ public class IrisCavePlacer implements IRare {
public int getSize(IrisData data) {
IrisCave cave = getRealCave(data);
if(cave != null)
{
if (cave != null) {
return cave.getMaxSize(data);
}

View File

@@ -287,7 +287,7 @@ public class IrisDimension extends IrisRegistrant {
int jump = strongholdJumpDistance;
RNG rng = new RNG((seed * 223) + 12945);
for (int i = 0; i < maxStrongholds; i++) {
for (int i = 0; i < maxStrongholds+1; i++) {
int m = i + 1;
pos.add(new Position2(
(int) ((rng.i(jump * i) + (jump * i)) * (rng.b() ? -1D : 1D)),
@@ -295,6 +295,8 @@ public class IrisDimension extends IrisRegistrant {
));
}
pos.remove(0);
return pos;
});
}

View File

@@ -55,7 +55,7 @@ public class IrisElipsoid implements IRare {
writer.setElipsoid(x, y, z,
xRadius.get(rng, z, y, engine.getData()),
yRadius.get(rng, x, z, engine.getData()),
zRadius.get(rng, y, x, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), false)));
zRadius.get(rng, y, x, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), 0)));
}
public double maxSize() {

View File

@@ -19,7 +19,6 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisRate;
import com.volmit.iris.util.math.M;
import lombok.Data;

View File

@@ -166,8 +166,7 @@ public class IrisEntity extends IrisRegistrant {
}
public Entity spawn(Engine gen, Location at, RNG rng) {
if(!Chunks.isSafe(at))
{
if (!Chunks.isSafe(at)) {
return null;
}
@@ -180,8 +179,7 @@ public class IrisEntity extends IrisRegistrant {
Entity ee = doSpawn(at);
if(ee == null && !Chunks.isSafe(at))
{
if (ee == null && !Chunks.isSafe(at)) {
return null;
}
@@ -345,8 +343,7 @@ public class IrisEntity extends IrisRegistrant {
AtomicInteger t = new AtomicInteger(0);
AtomicInteger v = new AtomicInteger(0);
v.set(J.sr(() -> {
if(t.get() > 100)
{
if (t.get() > 100) {
J.csr(v.get());
return;
}
@@ -389,8 +386,7 @@ public class IrisEntity extends IrisRegistrant {
}
private Entity doSpawn(Location at) {
if(!Chunks.isSafe(at))
{
if (!Chunks.isSafe(at)) {
return null;
}

View File

@@ -19,14 +19,11 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.IrisComplex;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.MatterMarker;
import com.volmit.iris.util.matter.slices.MarkerMatter;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -34,6 +34,8 @@ import lombok.experimental.Accessors;
@Desc("Configures rotation for iris")
@Data
public class IrisInterpolator {
public static final IrisInterpolator DEFAULT = new IrisInterpolator();
@Required
@Desc("The interpolation method when two biomes use different heights but this same generator")
private InterpolationMethod function = InterpolationMethod.BILINEAR_STARCAST_6;

View File

@@ -19,7 +19,6 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -21,8 +21,6 @@ package com.volmit.iris.engine.object;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.IrisBlockData;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -21,8 +21,6 @@ package com.volmit.iris.engine.object;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.IrisBlockData;
import com.volmit.iris.engine.object.IrisMaterialPalette;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.noise.CNG;

View File

@@ -46,7 +46,7 @@ public class IrisPyramid implements IRare {
private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>();
public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) {
writer.setPyramid(x, y, z, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), false)),
writer.setPyramid(x, y, z, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), 0)),
(int) baseWidth.get(rng, z, y, engine.getData()), true);
}

View File

@@ -18,6 +18,7 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.engine.framework.Engine;
@@ -62,15 +63,18 @@ public class IrisRavine extends IrisRegistrant {
private IrisShapedGeneratorStyle baseWidthStyle = new IrisShapedGeneratorStyle(NoiseStyle.PERLIN, 3, 6);
@MinNumber(1)
@MaxNumber(70)
@MaxNumber(100)
@Desc("The angle at which the ravine widens as it gets closer to the surface")
private double angle = 18;
@MinNumber(1)
@MaxNumber(70)
@MaxNumber(100)
@Desc("The angle at which the ravine widens as it gets closer to the surface")
private double topAngle = 38;
@Desc("To fill this cave with lava, set the lava level to a height from the bottom most point of the cave.")
private int lavaLevel = -1;
@Desc("How many worm nodes must be placed to actually generate a ravine? Higher reduces the chances but also reduces ravine 'holes'")
private int nodeThreshold = 5;
@@ -88,93 +92,97 @@ public class IrisRavine extends IrisRegistrant {
public String getTypeName() {
return "Ravine";
}
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
generate(writer, rng, engine, x, y, z, -1);
}
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int waterHint) {
KList<IrisPosition> pos = getWorm().generate(rng, engine.getData(), writer, null, x, y, z, (at) -> {});
KList<IrisPosition> pos = getWorm().generate(rng, engine.getData(), writer, null, x, y, z, (at) -> {
});
CNG dg = depthStyle.getGenerator().createNoCache(rng, engine.getData());
CNG bw = baseWidthStyle.getGenerator().createNoCache(rng, engine.getData());
int highestWater = Math.max(waterHint, -1);
boolean water = false;
if(highestWater == -1)
{
for(IrisPosition i : pos)
{
if (highestWater == -1) {
for (IrisPosition i : pos) {
int rsurface = y == -1 ? engine.getComplex().getHeightStream().get(x, z).intValue() : y;
int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), i.getX(), i.getZ()));
int surface = (int) Math.round(rsurface - depth * 0.45);
int yy = surface + depth;
int th = engine.getHeight(x, z, true);
if(yy > th && th < engine.getDimension().getFluidHeight())
{
if (yy > th && th < engine.getDimension().getFluidHeight()) {
highestWater = Math.max(highestWater, yy);
water = true;
break;
}
}
}
else
{
} else {
water = true;
}
MatterCavern c = new MatterCavern(true, customBiome, water);
MatterCavern c = new MatterCavern(true, customBiome, (byte) (water ? 1 : 0));
MatterCavern l = new MatterCavern(true, customBiome, (byte) 2);
if(pos.size() < nodeThreshold)
{
if (pos.size() < nodeThreshold) {
return;
}
for(IrisPosition p : pos)
{
for (IrisPosition p : pos) {
int rsurface = y == -1 ? engine.getComplex().getHeightStream().get(x, z).intValue() : y;
int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), p.getX(), p.getZ()));
int width = (int) Math.round(bw.fitDouble(baseWidthStyle.getMin(), baseWidthStyle.getMax(), p.getX(), p.getZ()));
int surface = (int) Math.round(rsurface - depth * 0.45);
fork.doCarving(writer, rng, engine, p.getX(), rng.i(surface-depth, surface), p.getZ(), Math.max(highestWater, waterHint));
fork.doCarving(writer, rng, engine, p.getX(), rng.i(surface - depth, surface), p.getZ(), Math.max(highestWater, waterHint));
for(int i = surface + depth; i >= surface; i--)
{
if(i % ribThickness == 0) {
for (int i = surface + depth; i >= surface; i--) {
if (i % ribThickness == 0) {
double v = width + ((((surface + depth) - i) * (angle / 360D)));
if(v <= 0.25)
{
if (v <= 0.25) {
break;
}
if(i <= ribThickness+2)
{
if (i <= ribThickness + 2) {
break;
}
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
if(lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid()))
{
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, l);
}
else
{
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
}
}
}
for(int i = surface - depth; i <= surface; i++)
{
if(i % ribThickness == 0) {
for (int i = surface - depth; i <= surface; i++) {
if (i % ribThickness == 0) {
double v = width - ((((surface - depth) - i) * (angle / 360D)));
if(v <= 0.25)
{
if (v <= 0.25) {
break;
}
if(i <= ribThickness+2)
{
if (i <= ribThickness + 2) {
break;
}
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
if(lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid()))
{
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, l);
}
else
{
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
}
}
}
}

View File

@@ -0,0 +1,47 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.util.math.RNG;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Snippet("color")
@Accessors(chain = true)
@NoArgsConstructor
@Desc("Represents a color")
@Data
public class IrisSeed {
@Desc("The seed to use")
private long seed = 1337;
@Desc("To calculate a seed Iris passes in it's natural seed for the current feature, then mixes it with your seed. Setting this to true ignores the parent seed and always uses your exact seed ignoring the input of Iris feature seeds. You can use this to match seeds on other generators.")
private boolean ignoreNaturalSeedInput = false;
public long getSeed(long seed) {
return (seed * 47) + getSeed() + 29334667L;
}
public RNG rng(long inseed) {
return new RNG(getSeed(inseed));
}
}

View File

@@ -66,4 +66,8 @@ public class IrisShapedGeneratorStyle {
public boolean isFlat() {
return min == max || getGenerator().isFlat();
}
public int getMid() {
return (getMax() + getMin()) / 2;
}
}

View File

@@ -46,7 +46,7 @@ public class IrisSphere implements IRare {
private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>();
public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) {
writer.setSphere(x, y, z, radius.get(rng, z, y, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), false)));
writer.setSphere(x, y, z, radius.get(rng, z, y, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), 0)));
}
public double maxSize() {

View File

@@ -65,4 +65,8 @@ public class IrisStyledRange {
public boolean isFlat() {
return getMax() == getMin() || style.isFlat();
}
public int getMid() {
return (int) ((getMax() + getMin()) / 2);
}
}

View File

@@ -21,7 +21,7 @@ package com.volmit.iris.engine.object.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)