9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-29 20:19:06 +00:00

Noise overlay support & Post Foliage Cleaner

This commit is contained in:
Daniel Mills
2020-09-05 01:39:19 -04:00
parent fc55622cc8
commit 44d800de1e
13 changed files with 162 additions and 37 deletions

View File

@@ -5,6 +5,7 @@ import org.bukkit.block.data.BlockData;
import com.volmit.iris.Iris;
import com.volmit.iris.gen.post.PostFloatingNibDeleter;
import com.volmit.iris.gen.post.PostFoliageCleaner;
import com.volmit.iris.gen.post.PostNibSmoother;
import com.volmit.iris.gen.post.PostPotholeFiller;
import com.volmit.iris.gen.post.PostSlabber;
@@ -115,6 +116,11 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
return new PostFloatingNibDeleter(this, phase);
}
if(processor.equals("foliage-cleaner"))
{
return new PostFoliageCleaner(this, phase);
}
if(processor.equals("nib-smoother"))
{
return new PostNibSmoother(this, phase);

View File

@@ -23,6 +23,7 @@ import com.volmit.iris.object.IrisDepositGenerator;
import com.volmit.iris.object.IrisDimension;
import com.volmit.iris.object.IrisGenerator;
import com.volmit.iris.object.IrisRegion;
import com.volmit.iris.object.IrisShapedGeneratorStyle;
import com.volmit.iris.util.B;
import com.volmit.iris.util.BiomeMap;
import com.volmit.iris.util.CaveResult;
@@ -755,6 +756,11 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
{
double h = getRawBiomeHeight(rrx, rrz);
for(IrisShapedGeneratorStyle i : getDimension().getOverlayNoise())
{
h += i.get(getMasterRandom(), rrx, rrz);
}
return h;
}

View File

@@ -36,10 +36,10 @@ public class PostFloatingNibDeleter extends IrisPostBlockFilter
return;
}
int ha = highestTerrainBlock(x + 1, z);
int hb = highestTerrainBlock(x, z + 1);
int hc = highestTerrainBlock(x - 1, z);
int hd = highestTerrainBlock(x, z - 1);
int ha = highestTerrainOrCarvingBlock(x + 1, z);
int hb = highestTerrainOrCarvingBlock(x, z + 1);
int hc = highestTerrainOrCarvingBlock(x - 1, z);
int hd = highestTerrainOrCarvingBlock(x, z - 1);
g += ha < h - 1 ? 1 : 0;
g += hb < h - 1 ? 1 : 0;
g += hc < h - 1 ? 1 : 0;

View File

@@ -0,0 +1,45 @@
package com.volmit.iris.gen.post;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.generator.ChunkGenerator.ChunkData;
import com.volmit.iris.gen.PostBlockChunkGenerator;
import com.volmit.iris.util.B;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.IrisPostBlockFilter;
@Post("foliage-cleaner")
public class PostFoliageCleaner extends IrisPostBlockFilter
{
public static final BlockData AIR = B.get("AIR");
@DontObfuscate
public PostFoliageCleaner(PostBlockChunkGenerator gen, int phase)
{
super(gen, phase);
}
@DontObfuscate
public PostFoliageCleaner(PostBlockChunkGenerator gen)
{
this(gen, 0);
}
@Override
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
{
int h = highestTerrainOrCarvingBlock(x, z);
BlockData b = getPostBlock(x, h + 1, z, currentPostX, currentPostZ, currentData);
if(B.isFoliage(b) || b.getMaterial().equals(Material.DEAD_BUSH))
{
Material onto = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData).getMaterial();
if(!B.canPlaceOnto(b.getMaterial(), onto))
{
setPostBlock(x, h + 1, z, AIR, currentPostX, currentPostZ, currentData);
}
}
}
}

View File

