9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-22 08:29:21 +00:00

重置后标记未保存

This commit is contained in:
XiaoMoMi
2025-04-29 17:48:51 +08:00
parent 646d7a9025
commit 26dfb82f80
2 changed files with 15 additions and 9 deletions

View File

@@ -273,6 +273,7 @@ public class BukkitWorldManager implements WorldManager, Listener {
} }
} }
if (Config.restoreVanillaBlocks()) { if (Config.restoreVanillaBlocks()) {
boolean unsaved = false;
CESection[] ceSections = ceChunk.sections(); CESection[] ceSections = ceChunk.sections();
Object worldServer = FastNMS.INSTANCE.field$CraftChunk$worldServer(chunk); Object worldServer = FastNMS.INSTANCE.field$CraftChunk$worldServer(chunk);
Object chunkSource = FastNMS.INSTANCE.method$ServerLevel$getChunkSource(worldServer); Object chunkSource = FastNMS.INSTANCE.method$ServerLevel$getChunkSource(worldServer);
@@ -282,19 +283,24 @@ public class BukkitWorldManager implements WorldManager, Listener {
CESection ceSection = ceSections[i]; CESection ceSection = ceSections[i];
Object section = sections[i]; Object section = sections[i];
BukkitInjector.uninjectLevelChunkSection(section); BukkitInjector.uninjectLevelChunkSection(section);
if (ceSection.statesContainer().isEmpty()) continue; if (!ceSection.statesContainer().isEmpty()) {
for (int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for (int y = 0; y < 16; y++) { for (int y = 0; y < 16; y++) {
ImmutableBlockState customState = ceSection.getBlockState(x, y, z); ImmutableBlockState customState = ceSection.getBlockState(x, y, z);
if (!customState.isEmpty() && customState.vanillaBlockState() != null) { if (!customState.isEmpty() && customState.vanillaBlockState() != null) {
FastNMS.INSTANCE.method$LevelChunkSection$setBlockState(section, x, y, z, customState.vanillaBlockState().handle(), false); FastNMS.INSTANCE.method$LevelChunkSection$setBlockState(section, x, y, z, customState.vanillaBlockState().handle(), false);
unsaved = true;
} }
} }
} }
} }
} }
} }
if (unsaved && !FastNMS.INSTANCE.method$LevelChunk$isUnsaved(levelChunk)) {
FastNMS.INSTANCE.method$LevelChunk$markUnsaved(levelChunk);
}
}
ceChunk.unload(); ceChunk.unload();
} }
} }

View File

@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G
# Project settings # Project settings
# Rule: [major update].[feature update].[bug fix] # Rule: [major update].[feature update].[bug fix]
project_version=0.0.52-beta.1 project_version=0.0.52
config_version=30 config_version=30
lang_version=8 lang_version=8
project_group=net.momirealms project_group=net.momirealms
@@ -50,7 +50,7 @@ byte_buddy_version=1.17.5
ahocorasick_version=0.6.3 ahocorasick_version=0.6.3
snake_yaml_version=2.4 snake_yaml_version=2.4
anti_grief_version=0.15 anti_grief_version=0.15
nms_helper_version=0.64 nms_helper_version=0.64.2
reactive_streams_version=1.0.4 reactive_streams_version=1.0.4
amazon_awssdk_version=2.31.23 amazon_awssdk_version=2.31.23
amazon_awssdk_eventstream_version=1.0.1 amazon_awssdk_eventstream_version=1.0.1