mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Reduce cave updates
This commit is contained in:
parent
c4fe14bd45
commit
88aad1e107
@ -67,6 +67,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
@ -271,10 +272,37 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
KMap<Long, Integer> updates = new KMap<>();
|
||||
RNG r = new RNG(Cache.key(c.getX(), c.getZ()));
|
||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterCavern.class, (x, y, z, v) -> {
|
||||
if (B.isAir(c.getBlock(x & 15, y, z & 15).getBlockData())) {
|
||||
if (!B.isFluid(c.getBlock(x & 15, y, z & 15).getBlockData())) {
|
||||
return;
|
||||
}
|
||||
boolean u = false;
|
||||
if(B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.DOWN).getBlockData()))
|
||||
{
|
||||
u = true;
|
||||
}
|
||||
|
||||
else if(B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.WEST).getBlockData()))
|
||||
{
|
||||
u = true;
|
||||
}
|
||||
|
||||
else if(B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.EAST).getBlockData()))
|
||||
{
|
||||
u = true;
|
||||
}
|
||||
|
||||
else if(B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.SOUTH).getBlockData()))
|
||||
{
|
||||
u = true;
|
||||
}
|
||||
|
||||
else if(B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.NORTH).getBlockData()))
|
||||
{
|
||||
u = true;
|
||||
}
|
||||
|
||||
if(u)
|
||||
{
|
||||
updates.compute(Cache.key(x & 15, z & 15), (k, vv) -> {
|
||||
if (vv != null) {
|
||||
return Math.max(vv, y);
|
||||
@ -282,6 +310,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
|
||||
return y;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
updates.forEach((k, v) -> update(Cache.keyX(k), v, Cache.keyZ(k), c, r));
|
||||
|
Loading…
x
Reference in New Issue
Block a user