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-10-18 22:27:52 +08:00
parent 9872be0286
commit a81774b01e

View File

@@ -16,6 +16,7 @@ import net.momirealms.craftengine.core.world.SectionPos;
import net.momirealms.craftengine.core.world.WorldManager; import net.momirealms.craftengine.core.world.WorldManager;
import net.momirealms.craftengine.core.world.chunk.CEChunk; import net.momirealms.craftengine.core.world.chunk.CEChunk;
import net.momirealms.craftengine.core.world.chunk.CESection; import net.momirealms.craftengine.core.world.chunk.CESection;
import net.momirealms.craftengine.core.world.chunk.PalettedContainer;
import net.momirealms.craftengine.core.world.chunk.storage.DefaultStorageAdaptor; import net.momirealms.craftengine.core.world.chunk.storage.DefaultStorageAdaptor;
import net.momirealms.craftengine.core.world.chunk.storage.StorageAdaptor; import net.momirealms.craftengine.core.world.chunk.storage.StorageAdaptor;
import net.momirealms.craftengine.core.world.chunk.storage.WorldDataStorage; import net.momirealms.craftengine.core.world.chunk.storage.WorldDataStorage;
@@ -346,14 +347,15 @@ public class BukkitWorldManager implements WorldManager, Listener {
boolean isEmptyBefore = FastNMS.INSTANCE.method$LevelSection$hasOnlyAir(section); boolean isEmptyBefore = FastNMS.INSTANCE.method$LevelSection$hasOnlyAir(section);
int sectionY = ceSection.sectionY; int sectionY = ceSection.sectionY;
// 有自定义方块 // 有自定义方块
if (!ceSection.statesContainer().isEmpty()) { PalettedContainer<ImmutableBlockState> palettedContainer = ceSection.statesContainer();
if (!palettedContainer.isEmpty()) {
if (isEmptyBefore) { if (isEmptyBefore) {
FastNMS.INSTANCE.method$LightEventListener$updateSectionStatus(lightEngine, FastNMS.INSTANCE.method$SectionPos$of(chunkX, sectionY, chunkZ), false); FastNMS.INSTANCE.method$LightEventListener$updateSectionStatus(lightEngine, FastNMS.INSTANCE.method$SectionPos$of(chunkX, sectionY, chunkZ), false);
} }
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 = palettedContainer.get(x, y, z);
if (!customState.isEmpty() && customState.customBlockState() != null) { if (!customState.isEmpty() && customState.customBlockState() != null) {
Object newState = customState.customBlockState().literalObject(); Object newState = customState.customBlockState().literalObject();
Object previous = FastNMS.INSTANCE.method$LevelChunkSection$setBlockState(section, x, y, z, newState, false); Object previous = FastNMS.INSTANCE.method$LevelChunkSection$setBlockState(section, x, y, z, newState, false);