@@ -27,11 +27,11 @@ public class PostNibSmoother extends IrisPostBlockFilter
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
{
int g = 0;
int h = highestTerrainBlock(x, z);
int ha = highestTerrainBlock(x + 1, z);
int hb = highestTerrainBlock(x, z + 1);
int hc = highestTerrainBlock(x - 1, z);
int hd = highestTerrainBlock(x, z - 1);
int h = highestTerrainOrCarvingBlock(x, z);
int ha = highestTerrainOrCarvingBlock(x + 1, z);
int hb = highestTerrainOrCarvingBlock(x, z + 1);
int hc = highestTerrainOrCarvingBlock(x - 1, z);
int hd = highestTerrainOrCarvingBlock(x, z - 1);
g += ha == h - 1 ? 1 : 0;
g += hb == h - 1 ? 1 : 0;
g += hc == h - 1 ? 1 : 0;

View File

@@ -25,11 +25,11 @@ public class PostPotholeFiller extends IrisPostBlockFilter
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
{
int g = 0;
int h = highestTerrainBlock(x, z);
int ha = highestTerrainBlock(x + 1, z);
int hb = highestTerrainBlock(x, z + 1);
int hc = highestTerrainBlock(x - 1, z);
int hd = highestTerrainBlock(x, z - 1);
int h = highestTerrainOrCarvingBlock(x, z);
int ha = highestTerrainOrCarvingBlock(x + 1, z);
int hb = highestTerrainOrCarvingBlock(x, z + 1);
int hc = highestTerrainOrCarvingBlock(x - 1, z);
int hd = highestTerrainOrCarvingBlock(x, z - 1);
g += ha == h + 1 ? 1 : 0;
g += hb == h + 1 ? 1 : 0;
g += hc == h + 1 ? 1 : 0;

View File

@@ -32,11 +32,11 @@ public class PostSlabber extends IrisPostBlockFilter
@Override
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
{
int h = highestTerrainBlock(x, z);
int ha = highestTerrainBlock(x + 1, z);
int hb = highestTerrainBlock(x, z + 1);
int hc = highestTerrainBlock(x - 1, z);
int hd = highestTerrainBlock(x, z - 1);
int h = highestTerrainOrCarvingBlock(x, z);
int ha = highestTerrainOrCarvingBlock(x + 1, z);
int hb = highestTerrainOrCarvingBlock(x, z + 1);
int hc = highestTerrainOrCarvingBlock(x - 1, z);
int hd = highestTerrainOrCarvingBlock(x, z - 1);
if((ha == h + 1 && isSolid(x + 1, ha, z, currentPostX, currentPostZ, currentData)) || (hb == h + 1 && isSolid(x, hb, z + 1, currentPostX, currentPostZ, currentData)) || (hc == h + 1 && isSolid(x - 1, hc, z, currentPostX, currentPostZ, currentData)) || (hd == h + 1 && isSolid(x, hd, z - 1, currentPostX, currentPostZ, currentData)))
{

View File

@@ -37,11 +37,11 @@ public class PostWallPatcher extends IrisPostBlockFilter
if(!biome.getWall().getPalette().isEmpty())
{
h = highestTerrainBlock(x, z);
ha = highestTerrainBlock(x + 1, z);
hb = highestTerrainBlock(x, z + 1);
hc = highestTerrainBlock(x - 1, z);
hd = highestTerrainBlock(x, z - 1);
h = highestTerrainOrCarvingBlock(x, z);
ha = highestTerrainOrCarvingBlock(x + 1, z);
hb = highestTerrainOrCarvingBlock(x, z + 1);
hc = highestTerrainOrCarvingBlock(x - 1, z);
hd = highestTerrainOrCarvingBlock(x, z - 1);
if(ha < h - 2 || hb < h - 2 || hc < h - 2 || hd < h - 2)
{

View File

@@ -30,7 +30,7 @@ public class PostWaterlogger extends IrisPostBlockFilter
@Override
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
{
int h = highestTerrainBlock(x, z);
int h = highestTerrainOrCarvingBlock(x, z);
BlockData b = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData);
if(b instanceof Waterlogged)