From 1993639bf6fe851b2f0826804f1b3f2943daba1d Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Mon, 7 Sep 2020 11:56:22 -0400 Subject: [PATCH] Config options & fix cave slabs for 2x lines --- src/main/java/com/volmit/iris/Iris.java | 23 - .../java/com/volmit/iris/ProjectManager.java | 11 +- .../volmit/iris/gen/IrisTerrainProvider.java | 2 +- .../iris/gen/PostBlockTerrainProvider.java | 109 +---- .../iris/gen/TopographicTerrainProvider.java | 7 + .../volmit/iris/gen/layer/GenLayerCave.java | 3 +- .../java/com/volmit/iris/gen/post/Post.java | 14 - .../iris/gen/post/PostFloatingNibDeleter.java | 62 --- .../iris/gen/post/PostFoliageCleaner.java | 45 -- .../iris/gen/post/PostMasterPatcher.java | 407 ++++++++++++++++++ .../volmit/iris/gen/post/PostNibSmoother.java | 53 --- .../iris/gen/post/PostPotholeFiller.java | 44 -- .../com/volmit/iris/gen/post/PostSlabber.java | 70 --- .../volmit/iris/gen/post/PostWallPatcher.java | 74 ---- .../volmit/iris/gen/post/PostWaterlogger.java | 65 --- .../com/volmit/iris/object/IrisDimension.java | 52 +-- .../iris/object/IrisEntityInitialSpawn.java | 7 +- .../volmit/iris/util/IrisPostBlockFilter.java | 18 +- 18 files changed, 456 insertions(+), 610 deletions(-) delete mode 100644 src/main/java/com/volmit/iris/gen/post/Post.java delete mode 100644 src/main/java/com/volmit/iris/gen/post/PostFloatingNibDeleter.java delete mode 100644 src/main/java/com/volmit/iris/gen/post/PostFoliageCleaner.java create mode 100644 src/main/java/com/volmit/iris/gen/post/PostMasterPatcher.java delete mode 100644 src/main/java/com/volmit/iris/gen/post/PostNibSmoother.java delete mode 100644 src/main/java/com/volmit/iris/gen/post/PostPotholeFiller.java delete mode 100644 src/main/java/com/volmit/iris/gen/post/PostSlabber.java delete mode 100644 src/main/java/com/volmit/iris/gen/post/PostWallPatcher.java delete mode 100644 src/main/java/com/volmit/iris/gen/post/PostWaterlogger.java diff --git a/src/main/java/com/volmit/iris/Iris.java b/src/main/java/com/volmit/iris/Iris.java index 8e41f8317..559f168b0 100644 --- a/src/main/java/com/volmit/iris/Iris.java +++ b/src/main/java/com/volmit/iris/Iris.java @@ -19,13 +19,6 @@ import org.bukkit.plugin.Plugin; import com.volmit.iris.command.CommandIris; import com.volmit.iris.command.PermissionIris; import com.volmit.iris.gen.IrisTerrainProvider; -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; -import com.volmit.iris.gen.post.PostWallPatcher; -import com.volmit.iris.gen.post.PostWaterlogger; import com.volmit.iris.gen.provisions.ProvisionBukkit; import com.volmit.iris.gen.scaffold.IrisGenConfiguration; import com.volmit.iris.gen.scaffold.TerrainTarget; @@ -35,7 +28,6 @@ import com.volmit.iris.util.Form; import com.volmit.iris.util.GroupedExecutor; import com.volmit.iris.util.IO; import com.volmit.iris.util.IrisLock; -import com.volmit.iris.util.IrisPostBlockFilter; import com.volmit.iris.util.J; import com.volmit.iris.util.KList; import com.volmit.iris.util.MortarPlugin; @@ -190,21 +182,6 @@ public class Iris extends MortarPlugin super.onDisable(); } - public static KList> loadPostProcessors() - { - KList> g = new KList>(); - - g.add(PostFloatingNibDeleter.class); - g.add(PostFoliageCleaner.class); - g.add(PostNibSmoother.class); - g.add(PostPotholeFiller.class); - g.add(PostSlabber.class); - g.add(PostWallPatcher.class); - g.add(PostWaterlogger.class); - - return g; - } - @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { diff --git a/src/main/java/com/volmit/iris/ProjectManager.java b/src/main/java/com/volmit/iris/ProjectManager.java index e3dc5824e..3124ea884 100644 --- a/src/main/java/com/volmit/iris/ProjectManager.java +++ b/src/main/java/com/volmit/iris/ProjectManager.java @@ -28,7 +28,6 @@ import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; import com.volmit.iris.gen.IrisTerrainProvider; import com.volmit.iris.gen.nms.NMSCreator; -import com.volmit.iris.gen.post.Post; import com.volmit.iris.gen.provisions.ProvisionBukkit; import com.volmit.iris.gen.scaffold.IrisGenConfiguration; import com.volmit.iris.gen.scaffold.TerrainTarget; @@ -57,7 +56,6 @@ import com.volmit.iris.util.DependsOn; import com.volmit.iris.util.Desc; import com.volmit.iris.util.Form; import com.volmit.iris.util.IO; -import com.volmit.iris.util.IrisPostBlockFilter; import com.volmit.iris.util.J; import com.volmit.iris.util.JSONArray; import com.volmit.iris.util.JSONException; @@ -1823,17 +1821,10 @@ public class ProjectManager IO.writeAll(new File(of, "interpolation-method.txt"), m.toString("\n")); m = new KList<>(); - for(Class i : Iris.loadPostProcessors()) - { - m.add(i.getDeclaredAnnotation(Post.class).value()); - } - - IO.writeAll(new File(of, "post-processors.txt"), m.toString("\n")); - m = new KList<>(); - for(PotionEffectType i : PotionEffectType.values()) { m.add(i.getName().toUpperCase().replaceAll("\\Q \\E", "_")); } + IO.writeAll(new File(of, "potioneffects.txt"), m.toString("\n")); } } diff --git a/src/main/java/com/volmit/iris/gen/IrisTerrainProvider.java b/src/main/java/com/volmit/iris/gen/IrisTerrainProvider.java index 80d1d5706..350c862a2 100644 --- a/src/main/java/com/volmit/iris/gen/IrisTerrainProvider.java +++ b/src/main/java/com/volmit/iris/gen/IrisTerrainProvider.java @@ -414,7 +414,7 @@ public class IrisTerrainProvider extends PostBlockTerrainProvider implements Iri { int x = (c.getX() * 16) + rng.nextInt(15); int z = (c.getZ() * 16) + rng.nextInt(15); - int y = getCarvedHeight(x, z); + int y = getCarvedHeight(x, z) + 1; IrisDimension dim = getDimension(); IrisRegion region = sampleRegion(x, z); IrisBiome above = sampleTrueBiome(x, z); diff --git a/src/main/java/com/volmit/iris/gen/PostBlockTerrainProvider.java b/src/main/java/com/volmit/iris/gen/PostBlockTerrainProvider.java index ebfb819c0..52afa5798 100644 --- a/src/main/java/com/volmit/iris/gen/PostBlockTerrainProvider.java +++ b/src/main/java/com/volmit/iris/gen/PostBlockTerrainProvider.java @@ -4,19 +4,12 @@ import org.bukkit.block.data.BlockData; import org.bukkit.generator.ChunkGenerator.ChunkData; 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; -import com.volmit.iris.gen.post.PostWallPatcher; -import com.volmit.iris.gen.post.PostWaterlogger; +import com.volmit.iris.gen.post.PostMasterPatcher; import com.volmit.iris.gen.scaffold.TerrainChunk; import com.volmit.iris.gen.scaffold.TerrainTarget; import com.volmit.iris.util.CaveResult; import com.volmit.iris.util.IPostBlockAccess; import com.volmit.iris.util.IrisLock; -import com.volmit.iris.util.IrisPostBlockFilter; import com.volmit.iris.util.KList; import com.volmit.iris.util.PrecisionStopwatch; import com.volmit.iris.util.RNG; @@ -30,6 +23,7 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i { private String postKey; private IrisLock postLock; + private PostMasterPatcher patcher; private int minPhase; private int maxPhase; @@ -43,6 +37,7 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i public void onInit(RNG rng) { super.onInit(rng); + patcher = new PostMasterPatcher(this); } @Override @@ -55,104 +50,36 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i return; } - KList filters = getDimension().getPostBlockProcessors(this); - int rx, i, j; PrecisionStopwatch p = PrecisionStopwatch.start(); - - for(int h = getMinPhase(); h <= getMaxPhase(); h++) + KList q = new KList<>(); + for(i = 0; i < 16; i++) { - for(i = 0; i < 16; i++) + rx = (x << 4) + i; + + for(j = 0; j < 16; j++) { - rx = (x << 4) + i; + int rxx = rx; + int rzz = (z << 4) + j; - for(j = 0; j < 16; j++) + getAccelerant().queue("post", () -> { - int rxx = rx; - int rzz = (z << 4) + j; - int hh = h; - - getAccelerant().queue("post", () -> - { - for(IrisPostBlockFilter f : filters) - { - if(f.getPhase() == hh) - { - f.onPost(rxx, rzz, x, z, terrain); - } - } - }); - } + patcher.onPost(rxx, rzz, x, z, terrain, q); + }); } + } - getAccelerant().waitFor("post"); + getAccelerant().waitFor("post"); - for(IrisPostBlockFilter f : filters) - { - if(f.getPhase() == h) - { - while(f.getQueue().size() > 0) - { - try - { - f.getQueue().pop().run(); - } - - catch(Throwable e) - { - - } - } - } - } + for(Runnable v : q) + { + v.run(); } p.end(); getMetrics().getPost().put(p.getMilliseconds()); } - public IrisPostBlockFilter createProcessor(String processor, int phase) - { - if(processor.equals("floating-block-remover")) - { - 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); - } - - if(processor.equals("pothole-filler")) - { - return new PostPotholeFiller(this, phase); - } - - if(processor.equals("slabber")) - { - return new PostSlabber(this, phase); - } - - if(processor.equals("wall-painter")) - { - return new PostWallPatcher(this, phase); - } - - if(processor.equals("waterlogger")) - { - return new PostWaterlogger(this, phase); - } - - Iris.error("Failed to find post processor: " + processor); - fail(new RuntimeException("Failed to find post processor: " + processor)); - return null; - } - @Override public void updateHeight(int x, int z, int h) { diff --git a/src/main/java/com/volmit/iris/gen/TopographicTerrainProvider.java b/src/main/java/com/volmit/iris/gen/TopographicTerrainProvider.java index 13bdea16a..4337e4e23 100644 --- a/src/main/java/com/volmit/iris/gen/TopographicTerrainProvider.java +++ b/src/main/java/com/volmit/iris/gen/TopographicTerrainProvider.java @@ -286,6 +286,13 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider // Carve out biomes KList caveResults = glCave.genCaves(rx, rz, x, z, sliver); + KList caveResults1 = glCave.genCaves(rx, rz, x, z, null); + + if(caveResults.size() != caveResults1.size()) + { + Iris.warn("REAL: " + caveResults.size() + " Guess: " + caveResults1.size()); + } + IrisBiome caveBiome = glBiome.generateData(InferredType.CAVE, wx, wz, rx, rz, region); // Decorate Cave Biome Height Sections diff --git a/src/main/java/com/volmit/iris/gen/layer/GenLayerCave.java b/src/main/java/com/volmit/iris/gen/layer/GenLayerCave.java index b8df60210..7aa09f845 100644 --- a/src/main/java/com/volmit/iris/gen/layer/GenLayerCave.java +++ b/src/main/java/com/volmit/iris/gen/layer/GenLayerCave.java @@ -4,6 +4,7 @@ import org.bukkit.Material; import org.bukkit.block.data.BlockData; import com.volmit.iris.gen.DimensionalTerrainProvider; +import com.volmit.iris.gen.IrisTerrainProvider; import com.volmit.iris.gen.atomics.AtomicSliver; import com.volmit.iris.noise.FastNoise; import com.volmit.iris.noise.FastNoise.CellularDistanceFunction; @@ -57,7 +58,7 @@ public class GenLayerCave extends GenLayer { double scale = layer.getCaveZoom(); - int surface = data.getHighestBlock(); + int surface = (int) Math.round(((IrisTerrainProvider) iris).getTerrainHeight((int) wxx, (int) wzz)); double wx = wxx + layer.getHorizontalSlope().get(rng, wxx, wzz); double wz = wzz + layer.getHorizontalSlope().get(rng, -wzz, -wxx); double baseWidth = (14 * scale); diff --git a/src/main/java/com/volmit/iris/gen/post/Post.java b/src/main/java/com/volmit/iris/gen/post/Post.java deleted file mode 100644 index 55c23c9f2..000000000 --- a/src/main/java/com/volmit/iris/gen/post/Post.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.volmit.iris.gen.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(); -} diff --git a/src/main/java/com/volmit/iris/gen/post/PostFloatingNibDeleter.java b/src/main/java/com/volmit/iris/gen/post/PostFloatingNibDeleter.java deleted file mode 100644 index 816525316..000000000 --- a/src/main/java/com/volmit/iris/gen/post/PostFloatingNibDeleter.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.volmit.iris.gen.post; - -import org.bukkit.block.data.BlockData; -import org.bukkit.generator.ChunkGenerator.ChunkData; - -import com.volmit.iris.gen.PostBlockTerrainProvider; -import com.volmit.iris.util.B; -import com.volmit.iris.util.DontObfuscate; -import com.volmit.iris.util.IrisPostBlockFilter; - -@Post("floating-block-remover") -public class PostFloatingNibDeleter extends IrisPostBlockFilter -{ - private static final BlockData AIR = B.getBlockData("AIR"); - - @DontObfuscate - public PostFloatingNibDeleter(PostBlockTerrainProvider gen, int phase) - { - super(gen, phase); - } - - @DontObfuscate - public PostFloatingNibDeleter(PostBlockTerrainProvider gen) - { - this(gen, 0); - } - - @Override - public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) - { - int g = 0; - int h = highestTerrainBlock(x, z); - - if(h < 1) - { - return; - } - - 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; - g += hd < h - 1 ? 1 : 0; - - if(g == 4 && isAir(x, h - 1, z, currentPostX, currentPostZ, currentData)) - { - setPostBlock(x, h, z, AIR, currentPostX, currentPostZ, currentData); - - for(int i = h - 1; i > 0; i--) - { - if(!isAir(x, i, z, currentPostX, currentPostZ, currentData)) - { - updateHeight(x, z, i); - break; - } - } - } - } -} diff --git a/src/main/java/com/volmit/iris/gen/post/PostFoliageCleaner.java b/src/main/java/com/volmit/iris/gen/post/PostFoliageCleaner.java deleted file mode 100644 index 957c51004..000000000 --- a/src/main/java/com/volmit/iris/gen/post/PostFoliageCleaner.java +++ /dev/null @@ -1,45 +0,0 @@ -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.PostBlockTerrainProvider; -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(PostBlockTerrainProvider gen, int phase) - { - super(gen, phase); - } - - @DontObfuscate - public PostFoliageCleaner(PostBlockTerrainProvider 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); - } - } - } -} diff --git a/src/main/java/com/volmit/iris/gen/post/PostMasterPatcher.java b/src/main/java/com/volmit/iris/gen/post/PostMasterPatcher.java new file mode 100644 index 000000000..f4ebe9e12 --- /dev/null +++ b/src/main/java/com/volmit/iris/gen/post/PostMasterPatcher.java @@ -0,0 +1,407 @@ +package com.volmit.iris.gen.post; + +import org.bukkit.Material; +import org.bukkit.block.data.BlockData; +import org.bukkit.block.data.Waterlogged; +import org.bukkit.block.data.type.Slab; +import org.bukkit.block.data.type.Slab.Type; +import org.bukkit.generator.ChunkGenerator.ChunkData; + +import com.volmit.iris.gen.PostBlockTerrainProvider; +import com.volmit.iris.object.InferredType; +import com.volmit.iris.object.IrisBiome; +import com.volmit.iris.util.B; +import com.volmit.iris.util.CaveResult; +import com.volmit.iris.util.DontObfuscate; +import com.volmit.iris.util.IrisPostBlockFilter; +import com.volmit.iris.util.KList; +import com.volmit.iris.util.RNG; + +public class PostMasterPatcher extends IrisPostBlockFilter +{ + private static final BlockData WATER = B.getBlockData("WATER"); + private static final BlockData AIR = B.getBlockData("AIR"); + private RNG rng; + + @DontObfuscate + public PostMasterPatcher(PostBlockTerrainProvider gen, int phase) + { + super(gen, phase); + rng = gen.getMasterRandom().nextParallelRNG(1239456); + } + + @DontObfuscate + public PostMasterPatcher(PostBlockTerrainProvider gen) + { + this(gen, 0); + } + + @Override + public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData, KList q) + { + 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); + + // Floating Nibs + int g = 0; + + if(h < 1) + { + return; + } + + 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, currentPostX, currentPostZ, currentData)) + { + setPostBlock(x, h, z, AIR, currentPostX, currentPostZ, currentData); + + for(int i = h - 1; i > 0; i--) + { + if(!isAir(x, i, z, currentPostX, currentPostZ, currentData)) + { + updateHeight(x, z, i); + h = i; + break; + } + } + } + + // Nibs + g = 0; + 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 >= 3) + { + BlockData bc = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData); + BlockData b = getPostBlock(x, h + 1, z, currentPostX, currentPostZ, currentData); + Material m = bc.getMaterial(); + + if(m.isSolid()) + { + setPostBlock(x, h, z, b, currentPostX, currentPostZ, currentData); + updateHeight(x, z, h - 1); + h--; + } + } + + else + { + // Potholes + g = 0; + 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 >= 3) + { + BlockData ba = getPostBlock(x, ha, z, currentPostX, currentPostZ, currentData); + BlockData bb = getPostBlock(x, hb, z, currentPostX, currentPostZ, currentData); + BlockData bc = getPostBlock(x, hc, z, currentPostX, currentPostZ, currentData); + BlockData bd = getPostBlock(x, hd, z, currentPostX, currentPostZ, currentData); + g = 0; + g = B.isSolid(ba) ? g + 1 : g; + g = B.isSolid(bb) ? g + 1 : g; + g = B.isSolid(bc) ? g + 1 : g; + g = B.isSolid(bd) ? g + 1 : g; + + if(g >= 3) + { + setPostBlock(x, h + 1, z, getPostBlock(x, h, z, currentPostX, currentPostZ, currentData), currentPostX, currentPostZ, currentData); + updateHeight(x, z, h + 1); + h++; + } + } + } + + // Wall Patcher + IrisBiome biome = gen.sampleTrueBiome(x, z); + + if(gen.getDimension().isPostProcessingWalls()) + { + if(!biome.getWall().getPalette().isEmpty()) + { + if(ha < h - 2 || hb < h - 2 || hc < h - 2 || hd < h - 2) + { + boolean brokeGround = false; + int max = Math.abs(Math.max(h - ha, Math.max(h - hb, Math.max(h - hc, h - hd)))); + + for(int i = h; i > h - max; i--) + { + BlockData d = biome.getWall().get(rng, x + i, i + h, z + i); + + if(d != null) + { + if(isAirOrWater(x, i, z, currentPostX, currentPostZ, currentData)) + { + if(brokeGround) + { + break; + } + + continue; + } + + setPostBlock(x, i, z, d, currentPostX, currentPostZ, currentData); + brokeGround = true; + } + } + } + } + } + + // Slab + if(gen.getDimension().isPostProcessingSlabs()) + { + //@builder + if((ha == h + 1 && isSolidNonSlab(x + 1, ha, z, currentPostX, currentPostZ, currentData)) + || (hb == h + 1 && isSolidNonSlab(x, hb, z + 1, currentPostX, currentPostZ, currentData)) + || (hc == h + 1 && isSolidNonSlab(x - 1, hc, z, currentPostX, currentPostZ, currentData)) + || (hd == h + 1 && isSolidNonSlab(x, hd, z - 1, currentPostX, currentPostZ, currentData))) + //@done + { + BlockData d = biome.getSlab().get(rng, x, h, z); + + if(d != null) + { + boolean cancel = false; + + if(B.isAir(d)) + { + cancel = true; + } + + if(d.getMaterial().equals(Material.SNOW) && h + 1 <= gen.getFluidHeight()) + { + cancel = true; + } + + if(isSnowLayer(x, h, z, currentPostX, currentPostZ, currentData)) + { + cancel = true; + } + + if(!cancel && isAirOrWater(x, h + 1, z, currentPostX, currentPostZ, currentData)) + { + setPostBlock(x, h + 1, z, d, currentPostX, currentPostZ, currentData); + updateHeight(x, z, h + 1); + h++; + } + } + } + } + + // Waterlogging + BlockData b = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData); + + if(b instanceof Waterlogged) + { + Waterlogged ww = (Waterlogged) b; + boolean w = false; + if(isWaterOrWaterlogged(x, h + 1, z, currentPostX, currentPostZ, currentData)) + { + w = true; + } + + else if((isWaterOrWaterlogged(x + 1, h, z, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x - 1, h, z, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x, h, z + 1, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x, h, z - 1, currentPostX, currentPostZ, currentData))) + { + w = true; + } + + if(w != ww.isWaterlogged()) + { + ww.setWaterlogged(w); + setPostBlock(x, h, z, ww, currentPostX, currentPostZ, currentData); + } + } + + else if(b.getMaterial().equals(Material.AIR) && h <= gen.getFluidHeight()) + { + if((isWaterOrWaterlogged(x + 1, h, z, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x - 1, h, z, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x, h, z + 1, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x, h, z - 1, currentPostX, currentPostZ, currentData))) + { + setPostBlock(x, h, z, WATER, currentPostX, currentPostZ, currentData); + } + } + + // Foliage + 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); + } + } + + if(gen.getDimension().isPostProcessCaves()) + { + IrisBiome cave = gen.sampleTrueBiome(x, 1, z); + + if(cave.getInferredType().equals(InferredType.CAVE)) + { + for(CaveResult i : gen.getCaves(x, z)) + { + if(i.getCeiling() > 256 || i.getFloor() < 0) + { + continue; + } + + int f = i.getFloor(); + int fa = nearestCaveFloor(f, x + 1, z, currentPostX, currentPostZ, currentData); + int fb = nearestCaveFloor(f, x, z + 1, currentPostX, currentPostZ, currentData); + int fc = nearestCaveFloor(f, x - 1, z, currentPostX, currentPostZ, currentData); + int fd = nearestCaveFloor(f, x, z - 1, currentPostX, currentPostZ, currentData); + int c = i.getCeiling(); + int ca = nearestCaveCeiling(c, x + 1, z, currentPostX, currentPostZ, currentData); + int cb = nearestCaveCeiling(c, x, z + 1, currentPostX, currentPostZ, currentData); + int cc = nearestCaveCeiling(c, x - 1, z, currentPostX, currentPostZ, currentData); + int cd = nearestCaveCeiling(c, x, z - 1, currentPostX, currentPostZ, currentData); + + if(gen.getDimension().isPostProcessingSlabs()) + { + //@builder + if((fa == f + 1 && isSolidNonSlab(x + 1, fa, z, currentPostX, currentPostZ, currentData)) + || (fb == f + 1 && isSolidNonSlab(x, fb, z + 1, currentPostX, currentPostZ, currentData)) + || (fc == f + 1 && isSolidNonSlab(x - 1, fc, z, currentPostX, currentPostZ, currentData)) + || (fd == f + 1 && isSolidNonSlab(x, fd, z - 1, currentPostX, currentPostZ, currentData))) + //@done + { + BlockData d = cave.getSlab().get(rng, x, f, z); + + if(d != null) + { + boolean cancel = false; + + if(B.isAir(d)) + { + cancel = true; + } + + if(d.getMaterial().equals(Material.SNOW) && f + 1 <= gen.getFluidHeight()) + { + cancel = true; + } + + if(isSnowLayer(x, f, z, currentPostX, currentPostZ, currentData)) + { + cancel = true; + } + + if(!cancel && isAirOrWater(x, f + 1, z, currentPostX, currentPostZ, currentData)) + { + setPostBlock(x, f + 1, z, d, currentPostX, currentPostZ, currentData); + } + } + } + + //@builder + if((ca == c - 1 && isSolidNonSlab(x + 1, ca, z, currentPostX, currentPostZ, currentData)) + || (cb == c - 1 && isSolidNonSlab(x, cb, z + 1, currentPostX, currentPostZ, currentData)) + || (cc == c - 1 && isSolidNonSlab(x - 1, cc, z, currentPostX, currentPostZ, currentData)) + || (cd == c - 1 && isSolidNonSlab(x, cd, z - 1, currentPostX, currentPostZ, currentData))) + //@done + { + BlockData d = cave.getSlab().get(rng, x, c, z); + + if(d != null) + { + boolean cancel = false; + + if(B.isAir(d)) + { + cancel = true; + } + + if(!(d instanceof Slab)) + { + cancel = true; + } + + if(isSnowLayer(x, c, z, currentPostX, currentPostZ, currentData)) + { + cancel = true; + } + + if(!cancel && isAirOrWater(x, c, z, currentPostX, currentPostZ, currentData)) + { + Slab slab = (Slab) d.clone(); + slab.setType(Type.TOP); + setPostBlock(x, c, z, slab, currentPostX, currentPostZ, currentData); + } + } + } + } + } + } + } + } + + private int nearestCaveFloor(int floor, int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) + { + if(B.isAir(getPostBlock(x, floor, z, currentPostX, currentPostZ, currentData))) + { + if(B.isAir(getPostBlock(x, floor - 1, z, currentPostX, currentPostZ, currentData))) + { + return floor - 2; + } + + return floor - 1; + } + + else + { + if(!B.isAir(getPostBlock(x, floor + 1, z, currentPostX, currentPostZ, currentData))) + { + if(!B.isAir(getPostBlock(x, floor + 2, z, currentPostX, currentPostZ, currentData))) + { + return floor + 2; + } + + return floor + 1; + } + + return floor; + } + } + + private int nearestCaveCeiling(int ceiling, int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) + { + if(B.isAir(getPostBlock(x, ceiling, z, currentPostX, currentPostZ, currentData))) + { + if(B.isAir(getPostBlock(x, ceiling + 1, z, currentPostX, currentPostZ, currentData))) + { + return ceiling + 2; + } + + return ceiling + 1; + } + + else + { + if(!B.isAir(getPostBlock(x, ceiling - 1, z, currentPostX, currentPostZ, currentData))) + { + if(!B.isAir(getPostBlock(x, ceiling - 2, z, currentPostX, currentPostZ, currentData))) + { + return ceiling - 2; + } + + return ceiling - 1; + } + + return ceiling; + } + } +} diff --git a/src/main/java/com/volmit/iris/gen/post/PostNibSmoother.java b/src/main/java/com/volmit/iris/gen/post/PostNibSmoother.java deleted file mode 100644 index 6601419cf..000000000 --- a/src/main/java/com/volmit/iris/gen/post/PostNibSmoother.java +++ /dev/null @@ -1,53 +0,0 @@ -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.PostBlockTerrainProvider; -import com.volmit.iris.util.DontObfuscate; -import com.volmit.iris.util.IrisPostBlockFilter; - -@Post("nib-smoother") -public class PostNibSmoother extends IrisPostBlockFilter -{ - @DontObfuscate - public PostNibSmoother(PostBlockTerrainProvider gen, int phase) - { - super(gen, phase); - } - - @DontObfuscate - public PostNibSmoother(PostBlockTerrainProvider gen) - { - this(gen, 0); - } - - @Override - public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) - { - int g = 0; - 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; - g += hd == h - 1 ? 1 : 0; - - if(g >= 3) - { - BlockData bc = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData); - BlockData b = getPostBlock(x, h + 1, z, currentPostX, currentPostZ, currentData); - Material m = bc.getMaterial(); - - if(m.isSolid()) - { - setPostBlock(x, h, z, b, currentPostX, currentPostZ, currentData); - updateHeight(x, z, h - 1); - } - } - } -} diff --git a/src/main/java/com/volmit/iris/gen/post/PostPotholeFiller.java b/src/main/java/com/volmit/iris/gen/post/PostPotholeFiller.java deleted file mode 100644 index 7366b33d2..000000000 --- a/src/main/java/com/volmit/iris/gen/post/PostPotholeFiller.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.volmit.iris.gen.post; - -import org.bukkit.generator.ChunkGenerator.ChunkData; - -import com.volmit.iris.gen.PostBlockTerrainProvider; -import com.volmit.iris.util.DontObfuscate; -import com.volmit.iris.util.IrisPostBlockFilter; - -@Post("pothole-filler") -public class PostPotholeFiller extends IrisPostBlockFilter -{ - @DontObfuscate - public PostPotholeFiller(PostBlockTerrainProvider gen, int phase) - { - super(gen, phase); - } - - @DontObfuscate - public PostPotholeFiller(PostBlockTerrainProvider gen) - { - this(gen, 0); - } - - @Override - public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) - { - int g = 0; - 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; - g += hd == h + 1 ? 1 : 0; - - if(g >= 3) - { - setPostBlock(x, h + 1, z, getPostBlock(x, h, z, currentPostX, currentPostZ, currentData), currentPostX, currentPostZ, currentData); - updateHeight(x, z, h + 1); - } - } -} diff --git a/src/main/java/com/volmit/iris/gen/post/PostSlabber.java b/src/main/java/com/volmit/iris/gen/post/PostSlabber.java deleted file mode 100644 index 1eb4917d6..000000000 --- a/src/main/java/com/volmit/iris/gen/post/PostSlabber.java +++ /dev/null @@ -1,70 +0,0 @@ -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.PostBlockTerrainProvider; -import com.volmit.iris.util.DontObfuscate; -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; - - @DontObfuscate - public PostSlabber(PostBlockTerrainProvider gen, int phase) - { - super(gen, phase); - rng = gen.getMasterRandom().nextParallelRNG(166456); - } - - @DontObfuscate - public PostSlabber(PostBlockTerrainProvider gen) - { - this(gen, 0); - } - - @Override - public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) - { - 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))) - { - BlockData d = gen.sampleTrueBiome(x, z).getSlab().get(rng, x, h, z); - - if(d != null) - { - if(d.getMaterial().equals(AIR)) - { - return; - } - - if(d.getMaterial().equals(Material.SNOW) && h + 1 <= gen.getFluidHeight()) - { - return; - } - - if(isSnowLayer(x, h, z, currentPostX, currentPostZ, currentData)) - { - return; - } - - if(isAirOrWater(x, h + 1, z, currentPostX, currentPostZ, currentData)) - { - setPostBlock(x, h + 1, z, d, currentPostX, currentPostZ, currentData); - updateHeight(x, z, h + 1); - } - } - } - } -} diff --git a/src/main/java/com/volmit/iris/gen/post/PostWallPatcher.java b/src/main/java/com/volmit/iris/gen/post/PostWallPatcher.java deleted file mode 100644 index e2abadcc2..000000000 --- a/src/main/java/com/volmit/iris/gen/post/PostWallPatcher.java +++ /dev/null @@ -1,74 +0,0 @@ -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.PostBlockTerrainProvider; -import com.volmit.iris.object.IrisBiome; -import com.volmit.iris.util.DontObfuscate; -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; - - @DontObfuscate - public PostWallPatcher(PostBlockTerrainProvider gen, int phase) - { - super(gen, phase); - rng = gen.getMasterRandom().nextParallelRNG(1239456); - } - - @DontObfuscate - public PostWallPatcher(PostBlockTerrainProvider gen) - { - this(gen, 0); - } - - @Override - public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) - { - IrisBiome biome = gen.sampleTrueBiome(x, z); - int h, ha, hb, hc, hd; - - if(!biome.getWall().getPalette().isEmpty()) - { - 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) - { - boolean brokeGround = false; - int max = Math.abs(Math.max(h - ha, Math.max(h - hb, Math.max(h - hc, h - hd)))); - - for(int i = h; i > h - max; i--) - { - BlockData d = biome.getWall().get(rng, x + i, i + h, z + i); - - if(d != null) - { - if(isAirOrWater(x, i, z, currentPostX, currentPostZ, currentData)) - { - if(brokeGround) - { - return; - } - - continue; - } - - setPostBlock(x, i, z, d, currentPostX, currentPostZ, currentData); - brokeGround = true; - } - } - } - } - } -} diff --git a/src/main/java/com/volmit/iris/gen/post/PostWaterlogger.java b/src/main/java/com/volmit/iris/gen/post/PostWaterlogger.java deleted file mode 100644 index a48d9bd05..000000000 --- a/src/main/java/com/volmit/iris/gen/post/PostWaterlogger.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.volmit.iris.gen.post; - -import org.bukkit.Material; -import org.bukkit.block.data.BlockData; -import org.bukkit.block.data.Waterlogged; -import org.bukkit.generator.ChunkGenerator.ChunkData; - -import com.volmit.iris.gen.PostBlockTerrainProvider; -import com.volmit.iris.util.B; -import com.volmit.iris.util.DontObfuscate; -import com.volmit.iris.util.IrisPostBlockFilter; - -@Post("waterlogger") -public class PostWaterlogger extends IrisPostBlockFilter -{ - private static final BlockData WATER = B.getBlockData("WATER"); - - @DontObfuscate - public PostWaterlogger(PostBlockTerrainProvider gen, int phase) - { - super(gen, phase); - } - - @DontObfuscate - public PostWaterlogger(PostBlockTerrainProvider gen) - { - super(gen); - } - - @Override - public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) - { - int h = highestTerrainOrCarvingBlock(x, z); - BlockData b = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData); - - if(b instanceof Waterlogged) - { - Waterlogged ww = (Waterlogged) b; - boolean w = false; - if(isWaterOrWaterlogged(x, h + 1, z, currentPostX, currentPostZ, currentData)) - { - w = true; - } - - else if((isWaterOrWaterlogged(x + 1, h, z, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x - 1, h, z, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x, h, z + 1, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x, h, z - 1, currentPostX, currentPostZ, currentData))) - { - w = true; - } - - if(w != ww.isWaterlogged()) - { - ww.setWaterlogged(w); - setPostBlock(x, h, z, ww, currentPostX, currentPostZ, currentData); - } - } - - else if(b.getMaterial().equals(Material.AIR) && h <= gen.getFluidHeight()) - { - if((isWaterOrWaterlogged(x + 1, h, z, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x - 1, h, z, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x, h, z + 1, currentPostX, currentPostZ, currentData) || isWaterOrWaterlogged(x, h, z - 1, currentPostX, currentPostZ, currentData))) - { - setPostBlock(x, h, z, WATER, currentPostX, currentPostZ, currentData); - } - } - } -} diff --git a/src/main/java/com/volmit/iris/object/IrisDimension.java b/src/main/java/com/volmit/iris/object/IrisDimension.java index ca08be642..c0ed14a02 100644 --- a/src/main/java/com/volmit/iris/object/IrisDimension.java +++ b/src/main/java/com/volmit/iris/object/IrisDimension.java @@ -8,7 +8,6 @@ import org.bukkit.util.BlockVector; import com.volmit.iris.Iris; import com.volmit.iris.gen.ContextualTerrainProvider; import com.volmit.iris.gen.ParallelTerrainProvider; -import com.volmit.iris.gen.PostBlockTerrainProvider; import com.volmit.iris.gen.atomics.AtomicCache; import com.volmit.iris.noise.CNG; import com.volmit.iris.util.ArrayType; @@ -142,7 +141,7 @@ public class IrisDimension extends IrisRegistrant @DontObfuscate @Desc("Carve terrain or not") private boolean carving = true; - + @DontObfuscate @Desc("Generate vanilla caves") private boolean vanillaCaves = false; @@ -159,10 +158,17 @@ public class IrisDimension extends IrisRegistrant @Desc("Use post processing or not") private boolean postProcessing = true; - @ArrayType(min = 1, type = IrisPostProcessor.class) @DontObfuscate - @Desc("Post Processors") - private KList postProcessors = getDefaultPostProcessors(); + @Desc("Add slabs in post processing") + private boolean postProcessingSlabs = true; + + @DontObfuscate + @Desc("Add painted walls in post processing") + private boolean postProcessingWalls = true; + + @DontObfuscate + @Desc("Use post processing for caves or not") + private boolean postProcessCaves = true; @ArrayType(min = 1, type = IrisCompatabilityFilter.class) @DontObfuscate @@ -315,31 +321,6 @@ public class IrisDimension extends IrisRegistrant private transient AtomicCache cosr = new AtomicCache<>(); private transient AtomicCache rad = new AtomicCache<>(); - public KList getPostBlockProcessors(PostBlockTerrainProvider g) - { - return cacheFilters.aquire(() -> - { - KList cacheFilters = new KList<>(); - - for(IrisPostProcessor i : getPostProcessors()) - { - cacheFilters.add(g.createProcessor(i.getProcessor(), i.getPhase())); - } - - g.setMinPhase(0); - g.setMaxPhase(0); - - for(IrisPostBlockFilter i : cacheFilters) - { - g.setMinPhase(Math.min(g.getMinPhase(), i.getPhase())); - g.setMaxPhase(Math.max(g.getMaxPhase(), i.getPhase())); - } - - Iris.info("Post Processing: " + cacheFilters.size() + " filters. Phases: " + g.getMinPhase() + " - " + g.getMaxPhase()); - return cacheFilters; - }); - } - public static KList getDefaultCompatability() { KList filters = new KList<>(); @@ -490,17 +471,6 @@ public class IrisDimension extends IrisRegistrant }); } - private KList getDefaultPostProcessors() - { - KList p = new KList(); - - p.add(new IrisPostProcessor("wall-painter")); - p.add(new IrisPostProcessor("slabber")); - p.add(new IrisPostProcessor("waterlogger", 1)); - - return p; - } - public BlockData getRock(RNG rng, double x, double y, double z) { if(getRockData().isEmpty()) diff --git a/src/main/java/com/volmit/iris/object/IrisEntityInitialSpawn.java b/src/main/java/com/volmit/iris/object/IrisEntityInitialSpawn.java index 423a3c5e4..3c7187981 100644 --- a/src/main/java/com/volmit/iris/object/IrisEntityInitialSpawn.java +++ b/src/main/java/com/volmit/iris/object/IrisEntityInitialSpawn.java @@ -43,8 +43,7 @@ public class IrisEntityInitialSpawn private transient AtomicCache rng = new AtomicCache<>(); private transient AtomicCache ent = new AtomicCache<>(); - @SuppressWarnings("unused") - public boolean spawn(ParallaxTerrainProvider gen, Chunk c, RNG rng) + public void spawn(ParallaxTerrainProvider gen, Chunk c, RNG rng) { int spawns = rng.i(1, rarity) == 1 ? rng.i(minSpawns, maxSpawns) : 0; @@ -55,11 +54,9 @@ public class IrisEntityInitialSpawn int x = (c.getX() * 16) + rng.i(15); int z = (c.getZ() * 16) + rng.i(15); int h = gen.getCarvedHeight(x, z, false); - return spawn100(gen, new Location(c.getWorld(), x, h, z)) != null; + spawn100(gen, new Location(c.getWorld(), x, h, z)); } } - - return false; } public IrisEntity getRealEntity(ParallaxTerrainProvider g) diff --git a/src/main/java/com/volmit/iris/util/IrisPostBlockFilter.java b/src/main/java/com/volmit/iris/util/IrisPostBlockFilter.java index ba3db1647..9aa830cde 100644 --- a/src/main/java/com/volmit/iris/util/IrisPostBlockFilter.java +++ b/src/main/java/com/volmit/iris/util/IrisPostBlockFilter.java @@ -8,7 +8,6 @@ import org.bukkit.block.data.type.Slab; import org.bukkit.generator.ChunkGenerator.ChunkData; import com.volmit.iris.gen.PostBlockTerrainProvider; -import com.volmit.iris.gen.post.Post; import lombok.Data; @@ -17,16 +16,12 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess { public PostBlockTerrainProvider gen; private int phase; - private String key; - private KList queue = new KList<>(); @DontObfuscate public IrisPostBlockFilter(PostBlockTerrainProvider gen, int phase) { this.gen = gen; this.phase = phase; - queue = new KList<>(); - key = getClass().getDeclaredAnnotation(Post.class).value(); } @DontObfuscate @@ -35,7 +30,7 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess this(gen, 0); } - public abstract void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData); + public abstract void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData, KList q); @Override public BlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData) @@ -84,6 +79,12 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess return d.getMaterial().isSolid(); } + public boolean isSolidNonSlab(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData) + { + BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData); + return d.getMaterial().isSolid() && !(d instanceof Slab); + } + public boolean isAirOrWater(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData) { BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData); @@ -126,11 +127,6 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess return gen.caveFloors(x, z); } - public void queue(Runnable a) - { - queue.add(a); - } - @Override public void updateHeight(int x, int z, int h) {