mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Docs and crap
This commit is contained in:
parent
7c6442d51f
commit
dffa357c0a
@ -2,6 +2,7 @@ package ninja.bytecode.iris;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -27,6 +28,8 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import ninja.bytecode.iris.generator.IrisChunkGenerator;
|
||||
import ninja.bytecode.iris.object.IrisBiome;
|
||||
import ninja.bytecode.iris.object.IrisDimension;
|
||||
@ -39,16 +42,22 @@ import ninja.bytecode.iris.util.BoardSettings;
|
||||
import ninja.bytecode.iris.util.CNG;
|
||||
import ninja.bytecode.iris.util.Cuboid;
|
||||
import ninja.bytecode.iris.util.Cuboid.CuboidDirection;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.Direction;
|
||||
import ninja.bytecode.iris.util.GroupedExecutor;
|
||||
import ninja.bytecode.iris.util.IO;
|
||||
import ninja.bytecode.iris.util.ScoreDirection;
|
||||
import ninja.bytecode.iris.wand.WandController;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
import ninja.bytecode.shuriken.collections.KMap;
|
||||
import ninja.bytecode.shuriken.execution.J;
|
||||
import ninja.bytecode.shuriken.format.Form;
|
||||
import ninja.bytecode.shuriken.json.JSONException;
|
||||
import ninja.bytecode.shuriken.json.JSONObject;
|
||||
import ninja.bytecode.shuriken.logging.L;
|
||||
import ninja.bytecode.shuriken.math.RollingSequence;
|
||||
import ninja.bytecode.shuriken.reaction.O;
|
||||
import ninja.bytecode.shuriken.tools.JarScanner;
|
||||
|
||||
public class Iris extends JavaPlugin implements BoardProvider
|
||||
{
|
||||
@ -73,6 +82,17 @@ public class Iris extends JavaPlugin implements BoardProvider
|
||||
data = new IrisDataManager(getDataFolder());
|
||||
wand = new WandController();
|
||||
manager = new BoardManager(this, BoardSettings.builder().boardProvider(this).scoreDirection(ScoreDirection.UP).build());
|
||||
J.a(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
writeDocs();
|
||||
}
|
||||
catch(JSONException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -93,7 +113,9 @@ public class Iris extends JavaPlugin implements BoardProvider
|
||||
int x = player.getLocation().getBlockX();
|
||||
int z = player.getLocation().getBlockZ();
|
||||
BiomeResult er = g.sampleTrueBiome(x, z);
|
||||
BiomeResult erx = g.sampleBiome(x, z);
|
||||
IrisBiome b = er != null ? er.getBiome() : null;
|
||||
IrisBiome bx = erx != null ? erx.getBiome() : null;
|
||||
lines.add("&7&m-----------------");
|
||||
lines.add(ChatColor.GREEN + "Speed" + ChatColor.GRAY + ": " + ChatColor.BOLD + "" + ChatColor.GRAY + Form.f(g.getMetrics().getPerSecond().getAverage(), 0) + "/s " + Form.duration(g.getMetrics().getTotal().getAverage(), 1) + "");
|
||||
lines.add(ChatColor.GREEN + "Loss" + ChatColor.GRAY + ": " + ChatColor.BOLD + "" + ChatColor.GRAY + Form.duration(g.getMetrics().getLoss().getAverage(), 4) + "");
|
||||
@ -101,11 +123,11 @@ public class Iris extends JavaPlugin implements BoardProvider
|
||||
lines.add(ChatColor.GREEN + "Noise" + ChatColor.GRAY + ": " + Form.f((int) hits.getAverage()));
|
||||
lines.add(ChatColor.GREEN + "Parallax Regions" + ChatColor.GRAY + ": " + Form.f((int) g.getParallaxMap().getLoadedRegions().size()));
|
||||
lines.add(ChatColor.GREEN + "Parallax Chunks" + ChatColor.GRAY + ": " + Form.f((int) g.getParallaxMap().getLoadedChunks().size()));
|
||||
lines.add(ChatColor.GREEN + "BUD Requests" + ChatColor.GRAY + ": " + Form.f((int) g.getUpdateBlocks().size()));
|
||||
|
||||
if(er != null && b != null)
|
||||
{
|
||||
lines.add(ChatColor.GREEN + "Biome" + ChatColor.GRAY + ": " + b.getName());
|
||||
lines.add(ChatColor.GREEN + "Real" + ChatColor.GRAY + ": " + bx.getName());
|
||||
lines.add(ChatColor.GREEN + "File" + ChatColor.GRAY + ": " + b.getLoadKey() + ".json");
|
||||
}
|
||||
|
||||
@ -120,6 +142,49 @@ public class Iris extends JavaPlugin implements BoardProvider
|
||||
return lines;
|
||||
}
|
||||
|
||||
public void writeDocs() throws IOException, JSONException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
|
||||
{
|
||||
JarScanner j = new JarScanner(getFile(), "ninja.bytecode.iris.object");
|
||||
j.scan();
|
||||
File of = new File(getDataFolder(), "packs");
|
||||
of.mkdirs();
|
||||
KMap<String, String> files = new KMap<>();
|
||||
|
||||
for(Class<?> i : j.getClasses())
|
||||
{
|
||||
if(i.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
Desc d = i.getAnnotation(Desc.class);
|
||||
KList<String> page = new KList<>();
|
||||
page.add("# " + i.getSimpleName());
|
||||
page.add("> " + d.value());
|
||||
|
||||
page.add("```json");
|
||||
page.add(new JSONObject(new Gson().toJson(i.getConstructor().newInstance())).toString(4));
|
||||
page.add("```");
|
||||
|
||||
page.add("");
|
||||
for(java.lang.reflect.Field k : i.getDeclaredFields())
|
||||
{
|
||||
if(k.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
page.add("## " + k.getName());
|
||||
page.add("> " + k.getAnnotation(Desc.class).value());
|
||||
page.add("");
|
||||
}
|
||||
}
|
||||
|
||||
String pge = page.toString("\n");
|
||||
files.put(i.getSimpleName(), pge);
|
||||
}
|
||||
}
|
||||
|
||||
for(String i : files.k())
|
||||
{
|
||||
IO.writeAll(new File(of, i + ".md"), files.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void onDisable()
|
||||
{
|
||||
for(GroupedExecutor i : executors)
|
||||
|
@ -5,5 +5,5 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IrisSettings
|
||||
{
|
||||
private int threads = 16;
|
||||
private int threads = 8;
|
||||
}
|
||||
|
@ -159,30 +159,30 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
|
||||
if(!getDimension().getFocus().equals(""))
|
||||
{
|
||||
IrisBiome biome = Iris.data.getBiomeLoader().load(getDimension().getFocus());
|
||||
|
||||
|
||||
for(String i : getDimension().getRegions())
|
||||
{
|
||||
IrisRegion reg = Iris.data.getRegionLoader().load(i);
|
||||
|
||||
|
||||
if(reg.getLandBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
biome.setInferredType(InferredType.LAND);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(reg.getSeaBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
biome.setInferredType(InferredType.SEA);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(reg.getShoreBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
biome.setInferredType(InferredType.SHORE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new BiomeResult(biome, 0);
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
|
||||
double wx = getModifiedX(x, z);
|
||||
double wz = getModifiedZ(x, z);
|
||||
IrisRegion region = glBiome.getRegion(wx, wz);
|
||||
BiomeResult res = glBiome.generateRegionData(wx, wz, region);
|
||||
BiomeResult res = glBiome.generateRegionData(wx, wz, x, z, region);
|
||||
biomeHitCache.put(pos, res);
|
||||
|
||||
return res;
|
||||
|
@ -3,7 +3,11 @@ package ninja.bytecode.iris.generator;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.object.InferredType;
|
||||
import ninja.bytecode.iris.object.IrisBiome;
|
||||
import ninja.bytecode.iris.object.IrisDimension;
|
||||
import ninja.bytecode.iris.object.IrisRegion;
|
||||
import ninja.bytecode.iris.util.BiomeResult;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ -29,19 +33,47 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
|
||||
return d;
|
||||
}
|
||||
|
||||
protected BiomeResult focus()
|
||||
{
|
||||
IrisBiome biome = Iris.data.getBiomeLoader().load(getDimension().getFocus());
|
||||
|
||||
for(String i : getDimension().getRegions())
|
||||
{
|
||||
IrisRegion reg = Iris.data.getRegionLoader().load(i);
|
||||
|
||||
if(reg.getLandBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
biome.setInferredType(InferredType.LAND);
|
||||
break;
|
||||
}
|
||||
|
||||
if(reg.getSeaBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
biome.setInferredType(InferredType.SEA);
|
||||
break;
|
||||
}
|
||||
|
||||
if(reg.getShoreBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
biome.setInferredType(InferredType.SHORE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new BiomeResult(biome, 0);
|
||||
}
|
||||
|
||||
public double getModifiedX(int rx, int rz)
|
||||
{
|
||||
return (getDimension().cosRotate() * rx) +
|
||||
(-getDimension().sinRotate() * rz) +
|
||||
|
||||
return (getDimension().cosRotate() * rx) + (-getDimension().sinRotate() * rz) +
|
||||
|
||||
getDimension().getCoordFracture(masterRandom, 39392).fitDoubleD(-getDimension().getCoordFractureDistance() / 2, getDimension().getCoordFractureDistance() / 2, rx, rz);
|
||||
}
|
||||
|
||||
public double getModifiedZ(int rx, int rz)
|
||||
{
|
||||
return (getDimension().sinRotate() * rx) +
|
||||
(getDimension().cosRotate() * rz) +
|
||||
|
||||
return (getDimension().sinRotate() * rx) + (getDimension().cosRotate() * rz) +
|
||||
|
||||
getDimension().getCoordFracture(masterRandom, 39392).fitDoubleD(-getDimension().getCoordFractureDistance() / 2, getDimension().getCoordFractureDistance() / 2, rx, rz);
|
||||
}
|
||||
|
||||
@ -49,4 +81,9 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
|
||||
{
|
||||
return (double) (modified) / getDimension().getTerrainZoom();
|
||||
}
|
||||
|
||||
public double getUnzoomed(double modified)
|
||||
{
|
||||
return (double) (modified) * getDimension().getTerrainZoom();
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class IrisChunkGenerator extends ParallaxChunkGenerator implements IrisCo
|
||||
@Override
|
||||
protected void onChunkLoaded(Chunk c)
|
||||
{
|
||||
updateLights();
|
||||
// TODO: updateLights(); better
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,8 +11,6 @@ import org.bukkit.block.data.BlockData;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.object.InferredType;
|
||||
import ninja.bytecode.iris.object.IrisBiome;
|
||||
import ninja.bytecode.iris.object.IrisBiomeDecorator;
|
||||
import ninja.bytecode.iris.object.IrisRegion;
|
||||
@ -63,7 +61,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
{
|
||||
updateBlocks.clear();
|
||||
}
|
||||
|
||||
|
||||
for(BlockPosition i : updateBlocks.copy())
|
||||
{
|
||||
if(getWorld().isChunkLoaded(i.getChunkX(), i.getChunkZ()))
|
||||
@ -115,16 +113,34 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
double noise = getNoiseHeight(rx, rz);
|
||||
int height = (int) Math.round(noise) + fluidHeight;
|
||||
IrisBiome biome = sampleTrueBiome(rx, rz).getBiome();
|
||||
|
||||
KList<BlockData> layers = biome.generateLayers(wx, wz, masterRandom, height);
|
||||
|
||||
for(int k = Math.max(height, fluidHeight); k < 255; k++)
|
||||
{
|
||||
if(k < Math.max(height, fluidHeight) + 3)
|
||||
{
|
||||
if(biomeMap != null)
|
||||
{
|
||||
sliver.set(k, biome.getGroundBiome(masterRandom, rz, k, rx));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(biomeMap != null)
|
||||
{
|
||||
sliver.set(k, biome.getSkyBiome(masterRandom, rx, k, rz));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int k = Math.max(height, fluidHeight); k >= 0; k--)
|
||||
{
|
||||
boolean underwater = k > height && k <= fluidHeight;
|
||||
|
||||
if(biomeMap != null)
|
||||
{
|
||||
sliver.set(k, biome.getDerivative());
|
||||
sliver.set(k, biome.getGroundBiome(masterRandom, rz, k, rx));
|
||||
biomeMap.setBiome(x, z, biome);
|
||||
}
|
||||
|
||||
@ -236,32 +252,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
{
|
||||
if(!getDimension().getFocus().equals(""))
|
||||
{
|
||||
IrisBiome biome = Iris.data.getBiomeLoader().load(getDimension().getFocus());
|
||||
|
||||
for(String i : getDimension().getRegions())
|
||||
{
|
||||
IrisRegion reg = Iris.data.getRegionLoader().load(i);
|
||||
|
||||
if(reg.getLandBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
biome.setInferredType(InferredType.LAND);
|
||||
break;
|
||||
}
|
||||
|
||||
if(reg.getSeaBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
biome.setInferredType(InferredType.SEA);
|
||||
break;
|
||||
}
|
||||
|
||||
if(reg.getShoreBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
biome.setInferredType(InferredType.SHORE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new BiomeResult(biome, 0);
|
||||
return focus();
|
||||
}
|
||||
|
||||
double wx = getModifiedX(x, z);
|
||||
@ -274,34 +265,34 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
// Stop shores from spawning on land
|
||||
if(current.isShore() && height > sh)
|
||||
{
|
||||
return glBiome.generateLandData(wx, wz, region);
|
||||
return glBiome.generateLandData(wx, wz, x, z, region);
|
||||
}
|
||||
|
||||
// Stop land & shore from spawning underwater
|
||||
if(current.isShore() || current.isLand() && height <= getDimension().getFluidHeight())
|
||||
{
|
||||
return glBiome.generateSeaData(wx, wz, region);
|
||||
return glBiome.generateSeaData(wx, wz, x, z, region);
|
||||
}
|
||||
|
||||
// Stop oceans from spawning on land
|
||||
if(current.isSea() && height > getDimension().getFluidHeight())
|
||||
{
|
||||
return glBiome.generateLandData(wx, wz, region);
|
||||
return glBiome.generateLandData(wx, wz, x, z, region);
|
||||
}
|
||||
|
||||
// Stop land from spawning underwater
|
||||
if(height <= getDimension().getFluidHeight())
|
||||
{
|
||||
return glBiome.generateSeaData(wx, wz, region);
|
||||
return glBiome.generateSeaData(wx, wz, x, z, region);
|
||||
}
|
||||
|
||||
// Stop land from spawning where shores go
|
||||
if(height <= getDimension().getFluidHeight() + sh)
|
||||
{
|
||||
return glBiome.generateShoreData(wx, wz, region);
|
||||
return glBiome.generateShoreData(wx, wz, x, z, region);
|
||||
}
|
||||
|
||||
return glBiome.generateRegionData(wx, wz, region);
|
||||
return glBiome.generateRegionData(wx, wz, x, z, region);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,6 +5,8 @@ import ninja.bytecode.iris.generator.DimensionChunkGenerator;
|
||||
import ninja.bytecode.iris.object.InferredType;
|
||||
import ninja.bytecode.iris.object.IrisBiome;
|
||||
import ninja.bytecode.iris.object.IrisRegion;
|
||||
import ninja.bytecode.iris.object.IrisRegionRidge;
|
||||
import ninja.bytecode.iris.object.IrisRegionSpot;
|
||||
import ninja.bytecode.iris.util.BiomeResult;
|
||||
import ninja.bytecode.iris.util.CellGenerator;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
@ -18,10 +20,12 @@ public class GenLayerBiome extends GenLayer
|
||||
private CellGenerator land;
|
||||
private CellGenerator shore;
|
||||
private CellGenerator sea;
|
||||
private DimensionChunkGenerator iris;
|
||||
|
||||
public GenLayerBiome(DimensionChunkGenerator iris, RNG rng)
|
||||
{
|
||||
super(iris, rng);
|
||||
this.iris = iris;
|
||||
region = new CellGenerator(rng.nextParallelRNG(1188519));
|
||||
bridge = new CellGenerator(rng.nextParallelRNG(1541462));
|
||||
land = new CellGenerator(rng.nextParallelRNG(9045162));
|
||||
@ -40,9 +44,9 @@ public class GenLayerBiome extends GenLayer
|
||||
return Iris.data.getRegionLoader().load(regionId);
|
||||
}
|
||||
|
||||
public BiomeResult generateData(double bx, double bz)
|
||||
public BiomeResult generateData(double bx, double bz, int rawX, int rawZ)
|
||||
{
|
||||
return generateRegionData(bx, bz, getRegion(bx, bz));
|
||||
return generateRegionData(bx, bz, rawX, rawZ, getRegion(bx, bz));
|
||||
}
|
||||
|
||||
public boolean isSea(double bx, double bz, IrisRegion regionData)
|
||||
@ -54,16 +58,16 @@ public class GenLayerBiome extends GenLayer
|
||||
return bridge.getIndex(x, z, 5) == 1;
|
||||
}
|
||||
|
||||
public BiomeResult generateRegionData(double bx, double bz, IrisRegion regionData)
|
||||
public BiomeResult generateRegionData(double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
if(isSea(bx, bz, regionData))
|
||||
{
|
||||
return generateSeaData(bx, bz, regionData);
|
||||
return generateSeaData(bx, bz, rawX, rawZ, regionData);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return generateLandData(bx, bz, regionData);
|
||||
return generateLandData(bx, bz, rawX, rawZ, regionData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,22 +81,70 @@ public class GenLayerBiome extends GenLayer
|
||||
return implode(bx, bz, regionData, cell, new BiomeResult(biome, cell.getDistance(x, z)));
|
||||
}
|
||||
|
||||
public BiomeResult generateSeaData(double bx, double bz, IrisRegion regionData)
|
||||
public BiomeResult generateSeaData(double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
for(IrisRegionRidge i : regionData.getRidgeBiomes())
|
||||
{
|
||||
if(i.getType().equals(InferredType.SEA) && i.isRidge(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(Iris.data.getBiomeLoader().load(i.getBiome()), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
for(IrisRegionSpot i : regionData.getSpotBiomes())
|
||||
{
|
||||
if(i.getType().equals(InferredType.SEA) && i.isSpot(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(Iris.data.getBiomeLoader().load(i.getBiome()), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
sea.setShuffle(42);
|
||||
sea.setCellScale(0.56 / iris.getDimension().getSeaZoom());
|
||||
return generateBiomeData(bx, bz, regionData, sea, regionData.getSeaBiomes(), InferredType.SEA);
|
||||
}
|
||||
|
||||
public BiomeResult generateLandData(double bx, double bz, IrisRegion regionData)
|
||||
public BiomeResult generateLandData(double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
for(IrisRegionRidge i : regionData.getRidgeBiomes())
|
||||
{
|
||||
if(i.getType().equals(InferredType.LAND) && i.isRidge(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(Iris.data.getBiomeLoader().load(i.getBiome()), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
for(IrisRegionSpot i : regionData.getSpotBiomes())
|
||||
{
|
||||
if(i.getType().equals(InferredType.LAND) && i.isSpot(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(Iris.data.getBiomeLoader().load(i.getBiome()), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
land.setShuffle(12);
|
||||
land.setCellScale(0.6 / iris.getDimension().getLandZoom());
|
||||
return generateBiomeData(bx, bz, regionData, land, regionData.getLandBiomes(), InferredType.LAND);
|
||||
}
|
||||
|
||||
public BiomeResult generateShoreData(double bx, double bz, IrisRegion regionData)
|
||||
public BiomeResult generateShoreData(double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
for(IrisRegionRidge i : regionData.getRidgeBiomes())
|
||||
{
|
||||
if(i.getType().equals(InferredType.SHORE) && i.isRidge(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(Iris.data.getBiomeLoader().load(i.getBiome()), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
for(IrisRegionSpot i : regionData.getSpotBiomes())
|
||||
{
|
||||
if(i.getType().equals(InferredType.SHORE) && i.isSpot(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(Iris.data.getBiomeLoader().load(i.getBiome()), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
shore.setShuffle(4);
|
||||
shore.setCellScale(0.8 / iris.getDimension().getShoreZoom());
|
||||
return generateBiomeData(bx, bz, regionData, shore, regionData.getShoreBiomes(), InferredType.SHORE);
|
||||
|
@ -1,13 +1,22 @@
|
||||
package ninja.bytecode.iris.object;
|
||||
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
|
||||
@Desc("Represents a rotation axis with intervals and maxes")
|
||||
@Data
|
||||
public class IrisAxisRotationClamp
|
||||
{
|
||||
@Desc("Should this axis be rotated at all?")
|
||||
private boolean enabled = false;
|
||||
|
||||
@Desc("The minimum angle (from) or set this and max to zero for any angle degrees")
|
||||
private double min = 0;
|
||||
|
||||
@Desc("The maximum angle (to) or set this and min to zero for any angle degrees")
|
||||
private double max = 0;
|
||||
|
||||
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees")
|
||||
private double interval = 0;
|
||||
|
||||
public IrisAxisRotationClamp()
|
||||
|
@ -9,25 +9,56 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import ninja.bytecode.iris.util.CNG;
|
||||
import ninja.bytecode.iris.util.CellGenerator;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
import ninja.bytecode.shuriken.logging.L;
|
||||
|
||||
@Desc("Represents a biome in iris.")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisBiome extends IrisRegistrant
|
||||
{
|
||||
@Desc("This is the human readable name for this biome. This can and should be different than the file name. This is not used for loading biomes in other objects.")
|
||||
private String name = "A Biome";
|
||||
|
||||
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen")
|
||||
private Dispersion biomeDispersion = Dispersion.SCATTER;
|
||||
|
||||
@Desc("This zooms in the biome colors if multiple derivatives are chosen")
|
||||
private double biomeZoom = 1;
|
||||
|
||||
@Desc("The raw derivative of this biome. This is required or the terrain will not properly generate. Use any vanilla biome type. Look in examples/biome-list.txt")
|
||||
private Biome derivative = Biome.THE_VOID;
|
||||
|
||||
@Desc("You can instead specify multiple biome derivatives to randomly scatter colors in this biome")
|
||||
private KList<Biome> biomeScatter = new KList<>();
|
||||
|
||||
@Desc("Since 1.13 supports 3D biomes, you can add different derivative colors for anything above the terrain. (Think swampy tree leaves with a desert looking grass surface)")
|
||||
private KList<Biome> biomeSkyScatter = new KList<>();
|
||||
|
||||
@Desc("If this biome has children biomes, and the gen layer chooses one of this biomes children, how much smaller will it be (inside of this biome). Higher values means a smaller biome relative to this biome's size. Set higher than 1.0 and below 3.0 for best results.")
|
||||
private double childShrinkFactor = 1.5;
|
||||
|
||||
@Desc("List any biome names (file names without.json) here as children. Portions of this biome can sometimes morph into their children. Iris supports cyclic relationships such as A > B > A > B. Iris will stop checking 9 biomes down the tree.")
|
||||
private KList<String> children = new KList<>();
|
||||
|
||||
@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> layers = new KList<IrisBiomePaletteLayer>().qadd(new IrisBiomePaletteLayer());
|
||||
|
||||
@Desc("Decorators are used for things like tall grass, bisected flowers, and even kelp or cactus (random heights)")
|
||||
private KList<IrisBiomeDecorator> decorators = new KList<IrisBiomeDecorator>();
|
||||
|
||||
@Desc("Objects define what schematics (iob files) iris will place in this biome")
|
||||
private KList<IrisObjectPlacement> objects = new KList<IrisObjectPlacement>();
|
||||
|
||||
@Desc("Generators for this biome. Multiple generators with different interpolation sizes will mix with other biomes how you would expect. This defines your biome height relative to the fluid height. Use negative for oceans.")
|
||||
private KList<IrisBiomeGeneratorLink> generators = new KList<IrisBiomeGeneratorLink>().qadd(new IrisBiomeGeneratorLink());
|
||||
|
||||
private transient ReentrantLock lock = new ReentrantLock();
|
||||
private transient CellGenerator childrenCell;
|
||||
private transient InferredType inferredType;
|
||||
private transient CNG biomeGenerator;
|
||||
private transient KList<CNG> layerHeightGenerators;
|
||||
private transient KList<CNG> layerSurfaceGenerators;
|
||||
|
||||
@ -48,6 +79,16 @@ public class IrisBiome extends IrisRegistrant
|
||||
return Math.max(0, Math.min(height, 255));
|
||||
}
|
||||
|
||||
public CNG getBiomeGenerator(RNG random)
|
||||
{
|
||||
if(biomeGenerator == null)
|
||||
{
|
||||
biomeGenerator = CNG.signature(random.nextParallelRNG(213949 + hashCode())).scale(biomeDispersion.equals(Dispersion.SCATTER) ? 1000D : 0.1D);
|
||||
}
|
||||
|
||||
return biomeGenerator;
|
||||
}
|
||||
|
||||
public CellGenerator getChildrenGenerator(RNG random, int sig, double scale)
|
||||
{
|
||||
if(childrenCell == null)
|
||||
@ -121,16 +162,59 @@ public class IrisBiome extends IrisRegistrant
|
||||
|
||||
public boolean isLand()
|
||||
{
|
||||
if(inferredType == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return inferredType.equals(InferredType.LAND);
|
||||
}
|
||||
|
||||
public boolean isSea()
|
||||
{
|
||||
if(inferredType == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return inferredType.equals(InferredType.SEA);
|
||||
}
|
||||
|
||||
public boolean isShore()
|
||||
{
|
||||
if(inferredType == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return inferredType.equals(InferredType.SHORE);
|
||||
}
|
||||
|
||||
public Biome getSkyBiome(RNG rng, double x, double y, double z)
|
||||
{
|
||||
if(biomeSkyScatter.isEmpty())
|
||||
{
|
||||
return getGroundBiome(rng, x, y, z);
|
||||
}
|
||||
|
||||
if(biomeSkyScatter.size() == 1)
|
||||
{
|
||||
return biomeSkyScatter.get(0);
|
||||
}
|
||||
|
||||
return biomeSkyScatter.get(getBiomeGenerator(rng).fit(0, biomeSkyScatter.size() - 1, x, y, z));
|
||||
}
|
||||
|
||||
public Biome getGroundBiome(RNG rng, double x, double y, double z)
|
||||
{
|
||||
if(biomeSkyScatter.isEmpty())
|
||||
{
|
||||
return getDerivative();
|
||||
}
|
||||
|
||||
if(biomeScatter.size() == 1)
|
||||
{
|
||||
return biomeScatter.get(0);
|
||||
}
|
||||
|
||||
return biomeScatter.get(getBiomeGenerator(rng).fit(0, biomeScatter.size() - 1, x, y, z));
|
||||
}
|
||||
}
|
||||
|
@ -5,22 +5,40 @@ import org.bukkit.block.data.BlockData;
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.util.BlockDataTools;
|
||||
import ninja.bytecode.iris.util.CNG;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
import ninja.bytecode.shuriken.collections.KMap;
|
||||
|
||||
@Desc("A biome decorator is used for placing flowers, grass, cacti and so on")
|
||||
@Data
|
||||
public class IrisBiomeDecorator
|
||||
{
|
||||
@Desc("The varience dispersion is used when multiple blocks are put in the palette. Scatter scrambles them, Wispy shows streak-looking varience")
|
||||
private Dispersion variance = Dispersion.SCATTER;
|
||||
|
||||
@Desc("Dispersion is used to pick places to spawn. Scatter randomly places them (vanilla) or Wispy for a streak like patch system.")
|
||||
private Dispersion dispersion = Dispersion.SCATTER;
|
||||
|
||||
@Desc("If this decorator has a height more than 1 this changes how it picks the height between your maxes. Scatter = random, Wispy = wavy heights")
|
||||
private Dispersion verticalVariance = Dispersion.SCATTER;
|
||||
private int iterations = 5;
|
||||
|
||||
@Desc("The minimum repeat stack height (setting to 3 would stack 3 of <block> on top of each other")
|
||||
private int stackMin = 1;
|
||||
|
||||
@Desc("The maximum repeat stack height")
|
||||
private int stackMax = 1;
|
||||
|
||||
@Desc("The zoom is for zooming in or out wispy dispersions. Makes patches bigger the higher this zoom value is/")
|
||||
private double zoom = 1;
|
||||
|
||||
@Desc("The vertical zoom is for wispy stack heights. Zooming this in makes stack heights more slowly change over a distance")
|
||||
private double verticalZoom = 1;
|
||||
|
||||
@Desc("The chance for this decorator to decorate at a given X,Y coordinate. This is hit 256 times per chunk (per surface block)")
|
||||
private double chance = 0.1;
|
||||
|
||||
@Desc("The palette of blocks to pick from when this decorator needs to place.")
|
||||
private KList<String> palette = new KList<String>().qadd("GRASS");
|
||||
|
||||
private transient KMap<Long, CNG> layerGenerators;
|
||||
@ -41,7 +59,7 @@ public class IrisBiomeDecorator
|
||||
{
|
||||
if(heightGenerator == null)
|
||||
{
|
||||
heightGenerator = CNG.signature(rng.nextParallelRNG(iterations + getBlockData().size() + stackMax + stackMin)).scale(1D / verticalZoom);
|
||||
heightGenerator = CNG.signature(rng.nextParallelRNG(getBlockData().size() + stackMax + stackMin)).scale(1D / verticalZoom);
|
||||
}
|
||||
|
||||
return heightGenerator;
|
||||
@ -58,7 +76,7 @@ public class IrisBiomeDecorator
|
||||
|
||||
if(!layerGenerators.containsKey(key))
|
||||
{
|
||||
layerGenerators.put(key, CNG.signature(rng.nextParallelRNG(iterations + getBlockData().size())).scale(1D / zoom));
|
||||
layerGenerators.put(key, CNG.signature(rng.nextParallelRNG(getBlockData().size())).scale(1D / zoom));
|
||||
}
|
||||
|
||||
return layerGenerators.get(key);
|
||||
|
@ -2,19 +2,27 @@ package ninja.bytecode.iris.object;
|
||||
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.IrisInterpolation;
|
||||
|
||||
@Desc("This represents a link to a generator for a biome")
|
||||
@Data
|
||||
public class IrisBiomeGeneratorLink
|
||||
{
|
||||
@Desc("The generator id")
|
||||
private String generator = "default";
|
||||
|
||||
@Desc("The min block value (value + fluidHeight)")
|
||||
private int min = 0;
|
||||
|
||||
@Desc("The max block value (value + fluidHeight)")
|
||||
private int max = 0;
|
||||
|
||||
private transient IrisGenerator gen;
|
||||
|
||||
public IrisBiomeGeneratorLink()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public IrisGenerator getCachedGenerator()
|
||||
|
@ -7,16 +7,27 @@ import org.bukkit.block.data.BlockData;
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.util.BlockDataTools;
|
||||
import ninja.bytecode.iris.util.CNG;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
|
||||
@Desc("A layer of surface / subsurface material in biomes")
|
||||
@Data
|
||||
public class IrisBiomePaletteLayer
|
||||
{
|
||||
@Desc("The dispersion of materials from the palette")
|
||||
private Dispersion dispersion = Dispersion.SCATTER;
|
||||
|
||||
@Desc("The min thickness of this layer")
|
||||
private int minHeight = 1;
|
||||
|
||||
@Desc("The max thickness of this layer")
|
||||
private int maxHeight = 1;
|
||||
|
||||
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
|
||||
private double terrainZoom = 5;
|
||||
|
||||
@Desc("The palette of blocks to be used in this layer")
|
||||
private KList<String> palette = new KList<String>().qadd("GRASS_BLOCK");
|
||||
|
||||
private transient ReentrantLock lock = new ReentrantLock();
|
||||
|
@ -5,34 +5,73 @@ import org.bukkit.World.Environment;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import ninja.bytecode.iris.util.CNG;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
|
||||
@Desc("Represents a dimension")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisDimension extends IrisRegistrant
|
||||
{
|
||||
@Desc("The human readable name of this dimension")
|
||||
private String name = "A Dimension";
|
||||
|
||||
@Desc("The interpolation function for splicing noise maxes together")
|
||||
private InterpolationMethod interpolationFunction = InterpolationMethod.BICUBIC;
|
||||
|
||||
@Desc("The interpolation distance scale. Increase = more smooth, less detail")
|
||||
private double interpolationScale = 63;
|
||||
private InterpolationMethod interpolationSurfaceFunction = InterpolationMethod.BICUBIC;
|
||||
private double interpolationSurfaceScale = 4;
|
||||
|
||||
@Desc("The world environment")
|
||||
private Environment environment = Environment.NORMAL;
|
||||
|
||||
@Desc("Define all of the regions to include in this dimension. Dimensions -> Regions -> Biomes -> Objects etc")
|
||||
private KList<String> regions = new KList<>();
|
||||
|
||||
@Desc("The fluid height for this dimension")
|
||||
private int fluidHeight = 63;
|
||||
|
||||
@Desc("Keep this either undefined or empty. Setting any biome name into this will force iris to only generate the specified biome. Great for testing.")
|
||||
private String focus = "";
|
||||
|
||||
@Desc("Zoom in or out the biome size. Higher = bigger biomes")
|
||||
private double biomeZoom = 5D;
|
||||
|
||||
@Desc("Zoom in or out the terrain. This stretches the terrain. Due to performance improvements, Higher than 2.0 may cause weird rounding artifacts. Lower = more terrain changes per block. Its a true zoom-out.")
|
||||
private double terrainZoom = 2D;
|
||||
|
||||
@Desc("You can rotate the input coordinates by an angle. This can make terrain appear more natural (less sharp corners and lines). This literally rotates the entire dimension by an angle. Hint: Try 12 degrees or something not on a 90 or 45 degree angle.")
|
||||
private double dimensionAngleDeg = 0;
|
||||
|
||||
@Desc("Iris adds a few roughness filters to noise. Increasing this smooths it out. Decreasing this makes it bumpier/scratchy")
|
||||
private double roughnessZoom = 2D;
|
||||
|
||||
@Desc("The height of the roughness filters")
|
||||
private int roughnessHeight = 3;
|
||||
|
||||
@Desc("Coordinate fracturing applies noise to the input coordinates. This creates the 'iris swirls' and wavy features. The distance pushes these waves further into places they shouldnt be. This is a block value multiplier.")
|
||||
private double coordFractureDistance = 20;
|
||||
|
||||
@Desc("Coordinate fracturing zoom. Higher = less frequent warping, Lower = more frequent and rapid warping / swirls.")
|
||||
private double coordFractureZoom = 8;
|
||||
|
||||
@Desc("This zooms in the land space")
|
||||
private double landZoom = 1;
|
||||
|
||||
@Desc("This can zoom the shores")
|
||||
private double shoreZoom = 1;
|
||||
|
||||
@Desc("This zooms oceanic biomes")
|
||||
private double seaZoom = 1;
|
||||
|
||||
@Desc("Zoom in continents")
|
||||
private double continentZoom = 1;
|
||||
|
||||
@Desc("Change the size of regions")
|
||||
private double regionZoom = 1;
|
||||
|
||||
@Desc("Disable this to stop placing schematics in biomes")
|
||||
private boolean placeObjects = true;
|
||||
|
||||
private transient CNG coordFracture;
|
||||
|
@ -2,19 +2,37 @@ package ninja.bytecode.iris.object;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
|
||||
@Desc("Represents a composite generator of noise gens")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisGenerator extends IrisRegistrant
|
||||
{
|
||||
@Desc("The zoom or frequency.")
|
||||
private double zoom = 1;
|
||||
|
||||
@Desc("The opacity, essentially a multiplier on the output.")
|
||||
private double opacity = 1;
|
||||
|
||||
@Desc("The offset to shift this noise x")
|
||||
private double offsetX = 0;
|
||||
|
||||
@Desc("The offset to shift this noise z")
|
||||
private double offsetZ = 0;
|
||||
|
||||
@Desc("The seed for this generator")
|
||||
private long seed = 1;
|
||||
|
||||
@Desc("The interpolation method when two biomes use different heights but this same generator")
|
||||
private InterpolationMethod interpolationFunction = InterpolationMethod.BICUBIC;
|
||||
|
||||
@Desc("The interpolation distance scale (blocks) when two biomes use different heights but this same generator")
|
||||
private double interpolationScale = 7;
|
||||
|
||||
@Desc("The list of noise gens this gen contains.")
|
||||
private KList<IrisNoiseGenerator> composite = new KList<IrisNoiseGenerator>();
|
||||
|
||||
public double getMax()
|
||||
@ -26,6 +44,7 @@ public class IrisGenerator extends IrisRegistrant
|
||||
{
|
||||
if(composite.isEmpty())
|
||||
{
|
||||
Iris.warn("Useless Generator: Composite is empty in " + getLoadKey());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -39,7 +58,14 @@ public class IrisGenerator extends IrisRegistrant
|
||||
h += i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
|
||||
}
|
||||
|
||||
return (h / tp) * opacity;
|
||||
double v = (h / tp) * opacity;
|
||||
|
||||
if(Double.isNaN(v))
|
||||
{
|
||||
Iris.warn("Nan value on gen: " + getLoadKey() + ": H = " + h + " TP = " + tp + " OPACITY = " + opacity + " ZOOM = " + zoom);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,26 +4,54 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.util.CNG;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.IrisInterpolation;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
|
||||
@Desc("A noise generator")
|
||||
@Data
|
||||
public class IrisNoiseGenerator
|
||||
{
|
||||
@Desc("The coordinate input zoom")
|
||||
private double zoom = 1;
|
||||
|
||||
@Desc("The output multiplier")
|
||||
private double opacity = 1;
|
||||
|
||||
@Desc("Coordinate offset x")
|
||||
private double offsetX = 0;
|
||||
|
||||
@Desc("Height output offset y")
|
||||
private double offsetY = 0;
|
||||
|
||||
@Desc("Coordinate offset z")
|
||||
private double offsetZ = 0;
|
||||
|
||||
@Desc("The seed")
|
||||
private long seed = 0;
|
||||
|
||||
@Desc("Apply a parametric curve on the output")
|
||||
private boolean parametric = false;
|
||||
@Desc("Apply a bezier curve on the output")
|
||||
private boolean bezier = false;
|
||||
|
||||
@Desc("Apply a sin-center curve on the output (0, and 1 = 0 and 0.5 = 1.0 using a sinoid shape.)")
|
||||
private boolean sinCentered = false;
|
||||
|
||||
@Desc("The exponent noise^EXPONENT")
|
||||
private double exponent = 1;
|
||||
|
||||
@Desc("Enable / disable. Outputs offsetY if disabled")
|
||||
private boolean enabled = true;
|
||||
|
||||
@Desc("If this generator uses the default iris swirly/wispy noise generator. Set to false for pure simplex.")
|
||||
private boolean irisBased = true;
|
||||
|
||||
@Desc("Multiple octaves for multple generators of changing zooms added together")
|
||||
private int octaves = 1;
|
||||
|
||||
@Desc("Apply a child noise generator to fracture the input coordinates of this generator")
|
||||
private KList<IrisNoiseGenerator> fracture = new KList<>();
|
||||
|
||||
private transient ReentrantLock lock;
|
||||
@ -79,7 +107,7 @@ public class IrisNoiseGenerator
|
||||
}
|
||||
|
||||
double n = getGenerator(superSeed).fitDoubleD(0, opacity, (x / zoom) + offsetX, (z / zoom) + offsetZ);
|
||||
n = (exponent != 1 ? Math.pow(n, exponent) : n) + offsetY;
|
||||
n = (exponent != 1 ? n < 0 ? -Math.pow(-n, exponent) : Math.pow(n, exponent) : n) + offsetY;
|
||||
n = parametric ? IrisInterpolation.parametric(n, 1) : n;
|
||||
n = bezier ? IrisInterpolation.bezier(n) : n;
|
||||
n = sinCentered ? IrisInterpolation.sinCenter(n) : n;
|
||||
|
@ -2,16 +2,22 @@ package ninja.bytecode.iris.object;
|
||||
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
|
||||
@Data
|
||||
public class IrisObjectPlacement
|
||||
{
|
||||
@Desc("List of objects to place")
|
||||
private KList<String> place = new KList<>();
|
||||
@Desc("Translate this object's placement")
|
||||
private IrisObjectTranslate translate = new IrisObjectTranslate();
|
||||
@Desc("Rotate this objects placement")
|
||||
private IrisObjectRotation rotation = new IrisObjectRotation();
|
||||
@Desc("The chance for this to place in a chunk. If you need multiple per chunk, set this to 1 and use density.")
|
||||
private double chance = 1;
|
||||
@Desc("If the chance check passes, place this many in a single chunk")
|
||||
private int density = 1;
|
||||
|
||||
public IrisObjectPlacement()
|
||||
|
@ -3,13 +3,19 @@ package ninja.bytecode.iris.object;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
|
||||
@Desc("Configures rotation for iris")
|
||||
@Data
|
||||
public class IrisObjectRotation
|
||||
{
|
||||
@Desc("If this rotator is enabled or not")
|
||||
private boolean enabled = true;
|
||||
@Desc("The x axis rotation")
|
||||
private IrisAxisRotationClamp xAxis = new IrisAxisRotationClamp();
|
||||
@Desc("The y axis rotation")
|
||||
private IrisAxisRotationClamp yAxis = new IrisAxisRotationClamp(true, 0, 0, 90);
|
||||
@Desc("The z axis rotation")
|
||||
private IrisAxisRotationClamp zAxis = new IrisAxisRotationClamp();
|
||||
|
||||
public IrisObjectRotation()
|
||||
|
@ -3,12 +3,19 @@ package ninja.bytecode.iris.object;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
|
||||
@Desc("Translate objects")
|
||||
@Data
|
||||
public class IrisObjectTranslate
|
||||
{
|
||||
@Desc("The x shift in blocks")
|
||||
private int x;
|
||||
|
||||
@Desc("The x shift in blocks")
|
||||
private int y;
|
||||
|
||||
@Desc("The x shift in blocks")
|
||||
private int z;
|
||||
|
||||
public IrisObjectTranslate()
|
||||
|
@ -5,23 +5,47 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import ninja.bytecode.iris.util.CNG;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
|
||||
@Desc("Represents an iris region")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisRegion extends IrisRegistrant
|
||||
{
|
||||
@Desc("The name of the region")
|
||||
private String name = "A Region";
|
||||
@Desc("The shore ration (How much percent of land should be a shore)")
|
||||
private double shoreRatio = 0.13;
|
||||
|
||||
@Desc("The min shore height")
|
||||
private double shoreHeightMin = 1.2;
|
||||
|
||||
@Desc("The the max shore height")
|
||||
private double shoreHeightMax = 3.2;
|
||||
|
||||
@Desc("The varience of the shore height")
|
||||
private double shoreHeightZoom = 3.14;
|
||||
|
||||
@Desc("The biome implosion ratio, how much to implode biomes into children (chance)")
|
||||
private double biomeImplosionRatio = 0.4;
|
||||
|
||||
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> landBiomes = new KList<>();
|
||||
|
||||
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> seaBiomes = new KList<>();
|
||||
|
||||
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> shoreBiomes = new KList<>();
|
||||
|
||||
@Desc("Ridge biomes create a vein-like network like rivers through this region")
|
||||
private KList<IrisRegionRidge> ridgeBiomes = new KList<>();
|
||||
|
||||
@Desc("Spot biomes splotch themselves across this region like lakes")
|
||||
private KList<IrisRegionSpot> spotBiomes = new KList<>();
|
||||
|
||||
private transient CNG shoreHeightGenerator;
|
||||
private transient ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
|
@ -0,0 +1,67 @@
|
||||
package ninja.bytecode.iris.object;
|
||||
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.util.CellGenerator;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
|
||||
@Desc("A ridge config")
|
||||
@Data
|
||||
public class IrisRegionRidge
|
||||
{
|
||||
@Desc("The biome name")
|
||||
private String biome;
|
||||
@Desc("The type this biome should override (land sea or shore)")
|
||||
private InferredType type = InferredType.LAND;
|
||||
@Desc("The chance this biome will be placed in a given spot")
|
||||
private double chance = 0.75;
|
||||
@Desc("The scale of the biome ridge. Higher values = wider veins & bigger connected cells")
|
||||
private double scale = 5;
|
||||
@Desc("The chance scale (cell chances)")
|
||||
private double chanceScale = 4;
|
||||
@Desc("The shuffle, how 'natural' this looks. Compared to pure polygons")
|
||||
private double shuffle = 16;
|
||||
@Desc("The chance shuffle (polygon cell chances)")
|
||||
private double chanceShuffle = 128;
|
||||
@Desc("The thickness of the vein")
|
||||
private double thickness = 0.125;
|
||||
private transient CellGenerator spot;
|
||||
private transient CellGenerator ridge;
|
||||
|
||||
public IrisRegionRidge()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean isRidge(RNG rng, double x, double z)
|
||||
{
|
||||
if(ridge == null)
|
||||
{
|
||||
ridge = new CellGenerator(rng.nextParallelRNG(165583 * hashCode()));
|
||||
ridge.setCellScale(scale);
|
||||
ridge.setShuffle(shuffle);
|
||||
}
|
||||
|
||||
if(spot == null)
|
||||
{
|
||||
spot = new CellGenerator(rng.nextParallelRNG(168523 * hashCode()));
|
||||
spot.setCellScale(chanceScale);
|
||||
spot.setShuffle(shuffle);
|
||||
}
|
||||
|
||||
if(chance < 1)
|
||||
{
|
||||
if(spot.getIndex(x, z, 1000) > chance * 1000)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(ridge.getDistance(x, z) <= thickness)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
45
src/main/java/ninja/bytecode/iris/object/IrisRegionSpot.java
Normal file
45
src/main/java/ninja/bytecode/iris/object/IrisRegionSpot.java
Normal file
@ -0,0 +1,45 @@
|
||||
package ninja.bytecode.iris.object;
|
||||
|
||||
import lombok.Data;
|
||||
import ninja.bytecode.iris.util.CellGenerator;
|
||||
import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
@Desc("A spot config")
|
||||
@Data
|
||||
public class IrisRegionSpot
|
||||
{
|
||||
@Desc("The biome to be placed")
|
||||
private String biome;
|
||||
@Desc("Where this spot overrides. Land sea or shore")
|
||||
private InferredType type = InferredType.LAND;
|
||||
@Desc("The scale of splotches")
|
||||
private double scale = 1;
|
||||
@Desc("Rarity is how often this splotch appears. higher = less often")
|
||||
private double rarity = 1;
|
||||
@Desc("The shuffle or how natural the splotch looks like (anti-polygon)")
|
||||
private double shuffle = 128;
|
||||
|
||||
private transient CellGenerator spot;
|
||||
|
||||
public IrisRegionSpot()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean isSpot(RNG rng, double x, double z)
|
||||
{
|
||||
if(spot == null)
|
||||
{
|
||||
spot = new CellGenerator(rng.nextParallelRNG(168583 * hashCode()));
|
||||
spot.setCellScale(scale);
|
||||
spot.setShuffle(shuffle);
|
||||
}
|
||||
|
||||
if(spot.getIndex(x, z, (int) (Math.round(rarity) + 8)) == (int) ((Math.round(rarity) + 8) / 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
14
src/main/java/ninja/bytecode/iris/util/Desc.java
Normal file
14
src/main/java/ninja/bytecode/iris/util/Desc.java
Normal file
@ -0,0 +1,14 @@
|
||||
package ninja.bytecode.iris.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({PARAMETER, TYPE, FIELD})
|
||||
public @interface Desc
|
||||
{
|
||||
String value();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user