This commit is contained in:
Daniel Mills
2020-07-29 00:23:48 -04:00
parent 7d4b980e59
commit 0ecde9531e
10 changed files with 200 additions and 63 deletions

View File

@@ -0,0 +1,14 @@
package com.volmit.iris.layer.post;
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(TYPE)
public @interface Post
{
String value();
}

View File

@@ -6,13 +6,19 @@ import com.volmit.iris.generator.PostBlockChunkGenerator;
import com.volmit.iris.util.BlockDataTools;
import com.volmit.iris.util.IrisPostBlockFilter;
public class PostFloatingNippleDeleter extends IrisPostBlockFilter
@Post("floating-block-remover")
public class PostFloatingNibDeleter extends IrisPostBlockFilter
{
private static final BlockData AIR = BlockDataTools.getBlockData("AIR");
public PostFloatingNippleDeleter(PostBlockChunkGenerator gen)
public PostFloatingNibDeleter(PostBlockChunkGenerator gen, int phase)
{
super(gen);
super(gen, phase);
}
public PostFloatingNibDeleter(PostBlockChunkGenerator gen)
{
this(gen, 0);
}
@Override

View File

@@ -6,11 +6,17 @@ import org.bukkit.block.data.BlockData;
import com.volmit.iris.generator.PostBlockChunkGenerator;
import com.volmit.iris.util.IrisPostBlockFilter;
public class PostNippleSmoother extends IrisPostBlockFilter
@Post("nib-smoother")
public class PostNibSmoother extends IrisPostBlockFilter
{
public PostNippleSmoother(PostBlockChunkGenerator gen)
public PostNibSmoother(PostBlockChunkGenerator gen, int phase)
{
super(gen);
super(gen, phase);
}
public PostNibSmoother(PostBlockChunkGenerator gen)
{
this(gen, 0);
}
@Override

View File

@@ -3,11 +3,17 @@ package com.volmit.iris.layer.post;
import com.volmit.iris.generator.PostBlockChunkGenerator;
import com.volmit.iris.util.IrisPostBlockFilter;
@Post("pothole-filler")
public class PostPotholeFiller extends IrisPostBlockFilter
{
public PostPotholeFiller(PostBlockChunkGenerator gen, int phase)
{
super(gen, phase);
}
public PostPotholeFiller(PostBlockChunkGenerator gen)
{
super(gen);
this(gen, 0);
}
@Override

View File

@@ -7,16 +7,22 @@ import com.volmit.iris.generator.PostBlockChunkGenerator;
import com.volmit.iris.util.IrisPostBlockFilter;
import com.volmit.iris.util.RNG;
@Post("slabber")
public class PostSlabber extends IrisPostBlockFilter
{
public static final Material AIR = Material.AIR;
public static final Material WATER = Material.WATER;
private RNG rng;
public PostSlabber(PostBlockChunkGenerator gen, int phase)
{
super(gen, phase);
rng = gen.getMasterRandom().nextParallelRNG(166456);
}
public PostSlabber(PostBlockChunkGenerator gen)
{
super(gen);
rng = gen.getMasterRandom().nextParallelRNG(1239456);
this(gen, 0);
}
@Override
@@ -41,8 +47,11 @@ public class PostSlabber extends IrisPostBlockFilter
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);
queue(() ->
{
setPostBlock(x, h + 1, z, d);
updateHeight(x, z, h + 1);
});
}
}
}

View File

@@ -8,15 +8,21 @@ import com.volmit.iris.object.IrisBiome;
import com.volmit.iris.util.IrisPostBlockFilter;
import com.volmit.iris.util.RNG;
@Post("wall-painter")
public class PostWallPatcher extends IrisPostBlockFilter
{
public static final Material AIR = Material.AIR;
private RNG rng;
public PostWallPatcher(PostBlockChunkGenerator gen, int phase)
{
super(gen, phase);
rng = gen.getMasterRandom().nextParallelRNG(1239456);
}
public PostWallPatcher(PostBlockChunkGenerator gen)
{
super(gen);
rng = gen.getMasterRandom().nextParallelRNG(1239456);
this(gen, 0);
}
@Override
@@ -40,8 +46,11 @@ public class PostWallPatcher extends IrisPostBlockFilter
if(s != null)
{
setPostBlock(x, h + 1, z, s);
updateHeight(x, z, h + 1);
if(!s.getMaterial().equals(AIR))
{
setPostBlock(x, h + 1, z, s);
updateHeight(x, z, h + 1);
}
}
for(int i = h; i > h - max; i--)

View File

@@ -1,14 +1,23 @@
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.Iris;
import com.volmit.iris.generator.PostBlockChunkGenerator;
import com.volmit.iris.util.BlockDataTools;
import com.volmit.iris.util.IrisPostBlockFilter;
@Post("waterlogger")
public class PostWaterlogger extends IrisPostBlockFilter
{
private static final BlockData WATER = BlockDataTools.getBlockData("WATER");
public PostWaterlogger(PostBlockChunkGenerator gen, int phase)
{
super(gen, phase);
}
public PostWaterlogger(PostBlockChunkGenerator gen)
{
super(gen);
@@ -23,32 +32,31 @@ public class PostWaterlogger extends IrisPostBlockFilter
if(b instanceof Waterlogged)
{
Waterlogged ww = (Waterlogged) b;
boolean w = ww.isWaterlogged();
if(isWater(x, h + 1, z))
if(ww.isWaterlogged())
{
return;
}
if(isWaterOrWaterlogged(x, h + 1, z) && !ww.isWaterlogged())
{
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);
}
else if(!ww.isWaterlogged() && (isWaterOrWaterlogged(x + 1, h, z) || isWaterOrWaterlogged(x - 1, h, z) || isWaterOrWaterlogged(x, h, z + 1) || isWaterOrWaterlogged(x, h, z - 1)))
{
ww.setWaterlogged(true);
setPostBlock(x, h, z, ww);
}
}
else if(b.getMaterial().equals(Material.AIR) && h <= gen.getFluidHeight())
{
if((isWaterOrWaterlogged(x + 1, h, z) || isWaterOrWaterlogged(x - 1, h, z) || isWaterOrWaterlogged(x, h, z + 1) || isWaterOrWaterlogged(x, h, z - 1)))
{
setPostBlock(x, h, z, WATER);
}
}
}
}