9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

Update BukkitWorldManager.java

This commit is contained in:
XiaoMoMi
2025-12-08 04:30:29 +08:00
parent 6e8515c3a7
commit 0d42069a1a

View File

@@ -295,21 +295,23 @@ public class BukkitWorldManager implements WorldManager, Listener {
Object chunkSource = FastNMS.INSTANCE.method$ServerLevel$getChunkSource(worldServer); Object chunkSource = FastNMS.INSTANCE.method$ServerLevel$getChunkSource(worldServer);
Object levelChunk = FastNMS.INSTANCE.method$ServerChunkCache$getChunkAtIfLoadedMainThread(chunkSource, chunk.getX(), chunk.getZ()); Object levelChunk = FastNMS.INSTANCE.method$ServerChunkCache$getChunkAtIfLoadedMainThread(chunkSource, chunk.getX(), chunk.getZ());
Object[] sections = FastNMS.INSTANCE.method$ChunkAccess$getSections(levelChunk); Object[] sections = FastNMS.INSTANCE.method$ChunkAccess$getSections(levelChunk);
for (int i = 0; i < ceSections.length; i++) { synchronized (sections) {
CESection ceSection = ceSections[i]; for (int i = 0; i < ceSections.length; i++) {
Object section = sections[i]; CESection ceSection = ceSections[i];
WorldStorageInjector.uninjectLevelChunkSection(section); Object section = sections[i];
if (Config.restoreVanillaBlocks()) { WorldStorageInjector.uninjectLevelChunkSection(section);
if (!ceSection.statesContainer().isEmpty()) { if (Config.restoreVanillaBlocks()) {
for (int x = 0; x < 16; x++) { if (!ceSection.statesContainer().isEmpty()) {
for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) { for (int z = 0; z < 16; z++) {
ImmutableBlockState customState = ceSection.getBlockState(x, y, z); for (int y = 0; y < 16; y++) {
if (!customState.isEmpty()) { ImmutableBlockState customState = ceSection.getBlockState(x, y, z);
BlockStateWrapper wrapper = customState.restoreBlockState(); if (!customState.isEmpty()) {
if (wrapper != null) { BlockStateWrapper wrapper = customState.restoreBlockState();
FastNMS.INSTANCE.method$LevelChunkSection$setBlockState(section, x, y, z, wrapper.literalObject(), false); if (wrapper != null) {
unsaved = true; FastNMS.INSTANCE.method$LevelChunkSection$setBlockState(section, x, y, z, wrapper.literalObject(), false);
unsaved = true;
}
} }
} }
} }