mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-29 12:09:07 +00:00
Config options & fix cave slabs for 2x lines
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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<IrisPostBlockFilter> filters = getDimension().getPostBlockProcessors(this);
|
||||
|
||||
int rx, i, j;
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
|
||||
for(int h = getMinPhase(); h <= getMaxPhase(); h++)
|
||||
KList<Runnable> 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)
|
||||
{
|
||||
|
||||
@@ -286,6 +286,13 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
|
||||
// Carve out biomes
|
||||
KList<CaveResult> caveResults = glCave.genCaves(rx, rz, x, z, sliver);
|
||||
KList<CaveResult> 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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
407
src/main/java/com/volmit/iris/gen/post/PostMasterPatcher.java
Normal file
407
src/main/java/com/volmit/iris/gen/post/PostMasterPatcher.java
Normal file
@@ -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<Runnable> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user