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

默认使用section修复潜在冲突

This commit is contained in:
XiaoMoMi
2025-07-21 04:54:45 +08:00
parent d18d4562d3
commit 8de1acc3ee
4 changed files with 7 additions and 9 deletions

View File

@@ -45,8 +45,6 @@ import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import static java.util.Objects.requireNonNull;
@@ -222,11 +220,12 @@ public class FastAsyncWorldEditDelegate extends AbstractDelegateExtent {
try {
CEChunk ceChunk = Optional.ofNullable(this.ceWorld.getChunkAtIfLoaded(chunkX, chunkZ))
.orElse(this.ceWorld.worldDataStorage().readChunkAt(this.ceWorld, new ChunkPos(chunkX, chunkZ)));
CESection ceSection = ceChunk.sectionById(SectionPos.blockToSectionCoord(blockY));
ImmutableBlockState immutableBlockState = BukkitBlockManager.instance().getImmutableBlockState(newStateId);
if (immutableBlockState == null) {
ceChunk.setBlockState(blockX, blockY, blockZ, EmptyBlock.STATE);
ceSection.setBlockState(blockX & 15, blockY & 15, blockZ & 15, EmptyBlock.STATE);
} else {
ceChunk.setBlockState(blockX, blockY, blockZ, immutableBlockState);
ceSection.setBlockState(blockX & 15, blockY & 15, blockZ & 15, immutableBlockState);
}
this.chunksToSave.add(ceChunk);
} catch (IOException e) {

View File

@@ -84,8 +84,6 @@ resource-pack:
ip: "localhost"
port: 8163
protocol: "http"
# The optional URL must be complete and include a trailing slash / at the end.
#url: "http://localhost:8163/"
deny-non-minecraft-request: true
one-time-token: true
rate-limit:
@@ -380,9 +378,9 @@ chunk-system:
# Settings for injection
injection:
# Requires a restart to apply
# SECTION: Inject the LevelChunkSection (Faster & Experimental) since 0.0.53
# SECTION: Inject the LevelChunkSection
# PALETTE: Inject the PalettedContainer
target: PALETTE
target: SECTION
# Enables faster injection method
# Note: May not work with certain server forks that alter chunk class structure (In most cases it won't conflict)
use-fast-method: false

View File

@@ -16,6 +16,7 @@ import net.momirealms.craftengine.core.pack.AbstractPackManager;
import net.momirealms.craftengine.core.pack.LoadingSequence;
import net.momirealms.craftengine.core.pack.Pack;
import net.momirealms.craftengine.core.pack.ResourceLocation;
import net.momirealms.craftengine.core.pack.host.ResourcePackHosts;
import net.momirealms.craftengine.core.pack.model.*;
import net.momirealms.craftengine.core.pack.model.generation.AbstractModelGenerator;
import net.momirealms.craftengine.core.pack.model.generation.ModelGeneration;

View File

@@ -113,7 +113,7 @@ public class CEChunk {
return this.sections[index];
}
@Nullable
@NotNull
public CESection sectionById(int sectionId) {
return this.sections[sectionIndex(sectionId)];
}