Rework async chunk api implementation

Firstly, the old methods all routed to the CompletableFuture method.
However, the CF method could not guarantee that if the caller
was off-main that the future would be "completed" on-main. Since
the callback methods used the CF one, this meant that the callback
methods did not guarantee that the callbacks were to be called on
the main thread.

Now, all methods route to getChunkAtAsync(x, z, gen, urgent, cb)
so that the methods with the callback are guaranteed to invoke
the callback on the main thread. The CF behavior remains unchanged;
it may still appear to complete on main if invoked off-main.

Secondly, remove the scheduleOnMain invocation in the async
chunk completion. This unnecessarily delays the callback
by 1 tick.

Thirdly, add getChunksAtAsync(minX, minZ, maxX, maxZ, ...) which
will load chunks within an area. This method is provided as a helper
as keeping all chunks loaded within an area can be complicated to
implement for plugins (due to the lacking ticket API), and is
already implemented internally anyways.

Fourthly, remove the ticket addition that occured with getChunkAt
and getChunkAtAsync. The ticket addition may delay the unloading
of the chunk unnecessarily. It also fixes a very rare timing bug
where the future/callback would be completed after the chunk
unloads.
This commit is contained in:
Spottedleaf 2024-11-18 22:34:32 -08:00
parent de6173b061
commit 8c5b837e05
720 changed files with 978 additions and 1034 deletions

View File

