1
0
mirror of https://github.com/PaperMC/Paper.git synced 2025-03-22 03:29:16 +01:00

Make force actually force a load

While this posed no issues in testing, this is the only behavioral
difference which might explain some increased reports in missing
chunks on the client
This commit is contained in:
Shane Freeder 2019-01-21 20:48:27 +00:00
parent 01dfa094b0
commit 90d2863f63

View File

@ -107,7 +107,7 @@ index 0000000000..1ba8477bf9
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644 new file mode 100644
index 0000000000..904544b3c3 index 0000000000..e3da35b6ba
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
@ -267,12 +267,18 @@ index 0000000000..904544b3c3
+ @Override + @Override
+ public boolean onChunkPacketCreate(Chunk chunk, int chunkSectionSelector, boolean force) { + public boolean onChunkPacketCreate(Chunk chunk, int chunkSectionSelector, boolean force) {
+ //Load nearby chunks if necessary + //Load nearby chunks if necessary
+ if (chunkEdgeMode == ChunkEdgeMode.WAIT && !force) { + if (force) {
+ // if forced, load NOW;
+ chunk.world.getChunkAt(chunk.locX - 1, chunk.locZ);
+ chunk.world.getChunkAt(chunk.locX + 1, chunk.locZ);
+ chunk.world.getChunkAt(chunk.locX, chunk.locZ - 1);
+ chunk.world.getChunkAt(chunk.locX, chunk.locZ + 1);
+ } else if (chunkEdgeMode == ChunkEdgeMode.WAIT && !force) {
+ if (chunk.world.getChunkIfLoaded(chunk.locX - 1, chunk.locZ) == null || chunk.world.getChunkIfLoaded(chunk.locX + 1, chunk.locZ) == null || chunk.world.getChunkIfLoaded(chunk.locX, chunk.locZ - 1) == null || chunk.world.getChunkIfLoaded(chunk.locX, chunk.locZ + 1) == null) { + if (chunk.world.getChunkIfLoaded(chunk.locX - 1, chunk.locZ) == null || chunk.world.getChunkIfLoaded(chunk.locX + 1, chunk.locZ) == null || chunk.world.getChunkIfLoaded(chunk.locX, chunk.locZ - 1) == null || chunk.world.getChunkIfLoaded(chunk.locX, chunk.locZ + 1) == null) {
+ //Don't create the chunk packet now, wait until nearby chunks are loaded and create it later + //Don't create the chunk packet now, wait until nearby chunks are loaded and create it later
+ return false; + return false;
+ } + }
+ } else if (chunkEdgeMode == ChunkEdgeMode.LOAD || chunkEdgeMode == ChunkEdgeMode.WAIT) { + } else if (chunkEdgeMode == ChunkEdgeMode.LOAD) {
+ boolean missingChunk = false; + boolean missingChunk = false;
+ //noinspection ConstantConditions + //noinspection ConstantConditions
+ missingChunk |= ((WorldServer)chunk.world).getChunkProvider().getChunkAt(chunk.locX - 1, chunk.locZ, true, true, c -> {}) == null; + missingChunk |= ((WorldServer)chunk.world).getChunkProvider().getChunkAt(chunk.locX - 1, chunk.locZ, true, true, c -> {}) == null;