Fix chunkgenerate on Forge 1.21.6
This commit is contained in:
parent
4daa33f540
commit
798a22f99b
3 changed files with 41 additions and 48 deletions
|
|
@ -43,9 +43,10 @@ public class ChunkStatusHDShader implements HDShader {
|
||||||
new ChunkStatusMap("carvers", 0xFFEFD5);
|
new ChunkStatusMap("carvers", 0xFFEFD5);
|
||||||
new ChunkStatusMap("liquid_carvers", 0xF0E68C);
|
new ChunkStatusMap("liquid_carvers", 0xF0E68C);
|
||||||
new ChunkStatusMap("features", 0xBDB76B);
|
new ChunkStatusMap("features", 0xBDB76B);
|
||||||
|
new ChunkStatusMap("initialize_light", 0xAAA0AA);
|
||||||
new ChunkStatusMap("light", 0xDDA0DD);
|
new ChunkStatusMap("light", 0xDDA0DD);
|
||||||
new ChunkStatusMap("spawn", 0xFF00FF);
|
|
||||||
new ChunkStatusMap("heightmaps", 0x9370DB);
|
new ChunkStatusMap("heightmaps", 0x9370DB);
|
||||||
|
new ChunkStatusMap("spawn", 0xFF00FF);
|
||||||
new ChunkStatusMap("full", 0x32CD32);
|
new ChunkStatusMap("full", 0x32CD32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ arguments=
|
||||||
auto.sync=false
|
auto.sync=false
|
||||||
build.scans.enabled=false
|
build.scans.enabled=false
|
||||||
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
|
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
|
||||||
connection.project.dir=../forge-1.21.6
|
connection.project.dir=..
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
gradle.user.home=
|
gradle.user.home=
|
||||||
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
|
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,7 @@ import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.LeavesBlock;
|
|
||||||
import net.minecraft.world.level.block.LiquidBlock;
|
import net.minecraft.world.level.block.LiquidBlock;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
|
||||||
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.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
|
|
@ -125,7 +123,6 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||||
import net.minecraftforge.eventbus.api.EventPriority;
|
import net.minecraftforge.eventbus.api.EventPriority;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
import net.minecraft.world.level.EmptyBlockGetter;
|
import net.minecraft.world.level.EmptyBlockGetter;
|
||||||
|
|
||||||
public class DynmapPlugin
|
public class DynmapPlugin
|
||||||
|
|
@ -1730,7 +1727,35 @@ public class DynmapPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority=EventPriority.LOWEST)
|
private void touchChunk(ForgeWorld fw, ChunkAccess c, String cause) {
|
||||||
|
int ymax = Integer.MIN_VALUE;
|
||||||
|
int ymin = Integer.MAX_VALUE;
|
||||||
|
LevelChunkSection[] sections = c.getSections();
|
||||||
|
// If no sections, assume all
|
||||||
|
if (sections.length == 0) {
|
||||||
|
ymax = (c.getMaxSection()+1) << 4;
|
||||||
|
ymin = c.getMinSection() << 4;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for(int i = 0; i < sections.length; i++) {
|
||||||
|
if((sections[i] != null) && (sections[i].hasOnlyAir() == false)) {
|
||||||
|
int sy = c.getSectionYFromSectionIndex(i) << 4;
|
||||||
|
if (sy < ymin) ymin = sy;
|
||||||
|
if ((sy+16) > ymax) ymax = sy + 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChunkPos cp = c.getPos();
|
||||||
|
int x = cp.x << 4;
|
||||||
|
int z = cp.z << 4;
|
||||||
|
Log.info(String.format("ymin=%d, ymax=%d", ymin, ymax));
|
||||||
|
// 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent(priority=EventPriority.MONITOR)
|
||||||
public void handleChunkLoad(ChunkEvent.Load event) {
|
public void handleChunkLoad(ChunkEvent.Load event) {
|
||||||
if(!onchunkgenerate) return;
|
if(!onchunkgenerate) return;
|
||||||
|
|
||||||
|
|
@ -1744,7 +1769,7 @@ public class DynmapPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@SubscribeEvent(priority=EventPriority.LOWEST)
|
@SubscribeEvent(priority=EventPriority.MONITOR)
|
||||||
public void handleChunkUnload(ChunkEvent.Unload event) {
|
public void handleChunkUnload(ChunkEvent.Unload event) {
|
||||||
if(!onchunkgenerate) return;
|
if(!onchunkgenerate) return;
|
||||||
|
|
||||||
|
|
@ -1756,29 +1781,13 @@ public class DynmapPlugin
|
||||||
ChunkPos cp = c.getPos();
|
ChunkPos cp = c.getPos();
|
||||||
if (fw != null) {
|
if (fw != null) {
|
||||||
if (!checkIfKnownChunk(fw, cp)) {
|
if (!checkIfKnownChunk(fw, cp)) {
|
||||||
int ymax = Integer.MIN_VALUE;
|
touchChunk(fw, c, "unload");
|
||||||
int ymin = Integer.MAX_VALUE;
|
|
||||||
LevelChunkSection[] sections = c.getSections();
|
|
||||||
for(int i = 0; i < sections.length; i++) {
|
|
||||||
if((sections[i] != null) && (sections[i].hasOnlyAir() == false)) {
|
|
||||||
int sy = c.getSectionYFromSectionIndex(i);
|
|
||||||
if (sy < ymin) ymin = sy;
|
|
||||||
if ((sy+16) > ymax) ymax = sy + 16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int x = cp.x << 4;
|
|
||||||
int z = cp.z << 4;
|
|
||||||
// If not empty AND not initial scan
|
|
||||||
if (ymax != Integer.MIN_VALUE) {
|
|
||||||
//Log.info(String.format("chunkkeyerate(unload)(%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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
removeKnownChunk(fw, cp);
|
removeKnownChunk(fw, cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@SubscribeEvent(priority=EventPriority.LOWEST)
|
@SubscribeEvent(priority=EventPriority.MONITOR)
|
||||||
public void handleChunkDataSave(ChunkDataEvent.Save event) {
|
public void handleChunkDataSave(ChunkDataEvent.Save event) {
|
||||||
if(!onchunkgenerate) return;
|
if(!onchunkgenerate) return;
|
||||||
|
|
||||||
|
|
@ -1789,33 +1798,16 @@ public class DynmapPlugin
|
||||||
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) {
|
||||||
if (!checkIfKnownChunk(fw, cp)) {
|
touchChunk(fw, c, "datasave");
|
||||||
int ymax = Integer.MIN_VALUE;
|
// If cooked, add to known
|
||||||
int ymin = Integer.MAX_VALUE;
|
if (c.getStatus() == ChunkStatus.FULL) {
|
||||||
LevelChunkSection[] sections = c.getSections();
|
addKnownChunk(fw, cp);
|
||||||
for(int i = 0; i < sections.length; i++) {
|
|
||||||
if((sections[i] != null) && (sections[i].hasOnlyAir() == false)) {
|
|
||||||
int sy = c.getSectionYFromSectionIndex(i);
|
|
||||||
if (sy < ymin) ymin = sy;
|
|
||||||
if ((sy+16) > ymax) ymax = sy + 16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int x = cp.x << 4;
|
|
||||||
int z = cp.z << 4;
|
|
||||||
// If not empty AND not initial scan
|
|
||||||
if (ymax != Integer.MIN_VALUE) {
|
|
||||||
//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");
|
|
||||||
}
|
|
||||||
// If cooked, add to known
|
|
||||||
if ((c.getStatus() == ChunkStatus.FULL) && (c instanceof LevelChunk)) {
|
|
||||||
addKnownChunk(fw, cp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@SubscribeEvent(priority=EventPriority.LOWEST)
|
|
||||||
|
@SubscribeEvent(priority=EventPriority.MONITOR, receiveCanceled=false)
|
||||||
public void handleBlockEvent(BlockEvent event) {
|
public void handleBlockEvent(BlockEvent event) {
|
||||||
if(!core_enabled) return;
|
if(!core_enabled) return;
|
||||||
if(!onblockchange) return;
|
if(!onblockchange) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue