Remove debug text

resolves #1606
This commit is contained in:
Aikar 2018-10-21 19:16:54 -04:00
parent 0db94d4fca
commit d066d8b926
2 changed files with 43 additions and 46 deletions

View File

@ -1,4 +1,4 @@
From c0a2b599b8b9c8180c56ca087281bb850ddd09db Mon Sep 17 00:00:00 2001
From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 21 Jul 2018 16:55:04 -0400
Subject: [PATCH] Async Chunk Loading and Generation
@ -43,7 +43,7 @@ reading or writing to the chunk will be safe, so plugins still
should not be touching chunks asynchronously!
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index b703e084..77d35ac9 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -385,4 +385,57 @@ public class PaperConfig {
@ -106,7 +106,7 @@ index b703e084..77d35ac9 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/util/PriorityQueuedExecutor.java b/src/main/java/com/destroystokyo/paper/util/PriorityQueuedExecutor.java
new file mode 100644
index 00000000..5c77b6e8
index 7ac07ac07ac0..7ac07ac07ac0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/PriorityQueuedExecutor.java
@@ -0,0 +1,281 @@
@ -392,7 +392,7 @@ index 00000000..5c77b6e8
+
+}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index edfcb107..cb998887 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -184,6 +184,7 @@ public class Chunk implements IChunkAccess {
@ -404,7 +404,7 @@ index edfcb107..cb998887 100644
Iterator iterator = protochunk.s().iterator();
diff --git a/src/main/java/net/minecraft/server/ChunkMap.java b/src/main/java/net/minecraft/server/ChunkMap.java
index 39ac032b..1662e4eb 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/ChunkMap.java
@@ -14,9 +14,17 @@ public class ChunkMap extends Long2ObjectOpenHashMap<Chunk> {
@ -510,7 +510,7 @@ index 39ac032b..1662e4eb 100644
public Chunk remove(Object object) {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 958a4084..a2e890de 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -35,12 +35,12 @@ public class ChunkProviderServer implements IChunkProvider {
@ -660,7 +660,7 @@ index 958a4084..a2e890de 100644
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index c233b7e9..edd07425 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -120,7 +120,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@ -687,7 +687,7 @@ index c233b7e9..edd07425 100644
completion = new Supplier<NBTTagCompound>() {
public NBTTagCompound get() {
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index bdfc7d81..a5c4564d 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -24,7 +24,17 @@ public class ChunkSection {
@ -709,7 +709,7 @@ index bdfc7d81..a5c4564d 100644
public IBlockData getType(int i, int j, int k) {
return this.blockIds.a(i, j, k);
diff --git a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
index 34019bd1..fc9091c8 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
+++ b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
@@ -20,13 +20,14 @@ public class ChunkTaskScheduler extends Scheduler<ChunkCoordIntPair, ChunkStatus
@ -780,7 +780,7 @@ index 34019bd1..fc9091c8 100644
protected ProtoChunk a(ChunkCoordIntPair chunkcoordintpair, ChunkStatus chunkstatus, Map<ChunkCoordIntPair, ProtoChunk> map) {
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
index 71a3636b..ff0fe254 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
@@ -3,7 +3,7 @@ package net.minecraft.server;
@ -865,7 +865,7 @@ index 71a3636b..ff0fe254 100644
// Paper start - Anti-Xray - Support default methods
diff --git a/src/main/java/net/minecraft/server/DefinedStructureManager.java b/src/main/java/net/minecraft/server/DefinedStructureManager.java
index 271dc41d..bd15534c 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/DefinedStructureManager.java
+++ b/src/main/java/net/minecraft/server/DefinedStructureManager.java
@@ -19,7 +19,7 @@ import org.apache.logging.log4j.Logger;
@ -878,7 +878,7 @@ index 271dc41d..bd15534c 100644
private final MinecraftServer d;
private final java.nio.file.Path e;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0237049a..cd601f29 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -209,7 +209,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -891,7 +891,7 @@ index 0237049a..cd601f29 100644
this.aJ = Sets.newHashSet();
this.aL = new double[] { 0.0D, 0.0D, 0.0D};
diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java
index 4698ee99..dfb45cc4 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/IChunkLoader.java
+++ b/src/main/java/net/minecraft/server/IChunkLoader.java
@@ -6,6 +6,8 @@ import javax.annotation.Nullable;
@ -904,7 +904,7 @@ index 4698ee99..dfb45cc4 100644
Chunk a(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException;
diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java
index 49fba097..9ad646f8 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/MathHelper.java
+++ b/src/main/java/net/minecraft/server/MathHelper.java
@@ -142,6 +142,7 @@ public class MathHelper {
@ -916,7 +916,7 @@ index 49fba097..9ad646f8 100644
fx = fx % 360.0F;
if (fx >= 180.0F) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 98d182fd..487d98eb 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -503,6 +503,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@ -1014,7 +1014,7 @@ index 98d182fd..487d98eb 100644
diff --git a/src/main/java/net/minecraft/server/PaperAsyncChunkProvider.java b/src/main/java/net/minecraft/server/PaperAsyncChunkProvider.java
new file mode 100644
index 00000000..5823917a
index 7ac07ac07ac0..7ac07ac07ac0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PaperAsyncChunkProvider.java
@@ -0,0 +1,593 @@
@ -1612,10 +1612,10 @@ index 00000000..5823917a
+
+}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 2c7c8adf..aabd107f 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -29,16 +29,62 @@ public class PlayerChunk {
@@ -29,16 +29,59 @@ public class PlayerChunk {
// You know the drill, https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse
// All may seem good at first, but there's deeper issues if you play for a bit
boolean chunkExists; // Paper
@ -1624,18 +1624,14 @@ index 2c7c8adf..aabd107f 100644
- public void run() {
- loadInProgress = false;
- PlayerChunk.this.chunk = PlayerChunk.this.playerChunkMap.getWorld().getChunkProviderServer().getChunkAt(location.x, location.z, true, true);
- markChunkUsed(); // Paper - delay chunk unloads
+ PaperAsyncChunkProvider.CancellableChunkRequest chunkRequest;
+ // Paper start
+ private java.util.function.Consumer<Chunk> chunkLoadedConsumer = chunk -> {
+ chunkRequest = null;
+ PlayerChunk pChunk = PlayerChunk.this;
+ if (chunk == null) {
+ new Throwable().printStackTrace();
}
+ pChunk.chunk = chunk;
+ markChunkUsed(); // Paper - delay chunk unloads
};
+ };
+ private boolean markedHigh = false;
+ void checkHighPriority(EntityPlayer player) {
+ if (done || markedHigh || chunk != null) {
@ -1659,8 +1655,9 @@ index 2c7c8adf..aabd107f 100644
+ if (chunkRequest == null) {
+ chunkRequest = this.playerChunkMap.getWorld().getChunkProviderServer().requestChunk(this.location.x, this.location.z, flag, markedHigh, chunkLoadedConsumer);
+ this.chunk = chunkRequest.getChunk(); // Paper)
+ markChunkUsed(); // Paper - delay chunk unloads
+ }
markChunkUsed(); // Paper - delay chunk unloads
}
- };
+ }
+ private double getDistance(EntityPlayer player, int inFront) {
+ final float yaw = MathHelper.normalizeYaw(player.yaw);
@ -1684,7 +1681,7 @@ index 2c7c8adf..aabd107f 100644
if (chunk == null) {
return;
}
@@ -58,8 +104,8 @@ public class PlayerChunk {
@@ -58,8 +101,8 @@ public class PlayerChunk {
ChunkProviderServer chunkproviderserver = playerchunkmap.getWorld().getChunkProviderServer();
chunkproviderserver.a(i, j);
@ -1695,7 +1692,7 @@ index 2c7c8adf..aabd107f 100644
markChunkUsed(); // Paper - delay chunk unloads
}
@@ -80,7 +126,7 @@ public class PlayerChunk {
@@ -80,7 +123,7 @@ public class PlayerChunk {
this.c.add(entityplayer);
if (this.done) {
this.sendChunk(entityplayer);
@ -1704,7 +1701,7 @@ index 2c7c8adf..aabd107f 100644
}
}
@@ -105,8 +151,9 @@ public class PlayerChunk {
@@ -105,8 +148,9 @@ public class PlayerChunk {
if (this.chunk != null) {
return true;
} else {
@ -1717,7 +1714,7 @@ index 2c7c8adf..aabd107f 100644
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index d1a443ca..1504bd11 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -27,10 +27,10 @@ public class PlayerChunkMap {
@ -1777,7 +1774,7 @@ index d1a443ca..1504bd11 100644
private void e() {
diff --git a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
index 3c35c0f4..187ca281 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
+++ b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
@@ -35,7 +35,7 @@ public class RegionLimitedWorldAccess implements GeneratorAccess {
@ -1790,7 +1787,7 @@ index 3c35c0f4..187ca281 100644
this.m = world.getChunkProvider().getChunkGenerator().getSettings();
this.i = world.getSeaLevel();
diff --git a/src/main/java/net/minecraft/server/SchedulerBatch.java b/src/main/java/net/minecraft/server/SchedulerBatch.java
index d868149d..0d45d933 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/SchedulerBatch.java
+++ b/src/main/java/net/minecraft/server/SchedulerBatch.java
@@ -9,6 +9,7 @@ public class SchedulerBatch<K, T extends SchedulerTask<K, T>, R> {
@ -1845,7 +1842,7 @@ index d868149d..0d45d933 100644
}
}
diff --git a/src/main/java/net/minecraft/server/StructurePiece.java b/src/main/java/net/minecraft/server/StructurePiece.java
index a5cf017d..def8730b 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/StructurePiece.java
+++ b/src/main/java/net/minecraft/server/StructurePiece.java
@@ -14,7 +14,7 @@ public abstract class StructurePiece {
@ -1872,7 +1869,7 @@ index a5cf017d..def8730b 100644
return null;
}
diff --git a/src/main/java/net/minecraft/server/StructureStart.java b/src/main/java/net/minecraft/server/StructureStart.java
index f87182b5..574930f5 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/StructureStart.java
+++ b/src/main/java/net/minecraft/server/StructureStart.java
@@ -6,7 +6,7 @@ import java.util.List;
@ -1921,7 +1918,7 @@ index f87182b5..574930f5 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a2559f0c..bbcedb8f 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -46,7 +46,7 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
@ -2018,7 +2015,7 @@ index a2559f0c..bbcedb8f 100644
if (entity == null) return false;
if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper
diff --git a/src/main/java/net/minecraft/server/WorldGenStronghold.java b/src/main/java/net/minecraft/server/WorldGenStronghold.java
index fa99fe01..4f49786a 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/WorldGenStronghold.java
+++ b/src/main/java/net/minecraft/server/WorldGenStronghold.java
@@ -9,24 +9,29 @@ import java.util.Random;
@ -2165,7 +2162,7 @@ index fa99fe01..4f49786a 100644
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ad3fea9c..0a764826 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -731,7 +731,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -2178,7 +2175,7 @@ index ad3fea9c..0a764826 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9c7b86a5..206cb30f 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1014,8 +1014,12 @@ public final class CraftServer implements Server {
@ -2206,7 +2203,7 @@ index 9c7b86a5..206cb30f 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index d0110070..02b6bf29 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -157,6 +157,16 @@ public class CraftWorld implements World {
@ -2244,7 +2241,7 @@ index d0110070..02b6bf29 100644
if (isChunkLoaded(chunkCoordX + x, chunkCoordZ + z)) {
unloadChunk(chunkCoordX + x, chunkCoordZ + z);
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 9e903159..4ead18b6 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -78,6 +78,7 @@ public class CraftEventFactory {
@ -2306,7 +2303,7 @@ index 9e903159..4ead18b6 100644
if (!event.isCancelled()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index 9c2adb23..62c197b8 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -21,6 +21,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
@ -2334,5 +2331,5 @@ index 9c2adb23..62c197b8 100644
this.random = new Random(seed);
this.chunkManager = world.worldProvider.getChunkGenerator().getWorldChunkManager();
--
2.19.1
2.18.0

View File

@ -1,4 +1,4 @@
From 7de7551aad86e8acb3ee4222357d0ccfd68a8ed3 Mon Sep 17 00:00:00 2001
From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 29 Sep 2018 01:18:16 -0400
Subject: [PATCH] Fix Sending Chunks to Client
@ -14,7 +14,7 @@ This fix always sends chunks to the client, and simply updates
the client anytime post processing is triggered with the new chunk data.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 2ecac57a..4258b120 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1205,7 +1205,7 @@ public class Chunk implements IChunkAccess {
@ -41,7 +41,7 @@ index 2ecac57a..4258b120 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index aabd107f..dd89f305 100644
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -23,7 +23,7 @@ public class PlayerChunk {
@ -53,7 +53,7 @@ index aabd107f..dd89f305 100644
// CraftBukkit start - add fields
// You know the drill, https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse
@@ -158,6 +158,7 @@ public class PlayerChunk {
@@ -155,6 +155,7 @@ public class PlayerChunk {
}
}
@ -62,5 +62,5 @@ index aabd107f..dd89f305 100644
if (this.done) {
return true;
--
2.19.1
2.18.0