This commit is contained in:
Daniel Mills
2020-07-28 20:49:35 -04:00
parent bccb4e154d
commit 7d4b980e59
16 changed files with 337 additions and 26 deletions

View File

@@ -0,0 +1,52 @@
package com.volmit.iris.layer.post;
import org.bukkit.block.data.BlockData;
import com.volmit.iris.generator.PostBlockChunkGenerator;
import com.volmit.iris.util.BlockDataTools;
import com.volmit.iris.util.IrisPostBlockFilter;
public class PostFloatingNippleDeleter extends IrisPostBlockFilter
{
private static final BlockData AIR = BlockDataTools.getBlockData("AIR");
public PostFloatingNippleDeleter(PostBlockChunkGenerator gen)
{
super(gen);
}
@Override
public void onPost(int x, int z)
{
int g = 0;
int h = highestTerrainBlock(x, z);
if(h < 1)
{
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);
g += ha < h - 1 ? 1 : 0;
g += hb < h - 1 ? 1 : 0;
g += hc < h - 1 ? 1 : 0;
g += hd < h - 1 ? 1 : 0;
if(g == 4 && isAir(x, h - 1, z))
{
setPostBlock(x, h, z, AIR);
for(int i = h - 1; i > 0; i--)
{
if(!isAir(x, i, z))
{
updateHeight(x, z, i);
break;
}
}
}
}
}

View File

@@ -16,13 +16,18 @@ public class PostNippleSmoother extends IrisPostBlockFilter
@Override
public void onPost(int x, int z)
{
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);
g += ha == h - 1 ? 1 : 0;
g += hb == h - 1 ? 1 : 0;
g += hc == h - 1 ? 1 : 0;
g += hd == h - 1 ? 1 : 0;
if(ha == h - 1 && hb == h - 1 && hc == h - 1 && hd == h - 1)
if(g >= 3)
{
BlockData bc = getPostBlock(x, h, z);
BlockData b = getPostBlock(x, h + 1, z);
@@ -31,6 +36,7 @@ public class PostNippleSmoother extends IrisPostBlockFilter
if(m.isSolid())
{
setPostBlock(x, h, z, b);
updateHeight(x, z, h - 1);
}
}
}

View File

@@ -13,15 +13,21 @@ public class PostPotholeFiller extends IrisPostBlockFilter
@Override
public void onPost(int x, int z)
{
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);
g += ha == h + 1 ? 1 : 0;
g += hb == h + 1 ? 1 : 0;
g += hc == h + 1 ? 1 : 0;
g += hd == h + 1 ? 1 : 0;
if(ha == h + 1 && hb == h + 1 && hc == h + 1 && hd == h + 1)
if(g >= 3)
{
setPostBlock(x, h + 1, z, getPostBlock(x, h, z));
updateHeight(x, z, h + 1);
}
}
}

View File

@@ -2,7 +2,6 @@ package com.volmit.iris.layer.post;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged;
import com.volmit.iris.generator.PostBlockChunkGenerator;
import com.volmit.iris.util.IrisPostBlockFilter;
@@ -24,10 +23,15 @@ public class PostSlabber extends IrisPostBlockFilter
public void onPost(int x, int z)
{
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);
if(highestTerrainBlock(x + 1, z) == h + 1 || highestTerrainBlock(x, z + 1) == h + 1 || highestTerrainBlock(x - 1, z) == h + 1 || highestTerrainBlock(x, z - 1) == h + 1)
if(ha == h + 1 || hb == h + 1 || hc == h + 1 || hd == h + 1)
{
BlockData d = gen.sampleTrueBiome(x, z).getBiome().getSlab().get(rng, x, h, z);
if(d != null)
{
if(d.getMaterial().equals(AIR))
@@ -35,14 +39,10 @@ public class PostSlabber extends IrisPostBlockFilter
return;
}
if(d instanceof Waterlogged)
{
((Waterlogged) d).setWaterlogged(getPostBlock(x, h + 1, z).getMaterial().equals(Material.WATER));
}
if(getPostBlock(x, h + 2, z).getMaterial().equals(AIR) || getPostBlock(x, h + 2, z).getMaterial().equals(WATER))
if(isAir(x, h + 2, z) || getPostBlock(x, h + 2, z).getMaterial().equals(WATER))
{
setPostBlock(x, h + 1, z, d);
updateHeight(x, z, h + 1);
}
}
}

View File

@@ -23,18 +23,26 @@ public class PostWallPatcher extends IrisPostBlockFilter
public void onPost(int x, int z)
{
IrisBiome biome = gen.sampleTrueBiome(x, z).getBiome();
int h, ha, hb, hc, hd;
if(!biome.getWall().getPalette().isEmpty())
{
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);
h = highestTerrainBlock(x, z);
ha = highestTerrainBlock(x + 1, z);
hb = highestTerrainBlock(x, z + 1);
hc = highestTerrainBlock(x - 1, z);
hd = highestTerrainBlock(x, z - 1);
if(ha < h - 2 || hb < h - 2 || hc < h - 2 || hd < h - 2)
{
int max = Math.abs(Math.max(h - ha, Math.max(h - hb, Math.max(h - hc, h - hd))));
BlockData s = gen.sampleTrueBiome(x, z).getBiome().getSlab().get(rng, x, h, z);
if(s != null)
{
setPostBlock(x, h + 1, z, s);
updateHeight(x, z, h + 1);
}
for(int i = h; i > h - max; i--)
{

View File

@@ -0,0 +1,54 @@
package com.volmit.iris.layer.post;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged;
import com.volmit.iris.Iris;
import com.volmit.iris.generator.PostBlockChunkGenerator;
import com.volmit.iris.util.IrisPostBlockFilter;
public class PostWaterlogger extends IrisPostBlockFilter
{
public PostWaterlogger(PostBlockChunkGenerator gen)
{
super(gen);
}
@Override
public void onPost(int x, int z)
{
int h = highestTerrainBlock(x, z);
BlockData b = getPostBlock(x, h, z);
if(b instanceof Waterlogged)
{
Waterlogged ww = (Waterlogged) b;
boolean w = ww.isWaterlogged();
if(isWater(x, h + 1, z))
{
ww.setWaterlogged(true);
}
else if(h < 98)
{
Iris.info("Data is " + getPostBlock(x, h + 1, z).getAsString());
}
else if(isWater(x + 1, h, z) || isWater(x - 1, h, z) || isWater(x, h, z + 1) || isWater(x, h, z - 1))
{
ww.setWaterlogged(true);
}
else
{
ww.setWaterlogged(false);
}
if(ww.isWaterlogged() != w)
{
setPostBlock(x, h, z, ww);
}
}
}
}