aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch')
-rw-r--r--Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch42
1 files changed, 20 insertions, 22 deletions
diff --git a/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch
index 39ce143a46..6d16c39327 100644
--- a/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch
+++ b/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch
@@ -78,10 +78,10 @@ index 49a594e5f345096cb3b9913b8ee2760795c5f012..bcb7ce2692c5bc1a6214c3a384949666
}
diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
-index 35b8a85d1280ba3be757b14b14388954ac1617d4..f47a6e0027de6886991aad5bcb98a04157aeb846 100644
+index f0e28f03074bc5e24e5fa64dca94c7573f952357..b7093f1682d152988a54ffc5e5579d2f0ce10ad4 100644
--- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
+++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
-@@ -108,6 +108,7 @@ public class ChunkCoordIntPair {
+@@ -107,6 +107,7 @@ public class ChunkCoordIntPair {
return "[" + this.x + ", " + this.z + "]";
}
@@ -90,7 +90,7 @@ index 35b8a85d1280ba3be757b14b14388954ac1617d4..f47a6e0027de6886991aad5bcb98a041
return new BlockPosition(this.d(), 0, this.e());
}
diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java
-index c072f61e8c88eac8335acd660d8ff0e2f9db819e..4c4108705e9d25912e57a7b3c28b4f1abad58377 100644
+index c072f61e8c88eac8335acd660d8ff0e2f9db819e..705c6e3a47a76509268075078f95871d313f6b76 100644
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
@@ -23,6 +23,7 @@ import java.util.concurrent.Executor;
@@ -106,7 +106,7 @@ index c072f61e8c88eac8335acd660d8ff0e2f9db819e..4c4108705e9d25912e57a7b3c28b4f1a
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> j;
private final Mailbox<ChunkTaskQueueSorter.b> k;
- private final LongSet l = new LongOpenHashSet();
-+ private final LongSet l = new LongOpenHashSet(); LongSet getOnPlayerTicketAddQueue() { return l; } // Paper - OBFHELPER
++ private final LongSet l = new LongOpenHashSet(); public final LongSet getOnPlayerTicketAddQueue() { return l; } // Paper - OBFHELPER
private final Executor m;
private long currentTick;
@@ -364,7 +364,7 @@ index c072f61e8c88eac8335acd660d8ff0e2f9db819e..4c4108705e9d25912e57a7b3c28b4f1a
});
}, i, true));
}
-@@ -409,6 +571,102 @@ public abstract class ChunkMapDistance {
+@@ -409,6 +571,101 @@ public abstract class ChunkMapDistance {
}
@@ -394,7 +394,7 @@ index c072f61e8c88eac8335acd660d8ff0e2f9db819e..4c4108705e9d25912e57a7b3c28b4f1a
+ BlockPosition blockPos = chunkPos.asPosition();
+
+ boolean isFront = false;
-+ BlockPosition.PooledBlockPosition pos = BlockPosition.PooledBlockPosition.acquire();
++ BlockPosition.MutableBlockPosition pos = new BlockPosition.MutableBlockPosition();
+ for (int index = 0, len = backingSet.length; index < len; ++index) {
+ if (!(backingSet[index] instanceof EntityPlayer)) {
+ continue;
@@ -421,7 +421,6 @@ index c072f61e8c88eac8335acd660d8ff0e2f9db819e..4c4108705e9d25912e57a7b3c28b4f1a
+ minDist = dist;
+ }
+ }
-+ pos.close();
+ if (minDist == Double.MAX_VALUE) {
+ minDist = 15;
+ } else {
@@ -467,7 +466,7 @@ index c072f61e8c88eac8335acd660d8ff0e2f9db819e..4c4108705e9d25912e57a7b3c28b4f1a
@Override
public void a() {
super.a();
-@@ -440,6 +698,7 @@ public abstract class ChunkMapDistance {
+@@ -440,6 +697,7 @@ public abstract class ChunkMapDistance {
}
@@ -475,7 +474,7 @@ index c072f61e8c88eac8335acd660d8ff0e2f9db819e..4c4108705e9d25912e57a7b3c28b4f1a
private boolean c(int i) {
return i <= this.e - 2;
}
-@@ -456,6 +715,7 @@ public abstract class ChunkMapDistance {
+@@ -456,6 +714,7 @@ public abstract class ChunkMapDistance {
this.a.defaultReturnValue((byte) (i + 2));
}
@@ -570,7 +569,7 @@ index 319059ba31f3614cc59cd4c4e4fa9242f6e4fe99..7c87ef638d538093e944341525a1027b
boolean flag1 = this.playerChunkMap.b();
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
-index 69b10093552fd3b84d355e216a3eb6bee3d486ef..4550e3449b146d5d416ece620d036cb17547b30e 100644
+index e80133932c5fad52c7b42c45c2b84aff7d11f296..e5a81f831813209d224ffedbc03f6d8243721a25 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -55,6 +55,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -617,7 +616,7 @@ index 69b10093552fd3b84d355e216a3eb6bee3d486ef..4550e3449b146d5d416ece620d036cb1
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i);
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
-index d24b5fa7e77bb18626459f6c3ab4aa20a7512712..e9cedbc8b62180134e774b119fb156c54f5767de 100644
+index b419f0e938b8406874ff7b3d0ee7a532e5990557..87810f007ad258935aa54c0f6a2e2d4325281623 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -655,6 +655,7 @@ public final class MCUtil {
@@ -882,7 +881,7 @@ index e5751adde516544722b95016f64b2a46c16e77ce..04dea2c9fd9337631a6289c7242338e1
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
-index 1147f58c6a0bc153e03a461588efabdfd9ed6357..6b48c4e1d69f8de6ec32258c200be3c136ba20aa 100644
+index f0dc6efce2e0ff053f134993cce94afb9b5cd6f3..3292bdcd143995d52f8c983a8984af203ecd60ca 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -51,6 +51,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean;
@@ -954,7 +953,7 @@ index 1147f58c6a0bc153e03a461588efabdfd9ed6357..6b48c4e1d69f8de6ec32258c200be3c1
this.playerViewDistanceNoTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
this.playerViewDistanceBroadcastMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
(EntityPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ,
-@@ -416,6 +434,116 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
+@@ -416,6 +434,115 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
});
// Paper end - no-tick view distance
}
@@ -997,7 +996,7 @@ index 1147f58c6a0bc153e03a461588efabdfd9ed6357..6b48c4e1d69f8de6ec32258c200be3c1
+ it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap priorities = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap();
+
+ int viewDistance = getEffectiveNoTickViewDistance();
-+ BlockPosition.PooledBlockPosition pos = BlockPosition.PooledBlockPosition.acquire();
++ BlockPosition.MutableBlockPosition pos = new BlockPosition.MutableBlockPosition();
+
+ // Prioritize circular near
+ double playerChunkX = MathHelper.floor(player.locX()) >> 4;
@@ -1053,7 +1052,6 @@ index 1147f58c6a0bc153e03a461588efabdfd9ed6357..6b48c4e1d69f8de6ec32258c200be3c1
+ });
+ }
+
-+ pos.close();
+ if (priorities.isEmpty()) return;
+ chunkDistanceManager.delayDistanceManagerTick = true;
+ priorities.long2IntEntrySet().fastForEach(entry -> chunkDistanceManager.markHighPriority(new ChunkCoordIntPair(entry.getLongKey()), entry.getIntValue()));
@@ -1071,7 +1069,7 @@ index 1147f58c6a0bc153e03a461588efabdfd9ed6357..6b48c4e1d69f8de6ec32258c200be3c1
public void updatePlayerMobTypeMap(Entity entity) {
if (!this.world.paperConfig.perPlayerMobSpawns) {
-@@ -545,6 +673,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
+@@ -545,6 +672,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
List<CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>>> list = Lists.newArrayList();
int j = chunkcoordintpair.x;
int k = chunkcoordintpair.z;
@@ -1079,7 +1077,7 @@ index 1147f58c6a0bc153e03a461588efabdfd9ed6357..6b48c4e1d69f8de6ec32258c200be3c1
for (int l = -i; l <= i; ++l) {
for (int i1 = -i; i1 <= i; ++i1) {
-@@ -563,6 +692,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
+@@ -563,6 +691,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
ChunkStatus chunkstatus = (ChunkStatus) intfunction.apply(j1);
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = playerchunk.a(chunkstatus, this);
@@ -1094,7 +1092,7 @@ index 1147f58c6a0bc153e03a461588efabdfd9ed6357..6b48c4e1d69f8de6ec32258c200be3c1
list.add(completablefuture);
}
-@@ -1030,14 +1167,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
+@@ -1030,14 +1166,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
};
CompletableFuture<NBTTagCompound> chunkSaveFuture = this.world.asyncChunkTaskManager.getChunkSaveFuture(chunkcoordintpair.x, chunkcoordintpair.z);
@@ -1122,7 +1120,7 @@ index 1147f58c6a0bc153e03a461588efabdfd9ed6357..6b48c4e1d69f8de6ec32258c200be3c1
return ret;
// Paper end
}
-@@ -1174,7 +1319,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
+@@ -1174,7 +1318,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
long i = playerchunk.i().pair();
playerchunk.getClass();
@@ -1132,7 +1130,7 @@ index 1147f58c6a0bc153e03a461588efabdfd9ed6357..6b48c4e1d69f8de6ec32258c200be3c1
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
-index 7fd991fd3994a18625c193aeb15ed521d3b6a447..6bb2b3520362d056d4d75c65764e4c8dbc1417f9 100644
+index 2223210b6ba0c4a1484bc76aec588fd35251f823..4bc5dfa83aa86275e226514db2d7e880b66e6567 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1302,6 +1302,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1208,7 +1206,7 @@ index d7b9d9fd3a3b607278a3d72b0b306b0be2aa30ad..6fd852db6bcfbfbf84ec2acf6d23b08a
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {
return new TicketType<>(s, comparator, 0L);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index b34269cd29fe15408e8811a8ab88b8d0fa43fcd3..4210aa793b497889ca732a51b2eadea08d88bfac 100644
+index f9a5ec5cb34425e346e9a7cc24986ece9a4c44e8..cc7c6204b6dcce766a0d3834f2963304b26107c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2520,6 +2520,10 @@ public class CraftWorld implements World {
@@ -1223,7 +1221,7 @@ index b34269cd29fe15408e8811a8ab88b8d0fa43fcd3..4210aa793b497889ca732a51b2eadea0
net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null);
return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index 3951d3366b9450465391d5ecba993442cc7b88b8..72cd52fd7f0ba8df5be8989111d76e7180f033d7 100644
+index f2d61a03c540ff10a6949e637b40a8057be2f1dc..adf918fd757fe3147f897de3ade64a9adf1d3203 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -750,6 +750,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {