mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
Remove Ceiling Gen & Post Block Sep
This commit is contained in:
parent
81f6ce26d4
commit
af22751210
@ -1,154 +0,0 @@
|
|||||||
package com.volmit.iris.gen;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
|
|
||||||
import com.volmit.iris.object.IrisDimension;
|
|
||||||
import com.volmit.iris.util.InvertedBiomeGrid;
|
|
||||||
import com.volmit.iris.util.RNG;
|
|
||||||
|
|
||||||
public abstract class CeilingChunkGenerator extends PostBlockChunkGenerator
|
|
||||||
{
|
|
||||||
protected boolean generatingCeiling = false;
|
|
||||||
protected boolean ceilingCached = false;
|
|
||||||
protected IrisDimension cacheCeiling = null;
|
|
||||||
protected IrisDimension cacheFloor = null;
|
|
||||||
|
|
||||||
public CeilingChunkGenerator(String dimensionName, int threads)
|
|
||||||
{
|
|
||||||
super(dimensionName, threads);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid)
|
|
||||||
{
|
|
||||||
targetFloor();
|
|
||||||
generate(random, x, z, data, grid);
|
|
||||||
|
|
||||||
if(getFloorDimension().isMirrorCeiling())
|
|
||||||
{
|
|
||||||
writeInverted(copy(data), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(getCeilingDimension() != null)
|
|
||||||
{
|
|
||||||
ChunkData ceiling = createChunkData(world);
|
|
||||||
InvertedBiomeGrid ceilingGrid = new InvertedBiomeGrid(grid);
|
|
||||||
targetCeiling();
|
|
||||||
generate(random, x, z, ceiling, ceilingGrid);
|
|
||||||
writeInverted(ceiling, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHotload()
|
|
||||||
{
|
|
||||||
super.onHotload();
|
|
||||||
ceilingCached = false;
|
|
||||||
cacheCeiling = null;
|
|
||||||
cacheFloor = null;
|
|
||||||
getCache().targetChunk(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void targetFloor()
|
|
||||||
{
|
|
||||||
generatingCeiling = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void targetCeiling()
|
|
||||||
{
|
|
||||||
generatingCeiling = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generate(RNG random, int x, int z, ChunkData ceiling, BiomeGrid grid)
|
|
||||||
{
|
|
||||||
super.onGenerate(random, x, z, ceiling, grid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IrisDimension getDimension()
|
|
||||||
{
|
|
||||||
return generatingCeiling ? getCeilingDimension() : getFloorDimension();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IrisDimension getFloorDimension()
|
|
||||||
{
|
|
||||||
if(cacheFloor != null)
|
|
||||||
{
|
|
||||||
return cacheFloor;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cacheFloor = super.getDimension();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IrisDimension getCeilingDimension()
|
|
||||||
{
|
|
||||||
if(ceilingCached)
|
|
||||||
{
|
|
||||||
return cacheCeiling;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(getFloorDimension().getCeiling().isEmpty())
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisDimension c = loadDimension(getFloorDimension().getCeiling());
|
|
||||||
|
|
||||||
if(c != null)
|
|
||||||
{
|
|
||||||
c.setInverted(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
ceilingCached = true;
|
|
||||||
cacheCeiling = c;
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeInverted(ChunkData data, ChunkData into)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
for(int j = 0; j < data.getMaxHeight(); j++)
|
|
||||||
{
|
|
||||||
for(int k = 0; k < 16; k++)
|
|
||||||
{
|
|
||||||
BlockData b = data.getBlockData(i, j, k);
|
|
||||||
|
|
||||||
if(b == null || b.getMaterial().equals(Material.AIR))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
into.setBlock(i, data.getMaxHeight() - j, k, b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChunkData copy(ChunkData d)
|
|
||||||
{
|
|
||||||
ChunkData copy = createChunkData(world);
|
|
||||||
|
|
||||||
for(int i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
for(int j = 0; j < d.getMaxHeight(); j++)
|
|
||||||
{
|
|
||||||
for(int k = 0; k < 16; k++)
|
|
||||||
{
|
|
||||||
BlockData b = d.getBlockData(i, j, k);
|
|
||||||
|
|
||||||
if(b == null || b.getMaterial().equals(Material.AIR))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
copy.setBlock(i, j, k, b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
}
|
|
@ -30,7 +30,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisContext
|
public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisContext
|
||||||
{
|
{
|
||||||
private Method initLighting;
|
private Method initLighting;
|
||||||
private IrisLock lock;
|
private IrisLock lock;
|
||||||
@ -139,11 +139,8 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
parallaxMap.saveAll();
|
parallaxMap.saveAll();
|
||||||
ceilingParallaxMap.saveAll();
|
|
||||||
parallaxMap.getLoadedChunks().clear();
|
parallaxMap.getLoadedChunks().clear();
|
||||||
parallaxMap.getLoadedRegions().clear();
|
parallaxMap.getLoadedRegions().clear();
|
||||||
ceilingParallaxMap.getLoadedChunks().clear();
|
|
||||||
ceilingParallaxMap.getLoadedRegions().clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(IOException e)
|
catch(IOException e)
|
||||||
@ -152,7 +149,6 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
setAvailableFilters(null);
|
setAvailableFilters(null);
|
||||||
setCeilingSliverCache(null);
|
|
||||||
setSliverCache(null);
|
setSliverCache(null);
|
||||||
Iris.info("Closing Iris Dimension " + getWorld().getName());
|
Iris.info("Closing Iris Dimension " + getWorld().getName());
|
||||||
}
|
}
|
||||||
@ -217,14 +213,8 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
|||||||
bytes += i.guessMemoryUsage();
|
bytes += i.guessMemoryUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(AtomicRegionData i : ceilingParallaxMap.getLoadedRegions().values())
|
|
||||||
{
|
|
||||||
bytes += i.guessMemoryUsage();
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes += getCache().getSize() * 65;
|
bytes += getCache().getSize() * 65;
|
||||||
bytes += parallaxMap.getLoadedChunks().size() * 256 * 4 * 460;
|
bytes += parallaxMap.getLoadedChunks().size() * 256 * 4 * 460;
|
||||||
bytes += ceilingParallaxMap.getLoadedChunks().size() * 256 * 4 * 460;
|
|
||||||
bytes += getSliverBuffer() * 220;
|
bytes += getSliverBuffer() * 220;
|
||||||
bytes += 823 * getData().getObjectLoader().getTotalStorage();
|
bytes += 823 * getData().getObjectLoader().getTotalStorage();
|
||||||
|
|
||||||
|
@ -37,8 +37,6 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
|||||||
{
|
{
|
||||||
protected KMap<ChunkPosition, AtomicSliver> sliverCache;
|
protected KMap<ChunkPosition, AtomicSliver> sliverCache;
|
||||||
protected AtomicWorldData parallaxMap;
|
protected AtomicWorldData parallaxMap;
|
||||||
protected KMap<ChunkPosition, AtomicSliver> ceilingSliverCache;
|
|
||||||
protected AtomicWorldData ceilingParallaxMap;
|
|
||||||
private MasterLock masterLock;
|
private MasterLock masterLock;
|
||||||
private IrisLock lock = new IrisLock("ParallaxLock");
|
private IrisLock lock = new IrisLock("ParallaxLock");
|
||||||
private IrisLock lockq = new IrisLock("ParallaxQueueLock");
|
private IrisLock lockq = new IrisLock("ParallaxQueueLock");
|
||||||
@ -48,7 +46,6 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
|||||||
{
|
{
|
||||||
super(dimensionName, threads);
|
super(dimensionName, threads);
|
||||||
sliverCache = new KMap<>();
|
sliverCache = new KMap<>();
|
||||||
ceilingSliverCache = new KMap<>();
|
|
||||||
sliverBuffer = 0;
|
sliverBuffer = 0;
|
||||||
masterLock = new MasterLock();
|
masterLock = new MasterLock();
|
||||||
}
|
}
|
||||||
@ -57,12 +54,11 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
|||||||
{
|
{
|
||||||
super.onInit(world, rng);
|
super.onInit(world, rng);
|
||||||
parallaxMap = new AtomicWorldData(world, "floor");
|
parallaxMap = new AtomicWorldData(world, "floor");
|
||||||
ceilingParallaxMap = new AtomicWorldData(world, "ceiling");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected KMap<ChunkPosition, AtomicSliver> getSliverCache()
|
protected KMap<ChunkPosition, AtomicSliver> getSliverCache()
|
||||||
{
|
{
|
||||||
return getDimension().isInverted() ? ceilingSliverCache : sliverCache;
|
return sliverCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onClose()
|
protected void onClose()
|
||||||
@ -72,7 +68,6 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
parallaxMap.unloadAll(true);
|
parallaxMap.unloadAll(true);
|
||||||
ceilingParallaxMap.unloadAll(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(IOException e)
|
catch(IOException e)
|
||||||
@ -150,7 +145,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
|||||||
|
|
||||||
public AtomicWorldData getParallaxMap()
|
public AtomicWorldData getParallaxMap()
|
||||||
{
|
{
|
||||||
return getDimension().isInverted() ? ceilingParallaxMap : parallaxMap;
|
return parallaxMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AtomicSliverMap getParallaxChunk(int x, int z)
|
public AtomicSliverMap getParallaxChunk(int x, int z)
|
||||||
|
@ -4,7 +4,6 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.object.IrisDimension;
|
|
||||||
import com.volmit.iris.util.CaveResult;
|
import com.volmit.iris.util.CaveResult;
|
||||||
import com.volmit.iris.util.IPostBlockAccess;
|
import com.volmit.iris.util.IPostBlockAccess;
|
||||||
import com.volmit.iris.util.IrisLock;
|
import com.volmit.iris.util.IrisLock;
|
||||||
@ -18,36 +17,35 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator implements IPostBlockAccess {
|
public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator implements IPostBlockAccess
|
||||||
protected boolean generatingCeiling = false;
|
{
|
||||||
protected boolean ceilingCached = false;
|
|
||||||
protected IrisDimension cacheCeiling = null;
|
|
||||||
protected IrisDimension cacheFloor = null;
|
|
||||||
private int currentPostX;
|
|
||||||
private int currentPostZ;
|
|
||||||
private ChunkData currentData;
|
|
||||||
private KList<IrisPostBlockFilter> availableFilters;
|
private KList<IrisPostBlockFilter> availableFilters;
|
||||||
private String postKey;
|
private String postKey;
|
||||||
private IrisLock lock;
|
private IrisLock lock;
|
||||||
private int minPhase;
|
private int minPhase;
|
||||||
private int maxPhase;
|
private int maxPhase;
|
||||||
|
|
||||||
public PostBlockChunkGenerator(String dimensionName, int threads) {
|
public PostBlockChunkGenerator(String dimensionName, int threads)
|
||||||
|
{
|
||||||
super(dimensionName, threads);
|
super(dimensionName, threads);
|
||||||
availableFilters = new KList<>();
|
availableFilters = new KList<>();
|
||||||
postKey = "post-" + dimensionName;
|
postKey = "post-" + dimensionName;
|
||||||
lock = new IrisLock("PostChunkGenerator");
|
lock = new IrisLock("PostChunkGenerator");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onInit(World world, RNG rng) {
|
public void onInit(World world, RNG rng)
|
||||||
|
{
|
||||||
super.onInit(world, rng);
|
super.onInit(world, rng);
|
||||||
|
|
||||||
for (Class<? extends IrisPostBlockFilter> i : Iris.postProcessors) {
|
for(Class<? extends IrisPostBlockFilter> i : Iris.postProcessors)
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
availableFilters.add(i.getConstructor(PostBlockChunkGenerator.class).newInstance(this));
|
availableFilters.add(i.getConstructor(PostBlockChunkGenerator.class).newInstance(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Throwable e) {
|
catch(Throwable e)
|
||||||
|
{
|
||||||
Iris.error("Failed to initialize post processor: " + i.getCanonicalName());
|
Iris.error("Failed to initialize post processor: " + i.getCanonicalName());
|
||||||
fail(e);
|
fail(e);
|
||||||
}
|
}
|
||||||
@ -55,33 +53,39 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid) {
|
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid)
|
||||||
|
{
|
||||||
super.onGenerate(random, x, z, data, grid);
|
super.onGenerate(random, x, z, data, grid);
|
||||||
|
|
||||||
if (!getDimension().isPostProcessing()) {
|
if(!getDimension().isPostProcessing())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KList<IrisPostBlockFilter> filters = getDimension().getPostBlockProcessors(this);
|
KList<IrisPostBlockFilter> filters = getDimension().getPostBlockProcessors(this);
|
||||||
currentData = data;
|
|
||||||
currentPostX = x;
|
|
||||||
currentPostZ = z;
|
|
||||||
int rx, i, j;
|
int rx, i, j;
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
|
|
||||||
for (int h = getMinPhase(); h <= getMaxPhase(); h++) {
|
for(int h = getMinPhase(); h <= getMaxPhase(); h++)
|
||||||
for (i = 0; i < 16; i++) {
|
{
|
||||||
|
for(i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
rx = (x << 4) + i;
|
rx = (x << 4) + i;
|
||||||
|
|
||||||
for (j = 0; j < 16; j++) {
|
for(j = 0; j < 16; j++)
|
||||||
|
{
|
||||||
int rxx = rx;
|
int rxx = rx;
|
||||||
int rzz = (z << 4) + j;
|
int rzz = (z << 4) + j;
|
||||||
int hh = h;
|
int hh = h;
|
||||||
|
|
||||||
getAccelerant().queue("post", () -> {
|
getAccelerant().queue("post", () ->
|
||||||
for (IrisPostBlockFilter f : filters) {
|
{
|
||||||
if (f.getPhase() == hh) {
|
for(IrisPostBlockFilter f : filters)
|
||||||
f.onPost(rxx, rzz);
|
{
|
||||||
|
if(f.getPhase() == hh)
|
||||||
|
{
|
||||||
|
f.onPost(rxx, rzz, x, z, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -90,14 +94,19 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
|
|||||||
|
|
||||||
getAccelerant().waitFor("post");
|
getAccelerant().waitFor("post");
|
||||||
|
|
||||||
for (IrisPostBlockFilter f : filters) {
|
for(IrisPostBlockFilter f : filters)
|
||||||
if (f.getPhase() == h) {
|
{
|
||||||
while (f.getQueue().size() > 0) {
|
if(f.getPhase() == h)
|
||||||
try {
|
{
|
||||||
|
while(f.getQueue().size() > 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
f.getQueue().pop().run();
|
f.getQueue().pop().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Throwable e) {
|
catch(Throwable e)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,15 +118,19 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
|
|||||||
getMetrics().getPost().put(p.getMilliseconds());
|
getMetrics().getPost().put(p.getMilliseconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisPostBlockFilter createProcessor(String processor, int phase) {
|
public IrisPostBlockFilter createProcessor(String processor, int phase)
|
||||||
for (IrisPostBlockFilter i : availableFilters) {
|
{
|
||||||
if (i.getKey().equals(processor)) {
|
for(IrisPostBlockFilter i : availableFilters)
|
||||||
try {
|
{
|
||||||
return i.getClass().getConstructor(PostBlockChunkGenerator.class, int.class).newInstance(this,
|
if(i.getKey().equals(processor))
|
||||||
phase);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return i.getClass().getConstructor(PostBlockChunkGenerator.class, int.class).newInstance(this, phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Throwable e) {
|
catch(Throwable e)
|
||||||
|
{
|
||||||
Iris.error("Failed initialize find post processor: " + processor);
|
Iris.error("Failed initialize find post processor: " + processor);
|
||||||
fail(e);
|
fail(e);
|
||||||
}
|
}
|
||||||
@ -130,13 +143,16 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateHeight(int x, int z, int h) {
|
public void updateHeight(int x, int z, int h)
|
||||||
|
{
|
||||||
getCache().updateHeight(x, z, h);
|
getCache().updateHeight(x, z, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockData getPostBlock(int x, int y, int z) {
|
public BlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
if (x >> 4 == currentPostX && z >> 4 == currentPostZ) {
|
{
|
||||||
|
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
|
||||||
|
{
|
||||||
lock.lock();
|
lock.lock();
|
||||||
BlockData d = currentData.getBlockData(x & 15, y, z & 15);
|
BlockData d = currentData.getBlockData(x & 15, y, z & 15);
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
@ -147,31 +163,36 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPostBlock(int x, int y, int z, BlockData d) {
|
public void setPostBlock(int x, int y, int z, BlockData d, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
if (x >> 4 == currentPostX && z >> 4 == currentPostZ) {
|
{
|
||||||
|
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
|
||||||
|
{
|
||||||
lock.lock();
|
lock.lock();
|
||||||
currentData.setBlock(x & 15, y, z & 15, d);
|
currentData.setBlock(x & 15, y, z & 15, d);
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else
|
||||||
Iris.warn("Post Block Overdraw: " + currentPostX + "," + currentPostZ + " into " + (x >> 4) + ", "
|
{
|
||||||
+ (z >> 4));
|
Iris.warn("Post Block Overdraw: " + currentPostX + "," + currentPostZ + " into " + (x >> 4) + ", " + (z >> 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int highestTerrainOrFluidBlock(int x, int z) {
|
public int highestTerrainOrFluidBlock(int x, int z)
|
||||||
|
{
|
||||||
return getHighest(x, z, false);
|
return getHighest(x, z, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int highestTerrainBlock(int x, int z) {
|
public int highestTerrainBlock(int x, int z)
|
||||||
|
{
|
||||||
return getHighest(x, z, true);
|
return getHighest(x, z, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KList<CaveResult> caveFloors(int x, int z) {
|
public KList<CaveResult> caveFloors(int x, int z)
|
||||||
|
{
|
||||||
return getCaves(x, z);
|
return getCaves(x, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,6 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
private RNG rockRandom;
|
private RNG rockRandom;
|
||||||
protected IrisLock regLock;
|
protected IrisLock regLock;
|
||||||
private KMap<String, IrisGenerator> generators;
|
private KMap<String, IrisGenerator> generators;
|
||||||
private KMap<String, IrisGenerator> ceilingGenerators;
|
|
||||||
protected GenLayerBiome glBiome;
|
protected GenLayerBiome glBiome;
|
||||||
protected CNG masterFracture;
|
protected CNG masterFracture;
|
||||||
protected ChronoLatch cwarn = new ChronoLatch(1000);
|
protected ChronoLatch cwarn = new ChronoLatch(1000);
|
||||||
@ -58,7 +57,6 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
{
|
{
|
||||||
super(dimensionName, threads);
|
super(dimensionName, threads);
|
||||||
generators = new KMap<>();
|
generators = new KMap<>();
|
||||||
ceilingGenerators = new KMap<>();
|
|
||||||
regLock = new IrisLock("BiomeChunkGenerator");
|
regLock = new IrisLock("BiomeChunkGenerator");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,7 +652,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
|
|
||||||
public void registerGenerator(IrisGenerator g, IrisDimension dim)
|
public void registerGenerator(IrisGenerator g, IrisDimension dim)
|
||||||
{
|
{
|
||||||
KMap<String, IrisGenerator> generators = dim.isInverted() ? ceilingGenerators : this.generators;
|
KMap<String, IrisGenerator> generators = this.generators;
|
||||||
|
|
||||||
regLock.lock();
|
regLock.lock();
|
||||||
if(g.getLoadKey() == null || generators.containsKey(g.getLoadKey()))
|
if(g.getLoadKey() == null || generators.containsKey(g.getLoadKey()))
|
||||||
@ -669,7 +667,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
|
|
||||||
protected KMap<String, IrisGenerator> getGenerators()
|
protected KMap<String, IrisGenerator> getGenerators()
|
||||||
{
|
{
|
||||||
return getDimension().isInverted() ? ceilingGenerators : generators;
|
return generators;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected double getBiomeHeight(double rx, double rz, int x, int z)
|
protected double getBiomeHeight(double rx, double rz, int x, int z)
|
||||||
@ -740,9 +738,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
protected void loadGenerators()
|
protected void loadGenerators()
|
||||||
{
|
{
|
||||||
generators.clear();
|
generators.clear();
|
||||||
ceilingGenerators.clear();
|
loadGenerators(getDimension());
|
||||||
loadGenerators(((CeilingChunkGenerator) this).getFloorDimension());
|
|
||||||
loadGenerators(((CeilingChunkGenerator) this).getCeilingDimension());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadGenerators(IrisDimension dim)
|
protected void loadGenerators(IrisDimension dim)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.volmit.iris.gen.post;
|
package com.volmit.iris.gen.post;
|
||||||
|
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
|
|
||||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||||
import com.volmit.iris.util.B;
|
import com.volmit.iris.util.B;
|
||||||
@ -22,7 +23,7 @@ public class PostFloatingNibDeleter extends IrisPostBlockFilter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPost(int x, int z)
|
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
int g = 0;
|
int g = 0;
|
||||||
int h = highestTerrainBlock(x, z);
|
int h = highestTerrainBlock(x, z);
|
||||||
@ -41,13 +42,13 @@ public class PostFloatingNibDeleter extends IrisPostBlockFilter
|
|||||||
g += hc < h - 1 ? 1 : 0;
|
g += hc < h - 1 ? 1 : 0;
|
||||||
g += hd < h - 1 ? 1 : 0;
|
g += hd < h - 1 ? 1 : 0;
|
||||||
|
|
||||||
if(g == 4 && isAir(x, h - 1, z))
|
if(g == 4 && isAir(x, h - 1, z, currentPostX, currentPostZ, currentData))
|
||||||
{
|
{
|
||||||
setPostBlock(x, h, z, AIR);
|
setPostBlock(x, h, z, AIR, currentPostX, currentPostZ, currentData);
|
||||||
|
|
||||||
for(int i = h - 1; i > 0; i--)
|
for(int i = h - 1; i > 0; i--)
|
||||||
{
|
{
|
||||||
if(!isAir(x, i, z))
|
if(!isAir(x, i, z, currentPostX, currentPostZ, currentData))
|
||||||
{
|
{
|
||||||
updateHeight(x, z, i);
|
updateHeight(x, z, i);
|
||||||
break;
|
break;
|
||||||
|
@ -2,6 +2,7 @@ package com.volmit.iris.gen.post;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
|
|
||||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||||
@ -20,7 +21,7 @@ public class PostNibSmoother extends IrisPostBlockFilter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPost(int x, int z)
|
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
int g = 0;
|
int g = 0;
|
||||||
int h = highestTerrainBlock(x, z);
|
int h = highestTerrainBlock(x, z);
|
||||||
@ -35,13 +36,13 @@ public class PostNibSmoother extends IrisPostBlockFilter
|
|||||||
|
|
||||||
if(g >= 3)
|
if(g >= 3)
|
||||||
{
|
{
|
||||||
BlockData bc = getPostBlock(x, h, z);
|
BlockData bc = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData);
|
||||||
BlockData b = getPostBlock(x, h + 1, z);
|
BlockData b = getPostBlock(x, h + 1, z, currentPostX, currentPostZ, currentData);
|
||||||
Material m = bc.getMaterial();
|
Material m = bc.getMaterial();
|
||||||
|
|
||||||
if(m.isSolid())
|
if(m.isSolid())
|
||||||
{
|
{
|
||||||
setPostBlock(x, h, z, b);
|
setPostBlock(x, h, z, b, currentPostX, currentPostZ, currentData);
|
||||||
updateHeight(x, z, h - 1);
|
updateHeight(x, z, h - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.volmit.iris.gen.post;
|
package com.volmit.iris.gen.post;
|
||||||
|
|
||||||
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
|
|
||||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||||
|
|
||||||
@ -17,7 +19,7 @@ public class PostPotholeFiller extends IrisPostBlockFilter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPost(int x, int z)
|
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
int g = 0;
|
int g = 0;
|
||||||
int h = highestTerrainBlock(x, z);
|
int h = highestTerrainBlock(x, z);
|
||||||
@ -32,7 +34,7 @@ public class PostPotholeFiller extends IrisPostBlockFilter
|
|||||||
|
|
||||||
if(g >= 3)
|
if(g >= 3)
|
||||||
{
|
{
|
||||||
setPostBlock(x, h + 1, z, getPostBlock(x, h, z));
|
setPostBlock(x, h + 1, z, getPostBlock(x, h, z, currentPostX, currentPostZ, currentData), currentPostX, currentPostZ, currentData);
|
||||||
updateHeight(x, z, h + 1);
|
updateHeight(x, z, h + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.volmit.iris.gen.post;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
|
|
||||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||||
@ -26,7 +27,7 @@ public class PostSlabber extends IrisPostBlockFilter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPost(int x, int z)
|
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
int h = highestTerrainBlock(x, z);
|
int h = highestTerrainBlock(x, z);
|
||||||
int ha = highestTerrainBlock(x + 1, z);
|
int ha = highestTerrainBlock(x + 1, z);
|
||||||
@ -34,7 +35,7 @@ public class PostSlabber extends IrisPostBlockFilter
|
|||||||
int hc = highestTerrainBlock(x - 1, z);
|
int hc = highestTerrainBlock(x - 1, z);
|
||||||
int hd = highestTerrainBlock(x, z - 1);
|
int hd = highestTerrainBlock(x, z - 1);
|
||||||
|
|
||||||
if((ha == h + 1 && isSolid(x + 1, ha, z)) || (hb == h + 1 && isSolid(x, hb, z + 1)) || (hc == h + 1 && isSolid(x - 1, hc, z)) || (hd == h + 1 && isSolid(x, hd, 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).getBiome().getSlab().get(rng, x, h, z);
|
BlockData d = gen.sampleTrueBiome(x, z).getBiome().getSlab().get(rng, x, h, z);
|
||||||
|
|
||||||
@ -50,16 +51,16 @@ public class PostSlabber extends IrisPostBlockFilter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isSnowLayer(x, h, z))
|
if(isSnowLayer(x, h, z, currentPostX, currentPostZ, currentData))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isAirOrWater(x, h + 2, z))
|
if(isAirOrWater(x, h + 2, z, currentPostX, currentPostZ, currentData))
|
||||||
{
|
{
|
||||||
queue(() ->
|
queue(() ->
|
||||||
{
|
{
|
||||||
setPostBlock(x, h + 1, z, d);
|
setPostBlock(x, h + 1, z, d, currentPostX, currentPostZ, currentData);
|
||||||
updateHeight(x, z, h + 1);
|
updateHeight(x, z, h + 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.volmit.iris.gen.post;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
|
|
||||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||||
import com.volmit.iris.object.IrisBiome;
|
import com.volmit.iris.object.IrisBiome;
|
||||||
@ -26,7 +27,7 @@ public class PostWallPatcher extends IrisPostBlockFilter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPost(int x, int z)
|
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
IrisBiome biome = gen.sampleTrueBiome(x, z).getBiome();
|
IrisBiome biome = gen.sampleTrueBiome(x, z).getBiome();
|
||||||
int h, ha, hb, hc, hd;
|
int h, ha, hb, hc, hd;
|
||||||
@ -48,7 +49,7 @@ public class PostWallPatcher extends IrisPostBlockFilter
|
|||||||
{
|
{
|
||||||
if(!s.getMaterial().equals(AIR))
|
if(!s.getMaterial().equals(AIR))
|
||||||
{
|
{
|
||||||
setPostBlock(x, h + 1, z, s);
|
setPostBlock(x, h + 1, z, s, currentPostX, currentPostZ, currentData);
|
||||||
updateHeight(x, z, h + 1);
|
updateHeight(x, z, h + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,12 +65,12 @@ public class PostWallPatcher extends IrisPostBlockFilter
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isAirOrWater(x, i, z))
|
if(isAirOrWater(x, i, z, currentPostX, currentPostZ, currentData))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
setPostBlock(x, i, z, d);
|
setPostBlock(x, i, z, d, currentPostX, currentPostZ, currentData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.volmit.iris.gen.post;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.Waterlogged;
|
import org.bukkit.block.data.Waterlogged;
|
||||||
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
|
|
||||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||||
import com.volmit.iris.util.B;
|
import com.volmit.iris.util.B;
|
||||||
@ -24,10 +25,10 @@ public class PostWaterlogger extends IrisPostBlockFilter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPost(int x, int z)
|
public void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
int h = highestTerrainBlock(x, z);
|
int h = highestTerrainBlock(x, z);
|
||||||
BlockData b = getPostBlock(x, h, z);
|
BlockData b = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData);
|
||||||
|
|
||||||
if(b instanceof Waterlogged)
|
if(b instanceof Waterlogged)
|
||||||
{
|
{
|
||||||
@ -38,24 +39,24 @@ public class PostWaterlogger extends IrisPostBlockFilter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isWaterOrWaterlogged(x, h + 1, z) && !ww.isWaterlogged())
|
if(isWaterOrWaterlogged(x, h + 1, z, currentPostX, currentPostZ, currentData) && !ww.isWaterlogged())
|
||||||
{
|
{
|
||||||
ww.setWaterlogged(true);
|
ww.setWaterlogged(true);
|
||||||
setPostBlock(x, h, z, ww);
|
setPostBlock(x, h, z, ww, currentPostX, currentPostZ, currentData);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(!ww.isWaterlogged() && (isWaterOrWaterlogged(x + 1, h, z) || isWaterOrWaterlogged(x - 1, h, z) || isWaterOrWaterlogged(x, h, z + 1) || isWaterOrWaterlogged(x, h, z - 1)))
|
else if(!ww.isWaterlogged() && (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)))
|
||||||
{
|
{
|
||||||
ww.setWaterlogged(true);
|
ww.setWaterlogged(true);
|
||||||
setPostBlock(x, h, z, ww);
|
setPostBlock(x, h, z, ww, currentPostX, currentPostZ, currentData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(b.getMaterial().equals(Material.AIR) && h <= gen.getFluidHeight())
|
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)))
|
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);
|
setPostBlock(x, h, z, WATER, currentPostX, currentPostZ, currentData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ import com.volmit.iris.util.MaxNumber;
|
|||||||
import com.volmit.iris.util.MinNumber;
|
import com.volmit.iris.util.MinNumber;
|
||||||
import com.volmit.iris.util.RNG;
|
import com.volmit.iris.util.RNG;
|
||||||
import com.volmit.iris.util.RegistryListBiome;
|
import com.volmit.iris.util.RegistryListBiome;
|
||||||
import com.volmit.iris.util.RegistryListDimension;
|
|
||||||
import com.volmit.iris.util.RegistryListRegion;
|
import com.volmit.iris.util.RegistryListRegion;
|
||||||
import com.volmit.iris.util.Required;
|
import com.volmit.iris.util.Required;
|
||||||
|
|
||||||
@ -145,15 +144,6 @@ public class IrisDimension extends IrisRegistrant
|
|||||||
@Desc("Compatability filters")
|
@Desc("Compatability filters")
|
||||||
private KList<IrisCompatabilityFilter> compatability = getDefaultCompatability();
|
private KList<IrisCompatabilityFilter> compatability = getDefaultCompatability();
|
||||||
|
|
||||||
@RegistryListDimension
|
|
||||||
@DontObfuscate
|
|
||||||
@Desc("The ceiling dimension. Leave blank for normal sky.")
|
|
||||||
private String ceiling = "";
|
|
||||||
|
|
||||||
@DontObfuscate
|
|
||||||
@Desc("Mirrors the generator floor into the ceiling. Think nether but worse...")
|
|
||||||
private boolean mirrorCeiling = false;
|
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("The world environment")
|
@Desc("The world environment")
|
||||||
@ -289,7 +279,6 @@ public class IrisDimension extends IrisRegistrant
|
|||||||
private transient AtomicCache<Double> sinr = new AtomicCache<>();
|
private transient AtomicCache<Double> sinr = new AtomicCache<>();
|
||||||
private transient AtomicCache<Double> cosr = new AtomicCache<>();
|
private transient AtomicCache<Double> cosr = new AtomicCache<>();
|
||||||
private transient AtomicCache<Double> rad = new AtomicCache<>();
|
private transient AtomicCache<Double> rad = new AtomicCache<>();
|
||||||
private transient boolean inverted = false;
|
|
||||||
|
|
||||||
public KList<IrisPostBlockFilter> getPostBlockProcessors(PostBlockChunkGenerator g)
|
public KList<IrisPostBlockFilter> getPostBlockProcessors(PostBlockChunkGenerator g)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package com.volmit.iris.util;
|
package com.volmit.iris.util;
|
||||||
|
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
|
|
||||||
public interface IPostBlockAccess
|
public interface IPostBlockAccess
|
||||||
{
|
{
|
||||||
public BlockData getPostBlock(int x, int y, int z);
|
public BlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData);
|
||||||
|
|
||||||
public void setPostBlock(int x, int y, int z, BlockData d);
|
public void setPostBlock(int x, int y, int z, BlockData d, int currentPostX, int currentPostZ, ChunkData currentData);
|
||||||
|
|
||||||
public int highestTerrainOrFluidBlock(int x, int z);
|
public int highestTerrainOrFluidBlock(int x, int z);
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.block.data.Levelled;
|
import org.bukkit.block.data.Levelled;
|
||||||
import org.bukkit.block.data.Waterlogged;
|
import org.bukkit.block.data.Waterlogged;
|
||||||
import org.bukkit.block.data.type.Slab;
|
import org.bukkit.block.data.type.Slab;
|
||||||
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
|
|
||||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||||
import com.volmit.iris.gen.post.Post;
|
import com.volmit.iris.gen.post.Post;
|
||||||
@ -32,18 +33,18 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess
|
|||||||
this(gen, 0);
|
this(gen, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void onPost(int x, int z);
|
public abstract void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockData getPostBlock(int x, int y, int z)
|
public BlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
return gen.getPostBlock(x, y, z);
|
return gen.getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPostBlock(int x, int y, int z, BlockData d)
|
public void setPostBlock(int x, int y, int z, BlockData d, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
gen.setPostBlock(x, y, z, d);
|
gen.setPostBlock(x, y, z, d, currentPostX, currentPostZ, currentData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -58,57 +59,57 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess
|
|||||||
return gen.highestTerrainBlock(x, z);
|
return gen.highestTerrainBlock(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAir(int x, int y, int z)
|
public boolean isAir(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
BlockData d = getPostBlock(x, y, z);
|
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
return d.getMaterial().equals(Material.AIR) || d.getMaterial().equals(Material.CAVE_AIR);
|
return d.getMaterial().equals(Material.AIR) || d.getMaterial().equals(Material.CAVE_AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasGravity(int x, int y, int z)
|
public boolean hasGravity(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
BlockData d = getPostBlock(x, y, z);
|
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
return d.getMaterial().equals(Material.SAND) || d.getMaterial().equals(Material.RED_SAND) || d.getMaterial().equals(Material.BLACK_CONCRETE_POWDER) || d.getMaterial().equals(Material.BLUE_CONCRETE_POWDER) || d.getMaterial().equals(Material.BROWN_CONCRETE_POWDER) || d.getMaterial().equals(Material.CYAN_CONCRETE_POWDER) || d.getMaterial().equals(Material.GRAY_CONCRETE_POWDER) || d.getMaterial().equals(Material.GREEN_CONCRETE_POWDER) || d.getMaterial().equals(Material.LIGHT_BLUE_CONCRETE_POWDER) || d.getMaterial().equals(Material.LIGHT_GRAY_CONCRETE_POWDER) || d.getMaterial().equals(Material.LIME_CONCRETE_POWDER) || d.getMaterial().equals(Material.MAGENTA_CONCRETE_POWDER) || d.getMaterial().equals(Material.ORANGE_CONCRETE_POWDER) || d.getMaterial().equals(Material.PINK_CONCRETE_POWDER) || d.getMaterial().equals(Material.PURPLE_CONCRETE_POWDER) || d.getMaterial().equals(Material.RED_CONCRETE_POWDER) || d.getMaterial().equals(Material.WHITE_CONCRETE_POWDER) || d.getMaterial().equals(Material.YELLOW_CONCRETE_POWDER);
|
return d.getMaterial().equals(Material.SAND) || d.getMaterial().equals(Material.RED_SAND) || d.getMaterial().equals(Material.BLACK_CONCRETE_POWDER) || d.getMaterial().equals(Material.BLUE_CONCRETE_POWDER) || d.getMaterial().equals(Material.BROWN_CONCRETE_POWDER) || d.getMaterial().equals(Material.CYAN_CONCRETE_POWDER) || d.getMaterial().equals(Material.GRAY_CONCRETE_POWDER) || d.getMaterial().equals(Material.GREEN_CONCRETE_POWDER) || d.getMaterial().equals(Material.LIGHT_BLUE_CONCRETE_POWDER) || d.getMaterial().equals(Material.LIGHT_GRAY_CONCRETE_POWDER) || d.getMaterial().equals(Material.LIME_CONCRETE_POWDER) || d.getMaterial().equals(Material.MAGENTA_CONCRETE_POWDER) || d.getMaterial().equals(Material.ORANGE_CONCRETE_POWDER) || d.getMaterial().equals(Material.PINK_CONCRETE_POWDER) || d.getMaterial().equals(Material.PURPLE_CONCRETE_POWDER) || d.getMaterial().equals(Material.RED_CONCRETE_POWDER) || d.getMaterial().equals(Material.WHITE_CONCRETE_POWDER) || d.getMaterial().equals(Material.YELLOW_CONCRETE_POWDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSolid(int x, int y, int z)
|
public boolean isSolid(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
BlockData d = getPostBlock(x, y, z);
|
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
return d.getMaterial().isSolid();
|
return d.getMaterial().isSolid();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAirOrWater(int x, int y, int z)
|
public boolean isAirOrWater(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
BlockData d = getPostBlock(x, y, z);
|
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
return d.getMaterial().equals(Material.WATER) || d.getMaterial().equals(Material.AIR) || d.getMaterial().equals(Material.CAVE_AIR);
|
return d.getMaterial().equals(Material.WATER) || d.getMaterial().equals(Material.AIR) || d.getMaterial().equals(Material.CAVE_AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSlab(int x, int y, int z)
|
public boolean isSlab(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
BlockData d = getPostBlock(x, y, z);
|
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
return d instanceof Slab;
|
return d instanceof Slab;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSnowLayer(int x, int y, int z)
|
public boolean isSnowLayer(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
BlockData d = getPostBlock(x, y, z);
|
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
return d.getMaterial().equals(Material.SNOW);
|
return d.getMaterial().equals(Material.SNOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWater(int x, int y, int z)
|
public boolean isWater(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
BlockData d = getPostBlock(x, y, z);
|
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
return d.getMaterial().equals(Material.WATER);
|
return d.getMaterial().equals(Material.WATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWaterOrWaterlogged(int x, int y, int z)
|
public boolean isWaterOrWaterlogged(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
BlockData d = getPostBlock(x, y, z);
|
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
return d.getMaterial().equals(Material.WATER) || (d instanceof Waterlogged && ((Waterlogged) d).isWaterlogged());
|
return d.getMaterial().equals(Material.WATER) || (d instanceof Waterlogged && ((Waterlogged) d).isWaterlogged());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLiquid(int x, int y, int z)
|
public boolean isLiquid(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||||
{
|
{
|
||||||
BlockData d = getPostBlock(x, y, z);
|
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||||
return d instanceof Levelled;
|
return d instanceof Levelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user