@ -8,10 +8,10 @@ Adds API's to load or generate chunks asynchronously.
Also adds utility methods to Entity to teleport asynchronously.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index ba9ab1d46effe1e6c08cebddb8b856e2b294d7cb..c77ca55c0686512e6d50b559139b6d6bbeb61062 100644
index ba9ab1d46effe1e6c08cebddb8b856e2b294d7cb..f314f8bc5c437c5703c1e093278d9046903ff2c8 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -977,6 +977,472 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -977,6 +977,509 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
}
// Paper end - additional getNearbyEntities API
@ -63,10 +63,7 @@ index ba9ab1d46effe1e6c08cebddb8b856e2b294d7cb..c77ca55c0686512e6d50b559139b6d6b
+ */
+ @Deprecated(since = "1.13.1")
+ public default void getChunkAtAsync(int x, int z, @NotNull ChunkLoadCallback cb) {
+ getChunkAtAsync(x, z, true).thenAccept(cb::onLoad).exceptionally((ex) -> {
+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex);
+ return null;
+ });
+ this.getChunkAtAsync(x, z, (java.util.function.Consumer<Chunk>)cb);
+ }
+
+ /**
@ -89,10 +86,7 @@ index ba9ab1d46effe1e6c08cebddb8b856e2b294d7cb..c77ca55c0686512e6d50b559139b6d6b
+ */
+ @Deprecated(since = "1.13.1")
+ public default void getChunkAtAsync(@NotNull Location loc, @NotNull ChunkLoadCallback cb) {
+ getChunkAtAsync(loc, true).thenAccept(cb::onLoad).exceptionally((ex) -> {
+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex);
+ return null;
+ });
+ this.getChunkAtAsync(loc.getBlockX() >> 4, loc.getBlockZ() >> 4, cb);
+ }
+
+ /**
@ -115,10 +109,7 @@ index ba9ab1d46effe1e6c08cebddb8b856e2b294d7cb..c77ca55c0686512e6d50b559139b6d6b
+ */
+ @Deprecated(since = "1.13.1")
+ public default void getChunkAtAsync(@NotNull Block block, @NotNull ChunkLoadCallback cb) {
+ getChunkAtAsync(block, true).thenAccept(cb::onLoad).exceptionally((ex) -> {
+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex);
+ return null;
+ });
+ this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, cb);
+ }
+
+ /**
@ -140,10 +131,7 @@ index ba9ab1d46effe1e6c08cebddb8b856e2b294d7cb..c77ca55c0686512e6d50b559139b6d6b
+ * will be executed synchronously
+ */
+ default void getChunkAtAsync(final int x, final int z, final @NotNull Consumer<? super Chunk> cb) {
+ this.getChunkAtAsync(x, z, true).thenAccept(cb).exceptionally((ex) -> {
+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex);
+ return null;
+ });
+ this.getChunkAtAsync(x, z, true, cb);
+ }
+
+ /**
@ -166,13 +154,58 @@ index ba9ab1d46effe1e6c08cebddb8b856e2b294d7cb..c77ca55c0686512e6d50b559139b6d6b
+ * will be executed synchronously
+ */
+ default void getChunkAtAsync(final int x, final int z, final boolean gen, final @NotNull Consumer<? super Chunk> cb) {
+ this.getChunkAtAsync(x, z, gen).thenAccept(cb).exceptionally((ex) -> {
+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex);
+ return null;
+ });
+ this.getChunkAtAsync(x, z, gen, false, cb);
+ }
+
+ /**
+ * Requests a {@link Chunk} to be loaded at the given coordinates
+ *
+ * This method makes no guarantee on how fast the chunk will load,
+ * and will return the chunk to the callback at a later time.
+ *
+ * You should use this method if you need a chunk but do not need it
+ * immediately, and you wish to let the server control the speed
+ * of chunk loads, keeping performance in mind.
+ *
+ * The {@link java.util.function.Consumer} will always be executed synchronously
+ * on the main Server Thread.
+ *
+ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16)
+ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16)
+ * @param gen Should we generate a chunk if it doesn't exist or not
+ * @param urgent If true, the chunk may be prioritised to be loaded above other chunks in queue
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ void getChunkAtAsync(final int x, final int z, final boolean gen, final boolean urgent, final @NotNull Consumer<? super Chunk> cb);
+
+ /**
+ * Requests all chunks with x between [minX, maxZ] and z
+ * between [minZ, maxZ] to be loaded.
+ *
+ * This method makes no guarantee on how fast the chunk will load,
+ * and will invoke the callback at possibly a later time.
+ *
+ * You should use this method if you need chunks loaded but do not need them
+ * immediately, and you wish to let the server control the speed
+ * of chunk loads, keeping performance in mind.
+ *
+ * The {@link Runnable} will always be executed synchronously
+ * on the main Server Thread, and when invoked all chunks requested will be loaded.
+ *
+ * @param minX Minimum chunk X-coordinate of the chunk - floor(world coordinate / 16)
+ * @param minZ Minimum chunk Z-coordinate of the chunk - floor(world coordinate / 16)
+ * @param maxX Maximum chunk X-coordinate of the chunk - floor(world coordinate / 16)
+ * @param maxZ Maximum chunk Z-coordinate of the chunk - floor(world coordinate / 16)
+ * @param urgent If true, the chunks may be prioritised to be loaded above other chunks in queue
+ * @param cb Callback to invoke when all chunks are loaded.
+ * Will be executed synchronously
+ * @see Chunk
+ */
+ void getChunksAtAsync(final int minX, final int minZ, final int maxX, final int maxZ, final boolean urgent,
+ final Runnable cb);
+
+ /**
+ * Requests a {@link Chunk} to be loaded at the given {@link Location}
+ *
+ * This method makes no guarantee on how fast the chunk will load,
@ -478,7 +511,11 @@ index ba9ab1d46effe1e6c08cebddb8b856e2b294d7cb..c77ca55c0686512e6d50b559139b6d6b
+ return this.getChunkAtAsync(x, z, true, true);
+ }
+
+ java.util.concurrent.@NotNull CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent);
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {
+ java.util.concurrent.CompletableFuture<Chunk> ret = new java.util.concurrent.CompletableFuture<>();
+ this.getChunkAtAsync(x, z, gen, urgent, ret::complete);
+ return ret;
+ }
+ // Paper end - async chunks API
+
/**

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add sun related API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index c77ca55c0686512e6d50b559139b6d6bbeb61062..7dbc2e4883feb5b0b1a20cf36cda01ef3795a262 100644
index f314f8bc5c437c5703c1e093278d9046903ff2c8..a8fe8c2f4327f0bee60eeac565620117f3fde2ee 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -1798,6 +1798,16 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -1835,6 +1835,16 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
public void setFullTime(long time);

View File

@ -12,7 +12,7 @@ that continues to have use (internally).
These do not help plugin developers if they bring moise noise than value.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 577b4b89b50441572f0edd9325047c38e25e782e..949ffc320502e46493183cc3ef621d9c4edbe7d6 100644
index f9067281bd5f1ac11dcb9cc2e19f3c5f17face21..03e836b9c2e6d141396cfe4a0034c5dcdcaf9e90 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -883,9 +883,8 @@ public final class Bukkit {
@ -470,7 +470,7 @@ index 6277451c3c6c551078c237cd767b6d70c4f585ea..7d33b3e2f81c14d3aeb800b39e782383
CRACKED(0x0),
GLYPHED(0x1),
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 08f6f85388e4c3e3aae40f709109f8706a400675..c6ebdefe940e5e3ab04aac0f22924ef5d876d328 100644
index 2719461e49a74f979d49dea9c664dfe3da8d2c8e..44ebe899f4278b8f7422385710bdc180375475fd 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -744,9 +744,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@ -590,7 +590,7 @@ index e455eb21abf121dc6ff10ff8a13dd06f67096a8f..bbc01e7c192ae6689c301670047ff114
return origin;
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 7dbc2e4883feb5b0b1a20cf36cda01ef3795a262..e4471e86e1b0993425087d8331e7c3d9896b3908 100644
index a8fe8c2f4327f0bee60eeac565620117f3fde2ee..7ef12976430272d814374ee066e975457111b7f3 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -418,9 +418,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@ -604,7 +604,7 @@ index 7dbc2e4883feb5b0b1a20cf36cda01ef3795a262..e4471e86e1b0993425087d8331e7c3d9
public boolean refreshChunk(int x, int z);
/**
@@ -3813,6 +3812,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -3850,6 +3849,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored);
// Spigot start
@ -612,7 +612,7 @@ index 7dbc2e4883feb5b0b1a20cf36cda01ef3795a262..e4471e86e1b0993425087d8331e7c3d9
public class Spigot {
/**
@@ -3846,7 +3846,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -3883,7 +3883,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
}
}
@ -624,7 +624,7 @@ index 7dbc2e4883feb5b0b1a20cf36cda01ef3795a262..e4471e86e1b0993425087d8331e7c3d9
Spigot spigot();
// Spigot end
@@ -4064,9 +4068,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -4101,9 +4105,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* Gets the dimension ID of this environment
*
* @return dimension ID
@ -636,7 +636,7 @@ index 7dbc2e4883feb5b0b1a20cf36cda01ef3795a262..e4471e86e1b0993425087d8331e7c3d9
public int getId() {
return id;
}
@@ -4076,9 +4080,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -4113,9 +4117,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*
* @param id The ID of the environment
* @return The environment

View File

@ -5,10 +5,10 @@ Subject: [PATCH] More World API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index e4471e86e1b0993425087d8331e7c3d9896b3908..ce1f3ffbab6a8dc8395e3a5b74a7874bb6b38aa9 100644
index 7ef12976430272d814374ee066e975457111b7f3..b22530070b95667e2b548ef1e68e536a5b8ee138 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -3811,6 +3811,72 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -3848,6 +3848,72 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored);

View File

@ -10,10 +10,10 @@ Subject: [PATCH] Expand FallingBlock API
Co-authored-by: Lukas Planz <lukas.planz@web.de>
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 2720f290a632dd32fd9e70a40e73db9d1d161e94..f037f46a9c6ce894f24af14c20fb514a58a8aee9 100644
index 2da3b4d3aa7bedd7c9e253d4036cef1f0d911d45..24eaf74420f6fbd4f0a0f13b719f57b50696aef3 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2244,8 +2244,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -2281,8 +2281,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return The spawned {@link FallingBlock} instance
* @throws IllegalArgumentException if {@link Location} or {@link
* MaterialData} are null or {@link Material} of the {@link MaterialData} is not a block
@ -24,7 +24,7 @@ index 2720f290a632dd32fd9e70a40e73db9d1d161e94..f037f46a9c6ce894f24af14c20fb514a
public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException;
/**
@@ -2258,8 +2260,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -2295,8 +2297,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return The spawned {@link FallingBlock} instance
* @throws IllegalArgumentException if {@link Location} or {@link
* BlockData} are null
@ -35,7 +35,7 @@ index 2720f290a632dd32fd9e70a40e73db9d1d161e94..f037f46a9c6ce894f24af14c20fb514a
public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData data) throws IllegalArgumentException;
/**
@@ -2276,7 +2280,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -2313,7 +2317,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return The spawned {@link FallingBlock} instance
* @throws IllegalArgumentException if {@link Location} or {@link
* Material} are null or {@link Material} is not a block

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add predicate for blocks when raytracing
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index f037f46a9c6ce894f24af14c20fb514a58a8aee9..86fd5f3d322b6203f02ca7c427ccd56336b93fc0 100644
index 24eaf74420f6fbd4f0a0f13b719f57b50696aef3..9a473448427b48038e097796459ff0352f5a54cc 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -1649,6 +1649,27 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -1686,6 +1686,27 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate<? super Entity> filter);
@ -36,7 +36,7 @@ index f037f46a9c6ce894f24af14c20fb514a58a8aee9..86fd5f3d322b6203f02ca7c427ccd563
/**
* Performs a ray trace that checks for block collisions using the blocks'
* precise collision shapes.
@@ -1712,6 +1733,34 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -1749,6 +1770,34 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks);
@ -71,7 +71,7 @@ index f037f46a9c6ce894f24af14c20fb514a58a8aee9..86fd5f3d322b6203f02ca7c427ccd563
/**
* Performs a ray trace that checks for both block and entity collisions.
* <p>
@@ -1745,6 +1794,42 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -1782,6 +1831,42 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate<? super Entity> filter);

View File

@ -39,10 +39,10 @@ index 983a8c20a06d2b509602b27f49c090598b8ecc42..fa98599e3eee37bf68f0e9813497c718
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 16570c3c7ed5e7ad25f20c1034f7b966d6e694da..adcd8161846b06fd1a7895750f98b629204a8406 100644
index ba57efc267e78d28c67648b0e994ffca3b8a8823..bb70a797ea5f0db5bd9f2397944687530b0d1cf3 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4127,6 +4127,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -4164,6 +4164,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
public Raid locateNearestRaid(@NotNull Location location, int radius);

View File

@ -3311,7 +3311,7 @@ index 0000000000000000000000000000000000000000..4123edddc556c47f3f8d83523c125fd2
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java b/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java
new file mode 100644
index 0000000000000000000000000000000000000000..94bba2b71918d79f54b3e28c35e76098ba0afd8c
index 0000000000000000000000000000000000000000..49fe9eed5d5d08abd6e9778fe0d0545f35552435
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java
@@ -0,0 +1,288 @@
@ -3378,7 +3378,7 @@ index 0000000000000000000000000000000000000000..94bba2b71918d79f54b3e28c35e76098
+ private static long chunkLoadCounter = 0L;
+ public static void scheduleChunkLoad(final ServerLevel level, final int chunkX, final int chunkZ, final ChunkStatus toStatus,
+ final boolean addTicket, final Priority priority, final Consumer<ChunkAccess> onComplete) {
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ if (!org.bukkit.Bukkit.isOwnedByCurrentRegion(level.getWorld(), chunkX, chunkZ)) {
+ scheduleChunkTask(level, chunkX, chunkZ, () -> {
+ scheduleChunkLoad(level, chunkX, chunkZ, toStatus, addTicket, priority, onComplete);
+ }, priority);
@ -3443,7 +3443,7 @@ index 0000000000000000000000000000000000000000..94bba2b71918d79f54b3e28c35e76098
+ throw new IllegalArgumentException("Cannot wait for INACCESSIBLE status");
+ }
+
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ if (!org.bukkit.Bukkit.isOwnedByCurrentRegion(level.getWorld(), chunkX, chunkZ)) {
+ scheduleChunkTask(level, chunkX, chunkZ, () -> {
+ scheduleTickingState(level, chunkX, chunkZ, toStatus, addTicket, priority, onComplete);
+ }, priority);
@ -5456,10 +5456,10 @@ index 9cdcab885a915990a679f3fc9ae6885f7d125bfd..3e35a64b4b92ec25789e85c7445375dd
boolean flag1 = this.chunkMap.promoteChunkMap();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f6a3606b972064c4ec78487374e6197c0c447e27..c6ded1ac73ddbc0336000f77c0f99fa20551a0de 100644
index f6a3606b972064c4ec78487374e6197c0c447e27..8978fa74ceae06bef6aad3b74d6544989c687c69 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -239,6 +239,98 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -239,6 +239,103 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return this.convertable.dimensionType;
}
@ -5501,21 +5501,26 @@ index f6a3606b972064c4ec78487374e6197c0c447e27..c6ded1ac73ddbc0336000f77c0f99fa2
+ });
+ return;
+ }
+ List<net.minecraft.world.level.chunk.ChunkAccess> ret = new java.util.ArrayList<>();
+ it.unimi.dsi.fastutil.ints.IntArrayList ticketLevels = new it.unimi.dsi.fastutil.ints.IntArrayList();
+
+ int minBlockX = Mth.floor(axisalignedbb.minX - 1.0E-7D) - 3;
+ int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3;
+
+ int minBlockZ = Mth.floor(axisalignedbb.minZ - 1.0E-7D) - 3;
+
+ int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3;
+ int maxBlockZ = Mth.floor(axisalignedbb.maxZ + 1.0E-7D) + 3;
+
+ int minChunkX = minBlockX >> 4;
+ int maxChunkX = maxBlockX >> 4;
+
+ int minChunkZ = minBlockZ >> 4;
+
+ int maxChunkX = maxBlockX >> 4;
+ int maxChunkZ = maxBlockZ >> 4;
+
+ this.loadChunks(minChunkX, minChunkZ, maxChunkX, maxChunkZ, priority, onLoad);
+ }
+
+ public final void loadChunks(int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ,
+ ca.spottedleaf.concurrentutil.util.Priority priority,
+ java.util.function.Consumer<List<net.minecraft.world.level.chunk.ChunkAccess>> onLoad) {
+ List<net.minecraft.world.level.chunk.ChunkAccess> ret = new java.util.ArrayList<>();
+ it.unimi.dsi.fastutil.ints.IntArrayList ticketLevels = new it.unimi.dsi.fastutil.ints.IntArrayList();
+ ServerChunkCache chunkProvider = this.getChunkSource();
+
+ int requiredChunks = (maxChunkX - minChunkX + 1) * (maxChunkZ - minChunkZ + 1);
@ -6196,7 +6201,7 @@ index d5451cb1976ca3675dd19b07bd8a2d363f82db86..e5054699f2f7555455b4da20249e253d
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 799444e4101283c972a160742a9e2548e604173f..8b58884d6cb1088a2fffb36a99bfe4dc568326d1 100644
index 799444e4101283c972a160742a9e2548e604173f..fb8c641604473a3853b2f8b9cd5c8a65fd2482be 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -256,8 +256,8 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -6219,36 +6224,32 @@ index 799444e4101283c972a160742a9e2548e604173f..8b58884d6cb1088a2fffb36a99bfe4dc
if (playerChunk == null) return false;
playerChunk.getTickingChunkFuture().thenAccept(either -> {
@@ -2110,4 +2110,55 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2110,4 +2110,51 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return this.spigot;
}
// Spigot end
+ // Paper start
+ public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {
+ if (Bukkit.isPrimaryThread()) {
+ net.minecraft.world.level.chunk.LevelChunk immediate = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
+ if (immediate != null) {
+ return java.util.concurrent.CompletableFuture.completedFuture(new CraftChunk(immediate));
+ @Override
+ public void getChunkAtAsync(int x, int z, boolean gen, boolean urgent, @NotNull Consumer<? super Chunk> cb) {
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.scheduleChunkLoad(
+ this.getHandle(), x, z, gen, ChunkStatus.FULL, true,
+ urgent ? ca.spottedleaf.concurrentutil.util.Priority.HIGHER : ca.spottedleaf.concurrentutil.util.Priority.NORMAL,
+ (ChunkAccess chunk) -> {
+ cb.accept(chunk == null ? null : new CraftChunk((net.minecraft.world.level.chunk.LevelChunk)chunk));
+ }
+ }
+ );
+
+ ca.spottedleaf.concurrentutil.util.Priority priority;
+ if (urgent) {
+ priority = ca.spottedleaf.concurrentutil.util.Priority.HIGHER;
+ } else {
+ priority = ca.spottedleaf.concurrentutil.util.Priority.NORMAL;
+ }
+ }
+
+ java.util.concurrent.CompletableFuture<Chunk> ret = new java.util.concurrent.CompletableFuture<>();
+
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
+ net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;
+ ret.complete(chunk == null ? null : new CraftChunk(chunk));
+ });
+ });
+
+ return ret;
+ @Override
+ public void getChunksAtAsync(int minX, int minZ, int maxX, int maxZ, boolean urgent, Runnable cb) {
+ this.getHandle().loadChunks(
+ minX, minZ, maxX, maxZ,
+ urgent ? ca.spottedleaf.concurrentutil.util.Priority.HIGHER : ca.spottedleaf.concurrentutil.util.Priority.NORMAL,
+ (List<ChunkAccess> chunks) -> {
+ cb.run();
+ }
+ );
+ }
+
+ @Override

View File

@ -3562,7 +3562,7 @@ index cbdb1a56a97150c164515a4ce6d3ba06428bf321..b214e7b302abbfe1641485a05f1371ac
public URI getUrl() {
return this.handle.link();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 8b58884d6cb1088a2fffb36a99bfe4dc568326d1..9a79b948264150d0f7a843a8ddd2ea9245ae66f3 100644
index fb8c641604473a3853b2f8b9cd5c8a65fd2482be..0ced83dba344ec55df0a0c992437dbb162426518 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -166,6 +166,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -3623,7 +3623,7 @@ index 8b58884d6cb1088a2fffb36a99bfe4dc568326d1..9a79b948264150d0f7a843a8ddd2ea92
private Map<String, GameRules.Key<?>> gamerules;
public synchronized Map<String, GameRules.Key<?>> getGameRulesNMS() {
if (this.gamerules != null) {
@@ -2160,5 +2197,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2156,5 +2193,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public void setSendViewDistance(final int viewDistance) {
throw new UnsupportedOperationException("Not implemented yet");
}

View File

@ -207,7 +207,7 @@ index 3e35a64b4b92ec25789e85c7445375dd899e1805..2e2976efcf99de269f67dec2c87cb910
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c6ded1ac73ddbc0336000f77c0f99fa20551a0de..f3633da64f990972cddc03f2fcfd34ced2955a7a 100644
index 8978fa74ceae06bef6aad3b74d6544989c687c69..b187561711227eed87ca73ceb8833fcb8e966b3d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -176,7 +176,6 @@ import net.minecraft.world.ticks.LevelTicks;
@ -218,7 +218,7 @@ index c6ded1ac73ddbc0336000f77c0f99fa20551a0de..f3633da64f990972cddc03f2fcfd34ce
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
import org.bukkit.craftbukkit.util.WorldUUID;
@@ -469,7 +468,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -474,7 +473,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
gameprofilerfiller.push("tickPending");
@ -226,7 +226,7 @@ index c6ded1ac73ddbc0336000f77c0f99fa20551a0de..f3633da64f990972cddc03f2fcfd34ce
if (!this.isDebug() && flag) {
j = this.getGameTime();
gameprofilerfiller.push("blockTicks");
@@ -478,7 +476,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -483,7 +481,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.fluidTicks.tick(j, 65536, this::tickFluid);
gameprofilerfiller.pop();
}
@ -234,7 +234,7 @@ index c6ded1ac73ddbc0336000f77c0f99fa20551a0de..f3633da64f990972cddc03f2fcfd34ce
gameprofilerfiller.popPush("raid");
if (flag) {
@@ -489,9 +486,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -494,9 +491,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.getChunkSource().tick(shouldKeepTicking, true);
gameprofilerfiller.popPush("blockEvents");
if (flag) {
@ -244,7 +244,7 @@ index c6ded1ac73ddbc0336000f77c0f99fa20551a0de..f3633da64f990972cddc03f2fcfd34ce
}
this.handlingTick = false;
@@ -504,7 +499,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -509,7 +504,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (flag1 || this.emptyTime++ < 300) {
gameprofilerfiller.push("entities");
@ -252,7 +252,7 @@ index c6ded1ac73ddbc0336000f77c0f99fa20551a0de..f3633da64f990972cddc03f2fcfd34ce
if (this.dragonFight != null && flag) {
gameprofilerfiller.push("dragonFight");
this.dragonFight.tick();
@@ -512,7 +506,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -517,7 +511,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
@ -260,7 +260,7 @@ index c6ded1ac73ddbc0336000f77c0f99fa20551a0de..f3633da64f990972cddc03f2fcfd34ce
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
if (!tickratemanager.isEntityFrozen(entity)) {
@@ -537,8 +530,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -542,8 +535,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
});
@ -269,7 +269,7 @@ index c6ded1ac73ddbc0336000f77c0f99fa20551a0de..f3633da64f990972cddc03f2fcfd34ce
gameprofilerfiller.pop();
this.tickBlockEntities();
}
@@ -951,7 +942,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -956,7 +947,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return;
}
// Spigot end
@ -277,7 +277,7 @@ index c6ded1ac73ddbc0336000f77c0f99fa20551a0de..f3633da64f990972cddc03f2fcfd34ce
entity.setOldPosAndRot();
ProfilerFiller gameprofilerfiller = Profiler.get();
@@ -970,7 +960,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -975,7 +965,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.tickPassenger(entity, entity1);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f3633da64f990972cddc03f2fcfd34ced2955a7a..025363e6b51ff8aa089715b1ec2a0fa1caab65d6 100644
index b187561711227eed87ca73ceb8833fcb8e966b3d..c7ca1638457752bb3828cdde66865c578560d86a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2182,6 +2182,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2187,6 +2187,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
entity.inWorld = true; // CraftBukkit - Mark entity as in world
entity.valid = true; // CraftBukkit
@ -25,7 +25,7 @@ index f3633da64f990972cddc03f2fcfd34ced2955a7a..025363e6b51ff8aa089715b1ec2a0fa1
public void onTrackingEnd(Entity entity) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index aba3e1b5d86940f91034ee6415c909529503a184..57960530e15f0e4b8fb40b725ff03aaf8ce6ffac 100644
index a69de4362934240d8469b820bd1fbfd4a60645a2..a753bcd3a40c5169866845eb7155646b25e40732 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -332,7 +332,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Disable thunder
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 025363e6b51ff8aa089715b1ec2a0fa1caab65d6..abb819c4263e6ea16152fbf55b044101ec8ec0d6 100644
index c7ca1638457752bb3828cdde66865c578560d86a..dbb473ef888823e4f53acefed38bb85471bf6088 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -589,7 +589,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -594,7 +594,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("thunder");

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Disable ice and snow
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index abb819c4263e6ea16152fbf55b044101ec8ec0d6..0e967e4c73dabc6cf6580d863c640cf4dff4f3bf 100644
index dbb473ef888823e4f53acefed38bb85471bf6088..217e6663713007c6c6a0d7132075a47a866c7db3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -619,11 +619,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -624,11 +624,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
gameprofilerfiller.popPush("iceandsnow");

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable spawn chances for skeleton horses
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0e967e4c73dabc6cf6580d863c640cf4dff4f3bf..e623f8e75ec895d18d854a1f2c0dbe41a67dffc8 100644
index 217e6663713007c6c6a0d7132075a47a866c7db3..d0501f4f122f502f5d7501830acc2150eef6a850 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -594,7 +594,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -599,7 +599,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (this.isRainingAt(blockposition)) {
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 50296ff319fd6f97e27ec1cb6bdcd7b85a6ce926..c36032803e8b7e4a8537f02738075e1a6baed3b1 100644
index 25415bd1aaa769bb655432193dcea65640f63115..0b0f68c9c1d153543ef4f333f39e89d353eb0dae 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2194,6 +2194,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2199,6 +2199,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.setOrigin(entity.getOriginVector().toLocation(getWorld()));
}
// Paper end - Entity origin API
@ -16,7 +16,7 @@ index 50296ff319fd6f97e27ec1cb6bdcd7b85a6ce926..c36032803e8b7e4a8537f02738075e1a
}
public void onTrackingEnd(Entity entity) {
@@ -2264,6 +2265,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2269,6 +2270,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
// CraftBukkit end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c36032803e8b7e4a8537f02738075e1a6baed3b1..828f47c6aadb609402f7237f8c234d595f39c970 100644
index 0b0f68c9c1d153543ef4f333f39e89d353eb0dae..92387bffda6d7a7bfe6197b33c69142f184f9d3b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1372,11 +1372,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1377,11 +1377,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public void updateNeighborsAt(BlockPos pos, Block block) {

View File

@ -11,10 +11,10 @@ Co-authored-by: lexikiq <noellekiq@gmail.com>
Co-authored-by: Aikar <aikar@aikar.co>
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 828f47c6aadb609402f7237f8c234d595f39c970..88c93a2e67c8d1bc227c7fa35bb919a40009f931 100644
index 92387bffda6d7a7bfe6197b33c69142f184f9d3b..3d54f52ed43ceef368804f7dce1dd95de3acc045 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1305,7 +1305,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1310,7 +1310,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) {
@ -23,7 +23,7 @@ index 828f47c6aadb609402f7237f8c234d595f39c970..88c93a2e67c8d1bc227c7fa35bb919a4
}
public int getLogicalHeight() {
@@ -2122,6 +2122,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2127,6 +2127,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return this.serverLevelData.getGameRules();
}

View File

@ -10,10 +10,10 @@ Adds an option to control the force mode of the particle.
This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 88c93a2e67c8d1bc227c7fa35bb919a40009f931..0c0d19708832a49734ea08ae05696e0cb20616e4 100644
index 3d54f52ed43ceef368804f7dce1dd95de3acc045..03161ef12960cab3b9c81c190dd808a9c5c476e1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1536,12 +1536,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1541,12 +1541,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
@ -34,7 +34,7 @@ index 88c93a2e67c8d1bc227c7fa35bb919a40009f931..0c0d19708832a49734ea08ae05696e0c
if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 44ecb821c528d10f38c8c85298c8257e92e3c41c..aa82637098072b9371a1815d6c05887e19f1424e 100644
index ea90a64810e2f0669d862b5b6deba0905380051f..807b912a0d24ded99dc487e55c9b1812ffd86c3f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1984,8 +1984,19 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -9,10 +9,10 @@ Co-authored-by: Esoteric Enderman <90862990+EsotericEnderman@users.noreply.githu
Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0c0d19708832a49734ea08ae05696e0cb20616e4..3324156c004e0506df8be23050f497d462b4b9c1 100644
index 03161ef12960cab3b9c81c190dd808a9c5c476e1..f0fc08bcc2988277b6a5e3107e6fc5c89bb67b93 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1419,6 +1419,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1424,6 +1424,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
public ServerExplosion explode0(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Level.ExplosionInteraction world_a, ParticleOptions particleparam, ParticleOptions particleparam1, Holder<SoundEvent> holder) {
@ -24,7 +24,7 @@ index 0c0d19708832a49734ea08ae05696e0cb20616e4..3324156c004e0506df8be23050f497d4
// CraftBukkit end
Explosion.BlockInteraction explosion_effect;
@@ -1450,6 +1455,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1455,6 +1460,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
Explosion.BlockInteraction explosion_effect1 = explosion_effect;
Vec3 vec3d = new Vec3(d0, d1, d2);
ServerExplosion serverexplosion = new ServerExplosion(this, entity, damagesource, explosiondamagecalculator, vec3d, f, flag, explosion_effect1);
@ -54,7 +54,7 @@ index 9f37d7284c81d529551107e2836627977efabd65..d1878f597c3d8119e9b248f4fe8af435
while (iterator.hasNext()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index aa82637098072b9371a1815d6c05887e19f1424e..a4f140fefaac7e74b6c9834e6b532f20e80b9ab9 100644
index 807b912a0d24ded99dc487e55c9b1812ffd86c3f..195e698eadc7ce916b4bcfe04849501ee4a39aad 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -776,6 +776,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3324156c004e0506df8be23050f497d462b4b9c1..75b2caba214c312f9afdd231ee3d75689380a5f3 100644
index f0fc08bcc2988277b6a5e3107e6fc5c89bb67b93..e03032b96e8f44ef83f52dcf3dc5a8856281e475 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1204,7 +1204,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1209,7 +1209,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) {
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) {
@ -19,7 +19,7 @@ index 3324156c004e0506df8be23050f497d462b4b9c1..75b2caba214c312f9afdd231ee3d7568
}
}
}
@@ -2249,7 +2249,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2254,7 +2254,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
@ -29,7 +29,7 @@ index 3324156c004e0506df8be23050f497d462b4b9c1..75b2caba214c312f9afdd231ee3d7568
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 98aeafcc51e23a7534c8d57e4db0eb58abb3f30b..29b836a75b835f0d5233db419fc5ca8dde885fdb 100644
index cded42f7af776d2596db9b33fabef91ea9b3b64e..075437bbca3ec82cf1a1cbf66f1af6966f519211 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -933,7 +933,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -165,7 +165,7 @@ index 6d4e0a90c70f7a66450cbb18ebec1d7bf9200af2..5ff159be1a6dfb4b1a5b9aa1e435d294
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b3f01ea79ecbce0130bbf3315a4076661affd1ae..01d257d1fe33b3d38e155b69436173a8a3c828e2 100644
index 48fce5964c49f30f705d11bbbabae49ad9a606c7..b8a453e3e54a205d703bb1f4602686606c0f0f4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1278,7 +1278,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 75b2caba214c312f9afdd231ee3d75689380a5f3..0635e7ed67d45abb7c419cf4ebda0e64718b630e 100644
index e03032b96e8f44ef83f52dcf3dc5a8856281e475..01c4f405692116813bbd3d851738f52a50b548a2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1166,6 +1166,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1171,6 +1171,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// CraftBukkit start
private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot

View File

@ -26,10 +26,10 @@ index f55832ce841621daab4d3a910650ab6562cefcda..f635da34335cd2901adf975fcd74c5c6
});
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0635e7ed67d45abb7c419cf4ebda0e64718b630e..91e462544b82e0fe41851fa0fa3f6d6f08ac490d 100644
index 01c4f405692116813bbd3d851738f52a50b548a2..ddff9f9f5322f62286f32161888e1b6a160fddfd 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1172,6 +1172,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1177,6 +1177,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return true;
}
// Paper end - extra debug info
@ -38,7 +38,7 @@ index 0635e7ed67d45abb7c419cf4ebda0e64718b630e..91e462544b82e0fe41851fa0fa3f6d6f
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 9cfd0b457f6c462921667b9439a7b3e32d019758..62412b37d4f7d37b3fec0966ab700c2ae4d8cada 100644
index d3901066dbfb85fecfd8ef42420dd2be4baaff60..cd6f1d86fe258889ad561869f444e2cfae27aebf 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -716,7 +716,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID
Use the PlayerList map instead of iterating over all players
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 91e462544b82e0fe41851fa0fa3f6d6f08ac490d..800dd7338d77289b7d0e6e126342eaea184d3e43 100644
index ddff9f9f5322f62286f32161888e1b6a160fddfd..32117fe89ca946658a7d292b4a470736a09bfa62 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -331,6 +331,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -336,6 +336,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
// Paper end

View File

@ -314,10 +314,10 @@ index 758b874424b1fed90893132e5455a683b789ebf2..0a895055ec7f61d3cb52d303bbe3f894
ChunkAccess ichunkaccess1 = (ChunkAccess) chunkresult.orElse(null); // CraftBukkit - decompile error
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 800dd7338d77289b7d0e6e126342eaea184d3e43..ecb9f6f0c9b24313b9e55b3a4c4f4bba40bc8fb3 100644
index 32117fe89ca946658a7d292b4a470736a09bfa62..af3adf1bf771c2327b2972a4f9db9df4c4775f1a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -410,6 +410,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -415,6 +415,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
}

View File

@ -25,10 +25,10 @@ index 5f85d7f7ec57fc1b0375e62a8e8e3e8783f34193..396310a51480cf0d1ea4c0959d3f8e4e
EntityType<?> entitytypes = entity.getType();
int i = entitytypes.clientTrackingRange() * 16;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index ecb9f6f0c9b24313b9e55b3a4c4f4bba40bc8fb3..0995a3a274df988a5c63c813de8213019a7c47c4 100644
index af3adf1bf771c2327b2972a4f9db9df4c4775f1a..161b556e5c5f3719b5623e71876a2250abc7f391 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2202,7 +2202,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2207,7 +2207,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public void onTrackingStart(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot
@ -37,7 +37,7 @@ index ecb9f6f0c9b24313b9e55b3a4c4f4bba40bc8fb3..0995a3a274df988a5c63c813de821301
if (entity instanceof ServerPlayer entityplayer) {
ServerLevel.this.players.add(entityplayer);
ServerLevel.this.updateSleepingPlayerList();
@@ -2232,6 +2232,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2237,6 +2237,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
entity.inWorld = true; // CraftBukkit - Mark entity as in world
entity.valid = true; // CraftBukkit

View File

@ -1,103 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 9 Jun 2020 03:33:03 -0400
Subject: [PATCH] Add Plugin Tickets to API Chunk Methods
Like previous versions, plugins loading chunks kept them loaded until
they garbage collected to avoid constant spamming of chunk loads
This adds tickets to a few more places so that they can be unloaded.
Additionally, this drops their ticket level to BORDER so they wont be ticking
so they will just sit inactive instead.
Using .loadChunk to keep a chunk ticking was a horrible idea for upstream
when we have TWO methods that are able to do that already in the API.
Also reduce their collection count down to a maximum of 1 second. Barely
anyone knows what chunk-gc is in bukkit.yml as its less relevant now, and
since this wasn't spigot behavior, this is safe to mostly ignore (unless someone
wants it to collect even faster, they can restore that setting back to 1 instead of 20+)
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9905555f249db72649bde8401835dd816ed7b428..972e3a1de1d289f82156097a9bf0faf03cb4ff42 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -382,7 +382,7 @@ public final class CraftServer implements Server {
this.overrideSpawnLimits();
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
- TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
+ TicketType.PLUGIN.timeout = Math.min(20, this.configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
this.loadIcon();
this.loadCompatibilities();
@@ -978,7 +978,7 @@ public final class CraftServer implements Server {
this.console.setMotd(config.motd);
this.overrideSpawnLimits();
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
- TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
+ TicketType.PLUGIN.timeout = Math.min(20, configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
this.printSaveWarning = false;
this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 93d1c641a6fa063f3c5a4b9b2d9a15071ae7de01..5ca7db643a1616df57be114faf9ce2e33e8d4eb8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -262,7 +262,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public Chunk getChunkAt(int x, int z) {
- net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) this.world.getChunk(x, z, ChunkStatus.FULL, true);
+ // Paper start - add ticket to hold chunk for a little while longer if plugin accesses it
+ net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
+ if (chunk == null) {
+ this.addTicket(x, z);
+ chunk = this.world.getChunkSource().getChunk(x, z, true);
+ }
+ // Paper end
return new CraftChunk(chunk);
}
@@ -276,6 +282,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return new CraftChunk(this.getHandle(), x, z);
}
+ // Paper start
+ private void addTicket(int x, int z) {
+ io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> this.world.getChunkSource().addRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 0, Unit.INSTANCE)); // Paper
+ }
+ // Paper end
+
@Override
public Chunk getChunkAt(Block block) {
Preconditions.checkArgument(block != null, "null block");
@@ -327,7 +339,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public boolean unloadChunkRequest(int x, int z) {
org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot
if (this.isChunkLoaded(x, z)) {
- this.world.getChunkSource().removeRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 1, Unit.INSTANCE);
+ this.world.getChunkSource().removeRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 0, Unit.INSTANCE); // Paper
}
return true;
@@ -439,7 +451,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
if (chunk instanceof net.minecraft.world.level.chunk.LevelChunk) {
- this.world.getChunkSource().addRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 1, Unit.INSTANCE);
+ this.world.getChunkSource().addRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 0, Unit.INSTANCE); // Paper
return true;
}
@@ -2248,6 +2260,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
ca.spottedleaf.moonrise.common.util.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;
+ if (chunk != null) this.addTicket(x, z); // Paper
ret.complete(chunk == null ? null : new CraftChunk(chunk));
});
});

View File

@ -30,7 +30,7 @@ index de40e522960469b98f987bd688489740446d9f85..5678d2007d5adf45dec0638c5dd848b6
public CraftAttributeMap(AttributeMap handle) {
this.handle = handle;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index b2683d6efd53b03d7043098b19a1504885a5b3c7..af78e73755743fb2db7a99b834affc963b44bc10 100644
index d9bbeb08cb58b1fbea5c6aab8f926236639e031d..43d1f278a56ff344ddf4e5d70471485b393a3b1d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -810,7 +810,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {

View File

@ -8,7 +8,7 @@ Adds a new event for all crafting stations that generate a result slot item
Anvil, Grindstone and Smithing now extend this event
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index 126565e673e94b9c66aa4547596bbf198c57c7ad..cc5aae32f34305965847ade8b530272b1126b5c9 100644
index dff005cc860fc5ff0759d6e35502deebd00943ed..ae0ba6b0e1f0bee3c3a701b22725171e499b97a3 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -333,6 +333,7 @@ public class AnvilMenu extends ItemCombinerMenu {
@ -94,7 +94,7 @@ index 0fb0ee5b22dc96c48d68e4391fd71b03d4e799f0..97837d1baf6b929a50e5562ef466050e
private void setupRecipeList(ItemStack stack) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index cb708c5ce9e81005d638f03e398e7f0f2b9f7521..876644a1b5d119c3420e3042b576e34878797d67 100644
index b8e1a7251f9fa09f03b00b387013af1c623a1e52..f8ec0bca1683d172bc673afc28cf9f7b76e26130 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1679,6 +1679,12 @@ public class CraftEventFactory {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 4d39aa2fdc311acb34d7b674365141b995c324b7..6a2f54a70b484effb903f084a5a109981ef38114 100644
index 911dcfb9b34d94e38db71c17022b8a8c1e707eb7..e3322e8897f361b3fbf8d7188207271906a84c46 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3797,7 +3797,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 807068fc6065f71961d34cb4f18b6eb39ae49637..c468947990cf05e554006e51d87b72fad7c28e55 100644
index eacc0675d751caf996c9741a5ef5df28d1b9999b..80198c2f6419a3358f41df15dd7bbeb642d37585 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -322,6 +322,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -57,7 +57,7 @@ index b9fbaddcc8239bf737fdea51790f678306e511eb..9a8b08d4b70b8890961e4af7ce6e870a
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 66e5e949c8711103ae9bf73161422f350c217874..80e25cc8de5e3714dee5cb5ce22e49695a149258 100644
index e4c39eba10124ebf675ac721866e0c73bf15e533..ad109929cb8d9be8e147adaf744f6fa588414404 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3154,6 +3154,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0995a3a274df988a5c63c813de8213019a7c47c4..17725a575a29aa8076582e1b8c644ffd928cfaae 100644
index 161b556e5c5f3719b5623e71876a2250abc7f391..9a6a9508673edcb2eda8b3e4802fd9502a7514d5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1700,7 +1700,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1705,7 +1705,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
float f1 = this.levelData.getSpawnAngle();
if (!blockposition1.equals(pos) || f1 != angle) {
@ -19,7 +19,7 @@ index 0995a3a274df988a5c63c813de8213019a7c47c4..17725a575a29aa8076582e1b8c644ffd
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 5ca7db643a1616df57be114faf9ce2e33e8d4eb8..3ff0a43907cbe2cb4e54c57d9ac735dc0dd7f8f4 100644
index f3ebea4d228d53057e2480a59eda5774eba03bb4..2ad9c104c7a99882417f9662d657841636751223 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -242,12 +242,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -7,7 +7,7 @@ Add a new event, BellRingEvent, to trigger whenever a player rings a
village bell. Passes along the bell block and the player who rang it.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 876644a1b5d119c3420e3042b576e34878797d67..629936b6266dadcac9d9a1fd584e7ba6b67a0002 100644
index f8ec0bca1683d172bc673afc28cf9f7b76e26130..798a608784d4880f8d8e77960cfaf27700d06ddb 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -377,10 +377,11 @@ public class CraftEventFactory {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Cache block data strings
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fce70aa2b0d92c6291720b75a07a6472eb55855b..b9acf51e30839447cb7fc48e202321ed4bb2b7ea 100644
index 99b5877fc2f568929b35aa10638173bbef27503b..356b3b7649edf9289c5736638bca50e5d9670782 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2184,6 +2184,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -22,7 +22,7 @@ index 00ce20359f6d73acf3f1016806e5f4f3b6d01bcd..1754e413dc1b7a18b3fc0b981eae1128
this.lastGoodY = this.awaitingPositionFromClient.y;
this.lastGoodZ = this.awaitingPositionFromClient.z;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 65144603a545903b8f11ee1b2b1ac2795af81381..906a5cc5671b707ef90d1f25d8ba5642c7a483bc 100644
index 9833c1876a6fdce15326f10ff9a44ab3587eaf32..e56ee4ee930bb788fb7b0e254798308571802ab4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -180,6 +180,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@ -72,7 +72,7 @@ index 56dbe701a93eb9f1309bec92e5d3b310860a4dc5..1b6ec72f59504d2f420d6d5dcbed4d3b
if (entity instanceof Mob) {
Mob entityinsentient = (Mob) entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index b001284e368f64871824c1f961999bb3f726de57..abecb0235eee3e62a84f15f2ef100efcf3fcbf2a 100644
index ec122fa4e443290ff973797740172e07f8e736ca..609c768ba4d22e346acbc9422ce41e3b887fadb1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -241,7 +241,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 17725a575a29aa8076582e1b8c644ffd928cfaae..c5029210d059a62577ede8b6e944e2f4dcbac420 100644
index 9a6a9508673edcb2eda8b3e4802fd9502a7514d5..b2777f49f658914d2211edd29ac3661f57ef18e0 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1193,6 +1193,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1198,6 +1198,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
} else {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 906a5cc5671b707ef90d1f25d8ba5642c7a483bc..3f0a44db707176c25e306f55fa63da9314d682a1 100644
index e56ee4ee930bb788fb7b0e254798308571802ab4..8f103dc563110f04563487f90fe02de4288a99a7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4734,4 +4734,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b9acf51e30839447cb7fc48e202321ed4bb2b7ea..f6667d9f514a821fd539e193dde1f78e77ca0fbf 100644
index 356b3b7649edf9289c5736638bca50e5d9670782..a570de59700ace7f17268a220ed104464c7e6b15 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2309,13 +2309,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 134cd194962be898253e034b19524fad0d48ada5..30675a23a25dc065e09d97b9b08386c9f41989d8 100644
index 9905555f249db72649bde8401835dd816ed7b428..f75d73402cf633254fe1ef4e919f09db48165190 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1968,6 +1968,28 @@ public final class CraftServer implements Server {

View File

@ -28,7 +28,7 @@ index 134810ac91d828d67759cd1ed56f11b71e292917..ba41646a5edb57c4d9766df08bbc5701
Connection.LOGGER.debug("Failed to sent packet", throwable);
if (this.getSending() == PacketFlow.CLIENTBOUND) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c468947990cf05e554006e51d87b72fad7c28e55..0ae490bb9b4cd781876054d0824c5392060208eb 100644
index 80198c2f6419a3358f41df15dd7bbeb642d37585..0236a3db9b839f871a11b16615ab982069ebe34b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -323,6 +323,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -52,7 +52,7 @@ index 9a8b08d4b70b8890961e4af7ce6e870aa1c7c810..f8ae8c8eff73e4e87eb34d0f2635517f
this.connection.disconnect(disconnectiondetails);
}));
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 530369764cad77466995f8f65070eec6a5de74f2..819fb4ef54dce33ec91604491132771f157c8d83 100644
index 54de4e701adea123c0fdfb5787e951699305bb81..8566e28d18a5b1221ba4e5d55e7788f80f956296 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -519,7 +519,7 @@ public abstract class PlayerList {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 80e25cc8de5e3714dee5cb5ce22e49695a149258..a631d35100b1910b717e359d3f27918a95a7a2cf 100644
index ad109929cb8d9be8e147adaf744f6fa588414404..c11c83376bd5e006bab86db6d8aa99b7ec371636 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2722,7 +2722,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4a26795d22c0276980f4d0ad266861389d8471a8..9ebce90de425989014466d2c5ce68fce505d1dcd 100644
index 20289623062acd34afb0ca5fc7daaf032ec1f418..7a4aaa56f8d547ebc537657855d5fcdb4ef21e36 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2196,6 +2196,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@ -44,7 +44,7 @@ index b8d57e25851dd7da905100dfd4022e4b99fd7f02..721321a19ce056f82de2bef44a8791dc
} else if (entity1 instanceof Player && entity instanceof Player && !io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions) { // Paper - Configurable player collision
return false;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6a2f54a70b484effb903f084a5a109981ef38114..499e4fbb919ae3875aaa371d6ee206b8b144387b 100644
index e3322e8897f361b3fbf8d7188207271906a84c46..b725bd297ed40aa8ccf3ad77f8652b39980efcf2 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3711,7 +3711,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 629936b6266dadcac9d9a1fd584e7ba6b67a0002..9f97216a4be562acb69281f4a638dad139c6bc7d 100644
index 798a608784d4880f8d8e77960cfaf27700d06ddb..f8751bf07479d6619ec1acb19f84a9af00ecd308 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -312,6 +312,10 @@ public class CraftEventFactory {

View File

@ -28,7 +28,7 @@ index 488ebd443903af812913437f1ade3002093f2470..a043ac10834562d357ef0b5aded2e916
public Vec3 decode(long x, long y, long z) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9ebce90de425989014466d2c5ce68fce505d1dcd..282863951033f7e036b0e58393651e1a22fada23 100644
index 7a4aaa56f8d547ebc537657855d5fcdb4ef21e36..e08d20b65fdea46be94228b4b10ba1cb7b3beeb6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4479,6 +4479,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

Some files were not shown because too many files have changed in this diff Show More