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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)))
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user