Improve async login (#3189)

Add helper functions to ChunkProviderServer to make this easier
for other uses

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
Spottedleaf 2020-04-19 10:58:02 -07:00 committed by GitHub
parent 9fd36824fc
commit f29c7ebd84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 333 additions and 224 deletions

View File

@ -1,4 +1,4 @@
From 45099c6fd2dc334423c131ab476bd8fca2526ab6 Mon Sep 17 00:00:00 2001
From 14de9d711e280f43a4c18b4f295eef6407d99f80 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:55:47 -0400
Subject: [PATCH] MC Utils
@ -6,7 +6,7 @@ Subject: [PATCH] MC Utils
diff --git a/src/main/java/com/destroystokyo/paper/util/concurrent/WeakSeqLock.java b/src/main/java/com/destroystokyo/paper/util/concurrent/WeakSeqLock.java
new file mode 100644
index 0000000000..4029dc68cf
index 000000000..4029dc68c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/concurrent/WeakSeqLock.java
@@ -0,0 +1,68 @@
@ -80,7 +80,7 @@ index 0000000000..4029dc68cf
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Int.java b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Int.java
new file mode 100644
index 0000000000..59868f37d1
index 000000000..59868f37d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Int.java
@@ -0,0 +1,162 @@
@ -248,7 +248,7 @@ index 0000000000..59868f37d1
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Object.java b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Object.java
new file mode 100644
index 0000000000..07685b6bd5
index 000000000..07685b6bd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Object.java
@@ -0,0 +1,172 @@
@ -426,7 +426,7 @@ index 0000000000..07685b6bd5
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java
new file mode 100644
index 0000000000..4eac057786
index 000000000..4eac05778
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java
@@ -0,0 +1,129 @@
@ -561,7 +561,7 @@ index 0000000000..4eac057786
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
new file mode 100644
index 0000000000..cdda74564c
index 000000000..cdda74564
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
@@ -0,0 +1,128 @@
@ -695,7 +695,7 @@ index 0000000000..cdda74564c
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
new file mode 100644
index 0000000000..84ef8d9eca
index 000000000..84ef8d9ec
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
@@ -0,0 +1,128 @@
@ -829,7 +829,7 @@ index 0000000000..84ef8d9eca
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/math/IntegerUtil.java b/src/main/java/com/destroystokyo/paper/util/math/IntegerUtil.java
new file mode 100644
index 0000000000..c3b936f54b
index 000000000..c3b936f54
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/math/IntegerUtil.java
@@ -0,0 +1,230 @@
@ -1065,7 +1065,7 @@ index 0000000000..c3b936f54b
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
new file mode 100644
index 0000000000..f625da9f09
index 000000000..f625da9f0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
@@ -0,0 +1,409 @@
@ -1480,7 +1480,7 @@ index 0000000000..f625da9f09
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java
new file mode 100644
index 0000000000..3f86c1ad43
index 000000000..3f86c1ad4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java
@@ -0,0 +1,175 @@
@ -1661,7 +1661,7 @@ index 0000000000..3f86c1ad43
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java
new file mode 100644
index 0000000000..8a552a87ab
index 000000000..8a552a87a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java
@@ -0,0 +1,27 @@
@ -1694,7 +1694,7 @@ index 0000000000..8a552a87ab
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java
new file mode 100644
index 0000000000..0292afc522
index 000000000..0292afc52
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java
@@ -0,0 +1,24 @@
@ -1724,7 +1724,7 @@ index 0000000000..0292afc522
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PooledLinkedHashSets.java b/src/main/java/com/destroystokyo/paper/util/misc/PooledLinkedHashSets.java
new file mode 100644
index 0000000000..e51104e65a
index 000000000..e51104e65
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/misc/PooledLinkedHashSets.java
@@ -0,0 +1,287 @@
@ -2017,7 +2017,7 @@ index 0000000000..e51104e65a
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java
new file mode 100644
index 0000000000..9df0006c1a
index 000000000..9df0006c1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java
@@ -0,0 +1,67 @@
@ -2089,7 +2089,7 @@ index 0000000000..9df0006c1a
+ }
+}
diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java
index 4f60b931a1..f427953a83 100644
index 4f60b931a..f427953a8 100644
--- a/src/main/java/net/minecraft/server/AxisAlignedBB.java
+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java
@@ -186,6 +186,7 @@ public class AxisAlignedBB {
@ -2101,7 +2101,7 @@ index 4f60b931a1..f427953a83 100644
return this.a(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
}
diff --git a/src/main/java/net/minecraft/server/BlockAccessAir.java b/src/main/java/net/minecraft/server/BlockAccessAir.java
index eff6ebcd30..30cbfc8eac 100644
index eff6ebcd3..30cbfc8ea 100644
--- a/src/main/java/net/minecraft/server/BlockAccessAir.java
+++ b/src/main/java/net/minecraft/server/BlockAccessAir.java
@@ -14,6 +14,18 @@ public enum BlockAccessAir implements IBlockAccess {
@ -2124,7 +2124,7 @@ index eff6ebcd30..30cbfc8eac 100644
public IBlockData getType(BlockPosition blockposition) {
return Blocks.AIR.getBlockData();
diff --git a/src/main/java/net/minecraft/server/BlockDataAbstract.java b/src/main/java/net/minecraft/server/BlockDataAbstract.java
index 1cf97cefc9..2040f18349 100644
index 1cf97cefc..2040f1834 100644
--- a/src/main/java/net/minecraft/server/BlockDataAbstract.java
+++ b/src/main/java/net/minecraft/server/BlockDataAbstract.java
@@ -78,6 +78,7 @@ public abstract class BlockDataAbstract<O, S> implements IBlockDataHolder<S> {
@ -2136,7 +2136,7 @@ index 1cf97cefc9..2040f18349 100644
return this.d.containsKey(iblockstate);
}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index c88a62f6b7..5dbd3e60fe 100644
index c88a62f6b..5dbd3e60f 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -120,6 +120,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
@ -2191,7 +2191,7 @@ index c88a62f6b7..5dbd3e60fe 100644
this.d = i;
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 55373cae07..c50fe1c245 100644
index 55373cae0..c50fe1c24 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -25,7 +25,7 @@ import org.apache.logging.log4j.Logger;
@ -2408,7 +2408,7 @@ index 55373cae07..c50fe1c245 100644
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java
index 11c4d23ba9..53c15c1c0b 100644
index 11c4d23ba..53c15c1c0 100644
--- a/src/main/java/net/minecraft/server/ChunkCache.java
+++ b/src/main/java/net/minecraft/server/ChunkCache.java
@@ -8,7 +8,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess {
@ -2442,7 +2442,7 @@ index 11c4d23ba9..53c15c1c0b 100644
@Override
public TileEntity getTileEntity(BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
index 260644bf0b..f2a19acd84 100644
index 260644bf0..f2a19acd8 100644
--- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
+++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
@@ -31,7 +31,9 @@ public class ChunkCoordIntPair {
@ -2457,7 +2457,7 @@ index 260644bf0b..f2a19acd84 100644
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 32c496fa88..2b0ad4226e 100644
index 32c496fa8..940bcf6ab 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -23,7 +23,7 @@ public class ChunkProviderServer extends IChunkProvider {
@ -2469,7 +2469,7 @@ index 32c496fa88..2b0ad4226e 100644
private final LightEngineThreaded lightEngine;
private final ChunkProviderServer.a serverThreadQueue;
public final PlayerChunkMap playerChunkMap;
@@ -35,6 +35,88 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -35,6 +35,167 @@ public class ChunkProviderServer extends IChunkProvider {
private final ChunkStatus[] cacheStatus = new ChunkStatus[4];
private final IChunkAccess[] cacheChunk = new IChunkAccess[4];
@ -2552,13 +2552,92 @@ index 32c496fa88..2b0ad4226e 100644
+ }
+ return (Chunk)this.getChunkAt(x, z, ChunkStatus.FULL, true);
+ }
+ // Paper
+
+ private long chunkFutureAwaitCounter;
+
+ public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer<Chunk> onLoad) {
+ if (Thread.currentThread() != this.serverThread) {
+ this.serverThreadQueue.execute(() -> {
+ ChunkProviderServer.this.getEntityTickingChunkAsync(x, z, onLoad);
+ });
+ return;
+ }
+ this.getChunkFutureAsynchronously(x, z, 31, PlayerChunk::getEntityTickingFuture, onLoad);
+ }
+
+ public void getTickingChunkAsync(int x, int z, java.util.function.Consumer<Chunk> onLoad) {
+ if (Thread.currentThread() != this.serverThread) {
+ this.serverThreadQueue.execute(() -> {
+ ChunkProviderServer.this.getTickingChunkAsync(x, z, onLoad);
+ });
+ return;
+ }
+ this.getChunkFutureAsynchronously(x, z, 32, PlayerChunk::getTickingFuture, onLoad);
+ }
+
+ public void getFullChunkAsync(int x, int z, java.util.function.Consumer<Chunk> onLoad) {
+ if (Thread.currentThread() != this.serverThread) {
+ this.serverThreadQueue.execute(() -> {
+ ChunkProviderServer.this.getFullChunkAsync(x, z, onLoad);
+ });
+ return;
+ }
+ this.getChunkFutureAsynchronously(x, z, 33, PlayerChunk::getFullChunkFuture, onLoad);
+ }
+
+ private void getChunkFutureAsynchronously(int x, int z, int ticketLevel, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> futureGet, java.util.function.Consumer<Chunk> onLoad) {
+ if (Thread.currentThread() != this.serverThread) {
+ throw new IllegalStateException();
+ }
+ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z);
+ Long identifier = Long.valueOf(this.chunkFutureAwaitCounter++);
+ this.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier);
+ this.tickDistanceManager();
+
+ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(chunkPos.pair());
+
+ if (chunk == null) {
+ throw new IllegalStateException("Expected playerchunk " + chunkPos + " in world '" + this.world.getWorld().getName() + "'");
+ }
+
+ CompletableFuture<Either<Chunk, PlayerChunk.Failure>> future = futureGet.apply(chunk);
+
+ future.whenCompleteAsync((either, throwable) -> {
+ try {
+ if (throwable != null) {
+ if (throwable instanceof ThreadDeath) {
+ throw (ThreadDeath)throwable;
+ }
+ MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", throwable);
+ } else if (either.right().isPresent()) {
+ MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "': " + either.right().get().toString());
+ }
+
+ try {
+ if (onLoad != null) {
+ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback.
+ }
+ } catch (Throwable thr) {
+ if (thr instanceof ThreadDeath) {
+ throw (ThreadDeath)thr;
+ }
+ MinecraftServer.LOGGER.fatal("Load callback for future await failed " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", thr);
+ return;
+ }
+ } finally {
+ // due to odd behaviour with CB unload implementation we need to have these AFTER the load callback.
+ ChunkProviderServer.this.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos);
+ ChunkProviderServer.this.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier);
+ }
+ }, this.serverThreadQueue);
+ }
+ // Paper end
+
+
public ChunkProviderServer(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator<?> chunkgenerator, int i, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier) {
this.world = worldserver;
this.serverThreadQueue = new ChunkProviderServer.a(worldserver);
@@ -77,6 +159,49 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -77,6 +238,49 @@ public class ChunkProviderServer extends IChunkProvider {
this.cacheChunk[0] = ichunkaccess;
}
@ -2609,7 +2688,7 @@ index 32c496fa88..2b0ad4226e 100644
@Override
public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) {
diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java
index 7ca3a1d0c5..2edd9b8714 100644
index 7ca3a1d0c..2edd9b871 100644
--- a/src/main/java/net/minecraft/server/DataBits.java
+++ b/src/main/java/net/minecraft/server/DataBits.java
@@ -83,6 +83,7 @@ public class DataBits {
@ -2621,7 +2700,7 @@ index 7ca3a1d0c5..2edd9b8714 100644
return this.a;
}
diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java
index 75ba698868..45403fbe30 100644
index 75ba69886..45403fbe3 100644
--- a/src/main/java/net/minecraft/server/DataPalette.java
+++ b/src/main/java/net/minecraft/server/DataPalette.java
@@ -4,10 +4,12 @@ import javax.annotation.Nullable;
@ -2638,7 +2717,7 @@ index 75ba698868..45403fbe30 100644
T a(int i);
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
index 774a8f5434..d5f5a51872 100644
index 774a8f543..d5f5a5187 100644
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
@@ -11,7 +11,7 @@ import java.util.stream.Collectors;
@ -2680,7 +2759,7 @@ index 774a8f5434..d5f5a51872 100644
this.a();
packetdataserializer.writeByte(this.i);
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
index fe69161e5b..b40c8d2f83 100644
index fe69161e5..b40c8d2f8 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -6,6 +6,8 @@ import org.bukkit.event.entity.EntityUnleashEvent;
@ -2693,7 +2772,7 @@ index fe69161e5b..b40c8d2f83 100644
super(entitytypes, world);
}
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index bdfb173853..0b06fa2b66 100644
index bdfb17385..0b06fa2b6 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -146,6 +146,7 @@ public abstract class EntityInsentient extends EntityLiving {
@ -2705,7 +2784,7 @@ index bdfb173853..0b06fa2b66 100644
// CraftBukkit start - fire event
setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 3b1bcf3495..1f350e3352 100644
index 3b1bcf349..1f350e335 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -129,6 +129,7 @@ public abstract class EntityLiving extends Entity {
@ -2717,7 +2796,7 @@ index 3b1bcf3495..1f350e3352 100644
@Override
public float getBukkitYaw() {
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index 00c3b666d7..e5322fbae5 100644
index 00c3b666d..e5322fbae 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -5,6 +5,7 @@ import java.util.function.Predicate;
@ -2729,7 +2808,7 @@ index 00c3b666d7..e5322fbae5 100644
super(entitytypes, world);
this.f = 5;
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index ce48210922..57ce9bde64 100644
index ce4821092..57ce9bde6 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -87,6 +87,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -2751,7 +2830,7 @@ index ce48210922..57ce9bde64 100644
this.displayName = this.getName();
this.canPickUpLoot = true;
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 29e776ca19..4328273b1f 100644
index 29e776ca1..4328273b1 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -4,6 +4,7 @@ import com.mojang.datafixers.DataFixUtils;
@ -2774,7 +2853,7 @@ index 29e776ca19..4328273b1f 100644
}
diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java
index 1890c760f9..7e5ece9d50 100644
index 1890c760f..7e5ece9d5 100644
--- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java
+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java
@@ -68,6 +68,15 @@ public abstract class IAsyncTaskHandler<R extends Runnable> implements Mailbox<R
@ -2794,7 +2873,7 @@ index 1890c760f9..7e5ece9d50 100644
this.d.add(r0);
LockSupport.unpark(this.getThread());
diff --git a/src/main/java/net/minecraft/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java
index 3b08770801..0dff023529 100644
index 3b0877080..0dff02352 100644
--- a/src/main/java/net/minecraft/server/IBlockAccess.java
+++ b/src/main/java/net/minecraft/server/IBlockAccess.java
@@ -9,10 +9,24 @@ public interface IBlockAccess {
@ -2823,7 +2902,7 @@ index 3b08770801..0dff023529 100644
return this.getType(blockposition).h();
}
diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java
index c5658c0779..b90baef0f5 100644
index c5658c077..b90baef0f 100644
--- a/src/main/java/net/minecraft/server/IOWorker.java
+++ b/src/main/java/net/minecraft/server/IOWorker.java
@@ -22,7 +22,7 @@ public class IOWorker implements AutoCloseable {
@ -2836,7 +2915,7 @@ index c5658c0779..b90baef0f5 100644
private boolean g = true;
private CompletableFuture<Void> h = new CompletableFuture();
diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java
index ba315131e1..cbe2aa4c0a 100644
index ba315131e..cbe2aa4c0 100644
--- a/src/main/java/net/minecraft/server/IWorldReader.java
+++ b/src/main/java/net/minecraft/server/IWorldReader.java
@@ -4,6 +4,7 @@ import javax.annotation.Nullable;
@ -2848,7 +2927,7 @@ index ba315131e1..cbe2aa4c0a 100644
IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag);
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 75308712d0..aa7501d366 100644
index 75308712d..aa7501d36 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -37,10 +37,19 @@ import org.bukkit.event.world.StructureGrowEvent;
@ -2908,7 +2987,7 @@ index 75308712d0..aa7501d366 100644
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
new file mode 100644
index 0000000000..9fb9a96ccb
index 000000000..9fb9a96cc
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -0,0 +1,414 @@
@ -3327,7 +3406,7 @@ index 0000000000..9fb9a96ccb
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index e85b24a327..75604dbc69 100644
index e85b24a32..75604dbc6 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
@@ -60,7 +60,7 @@ public class NBTTagCompound implements NBTBase {
@ -3356,7 +3435,7 @@ index e85b24a327..75604dbc69 100644
return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least"));
}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 6700582e36..3ccf166366 100644
index 6700582e3..3ccf16636 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -159,6 +159,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -3388,7 +3467,7 @@ index 6700582e36..3ccf166366 100644
public QueuedPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
this.a = packet;
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index 81b6f4581f..d9574a9ace 100644
index 81b6f4581..d9574a9ac 100644
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
@@ -33,6 +33,7 @@ public class PacketDataSerializer extends ByteBuf {
@ -3400,7 +3479,7 @@ index 81b6f4581f..d9574a9ace 100644
for (int j = 1; j < 5; ++j) {
if ((i & -1 << j * 7) == 0) {
diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java
index 90223deae3..63c4dbd327 100644
index 90223deae..63c4dbd32 100644
--- a/src/main/java/net/minecraft/server/PacketEncoder.java
+++ b/src/main/java/net/minecraft/server/PacketEncoder.java
@@ -42,6 +42,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
@ -3412,7 +3491,7 @@ index 90223deae3..63c4dbd327 100644
throw new SkipEncodeException(throwable);
} else {
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index 677e3e5f68..3a1d0deb0d 100644
index 677e3e5f6..3a1d0deb0 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -17,7 +17,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@ -3433,7 +3512,7 @@ index 677e3e5f68..3a1d0deb0d 100644
int j = 0;
ChunkSection[] achunksection = chunk.getSections();
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 5c5bf010d0..c4bbee7d6a 100644
index 5c5bf010d..6e9f402fb 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -19,9 +19,9 @@ public class PlayerChunk {
@ -3521,7 +3600,25 @@ index 5c5bf010d0..c4bbee7d6a 100644
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) {
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(chunkstatus.c());
@@ -335,13 +384,27 @@ public class PlayerChunk {
@@ -74,14 +123,17 @@ public class PlayerChunk {
return getChunkStatus(this.ticketLevel).b(chunkstatus) ? this.getStatusFutureUnchecked(chunkstatus) : PlayerChunk.UNLOADED_CHUNK_ACCESS_FUTURE;
}
+ public final CompletableFuture<Either<Chunk, PlayerChunk.Failure>> getTickingFuture() { return this.a(); } // Paper - OBFHELPER
public CompletableFuture<Either<Chunk, PlayerChunk.Failure>> a() {
return this.tickingFuture;
}
+ public final CompletableFuture<Either<Chunk, PlayerChunk.Failure>> getEntityTickingFuture() { return this.b(); } // Paper - OBFHELPER
public CompletableFuture<Either<Chunk, PlayerChunk.Failure>> b() {
return this.entityTickingFuture;
}
+ public final CompletableFuture<Either<Chunk, PlayerChunk.Failure>> getFullChunkFuture() { return this.c(); } // Paper - OBFHELPER
public CompletableFuture<Either<Chunk, PlayerChunk.Failure>> c() {
return this.fullChunkFuture;
}
@@ -335,13 +387,27 @@ public class PlayerChunk {
this.hasBeenLoaded |= flag3;
if (!flag2 && flag3) {
@ -3550,7 +3647,7 @@ index 5c5bf010d0..c4bbee7d6a 100644
this.a(((CompletableFuture<Either<Chunk, PlayerChunk.Failure>>) completablefuture).thenApply((either1) -> { // CraftBukkit - decompile error
playerchunkmap.getClass();
return either1.ifLeft(playerchunkmap::a);
@@ -352,12 +415,24 @@ public class PlayerChunk {
@@ -352,12 +418,24 @@ public class PlayerChunk {
boolean flag5 = playerchunk_state1.isAtLeast(PlayerChunk.State.TICKING);
if (!flag4 && flag5) {
@ -3577,7 +3674,7 @@ index 5c5bf010d0..c4bbee7d6a 100644
this.tickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
}
@@ -369,12 +444,24 @@ public class PlayerChunk {
@@ -369,12 +447,24 @@ public class PlayerChunk {
throw (IllegalStateException) SystemUtils.c(new IllegalStateException());
}
@ -3605,7 +3702,7 @@ index 5c5bf010d0..c4bbee7d6a 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 7ad30548e2..93d838ec2d 100644
index 7ad30548e..93d838ec2 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -99,6 +99,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -3654,7 +3751,7 @@ index 7ad30548e2..93d838ec2d 100644
@Override
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0c496ee0a0..6a681d694e 100644
index 0c496ee0a..6a681d694 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -67,9 +67,9 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -3671,7 +3768,7 @@ index 0c496ee0a0..6a681d694e 100644
private volatile int chatThrottle;
private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle");
diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java
index 08768a3c87..d103cfaace 100644
index 08768a3c8..d103cfaac 100644
--- a/src/main/java/net/minecraft/server/PlayerInventory.java
+++ b/src/main/java/net/minecraft/server/PlayerInventory.java
@@ -17,7 +17,7 @@ public class PlayerInventory implements IInventory, INamableTileEntity {
@ -3684,7 +3781,7 @@ index 08768a3c87..d103cfaace 100644
public final EntityHuman player;
private ItemStack carried;
diff --git a/src/main/java/net/minecraft/server/PotionUtil.java b/src/main/java/net/minecraft/server/PotionUtil.java
index b3824898da..bf4172be52 100644
index b3824898d..bf4172be5 100644
--- a/src/main/java/net/minecraft/server/PotionUtil.java
+++ b/src/main/java/net/minecraft/server/PotionUtil.java
@@ -110,6 +110,7 @@ public class PotionUtil {
@ -3696,7 +3793,7 @@ index b3824898da..bf4172be52 100644
MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry);
diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java
index 6e65306a27..39339fa275 100644
index 6e65306a2..39339fa27 100644
--- a/src/main/java/net/minecraft/server/ProtoChunk.java
+++ b/src/main/java/net/minecraft/server/ProtoChunk.java
@@ -80,6 +80,18 @@ public class ProtoChunk implements IChunkAccess {
@ -3719,7 +3816,7 @@ index 6e65306a27..39339fa275 100644
public IBlockData getType(BlockPosition blockposition) {
int i = blockposition.getY();
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 7b6e0e86b0..187c4e0f58 100644
index 7b6e0e86b..187c4e0f5 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -88,6 +88,7 @@ public class RegionFile implements AutoCloseable {
@ -3731,7 +3828,7 @@ index 7b6e0e86b0..187c4e0f58 100644
public synchronized DataInputStream a(ChunkCoordIntPair chunkcoordintpair) throws IOException {
int i = this.getOffset(chunkcoordintpair);
diff --git a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
index 8c123f265e..9d0e8c2d43 100644
index 8c123f265..9d0e8c2d4 100644
--- a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
+++ b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
@@ -108,6 +108,26 @@ public class RegionLimitedWorldAccess implements GeneratorAccess {
@ -3762,7 +3859,7 @@ index 8c123f265e..9d0e8c2d43 100644
public IBlockData getType(BlockPosition blockposition) {
return this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4).getType(blockposition);
diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java
index 4efcb8b595..60948afa4e 100644
index 4efcb8b59..60948afa4 100644
--- a/src/main/java/net/minecraft/server/RegistryBlockID.java
+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java
@@ -57,6 +57,7 @@ public class RegistryBlockID<T> implements Registry<T> {
@ -3774,7 +3871,7 @@ index 4efcb8b595..60948afa4e 100644
return this.b.size();
}
diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java
index 7b92ecfff9..7e224ebeff 100644
index 7b92ecfff..7e224ebef 100644
--- a/src/main/java/net/minecraft/server/SystemUtils.java
+++ b/src/main/java/net/minecraft/server/SystemUtils.java
@@ -58,7 +58,7 @@ public class SystemUtils {
@ -3786,8 +3883,20 @@ index 7b92ecfff9..7e224ebeff 100644
}
public static long getTimeMillis() {
diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java
index f82db93f8..75ab9f185 100644
--- a/src/main/java/net/minecraft/server/TicketType.java
+++ b/src/main/java/net/minecraft/server/TicketType.java
@@ -21,6 +21,7 @@ public class TicketType<T> {
public static final TicketType<ChunkCoordIntPair> UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1);
public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit
public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit
+ public static final TicketType<Long> FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {
return new TicketType<>(s, comparator, 0L);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 2e1eabba14..2a4fa455ff 100644
index 2e1eabba1..2a4fa455f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot
@ -3851,7 +3960,7 @@ index 2e1eabba14..2a4fa455ff 100644
return this.setTypeAndData(blockposition, fluid.getBlockData(), 3 | (flag ? 64 : 0));
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index d5014abc9d..8a5ac6f69b 100644
index d5014abc9..8a5ac6f69 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -973,6 +973,7 @@ public class WorldServer extends World {
@ -3871,7 +3980,7 @@ index d5014abc9d..8a5ac6f69b 100644
this.getScoreboard().a(entity);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index e181df6f4d..4a9132c701 100644
index e181df6f4..4a9132c70 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -85,6 +85,7 @@ public final class CraftItemStack extends ItemStack {
@ -3883,7 +3992,7 @@ index e181df6f4d..4a9132c701 100644
/**
* Mirror
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index d8358a0f03..d0b813008c 100644
index d8358a0f0..d0b813008 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -196,4 +196,22 @@ public class DummyGeneratorAccess implements GeneratorAccess {
@ -3910,7 +4019,7 @@ index d8358a0f03..d0b813008c 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java
index 1aec70a1f1..f72c13beda 100644
index 1aec70a1f..f72c13bed 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java
@@ -17,7 +17,7 @@ import java.util.RandomAccess;
@ -3923,5 +4032,5 @@ index 1aec70a1f1..f72c13beda 100644
private int initialCapacity;
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From 0f6b76838fe5cdb40f06b1e5fe44d620481efb5b Mon Sep 17 00:00:00 2001
From a54de5bf0eab573c121f0c1a342bc4685bbe18a6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@ -371,10 +371,10 @@ index 2b6fe2e01..87c5e09a5 100644
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 2b0ad4226..a878f7c75 100644
index 940bcf6ab..5bc7e86ef 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -227,11 +227,13 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -306,11 +306,13 @@ public class ChunkProviderServer extends IChunkProvider {
}
gameprofilerfiller.c("getChunkCacheMiss");
@ -390,7 +390,7 @@ index 2b0ad4226..a878f7c75 100644
ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1;
}, (playerchunk_failure) -> {
@@ -424,7 +426,9 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -503,7 +505,9 @@ public class ChunkProviderServer extends IChunkProvider {
public void save(boolean flag) {
this.tickDistanceManager();
@ -400,7 +400,7 @@ index 2b0ad4226..a878f7c75 100644
}
@Override
@@ -461,7 +465,9 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -540,7 +544,9 @@ public class ChunkProviderServer extends IChunkProvider {
this.tickDistanceManager();
this.world.timings.doChunkMap.stopTiming(); // Spigot
this.world.getMethodProfiler().exitEnter("chunks");
@ -410,7 +410,7 @@ index 2b0ad4226..a878f7c75 100644
this.world.timings.doChunkUnload.startTiming(); // Spigot
this.world.getMethodProfiler().exitEnter("unload");
this.playerChunkMap.unloadChunks(booleansupplier);
@@ -492,10 +498,12 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -571,10 +577,12 @@ public class ChunkProviderServer extends IChunkProvider {
// CraftBukkit end
this.world.getMethodProfiler().enter("naturalSpawnCount");
@ -423,7 +423,7 @@ index 2b0ad4226..a878f7c75 100644
this.world.getMethodProfiler().exit();
this.playerChunkMap.f().forEach((playerchunk) -> {
Optional<Chunk> optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
@@ -504,11 +512,14 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -583,11 +591,14 @@ public class ChunkProviderServer extends IChunkProvider {
Chunk chunk = (Chunk) optional.get();
this.world.getMethodProfiler().enter("broadcast");
@ -438,7 +438,7 @@ index 2b0ad4226..a878f7c75 100644
chunk.setInhabitedTime(chunk.getInhabitedTime() + j);
if (flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot
this.world.getMethodProfiler().enter("spawner");
@@ -559,24 +570,24 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -638,24 +649,24 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.getMethodProfiler().exit();
}

View File

@ -1,4 +1,4 @@
From 27922d38f4079c2750c243e416b640de9352799a Mon Sep 17 00:00:00 2001
From f55042716d3ac30f4e1bf608bb667c23eea4047c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:36:02 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
@ -9,10 +9,10 @@ from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index e5d89299f6..96ac76c134 100644
index 554013a98..05534126a 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -508,6 +508,15 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -587,6 +587,15 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.world.getMethodProfiler().exit();
@ -29,7 +29,7 @@ index e5d89299f6..96ac76c134 100644
Optional<Chunk> optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 1296eb04f0..625b684287 100644
index 1296eb04f..625b68428 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1,5 +1,6 @@
@ -48,7 +48,7 @@ index 1296eb04f0..625b684287 100644
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 936fc4f6b9..fcf229ad5d 100644
index 936fc4f6b..fcf229ad5 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -881,12 +881,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -78,5 +78,5 @@ index 936fc4f6b9..fcf229ad5d 100644
}
--
2.25.1
2.26.0

View File

@ -1,11 +1,11 @@
From 19868823361c3df65d170ea0a6863ccbabb3d377 Mon Sep 17 00:00:00 2001
From 701400c53b8656076b71f4027e94e50b0b8f8775 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 9 Jun 2019 03:53:22 +0100
Subject: [PATCH] incremental chunk saving
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 071e5e7f72..4867615215 100644
index 071e5e7f7..486761521 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -487,4 +487,19 @@ public class PaperWorldConfig {
@ -29,7 +29,7 @@ index 071e5e7f72..4867615215 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 23cc0c360f..d6637f3ddf 100644
index 23cc0c360..d6637f3dd 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -42,7 +42,7 @@ public class Chunk implements IChunkAccess {
@ -42,10 +42,10 @@ index 23cc0c360f..d6637f3ddf 100644
private long inhabitedTime;
@Nullable
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 0db7b88bdd..462b224dfe 100644
index c7e864888..d41316c43 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -434,6 +434,15 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -513,6 +513,15 @@ public class ChunkProviderServer extends IChunkProvider {
} // Paper - Timings
}
@ -62,7 +62,7 @@ index 0db7b88bdd..462b224dfe 100644
public void close() throws IOException {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e9841ef58d..7ca4a7cca8 100644
index e9841ef58..7ca4a7cca 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -168,6 +168,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -108,7 +108,7 @@ index e9841ef58d..7ca4a7cca8 100644
this.methodProfiler.enter("snooper");
if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index b6d3870063..66a389a67e 100644
index a640cb384..3d255b196 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -40,6 +40,9 @@ public class PlayerChunk {
@ -121,7 +121,7 @@ index b6d3870063..66a389a67e 100644
public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) {
this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size());
this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
@@ -382,7 +385,19 @@ public class PlayerChunk {
@@ -385,7 +388,19 @@ public class PlayerChunk {
boolean flag2 = playerchunk_state.isAtLeast(PlayerChunk.State.BORDER);
boolean flag3 = playerchunk_state1.isAtLeast(PlayerChunk.State.BORDER);
@ -141,7 +141,7 @@ index b6d3870063..66a389a67e 100644
if (!flag2 && flag3) {
// Paper start - cache ticking ready status
int expectCreateCount = ++this.fullChunkCreateCount;
@@ -502,8 +517,32 @@ public class PlayerChunk {
@@ -505,8 +520,32 @@ public class PlayerChunk {
}
public void m() {
@ -175,7 +175,7 @@ index b6d3870063..66a389a67e 100644
public void a(ProtoChunkExtension protochunkextension) {
for (int i = 0; i < this.statusFutures.length(); ++i) {
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index cdab5ab6be..18c71609c0 100644
index cdab5ab6b..18c71609c 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -331,6 +331,64 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -261,7 +261,7 @@ index cdab5ab6be..18c71609c0 100644
return PlayerChunk.getChunkState(playerchunk.getTicketLevel());
});
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 389c9d03a1..62c2275098 100644
index 389c9d03a..62c227509 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -814,11 +814,44 @@ public class WorldServer extends World {
@ -319,5 +319,5 @@ index 389c9d03a1..62c2275098 100644
this.checkSession();
this.worldProvider.i();
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From 900495214e6cb77bb3b25372a9f98b4226cf9883 Mon Sep 17 00:00:00 2001
From 2333fe5e9dcb1fd367a1fbeecfa1d72d3503d25a Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 15 Jun 2019 08:54:33 -0700
Subject: [PATCH] Fix World#isChunkGenerated calls
@ -8,7 +8,7 @@ This patch also adds a chunk status cache on region files (note that
its only purpose is to cache the status on DISK)
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 462b224df..b582171c5 100644
index d41316c43..262055fcc 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -28,7 +28,7 @@ public class ChunkProviderServer extends IChunkProvider {
@ -20,7 +20,7 @@ index 462b224df..b582171c5 100644
public final PlayerChunkMap playerChunkMap;
private final WorldPersistentData worldPersistentData;
private long lastTickTime;
@@ -203,6 +203,21 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -282,6 +282,21 @@ public class ChunkProviderServer extends IChunkProvider {
return ret;
}
@ -108,7 +108,7 @@ index f0a052eec..2f95174fc 100644
@Nullable
private PersistentStructureLegacy c;
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 66a389a67..027a6b0fd 100644
index 3d255b196..040d4b41e 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -114,6 +114,19 @@ public class PlayerChunk {
@ -376,5 +376,5 @@ index 661a89c5d..a71bb8650 100644
@Override
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From ad2c58d5fb63d550fe63fba39fc86e11b2504f8f Mon Sep 17 00:00:00 2001
From 904aede5990f211eafbc650a0f03b97b4f3decf3 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com>
Date: Mon, 20 Aug 2018 03:03:58 +0200
Subject: [PATCH] Anti-Xray
@ -1533,10 +1533,10 @@ index 47710067a..ef7ade797 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 027a6b0fd..50135446f 100644
index 040d4b41e..f1620ba80 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -220,6 +220,11 @@ public class PlayerChunk {
@@ -223,6 +223,11 @@ public class PlayerChunk {
World world = chunk.getWorld();
if (this.dirtyCount == 64) {
@ -1548,7 +1548,7 @@ index 027a6b0fd..50135446f 100644
this.s = -1;
}
@@ -252,7 +257,7 @@ public class PlayerChunk {
@@ -255,7 +260,7 @@ public class PlayerChunk {
this.a(world, blockposition);
}
} else if (this.dirtyCount == 64) {
@ -1636,13 +1636,13 @@ index 39339fa27..f376e2106 100644
return this.j[i];
diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java
index f82db93f8..1d1b267f3 100644
index 75ab9f185..4cf28bc2d 100644
--- a/src/main/java/net/minecraft/server/TicketType.java
+++ b/src/main/java/net/minecraft/server/TicketType.java
@@ -21,6 +21,7 @@ public class TicketType<T> {
public static final TicketType<ChunkCoordIntPair> UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1);
@@ -22,6 +22,7 @@ public class TicketType<T> {
public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit
public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit
public static final TicketType<Long> FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper
+ public static final TicketType<Integer> ANTIXRAY = a("antixray", Integer::compareTo); // Paper - Anti-Xray
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {

View File

@ -1,4 +1,4 @@
From 90c6afa04d27f9ea0bbf826227ff19f734426d0f Mon Sep 17 00:00:00 2001
From 419f115d796424a848ba775b72f611180680b128 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 13 Jul 2019 09:23:10 -0700
Subject: [PATCH] Asynchronous chunk IO and loading
@ -121,7 +121,7 @@ tasks required to be executed by the chunk load task (i.e lighting
and some poi tasks).
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
index 27ce4a828e..30bafb214b 100644
index 27ce4a828..30bafb214 100644
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -61,6 +61,17 @@ public class WorldTimingsHandler {
@ -161,7 +161,7 @@ index 27ce4a828e..30bafb214b 100644
public static Timing getTickList(WorldServer worldserver, String timingsType) {
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index dbd1439970..6916ed30c4 100644
index dbd143997..6916ed30c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -1,5 +1,6 @@
@ -237,7 +237,7 @@ index dbd1439970..6916ed30c4 100644
+ }
}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
index 23626bef3a..1edcecd2ee 100644
index 23626bef3..1edcecd2e 100644
--- a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -9,6 +9,7 @@ import java.util.concurrent.Executors;
@ -318,7 +318,7 @@ index 23626bef3a..1edcecd2ee 100644
diff --git a/src/main/java/com/destroystokyo/paper/io/IOUtil.java b/src/main/java/com/destroystokyo/paper/io/IOUtil.java
new file mode 100644
index 0000000000..5af0ac3d9e
index 000000000..5af0ac3d9
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/IOUtil.java
@@ -0,0 +1,62 @@
@ -386,7 +386,7 @@ index 0000000000..5af0ac3d9e
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java
new file mode 100644
index 0000000000..4f10a8311e
index 000000000..4f10a8311
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java
@@ -0,0 +1,661 @@
@ -1053,7 +1053,7 @@ index 0000000000..4f10a8311e
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/PrioritizedTaskQueue.java b/src/main/java/com/destroystokyo/paper/io/PrioritizedTaskQueue.java
new file mode 100644
index 0000000000..97f2e433c4
index 000000000..97f2e433c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/PrioritizedTaskQueue.java
@@ -0,0 +1,277 @@
@ -1336,7 +1336,7 @@ index 0000000000..97f2e433c4
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/QueueExecutorThread.java b/src/main/java/com/destroystokyo/paper/io/QueueExecutorThread.java
new file mode 100644
index 0000000000..ee906b594b
index 000000000..ee906b594
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/QueueExecutorThread.java
@@ -0,0 +1,241 @@
@ -1583,7 +1583,7 @@ index 0000000000..ee906b594b
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java
new file mode 100644
index 0000000000..305da47868
index 000000000..305da4786
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java
@@ -0,0 +1,149 @@
@ -1738,7 +1738,7 @@ index 0000000000..305da47868
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java
new file mode 100644
index 0000000000..60312b85f9
index 000000000..60312b85f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java
@@ -0,0 +1,112 @@
@ -1856,7 +1856,7 @@ index 0000000000..60312b85f9
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java
new file mode 100644
index 0000000000..1dfa8abfd8
index 000000000..1dfa8abfd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java
@@ -0,0 +1,40 @@
@ -1902,7 +1902,7 @@ index 0000000000..1dfa8abfd8
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
new file mode 100644
index 0000000000..2b20c159f6
index 000000000..2b20c159f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
@@ -0,0 +1,492 @@
@ -2399,10 +2399,10 @@ index 0000000000..2b20c159f6
+
+}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index b582171c51..03d7ce8294 100644
index 262055fcc..68bac9a3c 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -218,11 +218,137 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -297,11 +297,137 @@ public class ChunkProviderServer extends IChunkProvider {
return playerChunk.getAvailableChunkNow();
}
@ -2540,7 +2540,7 @@ index b582171c51..03d7ce8294 100644
if (Thread.currentThread() != this.serverThread) {
return (IChunkAccess) CompletableFuture.supplyAsync(() -> {
return this.getChunkAt(i, j, chunkstatus, flag);
@@ -248,8 +374,13 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -327,8 +453,13 @@ public class ChunkProviderServer extends IChunkProvider {
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag);
if (!completablefuture.isDone()) { // Paper
@ -2554,7 +2554,7 @@ index b582171c51..03d7ce8294 100644
this.world.timings.chunkAwait.stopTiming(); // Paper
} // Paper
ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
@@ -754,11 +885,12 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -833,11 +964,12 @@ public class ChunkProviderServer extends IChunkProvider {
protected boolean executeNext() {
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
try {
@ -2569,7 +2569,7 @@ index b582171c51..03d7ce8294 100644
} finally {
playerChunkMap.callbackExecutor.run();
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 8816c90e2d..1298a07dc7 100644
index 8816c90e2..1298a07dc 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
@ -2834,7 +2834,7 @@ index 8816c90e2d..1298a07dc7 100644
nbttagcompound1.set("PostProcessing", a(ichunkaccess.l()));
diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java
index 134a4f0b7d..40ce30cdc2 100644
index 134a4f0b7..40ce30cdc 100644
--- a/src/main/java/net/minecraft/server/ChunkStatus.java
+++ b/src/main/java/net/minecraft/server/ChunkStatus.java
@@ -153,6 +153,7 @@ public class ChunkStatus {
@ -2870,7 +2870,7 @@ index 134a4f0b7d..40ce30cdc2 100644
return this.c() >= chunkstatus.c();
}
diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java
index 7e5ece9d50..cfe43e882e 100644
index 7e5ece9d5..cfe43e882 100644
--- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java
+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java
@@ -91,7 +91,7 @@ public abstract class IAsyncTaskHandler<R extends Runnable> implements Mailbox<R
@ -2883,7 +2883,7 @@ index 7e5ece9d50..cfe43e882e 100644
;
}
diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java
index 2f95174fcc..134c76065b 100644
index 2f95174fc..134c76065 100644
--- a/src/main/java/net/minecraft/server/IChunkLoader.java
+++ b/src/main/java/net/minecraft/server/IChunkLoader.java
@@ -3,37 +3,49 @@ package net.minecraft.server;
@ -3008,7 +3008,7 @@ index 2f95174fcc..134c76065b 100644
+// Paper end
}
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 2dcecc1bbd..d9941b38ca 100644
index 2dcecc1bb..d9941b38c 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -627,4 +627,9 @@ public final class MCUtil {
@ -3022,7 +3022,7 @@ index 2dcecc1bbd..d9941b38ca 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7ca4a7cca8..61fc659ed2 100644
index 7ca4a7cca..61fc659ed 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -777,6 +777,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -3034,7 +3034,7 @@ index 7ca4a7cca8..61fc659ed2 100644
public String getServerIp() {
diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java
index e9c405fb53..33cfeabdee 100644
index e9c405fb5..33cfeabde 100644
--- a/src/main/java/net/minecraft/server/NextTickListEntry.java
+++ b/src/main/java/net/minecraft/server/NextTickListEntry.java
@@ -4,7 +4,7 @@ import java.util.Comparator;
@ -3056,7 +3056,7 @@ index e9c405fb53..33cfeabdee 100644
this.e = t0;
this.b = i;
diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java
index ed8c4a87b5..996c832638 100644
index ed8c4a87b..996c83263 100644
--- a/src/main/java/net/minecraft/server/NibbleArray.java
+++ b/src/main/java/net/minecraft/server/NibbleArray.java
@@ -71,6 +71,7 @@ public class NibbleArray {
@ -3068,7 +3068,7 @@ index ed8c4a87b5..996c832638 100644
return this.a == null ? new NibbleArray() : new NibbleArray((byte[]) this.a.clone());
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 50135446f7..b38bc67758 100644
index f1620ba80..74e6b8b97 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -127,6 +127,18 @@ public class PlayerChunk {
@ -3090,7 +3090,7 @@ index 50135446f7..b38bc67758 100644
// Paper end
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) {
@@ -354,7 +366,7 @@ public class PlayerChunk {
@@ -357,7 +369,7 @@ public class PlayerChunk {
ChunkStatus chunkstatus = getChunkStatus(this.oldTicketLevel);
ChunkStatus chunkstatus1 = getChunkStatus(this.ticketLevel);
boolean flag = this.oldTicketLevel <= PlayerChunkMap.GOLDEN_TICKET;
@ -3099,7 +3099,7 @@ index 50135446f7..b38bc67758 100644
PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel);
PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel);
// CraftBukkit start
@@ -390,6 +402,12 @@ public class PlayerChunk {
@@ -393,6 +405,12 @@ public class PlayerChunk {
}
});
@ -3113,7 +3113,7 @@ index 50135446f7..b38bc67758 100644
completablefuture = (CompletableFuture) this.statusFutures.get(i);
if (completablefuture != null) {
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index b4c9d544fe..7e5fa016c7 100644
index b4c9d544f..7e5fa016c 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -63,7 +63,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -3596,7 +3596,7 @@ index b4c9d544fe..7e5fa016c7 100644
return this.m;
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index d37abf2cf3..df728e2c0a 100644
index d37abf2cf..df728e2c0 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -36,6 +36,8 @@ public class RegionFile implements AutoCloseable {
@ -3641,7 +3641,7 @@ index d37abf2cf3..df728e2c0a 100644
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index e07ae98540..0f201000f6 100644
index e07ae9854..0f201000f 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -9,7 +9,7 @@ import java.io.File;
@ -3746,7 +3746,7 @@ index e07ae98540..0f201000f6 100644
return regionfile != null ? regionfile.chunkExists(pos) : false;
diff --git a/src/main/java/net/minecraft/server/RegionFileSection.java b/src/main/java/net/minecraft/server/RegionFileSection.java
index db9f0196bd..a6d8ef5eb4 100644
index db9f0196b..a6d8ef5eb 100644
--- a/src/main/java/net/minecraft/server/RegionFileSection.java
+++ b/src/main/java/net/minecraft/server/RegionFileSection.java
@@ -20,28 +20,29 @@ import javax.annotation.Nullable;
@ -3882,19 +3882,19 @@ index db9f0196bd..a6d8ef5eb4 100644
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java
index 1d1b267f32..4b87ca2ecb 100644
index 4cf28bc2d..6e0d0a54a 100644
--- a/src/main/java/net/minecraft/server/TicketType.java
+++ b/src/main/java/net/minecraft/server/TicketType.java
@@ -22,6 +22,7 @@ public class TicketType<T> {
public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit
@@ -23,6 +23,7 @@ public class TicketType<T> {
public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit
public static final TicketType<Long> FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper
public static final TicketType<Integer> ANTIXRAY = a("antixray", Integer::compareTo); // Paper - Anti-Xray
+ public static final TicketType<Long> ASYNC_LOAD = a("async_load", Long::compareTo); // Paper
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {
return new TicketType<>(s, comparator, 0L);
diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java
index c999f8c9bf..b59ef1a633 100644
index c999f8c9b..b59ef1a63 100644
--- a/src/main/java/net/minecraft/server/VillagePlace.java
+++ b/src/main/java/net/minecraft/server/VillagePlace.java
@@ -24,8 +24,16 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
@ -3983,7 +3983,7 @@ index c999f8c9bf..b59ef1a633 100644
HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index e3913952d9..b967f6a15f 100644
index e3913952d..b967f6a15 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -82,6 +82,79 @@ public class WorldServer extends World {
@ -4085,7 +4085,7 @@ index e3913952d9..b967f6a15f 100644
}
public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a71bb86508..1d275520fb 100644
index a71bb8650..1d275520f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -554,22 +554,23 @@ public class CraftWorld implements World {
@ -4146,7 +4146,7 @@ index a71bb86508..1d275520fb 100644
// Spigot start
@Override
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 07936eeba2..5bdcdcf9e8 100644
index 07936eeba..5bdcdcf9e 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -6,6 +6,7 @@ import java.lang.management.ThreadInfo;
@ -4166,5 +4166,5 @@ index 07936eeba2..5bdcdcf9e8 100644
log.log( Level.SEVERE, "------------------------------" );
//
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From c58275b04b6ddcdfbcf2f946e97f3a9c90f1edc4 Mon Sep 17 00:00:00 2001
From 8d2f6773c49ff20e2076b58c03571edc8b86f2be Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 19 Jul 2019 03:29:14 -0700
Subject: [PATCH] Reduce sync loads
@ -11,7 +11,7 @@ it must be enabled by setting the startup flag -Dpaper.debug-sync-loads=true
To get a debug log for sync loads, the command is /paper syncloadinfo
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index af81098784..dfe92780ad 100644
index af8109878..dfe92780a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -1,9 +1,13 @@
@ -91,7 +91,7 @@ index af81098784..dfe92780ad 100644
if (args.length < 2 || args[1].equals("*")) {
diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
new file mode 100644
index 0000000000..59aec10329
index 000000000..59aec1032
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
@@ -0,0 +1,172 @@
@ -268,10 +268,10 @@ index 0000000000..59aec10329
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 03d7ce8294..eb4bc66bce 100644
index 68bac9a3c..dd4bb664a 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -378,6 +378,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -457,6 +457,7 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z);
// Paper end
@ -280,7 +280,7 @@ index 03d7ce8294..eb4bc66bce 100644
this.serverThreadQueue.awaitTasks(completablefuture::isDone);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 90f60dfd47..48c75af827 100644
index 90f60dfd4..48c75af82 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1173,7 +1173,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@ -311,7 +311,7 @@ index 90f60dfd47..48c75af827 100644
if (chunk != null) {
chunk.a(oclass, axisalignedbb, list, predicate);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index d4ef2403d5..7088dbf6a2 100644
index b967f6a15..0d25529b3 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -154,6 +154,12 @@ public class WorldServer extends World {
@ -328,5 +328,5 @@ index d4ef2403d5..7088dbf6a2 100644
// Add env and gen to constructor
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
--
2.25.1
2.26.0

View File

@ -1,11 +1,11 @@
From 3cf6f732b741c5e5208019f92c9454efc2e96e84 Mon Sep 17 00:00:00 2001
From 2bc7396ac5f5c494f26a1a0fe4373b5fb51ab1d7 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com>
Date: Mon, 19 Aug 2019 01:27:58 +0500
Subject: [PATCH] implement optional per player mob spawns
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
index 30bafb214b..c9a3ba4bfb 100644
index 30bafb214..c9a3ba4bf 100644
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -60,6 +60,7 @@ public class WorldTimingsHandler {
@ -25,7 +25,7 @@ index 30bafb214b..c9a3ba4bfb 100644
poiUnload = Timings.ofSafe(name + "Chunk unload - POI");
chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk");
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 9d9260ad07..fd3dbea628 100644
index 9d9260ad0..fd3dbea62 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -613,4 +613,9 @@ public class PaperWorldConfig {
@ -40,7 +40,7 @@ index 9d9260ad07..fd3dbea628 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java
new file mode 100644
index 0000000000..9ebd7ecb7a
index 000000000..9ebd7ecb7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java
@@ -0,0 +1,253 @@
@ -299,7 +299,7 @@ index 0000000000..9ebd7ecb7a
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java b/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java
new file mode 100644
index 0000000000..4f13d3ff83
index 000000000..4f13d3ff8
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java
@@ -0,0 +1,241 @@
@ -545,10 +545,10 @@ index 0000000000..4f13d3ff83
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index eb4bc66bce..a6529cefe8 100644
index dd4bb664a..d06027438 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -660,7 +660,22 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -739,7 +739,22 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.chunkMapDistance.b();
EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values();
@ -572,7 +572,7 @@ index eb4bc66bce..a6529cefe8 100644
this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.world.getMethodProfiler().exit();
@@ -728,8 +743,23 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -807,8 +822,23 @@ public class ChunkProviderServer extends IChunkProvider {
if (enumcreaturetype != EnumCreatureType.MISC && (!enumcreaturetype.c() || this.allowAnimals) && (enumcreaturetype.c() || this.allowMonsters) && (!enumcreaturetype.d() || flag2)) {
int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits
@ -599,7 +599,7 @@ index eb4bc66bce..a6529cefe8 100644
}
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index d00b687d25..07a2310b18 100644
index d00b687d2..07a2310b1 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -81,6 +81,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -631,7 +631,7 @@ index d00b687d25..07a2310b18 100644
return this.cs;
}
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 8427ee2ee8..0f04bcc8b7 100644
index 8427ee2ee..0f04bcc8b 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -254,6 +254,7 @@ public class EntityTypes<T extends Entity> {
@ -643,7 +643,7 @@ index 8427ee2ee8..0f04bcc8b7 100644
return this.bb;
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 7e5fa016c7..f564502f81 100644
index 7e5fa016c..f564502f8 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -78,7 +78,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -682,7 +682,7 @@ index 7e5fa016c7..f564502f81 100644
private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) {
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index fdac5bb3a2..58bbf2f9d2 100644
index fdac5bb3a..58bbf2f9d 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -3,6 +3,7 @@ package net.minecraft.server;
@ -755,7 +755,7 @@ index fdac5bb3a2..58bbf2f9d2 100644
@Nullable
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 08e9444fad..1b823bcc08 100644
index 149600ae5..b164ee898 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1028,7 +1028,20 @@ public class WorldServer extends World {
@ -800,5 +800,5 @@ index 08e9444fad..1b823bcc08 100644
@Override
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From f37966fdd4021864d1c618fc26616b1676b62b21 Mon Sep 17 00:00:00 2001
From 758d8546460ee2e90a48a4cb5db6e318263a4944 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 25 Jan 2020 17:04:35 -0800
Subject: [PATCH] Optimise getChunkAt calls for loaded chunks
@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either,
then unwrap it...
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index a6529cefe8..8412feef6b 100644
index d06027438..12fa1013f 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -354,6 +354,12 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -433,6 +433,12 @@ public class ChunkProviderServer extends IChunkProvider {
return this.getChunkAt(i, j, chunkstatus, flag);
}, this.serverThreadQueue).join();
} else {
@ -23,7 +23,7 @@ index a6529cefe8..8412feef6b 100644
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
gameprofilerfiller.c("getChunk");
@@ -404,39 +410,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -483,39 +489,7 @@ public class ChunkProviderServer extends IChunkProvider {
if (Thread.currentThread() != this.serverThread) {
return null;
} else {
@ -65,7 +65,7 @@ index a6529cefe8..8412feef6b 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 79d8c7ba31..28b6c9a083 100644
index 79d8c7ba3..28b6c9a08 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -259,6 +259,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@ -84,5 +84,5 @@ index 79d8c7ba31..28b6c9a083 100644
}
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From 37ec5b6997cb9ba61792aa97b8cc9bbcfc45e186 Mon Sep 17 00:00:00 2001
From 22ff60999f9a027a3174672784ff94e158629627 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 14 Feb 2020 01:24:39 -0800
Subject: [PATCH] Optimise TickListServer by rewriting it
@ -43,7 +43,7 @@ sets the excessive tick delay to the specified ticks (defaults to
diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java
new file mode 100644
index 0000000000..ce653f6b4b
index 000000000..ce653f6b4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java
@@ -0,0 +1,622 @@
@ -671,7 +671,7 @@ index 0000000000..ce653f6b4b
+}
diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/TickListServerInterval.java b/src/main/java/com/destroystokyo/paper/server/ticklist/TickListServerInterval.java
new file mode 100644
index 0000000000..13cf1a55a9
index 000000000..13cf1a55a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/server/ticklist/TickListServerInterval.java
@@ -0,0 +1,41 @@
@ -718,7 +718,7 @@ index 0000000000..13cf1a55a9
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/set/LinkedSortedSet.java b/src/main/java/com/destroystokyo/paper/util/set/LinkedSortedSet.java
new file mode 100644
index 0000000000..118988c39e
index 000000000..118988c39
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/set/LinkedSortedSet.java
@@ -0,0 +1,142 @@
@ -865,7 +865,7 @@ index 0000000000..118988c39e
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index e650a2e48d..2d07d350d2 100644
index e650a2e48..2d07d350d 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -125,6 +125,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
@ -877,12 +877,12 @@ index e650a2e48d..2d07d350d2 100644
return this.b(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 8412feef6b..1dcd0980ec 100644
index 12fa1013f..5c45756c7 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -119,6 +119,13 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -198,6 +198,13 @@ public class ChunkProviderServer extends IChunkProvider {
}
// Paper
// Paper end
+ // Paper start - rewrite ticklistserver
+ public final boolean isTickingReadyMainThread(BlockPosition pos) {
@ -895,7 +895,7 @@ index 8412feef6b..1dcd0980ec 100644
public ChunkProviderServer(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator<?> chunkgenerator, int i, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier) {
this.world = worldserver;
diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java
index 33cfeabdee..2287e47d1b 100644
index 33cfeabde..2287e47d1 100644
--- a/src/main/java/net/minecraft/server/NextTickListEntry.java
+++ b/src/main/java/net/minecraft/server/NextTickListEntry.java
@@ -5,11 +5,13 @@ import java.util.Comparator;
@ -966,10 +966,10 @@ index 33cfeabdee..2287e47d1b 100644
public String toString() {
return this.e + ": " + this.a + ", " + this.b + ", " + this.c + ", " + this.f;
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index b38bc67758..9f8818c2d4 100644
index 74e6b8b97..04b97cec2 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -474,7 +474,9 @@ public class PlayerChunk {
@@ -477,7 +477,9 @@ public class PlayerChunk {
PlayerChunk.this.isTickingReady = true;
@ -981,7 +981,7 @@ index b38bc67758..9f8818c2d4 100644
}
});
diff --git a/src/main/java/net/minecraft/server/StructureBoundingBox.java b/src/main/java/net/minecraft/server/StructureBoundingBox.java
index dbb565e74d..185658e230 100644
index dbb565e74..185658e23 100644
--- a/src/main/java/net/minecraft/server/StructureBoundingBox.java
+++ b/src/main/java/net/minecraft/server/StructureBoundingBox.java
@@ -4,12 +4,12 @@ import com.google.common.base.MoreObjects;
@ -1020,7 +1020,7 @@ index dbb565e74d..185658e230 100644
return baseblockposition.getX() >= this.a && baseblockposition.getX() <= this.d && baseblockposition.getZ() >= this.c && baseblockposition.getZ() <= this.f && baseblockposition.getY() >= this.b && baseblockposition.getY() <= this.e;
}
diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java
index f533860bbe..3f1aa5ced6 100644
index f533860bb..3f1aa5ced 100644
--- a/src/main/java/net/minecraft/server/TickListServer.java
+++ b/src/main/java/net/minecraft/server/TickListServer.java
@@ -42,6 +42,11 @@ public class TickListServer<T> implements TickList<T> {
@ -1143,7 +1143,7 @@ index f533860bbe..3f1aa5ced6 100644
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index eb99819e51..5ba46fca55 100644
index ed41c814a..9d35d650f 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -170,6 +170,13 @@ public class WorldServer extends World {
@ -1174,5 +1174,5 @@ index eb99819e51..5ba46fca55 100644
}, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a, "Fluids"); // Paper - Timings
this.navigators = Sets.newHashSet();
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From a596ba5a8a27d27f5e1210d9fa5193e28f81143e Mon Sep 17 00:00:00 2001
From 19185f409ba9b22100845c12555e2dd046280aec Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 8 Apr 2020 03:06:30 -0400
Subject: [PATCH] Optimize PlayerChunkMap memory use for visibleChunks
@ -13,7 +13,7 @@ This should result in siginificant memory use reduction and improved GC behavior
diff --git a/src/main/java/com/destroystokyo/paper/util/map/Long2ObjectLinkedOpenHashMapFastCopy.java b/src/main/java/com/destroystokyo/paper/util/map/Long2ObjectLinkedOpenHashMapFastCopy.java
new file mode 100644
index 0000000000..e0ad725b2e
index 000000000..e0ad725b2
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/map/Long2ObjectLinkedOpenHashMapFastCopy.java
@@ -0,0 +1,32 @@
@ -50,10 +50,10 @@ index 0000000000..e0ad725b2e
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 1dcd0980ec..e627440c41 100644
index 5c45756c7..1c0a7f402 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -669,7 +669,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -748,7 +748,7 @@ public class ChunkProviderServer extends IChunkProvider {
entityPlayer.playerNaturallySpawnedEvent.callEvent();
};
// Paper end
@ -63,7 +63,7 @@ index 1dcd0980ec..e627440c41 100644
if (optional.isPresent()) {
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index d9941b38ca..71ab65e00f 100644
index d9941b38c..71ab65e00 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -529,7 +529,7 @@ public final class MCUtil {
@ -76,7 +76,7 @@ index d9941b38ca..71ab65e00f 100644
List<PlayerChunk> allChunks = new ArrayList<>(visibleChunks.values());
List<EntityPlayer> players = world.players;
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index e1e4ea793a..e61ddeb1ff 100644
index e1e4ea793..e61ddeb1f 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -55,8 +55,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -213,7 +213,7 @@ index e1e4ea793a..e61ddeb1ff 100644
while (objectbidirectionaliterator.hasNext()) {
Entry<PlayerChunk> entry = (Entry) objectbidirectionaliterator.next();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 051506fce8..630d6470a4 100644
index 051506fce..630d6470a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -74,6 +74,7 @@ import net.minecraft.server.GameRules;
@ -271,5 +271,5 @@ index 051506fce8..630d6470a4 100644
return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.server.Chunk::getBukkitChunk).toArray(Chunk[]::new);
}
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From f711da2a5ed987d6abead3d3964343cc90f7a1ef Mon Sep 17 00:00:00 2001
From 402cb862f7c90839d16facd19e65005f1c9452df Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 9 Apr 2020 00:09:26 -0400
Subject: [PATCH] Speed up processing of chunk loads and generation
@ -33,7 +33,7 @@ In a view distance of 15, chunk loading performance was visually faster on the c
Flying at high speed in spectator mode was able to keep up with chunk loading (as long as they are already generated)
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
index 69e26a8267..434833d50e 100644
index 69e26a826..434833d50 100644
--- a/src/main/java/co/aikar/timings/MinecraftTimings.java
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -13,6 +13,7 @@ import java.util.Map;
@ -45,10 +45,10 @@ index 69e26a8267..434833d50e 100644
public static final Timing commandFunctionsTimer = Timings.ofSafe("Command Functions");
public static final Timing connectionTimer = Timings.ofSafe("Connection Handler");
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index e627440c41..bacfc4cba6 100644
index 1c0a7f402..4af75a954 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -602,6 +602,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -681,6 +681,7 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.getMethodProfiler().enter("purge");
this.world.timings.doChunkMap.startTiming(); // Spigot
this.chunkMapDistance.purgeTickets();
@ -56,7 +56,7 @@ index e627440c41..bacfc4cba6 100644
this.tickDistanceManager();
this.world.timings.doChunkMap.stopTiming(); // Spigot
this.world.getMethodProfiler().exitEnter("chunks");
@@ -611,6 +612,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -690,6 +691,7 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.timings.doChunkUnload.startTiming(); // Spigot
this.world.getMethodProfiler().exitEnter("unload");
this.playerChunkMap.unloadChunks(booleansupplier);
@ -64,7 +64,7 @@ index e627440c41..bacfc4cba6 100644
this.world.timings.doChunkUnload.stopTiming(); // Spigot
this.world.getMethodProfiler().exit();
this.clearCache();
@@ -669,7 +671,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -748,7 +750,7 @@ public class ChunkProviderServer extends IChunkProvider {
entityPlayer.playerNaturallySpawnedEvent.callEvent();
};
// Paper end
@ -73,7 +73,7 @@ index e627440c41..bacfc4cba6 100644
Optional<Chunk> optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
if (optional.isPresent()) {
@@ -752,6 +754,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -831,6 +833,7 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.timings.chunkTicks.startTiming(); // Spigot // Paper
this.world.a(chunk, k);
this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper
@ -81,7 +81,7 @@ index e627440c41..bacfc4cba6 100644
}
}
});
@@ -893,6 +896,38 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -972,6 +975,38 @@ public class ChunkProviderServer extends IChunkProvider {
super.executeTask(runnable);
}
@ -121,7 +121,7 @@ index e627440c41..bacfc4cba6 100644
protected boolean executeNext() {
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e35bacac71..2f424e6e8b 100644
index e35bacac7..2f424e6e8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -907,6 +907,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -163,7 +163,7 @@ index e35bacac71..2f424e6e8b 100644
protected TickTask postToMainThread(Runnable runnable) {
return new TickTask(this.ticks, runnable);
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index e61ddeb1ff..92c9ab43d7 100644
index e61ddeb1f..92c9ab43d 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -793,7 +793,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -176,7 +176,7 @@ index e61ddeb1ff..92c9ab43d7 100644
});
};
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 969c6aadf6..4b9b79a996 100644
index 969c6aadf..4b9b79a99 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -420,6 +420,7 @@ public class WorldServer extends World {
@ -214,5 +214,5 @@ index 969c6aadf6..4b9b79a996 100644
gameprofilerfiller.exit();
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From dbdeade181e9720106c3ac60c465319597d3518a Mon Sep 17 00:00:00 2001
From 55e3f456cb8b3797ffcf5eceb57ffb64f4193407 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 11 Apr 2020 03:56:07 -0400
Subject: [PATCH] Implement Chunk Priority / Urgency System for World Gen
@ -16,10 +16,10 @@ lots of chunks already.
This massively reduces the lag spikes from sync chunk gens.
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index bacfc4cba6..f741a034e8 100644
index 4af75a954..8d4b227ef 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -227,6 +227,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -306,6 +306,7 @@ public class ChunkProviderServer extends IChunkProvider {
}
private long asyncLoadSeqCounter;
@ -27,7 +27,7 @@ index bacfc4cba6..f741a034e8 100644
public void getChunkAtAsynchronously(int x, int z, boolean gen, java.util.function.Consumer<Chunk> onComplete) {
if (Thread.currentThread() != this.serverThread) {
@@ -384,10 +385,18 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -463,10 +464,18 @@ public class ChunkProviderServer extends IChunkProvider {
}
gameprofilerfiller.c("getChunkCacheMiss");
@ -46,7 +46,7 @@ index bacfc4cba6..f741a034e8 100644
this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z);
// Paper end
@@ -397,6 +406,11 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -476,6 +485,11 @@ public class ChunkProviderServer extends IChunkProvider {
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
this.world.timings.chunkAwait.stopTiming(); // Paper
} // Paper
@ -59,7 +59,7 @@ index bacfc4cba6..f741a034e8 100644
return ichunkaccess1;
}, (playerchunk_failure) -> {
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 9f8818c2d4..a9a2ce3d3f 100644
index 04b97cec2..568fbbd5f 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -43,6 +43,111 @@ public class PlayerChunk {
@ -187,7 +187,7 @@ index 9f8818c2d4..a9a2ce3d3f 100644
// Paper end
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) {
@@ -351,7 +462,7 @@ public class PlayerChunk {
@@ -354,7 +465,7 @@ public class PlayerChunk {
}
public int k() {
@ -197,7 +197,7 @@ index 9f8818c2d4..a9a2ce3d3f 100644
private void d(int i) {
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 92c9ab43d7..c38d31fafe 100644
index 92c9ab43d..c38d31faf 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -324,6 +324,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -280,5 +280,5 @@ index 92c9ab43d7..c38d31fafe 100644
return either.flatMap((list) -> {
Chunk chunk = (Chunk) list.get(list.size() / 2);
--
2.25.1
2.26.0

View File

@ -1,4 +1,4 @@
From 9f57d53bd92a3c87603dc929b6490a8501a18c0d Mon Sep 17 00:00:00 2001
From ad087d201ddcc82d97a6c37d55e1a7eaa32ceb3e Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Thu, 16 Apr 2020 16:13:59 -0700
Subject: [PATCH] Optimize ChunkProviderServer's chunk level checking helper
@ -9,10 +9,10 @@ so inline where possible, and avoid the abstraction of the
Either class.
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index f741a034e..664a244dd 100644
index 8d4b227ef..59568224f 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -534,27 +534,37 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -613,27 +613,37 @@ public class ChunkProviderServer extends IChunkProvider {
public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER
@Override public boolean a(Entity entity) {

View File

@ -1,4 +1,4 @@
From 5895b7d41d8065551cc27a225ccf2c5494d3b491 Mon Sep 17 00:00:00 2001
From 44c619f1495272cbc450dc6ca1e805dcd2a7a527 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 18 Apr 2020 04:36:11 -0400
Subject: [PATCH] Fix Chunk Post Processing deadlock risk
@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproduceable crash
for heightmaps.
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index ba6bdc40a..a72f821f2 100644
index 59568224f..fd84807a5 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -938,6 +938,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -1017,6 +1017,7 @@ public class ChunkProviderServer extends IChunkProvider {
// we do not want to use this.executeNext as that also processes chunk loads and might count against task counter.
// We also have already ticked the distance manager above too.
if (server.chunksTasksRan < 200 && now - lastChunkTask > 100000 && super.executeNext()) {
@ -36,7 +36,7 @@ index ba6bdc40a..a72f821f2 100644
ChunkProviderServer.this.lightEngine.queueUpdate();
server.chunksTasksRan++;
lastChunkTask = now;
@@ -961,7 +962,11 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -1040,7 +1041,11 @@ public class ChunkProviderServer extends IChunkProvider {
return true;
} else {
ChunkProviderServer.this.lightEngine.queueUpdate();

View File

@ -1,11 +1,11 @@
From 5bfa76db63cb31d5187548eea7b1cc94f3ab2c3e Mon Sep 17 00:00:00 2001
From d1b5d9b592e1f4d6763a1d8e4873d4752975bb72 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 19 Apr 2020 04:28:29 -0400
Subject: [PATCH] Load Chunks for Login Asynchronously
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index e737381b3..83ceb3f99 100644
index c2850d50d..d145c4bf1 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -106,8 +106,9 @@ public abstract class PlayerList {
@ -25,7 +25,7 @@ index e737381b3..83ceb3f99 100644
+ // Paper start - async load spawn in chunk
+ WorldServer finalWorldserver = worldserver;
+ worldserver.getChunkProvider().getChunkAtAsynchronously(loc.getBlockX() >> 4, loc.getBlockZ() >> 4, true, (chunk -> {
+ worldserver.getChunkProvider().getTickingChunkAsync(loc.getBlockX() >> 4, loc.getBlockZ() >> 4, (chunk -> { // use ticking - as it has at least 1 neighbours loaded
+ if (networkmanager.isConnected()) {
+ postChunkLoadJoin(entityplayer, finalWorldserver, nbttagcompound, networkmanager, lastKnownName, networkmanager.getSocketAddress().toString());
+ }
@ -37,5 +37,5 @@ index e737381b3..83ceb3f99 100644
// PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
WorldData worlddata = worldserver.getWorldData();
--
2.25.1
2.26.0