Fix holes and crap

This commit is contained in:
Daniel Mills 2020-10-28 01:28:43 -04:00
parent 6a03b4b125
commit f1856afa77

View File

@ -1,6 +1,7 @@
package com.volmit.iris.gen.post; 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.Waterlogged; import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Slab; import org.bukkit.block.data.type.Slab;
import org.bukkit.block.data.type.Slab.Type; import org.bukkit.block.data.type.Slab.Type;
@ -18,8 +19,8 @@ import com.volmit.iris.util.RNG;
public class PostMasterPatcher extends IrisPostBlockFilter public class PostMasterPatcher extends IrisPostBlockFilter
{ {
private static final FastBlockData WATER = B.getBlockData("WATER"); private static final BlockData WATER = B.getBlockData("WATER");
private static final FastBlockData AIR = B.getBlockData("AIR"); private static final BlockData AIR = B.getBlockData("AIR");
private final RNG rng; private final RNG rng;
@DontObfuscate @DontObfuscate
@ -79,12 +80,14 @@ public class PostMasterPatcher 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 >= 3) if(g >= 4)
{ {
FastBlockData bc = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData); BlockData bc = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData);
FastBlockData b = getPostBlock(x, h + 1, z, currentPostX, currentPostZ, currentData); BlockData b = getPostBlock(x, h + 1, z, currentPostX, currentPostZ, currentData);
Material m = bc.getMaterial(); Material m = bc.getMaterial();
if((b.getMaterial().isOccluding() && b.getMaterial().isSolid()))
{
if(m.isSolid()) if(m.isSolid())
{ {
setPostBlock(x, h, z, b, currentPostX, currentPostZ, currentData); setPostBlock(x, h, z, b, currentPostX, currentPostZ, currentData);
@ -92,6 +95,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
h--; h--;
} }
} }
}
else else
{ {
@ -102,12 +106,12 @@ public class PostMasterPatcher 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 >= 3) if(g >= 4)
{ {
FastBlockData ba = getPostBlock(x, ha, z, currentPostX, currentPostZ, currentData); BlockData ba = getPostBlock(x, ha, z, currentPostX, currentPostZ, currentData);
FastBlockData bb = getPostBlock(x, hb, z, currentPostX, currentPostZ, currentData); BlockData bb = getPostBlock(x, hb, z, currentPostX, currentPostZ, currentData);
FastBlockData bc = getPostBlock(x, hc, z, currentPostX, currentPostZ, currentData); BlockData bc = getPostBlock(x, hc, z, currentPostX, currentPostZ, currentData);
FastBlockData bd = getPostBlock(x, hd, z, currentPostX, currentPostZ, currentData); BlockData bd = getPostBlock(x, hd, z, currentPostX, currentPostZ, currentData);
g = 0; g = 0;
g = B.isSolid(ba) ? g + 1 : g; g = B.isSolid(ba) ? g + 1 : g;
g = B.isSolid(bb) ? g + 1 : g; g = B.isSolid(bb) ? g + 1 : g;
@ -137,7 +141,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
for(int i = h; i > h - max; i--) for(int i = h; i > h - max; i--)
{ {
FastBlockData d = biome.getWall().get(rng, x + i, i + h, z + i, gen.getData()); BlockData d = biome.getWall().get(rng, x + i, i + h, z + i, gen.getData());
if(d != null) if(d != null)
{ {
@ -169,7 +173,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|| (hd == h + 1 && isSolidNonSlab(x, hd, z - 1, currentPostX, currentPostZ, currentData))) || (hd == h + 1 && isSolidNonSlab(x, hd, z - 1, currentPostX, currentPostZ, currentData)))
//@done //@done
{ {
FastBlockData d = biome.getSlab().get(rng, x, h, z, gen.getData()); BlockData d = biome.getSlab().get(rng, x, h, z, gen.getData());
if(d != null) if(d != null)
{ {
@ -201,11 +205,11 @@ public class PostMasterPatcher extends IrisPostBlockFilter
} }
// Waterlogging // Waterlogging
FastBlockData b = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData); BlockData b = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData);
if(b.getBlockData() instanceof Waterlogged) if(b instanceof Waterlogged)
{ {
Waterlogged ww = (Waterlogged) b.getBlockData(); Waterlogged ww = (Waterlogged) b;
boolean w = false; boolean w = false;
if(isWaterOrWaterlogged(x, h + 1, z, currentPostX, currentPostZ, currentData)) if(isWaterOrWaterlogged(x, h + 1, z, currentPostX, currentPostZ, currentData))
{ {
@ -276,9 +280,9 @@ public class PostMasterPatcher extends IrisPostBlockFilter
g += fc == f - 1 ? 1 : 0; g += fc == f - 1 ? 1 : 0;
g += fd == f - 1 ? 1 : 0; g += fd == f - 1 ? 1 : 0;
if(g >= 3) if(g >= 4)
{ {
FastBlockData bc = getPostBlock(x, f, z, currentPostX, currentPostZ, currentData); BlockData bc = getPostBlock(x, f, z, currentPostX, currentPostZ, currentData);
b = getPostBlock(x, f + 1, z, currentPostX, currentPostZ, currentData); b = getPostBlock(x, f + 1, z, currentPostX, currentPostZ, currentData);
Material m = bc.getMaterial(); Material m = bc.getMaterial();
@ -299,19 +303,19 @@ public class PostMasterPatcher extends IrisPostBlockFilter
g += fc == f + 1 ? 1 : 0; g += fc == f + 1 ? 1 : 0;
g += fd == f + 1 ? 1 : 0; g += fd == f + 1 ? 1 : 0;
if(g >= 3) if(g >= 4)
{ {
FastBlockData ba = getPostBlock(x, fa, z, currentPostX, currentPostZ, currentData); BlockData ba = getPostBlock(x, fa, z, currentPostX, currentPostZ, currentData);
FastBlockData bb = getPostBlock(x, fb, z, currentPostX, currentPostZ, currentData); BlockData bb = getPostBlock(x, fb, z, currentPostX, currentPostZ, currentData);
FastBlockData bc = getPostBlock(x, fc, z, currentPostX, currentPostZ, currentData); BlockData bc = getPostBlock(x, fc, z, currentPostX, currentPostZ, currentData);
FastBlockData bd = getPostBlock(x, fd, z, currentPostX, currentPostZ, currentData); BlockData bd = getPostBlock(x, fd, z, currentPostX, currentPostZ, currentData);
g = 0; g = 0;
g = B.isSolid(ba) ? g + 1 : g; g = B.isSolid(ba) ? g + 1 : g;
g = B.isSolid(bb) ? g + 1 : g; g = B.isSolid(bb) ? g + 1 : g;
g = B.isSolid(bc) ? g + 1 : g; g = B.isSolid(bc) ? g + 1 : g;
g = B.isSolid(bd) ? g + 1 : g; g = B.isSolid(bd) ? g + 1 : g;
if(g >= 3) if(g >= 4)
{ {
setPostBlock(x, f + 1, z, getPostBlock(x, f, z, currentPostX, currentPostZ, currentData), currentPostX, currentPostZ, currentData); setPostBlock(x, f + 1, z, getPostBlock(x, f, z, currentPostX, currentPostZ, currentData), currentPostX, currentPostZ, currentData);
updateHeight(x, z, f + 1); updateHeight(x, z, f + 1);
@ -329,7 +333,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|| (fd == f + 1 && isSolidNonSlab(x, fd, z - 1, currentPostX, currentPostZ, currentData))) || (fd == f + 1 && isSolidNonSlab(x, fd, z - 1, currentPostX, currentPostZ, currentData)))
//@done //@done
{ {
FastBlockData d = cave.getSlab().get(rng, x, f, z, gen.getData()); BlockData d = cave.getSlab().get(rng, x, f, z, gen.getData());
if(d != null) if(d != null)
{ {
@ -364,7 +368,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|| (cd == c - 1 && isSolidNonSlab(x, cd, z - 1, currentPostX, currentPostZ, currentData))) || (cd == c - 1 && isSolidNonSlab(x, cd, z - 1, currentPostX, currentPostZ, currentData)))
//@done //@done
{ {
FastBlockData d = cave.getSlab().get(rng, x, c, z, gen.getData()); BlockData d = cave.getSlab().get(rng, x, c, z, gen.getData());
if(d != null) if(d != null)
{ {
@ -375,7 +379,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
cancel = true; cancel = true;
} }
if(!(d.getBlockData() instanceof Slab)) if(!(d instanceof Slab))
{ {
cancel = true; cancel = true;
} }
@ -387,9 +391,9 @@ public class PostMasterPatcher extends IrisPostBlockFilter
if(!cancel && isAirOrWater(x, c, z, currentPostX, currentPostZ, currentData)) if(!cancel && isAirOrWater(x, c, z, currentPostX, currentPostZ, currentData))
{ {
Slab slab = (Slab) d.getBlockData().clone(); Slab slab = (Slab) d.clone();
slab.setType(Type.TOP); slab.setType(Type.TOP);
setPostBlock(x, c, z, d, currentPostX, currentPostZ, currentData); setPostBlock(x, c, z, slab, currentPostX, currentPostZ, currentData);
} }
} }
} }