Improve forge chunk generate handling

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

View file

@ -17,7 +17,7 @@
<script type="text/javascript" src="js/jquery-3.5.1.js?_=${version}-${buildnumber}"></script> <script type="text/javascript" src="js/jquery-3.5.1.js?_=${version}-${buildnumber}"></script>
<link rel="stylesheet" type="text/css" href="css/leaflet.css?_=${version}-${buildnumber}" /> <link rel="stylesheet" type="text/css" href="css/leaflet.css?_=${version}-${buildnumber}" />
<script type="text/javascript" src="js/leaflet.js?_=${version}-${buildnumber}"></script> <script type="text/javascript" src="js/leaflet.js?_=${version}-${buildnumber}"></script>
<!-- FOr source debug on leaflet <script type="text/javascript" src="js/leaflet-src.js?_=${version}-${buildnumber}"></script> -->
<script type="text/javascript" src="js/custommarker.js?_=${version}-${buildnumber}"></script> <script type="text/javascript" src="js/custommarker.js?_=${version}-${buildnumber}"></script>
<script type="text/javascript" src="js/dynmaputils.js?_=${version}-${buildnumber}"></script> <script type="text/javascript" src="js/dynmaputils.js?_=${version}-${buildnumber}"></script>

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1732,7 +1732,7 @@ public class DynmapPlugin
IWorld w = event.getWorld(); IWorld w = event.getWorld();
if(!(w instanceof ServerWorld)) return; if(!(w instanceof ServerWorld)) return;
IChunk c = event.getChunk(); IChunk c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) { if ((c != null) && (c.getStatus() == ChunkStatus.FULL) && (c instanceof Chunk)) {
ForgeWorld fw = getWorld((IServerWorld)w, false); ForgeWorld fw = getWorld((IServerWorld)w, false);
if (fw != null) { if (fw != null) {
addKnownChunk(fw, c.getPos()); addKnownChunk(fw, c.getPos());
@ -1746,7 +1746,7 @@ public class DynmapPlugin
IWorld w = event.getWorld(); IWorld w = event.getWorld();
if(!(w instanceof ServerWorld)) return; if(!(w instanceof ServerWorld)) return;
IChunk c = event.getChunk(); IChunk c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) { if (c != null) {
ForgeWorld fw = getWorld((IServerWorld)w, false); ForgeWorld fw = getWorld((IServerWorld)w, false);
ChunkPos cp = c.getPos(); ChunkPos cp = c.getPos();
if (fw != null) { if (fw != null) {
@ -1780,7 +1780,7 @@ public class DynmapPlugin
IWorld w = event.getWorld(); IWorld w = event.getWorld();
if(!(w instanceof ServerWorld)) return; if(!(w instanceof ServerWorld)) return;
IChunk c = event.getChunk(); IChunk c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) { if (c != null) {
ForgeWorld fw = getWorld((IServerWorld)w, false); ForgeWorld fw = getWorld((IServerWorld)w, false);
ChunkPos cp = c.getPos(); ChunkPos cp = c.getPos();
if (fw != null) { if (fw != null) {
@ -1801,7 +1801,10 @@ public class DynmapPlugin
if (ymax != Integer.MIN_VALUE) { if (ymax != Integer.MIN_VALUE) {
mapManager.touchVolume(fw.getName(), x, ymin, z, x+15, ymax, z+15, "chunkgenerate"); mapManager.touchVolume(fw.getName(), x, ymin, z, x+15, ymax, z+15, "chunkgenerate");
} }
addKnownChunk(fw, cp); // If cooked, add it to known
if ((c.getStatus() == ChunkStatus.FULL) && (c instanceof Chunk)) {
addKnownChunk(fw, cp);
}
} }
} }
} }

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.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus; 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.chunk.LevelChunkSection;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@ -1703,7 +1704,7 @@ public class DynmapPlugin
LevelAccessor w = event.getWorld(); LevelAccessor w = event.getWorld();
if(!(w instanceof ServerLevel)) return; if(!(w instanceof ServerLevel)) return;
ChunkAccess c = event.getChunk(); 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); ForgeWorld fw = getWorld((ServerLevel)w, false);
if (fw != null) { if (fw != null) {
addKnownChunk(fw, c.getPos()); addKnownChunk(fw, c.getPos());
@ -1717,7 +1718,7 @@ public class DynmapPlugin
LevelAccessor w = event.getWorld(); LevelAccessor w = event.getWorld();
if(!(w instanceof ServerLevel)) return; if(!(w instanceof ServerLevel)) return;
ChunkAccess c = event.getChunk(); ChunkAccess c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) { if (c != null) {
ForgeWorld fw = getWorld((ServerLevel)w, false); ForgeWorld fw = getWorld((ServerLevel)w, false);
ChunkPos cp = c.getPos(); ChunkPos cp = c.getPos();
if (fw != null) { if (fw != null) {
@ -1751,7 +1752,7 @@ public class DynmapPlugin
LevelAccessor w = event.getWorld(); LevelAccessor w = event.getWorld();
if(!(w instanceof ServerLevel)) return; if(!(w instanceof ServerLevel)) return;
ChunkAccess c = event.getChunk(); ChunkAccess c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) { if (c != null) {
ForgeWorld fw = getWorld((ServerLevel)w, false); ForgeWorld fw = getWorld((ServerLevel)w, false);
ChunkPos cp = c.getPos(); ChunkPos cp = c.getPos();
if (fw != null) { if (fw != null) {
@ -1772,7 +1773,10 @@ public class DynmapPlugin
if (ymax != Integer.MIN_VALUE) { if (ymax != Integer.MIN_VALUE) {
mapManager.touchVolume(fw.getName(), x, ymin, z, x+15, ymax, z+15, "chunkgenerate"); 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);
}
} }
} }
} }

View file

@ -57,6 +57,7 @@ import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus; 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.chunk.LevelChunkSection;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@ -1704,7 +1705,7 @@ public class DynmapPlugin
LevelAccessor w = event.getWorld(); LevelAccessor w = event.getWorld();
if(!(w instanceof ServerLevel)) return; if(!(w instanceof ServerLevel)) return;
ChunkAccess c = event.getChunk(); 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); ForgeWorld fw = getWorld((ServerLevel)w, false);
if (fw != null) { if (fw != null) {
addKnownChunk(fw, c.getPos()); addKnownChunk(fw, c.getPos());
@ -1718,7 +1719,7 @@ public class DynmapPlugin
LevelAccessor w = event.getWorld(); LevelAccessor w = event.getWorld();
if(!(w instanceof ServerLevel)) return; if(!(w instanceof ServerLevel)) return;
ChunkAccess c = event.getChunk(); ChunkAccess c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) { if (c != null) {
ForgeWorld fw = getWorld((ServerLevel)w, false); ForgeWorld fw = getWorld((ServerLevel)w, false);
ChunkPos cp = c.getPos(); ChunkPos cp = c.getPos();
if (fw != null) { if (fw != null) {
@ -1752,7 +1753,7 @@ public class DynmapPlugin
LevelAccessor w = event.getWorld(); LevelAccessor w = event.getWorld();
if(!(w instanceof ServerLevel)) return; if(!(w instanceof ServerLevel)) return;
ChunkAccess c = event.getChunk(); ChunkAccess c = event.getChunk();
if ((c != null) && (c.getStatus() == ChunkStatus.FULL)) { if (c != null) {
ForgeWorld fw = getWorld((ServerLevel)w, false); ForgeWorld fw = getWorld((ServerLevel)w, false);
ChunkPos cp = c.getPos(); ChunkPos cp = c.getPos();
if (fw != null) { if (fw != null) {
@ -1774,7 +1775,10 @@ public class DynmapPlugin
//Log.info(String.format("chunkkeyerate(save)(%s,%d,%d,%d,%d,%d,%s)", fw.getName(), x, ymin, z, x+15, ymax, z+15)); //Log.info(String.format("chunkkeyerate(save)(%s,%d,%d,%d,%d,%d,%s)", fw.getName(), x, ymin, z, x+15, ymax, z+15));
mapManager.touchVolume(fw.getName(), x, ymin, z, x+15, ymax, z+15, "chunkgenerate"); mapManager.touchVolume(fw.getName(), x, ymin, z, x+15, ymax, z+15, "chunkgenerate");
} }
addKnownChunk(fw, cp); // If cooked, add to known
if ((c.getStatus() == ChunkStatus.FULL) && (c instanceof LevelChunk)) {
addKnownChunk(fw, cp);
}
} }
} }
} }