Improve forge chunk generate handling

This commit is contained in:
Mike Primm 2021-12-25 21:46:28 -06:00
parent 21e8663e0b
commit 450921569c
8 changed files with 14092 additions and 14073 deletions

View file

@ -59,6 +59,7 @@ import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.Vec3;
@ -1703,7 +1704,7 @@ public class DynmapPlugin
LevelAccessor w = event.getWorld();
if(!(w instanceof ServerLevel)) return;
ChunkAccess c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) {
if ((c != null) && (c.getStatus() == ChunkStatus.FULL) && (c instanceof LevelChunk)) {
ForgeWorld fw = getWorld((ServerLevel)w, false);
if (fw != null) {
addKnownChunk(fw, c.getPos());
@ -1717,7 +1718,7 @@ public class DynmapPlugin
LevelAccessor w = event.getWorld();
if(!(w instanceof ServerLevel)) return;
ChunkAccess c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) {
if (c != null) {
ForgeWorld fw = getWorld((ServerLevel)w, false);
ChunkPos cp = c.getPos();
if (fw != null) {
@ -1751,7 +1752,7 @@ public class DynmapPlugin
LevelAccessor w = event.getWorld();
if(!(w instanceof ServerLevel)) return;
ChunkAccess c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) {
if (c != null) {
ForgeWorld fw = getWorld((ServerLevel)w, false);
ChunkPos cp = c.getPos();
if (fw != null) {
@ -1771,8 +1772,11 @@ public class DynmapPlugin
// If not empty AND not initial scan
if (ymax != Integer.MIN_VALUE) {
mapManager.touchVolume(fw.getName(), x, ymin, z, x+15, ymax, z+15, "chunkgenerate");
}
addKnownChunk(fw, cp);
}
// If chunk is cooked, add it to known
if ((c.getStatus() == ChunkStatus.FULL) && (c instanceof LevelChunk)) {
addKnownChunk(fw, cp);
}
}
}
}