Deep ocean tech

This commit is contained in:
Daniel Mills 2020-01-25 17:45:06 -05:00
parent b49c1e6e47
commit f645589cda
5 changed files with 21 additions and 144 deletions

View File

@ -42,7 +42,7 @@ public class Settings
public double heightScale = 0.56;
public double baseHeight = 0.065;
public int seaLevel = 63;
public double biomeScale = 0.5;
public double biomeScale = 0.75;
public boolean flatBedrock = false;
}
}

View File

@ -538,144 +538,6 @@ public class IrisGenerator extends ParallaxWorldGenerator
}
}
}
KList<Integer> hs = plan.getCaveHeights(x, z);
if(hs != null && !hs.isEmpty())
{
int h = 0;
int border = 0;
for(int hx : hs)
{
h = hx - 1;
border = 0;
if(x == 0 || x == 15)
{
border++;
}
if(z == 0 || z == 15)
{
border++;
}
if(h > 1)
{
above = 0;
below = 0;
if(x + 1 <= 15)
{
v = plan.getRealHeight(x + 1, z);
if(v > h)
{
above++;
}
else if(v < h)
{
below++;
}
}
if(x - 1 >= 0)
{
v = plan.getRealHeight(x - 1, z);
if(v > h)
{
above++;
}
else if(v < h)
{
below++;
}
}
if(z + 1 <= 15)
{
v = plan.getRealHeight(x, z + 1);
if(v > h)
{
above++;
}
else if(v < h)
{
below++;
}
}
if(z - 1 >= 0)
{
v = plan.getRealHeight(x, z - 1);
if(v > h)
{
above++;
}
else if(v < h)
{
below++;
}
}
// Patch Hole
if(above >= 4 - border)
{
data.setBlock(x, h + 1, z, data.getMB(x, h, z));
plan.setRealHeight(x, z, h + 1);
}
// Remove Nipple
else if(below >= 4 - border)
{
data.setBlock(x, h - 1, z, data.getMB(x, h, z));
data.setBlock(x, h, z, Material.AIR);
plan.setRealHeight(x, z, h - 1);
}
// Slab Smoothing
else if(below == 0 && above > 0 && f == Iris.settings.gen.blockSmoothing - 1)
{
MB d = data.getMB(x, h, z);
if(d.material.equals(Material.STAINED_CLAY) && d.data == 1)
{
data.setBlock(x, h + 1, z, Material.STONE_SLAB2);
}
else if(d.material.equals(Material.SAND))
{
if(d.data == 0)
{
data.setBlock(x, h + 1, z, Material.STEP, (byte) 1);
}
if(d.data == 1)
{
data.setBlock(x, h + 1, z, Material.STONE_SLAB2);
}
}
else if(d.material.equals(Material.SNOW_BLOCK))
{
data.setBlock(x, h + 1, z, Material.SNOW, (byte) 4);
}
else if(d.material.equals(Material.STONE) || d.material.equals(Material.SMOOTH_BRICK) || d.material.equals(Material.COBBLESTONE) || d.material.equals(Material.GRAVEL))
{
data.setBlock(x, h + 1, z, Material.STEP, (byte) 5);
}
}
}
}
}
}
}
}

View File

@ -11,6 +11,7 @@ import ninja.bytecode.iris.generator.IrisGenerator;
import ninja.bytecode.iris.pack.IrisBiome;
import ninja.bytecode.iris.pack.IrisRegion;
import ninja.bytecode.iris.util.BiomeLayer;
import ninja.bytecode.iris.util.Borders;
import ninja.bytecode.iris.util.GenLayer;
import ninja.bytecode.iris.util.PolygonGenerator;
import ninja.bytecode.shuriken.collections.KList;
@ -156,6 +157,17 @@ public class GenLayerBiome extends GenLayer
return biome;
}
if(!Borders.isBorderWithin(x, z, 24, 45, (x / 10D) + (z / 10D), (a, b) -> ocean.getIndex(a, b)))
{
if(region.getDeepOcean() == null)
{
L.f(C.YELLOW + "Cannot find Deep Ocean in Region" + C.RED + biome.getRegionID());
return biome;
}
return getRegion(biome.getRegionID()).getDeepOcean();
}
if(region.getOcean() == null)
{
L.f(C.YELLOW + "Cannot find Ocean in Region" + C.RED + biome.getRegionID());

View File

@ -82,11 +82,6 @@ public class GenLayerCaves extends GenLayer
}
}
}
if(lowest < 256)
{
plan.setCaveHeight(x, z, lowest);
}
}
}

View File

@ -12,6 +12,7 @@ public class IrisRegion
private String name;
private KList<IrisBiome> biomes;
private IrisBiome ocean;
private IrisBiome deepOcean;
private IrisBiome lake;
private IrisBiome lakeBeach;
private IrisBiome channel;
@ -23,6 +24,7 @@ public class IrisRegion
this.biomes = new KList<>();
beach = null;
ocean = null;
deepOcean = null;
lake = null;
lakeBeach = null;
channel = null;
@ -35,6 +37,7 @@ public class IrisRegion
JSONObject o = Iris.pack().loadJSON("pack/regions/" + name + ".json");
J.attempt(() -> name = o.getString("name"));
J.attempt(() -> ocean = Iris.pack().getBiomeById(o.getString("ocean")));
J.attempt(() -> deepOcean = Iris.pack().getBiomeById(o.getString("deepOcean")));
J.attempt(() -> beach = Iris.pack().getBiomeById(o.getString("beach")));
J.attempt(() -> lake = Iris.pack().getBiomeById(o.getString("lake")));
J.attempt(() -> lakeBeach = Iris.pack().getBiomeById(o.getString("shore")));
@ -77,6 +80,11 @@ public class IrisRegion
return ocean;
}
public IrisBiome getDeepOcean()
{
return deepOcean;
}
public IrisBiome getLake()
{
return lake;