diff --git a/LICENSE.md b/LICENSE.md index 704c1863a1..687fd815fe 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -43,7 +43,7 @@ ysl3000 Machine_Maker Ivan Pekov Camotoy <20743703+Camotoy@users.noreply.github.com> -Bjarne Koll +Bjarne Koll MeFisto94 Owen1212055 <23108066+Owen1212055@users.noreply.github.com> LemonCaramel diff --git a/build.gradle.kts b/build.gradle.kts index 20ab99b72b..209c94fcb4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ import kotlin.io.path.* plugins { java `maven-publish` - id("io.papermc.paperweight.core") version "1.7.4" + id("io.papermc.paperweight.core") version "1.7.5" } allprojects { diff --git a/patches/api/0112-Expand-Explosions-API.patch b/patches/api/0112-Expand-Explosions-API.patch index 42f8422bee..bc6d875f8f 100644 --- a/patches/api/0112-Expand-Explosions-API.patch +++ b/patches/api/0112-Expand-Explosions-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expand Explosions API Add Entity as a Source capability, and add more API choices, and on Location. Co-authored-by: Esoteric Enderman <90862990+EsotericEnderman@users.noreply.github.com> -Co-authored-by: Bjarne Koll +Co-authored-by: Bjarne Koll diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java index df88bc77a3fa2506adf17eddc6300ac65774df6f..fe2e0939df61b1f59d12adf3f760f1d619bb3de3 100644 diff --git a/patches/api/0139-Async-Chunks-API.patch b/patches/api/0139-Async-Chunks-API.patch index caa55b4c1f..bda9be5732 100644 --- a/patches/api/0139-Async-Chunks-API.patch +++ b/patches/api/0139-Async-Chunks-API.patch @@ -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..1161c286aaaaad761c80ca97c25fd166365bb044 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)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 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 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 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 @NotNull 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 getChunkAtAsync(int x, int z, boolean gen, boolean urgent); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent) { ++ java.util.concurrent.CompletableFuture ret = new java.util.concurrent.CompletableFuture<>(); ++ this.getChunkAtAsync(x, z, gen, urgent, ret::complete); ++ return ret; ++ } + // Paper end - async chunks API + /** diff --git a/patches/api/0150-Add-sun-related-API.patch b/patches/api/0150-Add-sun-related-API.patch index e0ca3a8475..7d03429481 100644 --- a/patches/api/0150-Add-sun-related-API.patch +++ b/patches/api/0150-Add-sun-related-API.patch @@ -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); diff --git a/patches/api/0166-Fix-Spigot-annotation-mistakes.patch b/patches/api/0166-Fix-Spigot-annotation-mistakes.patch index 8551ae81c5..bc117b0fdf 100644 --- a/patches/api/0166-Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/0166-Fix-Spigot-annotation-mistakes.patch @@ -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 diff --git a/patches/api/0216-Add-PlayerItemCooldownEvent.patch b/patches/api/0216-Add-PlayerItemCooldownEvent.patch index 32321693b6..13bfa89a28 100644 --- a/patches/api/0216-Add-PlayerItemCooldownEvent.patch +++ b/patches/api/0216-Add-PlayerItemCooldownEvent.patch @@ -6,14 +6,54 @@ Subject: [PATCH] Add PlayerItemCooldownEvent diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..07b3a93ea09f0ae7d0e7a5af3633a0c669d36fcf +index 0000000000000000000000000000000000000000..165dcf8b68da5dc01eaa83b3bffd7a2bbf0df526 --- /dev/null +++ b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java -@@ -0,0 +1,79 @@ +@@ -0,0 +1,34 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.Material; ++import org.bukkit.NamespacedKey; ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Fired when a player receives an item cooldown when using an item. ++ * ++ * @see PlayerItemGroupCooldownEvent for a more general event when applied to a group of items ++ */ ++@NullMarked ++public class PlayerItemCooldownEvent extends PlayerItemGroupCooldownEvent { ++ ++ private final Material type; ++ ++ @ApiStatus.Internal ++ public PlayerItemCooldownEvent(final Player player, final Material type, final NamespacedKey cooldownGroup, final int cooldown) { ++ super(player, cooldownGroup, cooldown); ++ this.type = type; ++ } ++ ++ /** ++ * Get the material of the item affected by the cooldown. ++ * ++ * @return material affected by the cooldown ++ */ ++ public Material getType() { ++ return this.type; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemGroupCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemGroupCooldownEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e66aed33b165b86cc5e51eb5c29159232be4a9ef +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerItemGroupCooldownEvent.java +@@ -0,0 +1,81 @@ +package io.papermc.paper.event.player; + +import com.google.common.base.Preconditions; -+import org.bukkit.Material; ++import org.bukkit.NamespacedKey; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; @@ -23,31 +63,33 @@ index 0000000000000000000000000000000000000000..07b3a93ea09f0ae7d0e7a5af3633a0c6 + +/** + * Fired when a player receives an item cooldown. ++ * ++ * @see PlayerItemCooldownEvent for a more specific event when applied to a specific item. + */ +@NullMarked -+public class PlayerItemCooldownEvent extends PlayerEvent implements Cancellable { ++public class PlayerItemGroupCooldownEvent extends PlayerEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + -+ private final Material type; ++ private final NamespacedKey cooldownGroup; + private int cooldown; + + private boolean cancelled; + + @ApiStatus.Internal -+ public PlayerItemCooldownEvent(final Player player, final Material type, final int cooldown) { ++ public PlayerItemGroupCooldownEvent(final Player player, final NamespacedKey cooldownGroup, final int cooldown) { + super(player); -+ this.type = type; ++ this.cooldownGroup = cooldownGroup; + this.cooldown = cooldown; + } + + /** -+ * Get the material affected by the cooldown. ++ * Get the cooldown group as defined by an item's {@link org.bukkit.inventory.meta.components.UseCooldownComponent}. + * -+ * @return material affected by the cooldown ++ * @return cooldown group + */ -+ public Material getType() { -+ return this.type; ++ public NamespacedKey getCooldownGroup() { ++ return this.cooldownGroup; + } + + /** diff --git a/patches/api/0260-More-World-API.patch b/patches/api/0260-More-World-API.patch index 3e453dac00..72e7008eb5 100644 --- a/patches/api/0260-More-World-API.patch +++ b/patches/api/0260-More-World-API.patch @@ -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); diff --git a/patches/api/0348-Expand-FallingBlock-API.patch b/patches/api/0348-Expand-FallingBlock-API.patch index 787bb82c19..94e67cd25a 100644 --- a/patches/api/0348-Expand-FallingBlock-API.patch +++ b/patches/api/0348-Expand-FallingBlock-API.patch @@ -10,10 +10,10 @@ Subject: [PATCH] Expand FallingBlock API Co-authored-by: Lukas Planz 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 diff --git a/patches/api/0353-More-Teleport-API.patch b/patches/api/0353-More-Teleport-API.patch index 83cd2cd870..84e42259e2 100644 --- a/patches/api/0353-More-Teleport-API.patch +++ b/patches/api/0353-More-Teleport-API.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..544eec787ea837f7d29df6519255840d +} diff --git a/src/main/java/io/papermc/paper/entity/TeleportFlag.java b/src/main/java/io/papermc/paper/entity/TeleportFlag.java new file mode 100644 -index 0000000000000000000000000000000000000000..bbc006152ac7885e1ffd05e84073ac1af45cc1a3 +index 0000000000000000000000000000000000000000..9dbbe1f3cfda3b1862fd9cf1ef9853329eda750c --- /dev/null +++ b/src/main/java/io/papermc/paper/entity/TeleportFlag.java @@ -0,0 +1,113 @@ @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..bbc006152ac7885e1ffd05e84073ac1a + /** + * Note: These flags only work on {@link org.bukkit.entity.Player} entities. + *

-+ * Relative flags enable a player to not loose their velocity in the flag-specific axis/context when teleporting. ++ * Relative flags enable a player to not lose their velocity in the flag-specific axis/context when teleporting. + * + * @apiNote The relative flags exposed in the API do *not* mirror all flags known to vanilla, as relative flags concerning + * the position are non-applicable given teleports always expect an absolute location. @@ -65,19 +65,19 @@ index 0000000000000000000000000000000000000000..bbc006152ac7885e1ffd05e84073ac1a + */ + enum Relative implements TeleportFlag { + /** -+ * Configures the player to not loose velocity in their x axis during the teleport. ++ * Configures the player to not lose velocity in their x axis during the teleport. + */ + VELOCITY_X, + /** -+ * Configures the player to not loose velocity in their y axis during the teleport. ++ * Configures the player to not lose velocity in their y axis during the teleport. + */ + VELOCITY_Y, + /** -+ * Configures the player to not loose velocity in their z axis during the teleport. ++ * Configures the player to not lose velocity in their z axis during the teleport. + */ + VELOCITY_Z, + /** -+ * Configures the player to not loose velocity in their current rotation during the teleport. ++ * Configures the player to not lose velocity in their current rotation during the teleport. + */ + VELOCITY_ROTATION; + /** diff --git a/patches/api/0421-Add-predicate-for-blocks-when-raytracing.patch b/patches/api/0421-Add-predicate-for-blocks-when-raytracing.patch index e24c9fcedf..b2f0a44527 100644 --- a/patches/api/0421-Add-predicate-for-blocks-when-raytracing.patch +++ b/patches/api/0421-Add-predicate-for-blocks-when-raytracing.patch @@ -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 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. *

-@@ -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 filter); diff --git a/patches/api/0455-More-Raid-API.patch b/patches/api/0455-More-Raid-API.patch index 947b51c645..4df004960a 100644 --- a/patches/api/0455-More-Raid-API.patch +++ b/patches/api/0455-More-Raid-API.patch @@ -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); diff --git a/patches/api/0472-Introduce-registry-entry-and-builders.patch b/patches/api/0472-Introduce-registry-entry-and-builders.patch index 56e6efc80a..0a25fd735e 100644 --- a/patches/api/0472-Introduce-registry-entry-and-builders.patch +++ b/patches/api/0472-Introduce-registry-entry-and-builders.patch @@ -1,5 +1,5 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll +From: Bjarne Koll Date: Thu, 13 Jun 2024 22:35:05 +0200 Subject: [PATCH] Introduce registry entry and builders diff --git a/patches/api/0495-DataComponent-API.patch b/patches/api/0495-DataComponent-API.patch new file mode 100644 index 0000000000..9284c1e00b --- /dev/null +++ b/patches/api/0495-DataComponent-API.patch @@ -0,0 +1,4186 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 28 Apr 2024 19:53:06 -0400 +Subject: [PATCH] DataComponent API + +Exposes the data component logic used by vanilla ItemStack to API +consumers as a version-specific API. +The types and methods introduced by this patch do not follow the general +API deprecation contracts and will be adapted to each new minecraft +release without backwards compatibility measures. + +diff --git a/src/main/java/io/papermc/paper/block/BlockPredicate.java b/src/main/java/io/papermc/paper/block/BlockPredicate.java +new file mode 100644 +index 0000000000000000000000000000000000000000..92ea82ee95c449916955631297a059f1b9198c9b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/block/BlockPredicate.java +@@ -0,0 +1,50 @@ ++package io.papermc.paper.block; ++ ++import io.papermc.paper.registry.set.RegistryKeySet; ++import org.bukkit.block.BlockType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface BlockPredicate { ++ ++ static Builder predicate() { ++ // ++ record BlockPredicateImpl(@Nullable RegistryKeySet blocks) implements BlockPredicate { ++ } ++ ++ class BuilderImpl implements Builder { ++ ++ private @Nullable RegistryKeySet blocks; ++ ++ @Override ++ public Builder blocks(final @Nullable RegistryKeySet blocks) { ++ this.blocks = blocks; ++ return this; ++ } ++ ++ @Override ++ public BlockPredicate build() { ++ return new BlockPredicateImpl(this.blocks); ++ } ++ } ++ // ++ return new BuilderImpl(); ++ } ++ ++ @Nullable RegistryKeySet blocks(); ++ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder { ++ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder blocks(@Nullable RegistryKeySet blocks); ++ ++ BlockPredicate build(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/BuildableDataComponent.java b/src/main/java/io/papermc/paper/datacomponent/BuildableDataComponent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4d2ee71b82ff4a66c7f84e73c028f146e0f851ad +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/BuildableDataComponent.java +@@ -0,0 +1,19 @@ ++package io.papermc.paper.datacomponent; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface BuildableDataComponent, B extends DataComponentBuilder> { ++ ++ /** ++ * Creates a new builder from this data component. ++ * ++ * @return a new builder ++ */ ++ @Contract(value = "-> new", pure = true) ++ B toBuilder(); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/DataComponentBuilder.java b/src/main/java/io/papermc/paper/datacomponent/DataComponentBuilder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9365e57499c8e337a40835b2ec9a92ebe4391bfc +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/DataComponentBuilder.java +@@ -0,0 +1,24 @@ ++package io.papermc.paper.datacomponent; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Base builder type for all component builders. ++ * ++ * @param built component type ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface DataComponentBuilder { ++ ++ /** ++ * Builds the immutable component value. ++ * ++ * @return a new component value ++ */ ++ @Contract(value = "-> new", pure = true) ++ C build(); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/DataComponentType.java b/src/main/java/io/papermc/paper/datacomponent/DataComponentType.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e2266d86a4dd1bf20346e48c428f8baf8a84b76b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/DataComponentType.java +@@ -0,0 +1,30 @@ ++package io.papermc.paper.datacomponent; ++ ++import org.bukkit.Keyed; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface DataComponentType extends Keyed { ++ ++ /** ++ * Checks if this data component type is persistent, or ++ * that it will be saved with any itemstack it's attached to. ++ * ++ * @return {@code true} if persistent, {@code false} otherwise ++ */ ++ boolean isPersistent(); ++ ++ @SuppressWarnings("unused") ++ @ApiStatus.NonExtendable ++ interface Valued extends DataComponentType { ++ ++ } ++ ++ @ApiStatus.NonExtendable ++ interface NonValued extends DataComponentType { ++ ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java b/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e79737ae012179fc7c89b14af8801b8b09fa042b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java +@@ -0,0 +1,344 @@ ++package io.papermc.paper.datacomponent; ++ ++import io.papermc.paper.datacomponent.item.BannerPatternLayers; ++import io.papermc.paper.datacomponent.item.BlockItemDataProperties; ++import io.papermc.paper.datacomponent.item.BundleContents; ++import io.papermc.paper.datacomponent.item.ChargedProjectiles; ++import io.papermc.paper.datacomponent.item.Consumable; ++import io.papermc.paper.datacomponent.item.CustomModelData; ++import io.papermc.paper.datacomponent.item.DamageResistant; ++import io.papermc.paper.datacomponent.item.DeathProtection; ++import io.papermc.paper.datacomponent.item.DyedItemColor; ++import io.papermc.paper.datacomponent.item.Enchantable; ++import io.papermc.paper.datacomponent.item.Equippable; ++import io.papermc.paper.datacomponent.item.Fireworks; ++import io.papermc.paper.datacomponent.item.FoodProperties; ++import io.papermc.paper.datacomponent.item.ItemAdventurePredicate; ++import io.papermc.paper.datacomponent.item.ItemArmorTrim; ++import io.papermc.paper.datacomponent.item.ItemAttributeModifiers; ++import io.papermc.paper.datacomponent.item.ItemContainerContents; ++import io.papermc.paper.datacomponent.item.ItemEnchantments; ++import io.papermc.paper.datacomponent.item.ItemLore; ++import io.papermc.paper.datacomponent.item.JukeboxPlayable; ++import io.papermc.paper.datacomponent.item.LodestoneTracker; ++import io.papermc.paper.datacomponent.item.MapDecorations; ++import io.papermc.paper.datacomponent.item.MapId; ++import io.papermc.paper.datacomponent.item.MapItemColor; ++import io.papermc.paper.datacomponent.item.OminousBottleAmplifier; ++import io.papermc.paper.datacomponent.item.PotDecorations; ++import io.papermc.paper.datacomponent.item.PotionContents; ++import io.papermc.paper.datacomponent.item.Repairable; ++import io.papermc.paper.datacomponent.item.ResolvableProfile; ++import io.papermc.paper.datacomponent.item.SeededContainerLoot; ++import io.papermc.paper.datacomponent.item.SuspiciousStewEffects; ++import io.papermc.paper.datacomponent.item.Tool; ++import io.papermc.paper.datacomponent.item.Unbreakable; ++import io.papermc.paper.datacomponent.item.UseCooldown; ++import io.papermc.paper.datacomponent.item.UseRemainder; ++import io.papermc.paper.datacomponent.item.WritableBookContent; ++import io.papermc.paper.datacomponent.item.WrittenBookContent; ++import io.papermc.paper.item.MapPostProcessing; ++import java.util.List; ++import net.kyori.adventure.key.Key; ++import net.kyori.adventure.text.Component; ++import org.bukkit.DyeColor; ++import org.bukkit.FireworkEffect; ++import org.bukkit.MusicInstrument; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.bukkit.inventory.ItemRarity; ++import org.checkerframework.checker.index.qual.NonNegative; ++import org.checkerframework.checker.index.qual.Positive; ++import org.checkerframework.common.value.qual.IntRange; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++import static java.util.Objects.requireNonNull; ++ ++/** ++ * All the different types of data that {@link org.bukkit.inventory.ItemStack ItemStacks} ++ * and {@link org.bukkit.inventory.ItemType ItemTypes} can have. ++ */ ++@NullMarked ++@ApiStatus.Experimental ++public final class DataComponentTypes { ++ ++ /** ++ * Controls the maximum stacking size of this item. ++ *
++ * Values greater than 1 are mutually exclusive with the {@link #MAX_DAMAGE} component. ++ */ ++ public static final DataComponentType.Valued<@IntRange(from = 1, to = 99) Integer> MAX_STACK_SIZE = valued("max_stack_size"); ++ /** ++ * Controls the maximum amount of damage than an item can take, ++ * if not present, the item cannot be damaged. ++ *
++ * Mutually exclusive with the {@link #MAX_STACK_SIZE} component greater than 1. ++ * ++ * @see #DAMAGE ++ */ ++ public static final DataComponentType.Valued<@Positive Integer> MAX_DAMAGE = valued("max_damage"); ++ /** ++ * The amount of durability removed from an item, ++ * for damageable items (with the {@link #MAX_DAMAGE} component), has an implicit default value of: {@code 0}. ++ * ++ * @see #MAX_DAMAGE ++ */ ++ public static final DataComponentType.Valued<@NonNegative Integer> DAMAGE = valued("damage"); ++ /** ++ * If set, the item will not lose any durability when used. ++ */ ++ public static final DataComponentType.Valued UNBREAKABLE = valued("unbreakable"); ++ /** ++ * Custom name override for an item (as set by renaming with an Anvil). ++ * ++ * @see #ITEM_NAME ++ */ ++ public static final DataComponentType.Valued CUSTOM_NAME = valued("custom_name"); ++ /** ++ * When present, replaces default item name with contained chat component. ++ *

++ * Differences from {@link #CUSTOM_NAME}: ++ *

    ++ *
  • can't be changed or removed in Anvil
  • ++ *
  • is not styled with italics when displayed to player
  • ++ *
  • does not show labels where applicable ++ * (for example: banner markers, names in item frames)
  • ++ *
++ * ++ * @see #CUSTOM_NAME ++ */ ++ public static final DataComponentType.Valued ITEM_NAME = valued("item_name"); ++ public static final DataComponentType.Valued ITEM_MODEL = valued("item_model"); ++ /** ++ * Additional lines to include in an item's tooltip. ++ */ ++ public static final DataComponentType.Valued LORE = valued("lore"); ++ /** ++ * Controls the color of the item name. ++ */ ++ public static final DataComponentType.Valued RARITY = valued("rarity"); ++ /** ++ * Controls the enchantments on an item. ++ *
++ * If not present on a non-enchantment book, this item will not work in an anvil. ++ * ++ * @see #STORED_ENCHANTMENTS ++ */ ++ public static final DataComponentType.Valued ENCHANTMENTS = valued("enchantments"); ++ /** ++ * Controls which blocks a player in Adventure mode can place on with this item. ++ */ ++ public static final DataComponentType.Valued CAN_PLACE_ON = valued("can_place_on"); ++ /** ++ * Controls which blocks a player in Adventure mode can break with this item. ++ */ ++ public static final DataComponentType.Valued CAN_BREAK = valued("can_break"); ++ /** ++ * Holds attribute modifiers applied to any item, ++ * if not set, has an implicit default value based on the item type's ++ * default attributes (e.g. attack damage for weapons). ++ */ ++ public static final DataComponentType.Valued ATTRIBUTE_MODIFIERS = valued("attribute_modifiers"); ++ /** ++ * Controls the minecraft:custom_model_data property in the item model. ++ */ ++ public static final DataComponentType.Valued CUSTOM_MODEL_DATA = valued("custom_model_data"); ++ /** ++ * If set, disables 'additional' tooltip part which comes from the item type ++ * (e.g. content of a shulker). ++ */ ++ public static final DataComponentType.NonValued HIDE_ADDITIONAL_TOOLTIP = unvalued("hide_additional_tooltip"); ++ /** ++ * If set, it will completely hide whole item tooltip (that includes item name). ++ */ ++ public static final DataComponentType.NonValued HIDE_TOOLTIP = unvalued("hide_tooltip"); ++ /** ++ * The additional experience cost required to modify an item in an Anvil. ++ * If not present, has an implicit default value of: {@code 0}. ++ */ ++ public static final DataComponentType.Valued<@NonNegative Integer> REPAIR_COST = valued("repair_cost"); ++ /** ++ * Causes an item to not be pickable in the creative menu, currently not very useful. ++ */ ++ // public static final DataComponentType.NonValued CREATIVE_SLOT_LOCK = unvalued("creative_slot_lock"); ++ /** ++ * Overrides the enchantment glint effect on an item. ++ * If not present, default behaviour is used. ++ */ ++ public static final DataComponentType.Valued ENCHANTMENT_GLINT_OVERRIDE = valued("enchantment_glint_override"); ++ /** ++ * Marks that a projectile item would be intangible when fired ++ * (i.e. can only be picked up by a creative mode player). ++ */ ++ public static final DataComponentType.NonValued INTANGIBLE_PROJECTILE = unvalued("intangible_projectile"); ++ /** ++ * Controls potential food benefits gained when consuming the item the component is applied on. ++ * Requires the {@link #CONSUMABLE} component to allow consumption in the first place. ++ */ ++ public static final DataComponentType.Valued FOOD = valued("food"); ++ public static final DataComponentType.Valued CONSUMABLE = valued("consumable"); ++ public static final DataComponentType.Valued USE_REMAINDER = valued("use_remainder"); ++ public static final DataComponentType.Valued USE_COOLDOWN = valued("use_cooldown"); ++ /** ++ * If present, this item will not burn in fire. ++ */ ++ public static final DataComponentType.Valued DAMAGE_RESISTANT = valued("damage_resistant"); ++ /** ++ * Controls the behavior of the item as a tool. ++ */ ++ public static final DataComponentType.Valued TOOL = valued("tool"); ++ public static final DataComponentType.Valued ENCHANTABLE = valued("enchantable"); ++ public static final DataComponentType.Valued EQUIPPABLE = valued("equippable"); ++ public static final DataComponentType.Valued REPAIRABLE = valued("repairable"); ++ public static final DataComponentType.NonValued GLIDER = unvalued("glider"); ++ public static final DataComponentType.Valued TOOLTIP_STYLE = valued("tooltip_style"); ++ public static final DataComponentType.Valued DEATH_PROTECTION = valued("death_protection"); ++ /** ++ * Stores list of enchantments and their levels for an Enchanted Book. ++ * Unlike {@link #ENCHANTMENTS}, the effects provided by enchantments ++ * do not apply from this component. ++ *
++ * If not present on an Enchanted Book, it will not work in an anvil. ++ *

++ * Has an undefined behaviour if present on an item that is not an Enchanted Book ++ * (currently the presence of this component allows enchantments from {@link #ENCHANTMENTS} ++ * to be applied as if this item was an Enchanted Book). ++ * ++ * @see #ENCHANTMENTS ++ */ ++ public static final DataComponentType.Valued STORED_ENCHANTMENTS = valued("stored_enchantments"); ++ /** ++ * Represents a color applied to a dyeable item (in the {@link io.papermc.paper.registry.keys.tags.ItemTypeTagKeys#DYEABLE} item tag). ++ */ ++ public static final DataComponentType.Valued DYED_COLOR = valued("dyed_color"); ++ /** ++ * Represents the tint of the decorations on the {@link org.bukkit.inventory.ItemType#FILLED_MAP} item. ++ */ ++ public static final DataComponentType.Valued MAP_COLOR = valued("map_color"); ++ /** ++ * References the shared map state holding map contents and markers for a {@link org.bukkit.inventory.ItemType#FILLED_MAP}. ++ */ ++ public static final DataComponentType.Valued MAP_ID = valued("map_id"); ++ /** ++ * Holds a list of markers to be placed on a {@link org.bukkit.inventory.ItemType#FILLED_MAP} (used for Explorer Maps). ++ */ ++ public static final DataComponentType.Valued MAP_DECORATIONS = valued("map_decorations"); ++ /** ++ * Internal map item state used in the map crafting recipe. ++ */ ++ public static final DataComponentType.Valued MAP_POST_PROCESSING = valued("map_post_processing"); ++ /** ++ * Holds all projectiles that have been loaded into a Crossbow. ++ * If not present, the Crossbow is not charged. ++ */ ++ public static final DataComponentType.Valued CHARGED_PROJECTILES = valued("charged_projectiles"); ++ /** ++ * Holds all items stored inside a Bundle. ++ * If removed, items cannot be added to the Bundle. ++ */ ++ public static final DataComponentType.Valued BUNDLE_CONTENTS = valued("bundle_contents"); ++ /** ++ * Holds the contents of a potion (Potion, Splash Potion, Lingering Potion), ++ * or potion applied to a Tipped Arrow. ++ */ ++ public static final DataComponentType.Valued POTION_CONTENTS = valued("potion_contents"); ++ /** ++ * Holds the effects that will be applied when consuming Suspicious Stew. ++ */ ++ public static final DataComponentType.Valued SUSPICIOUS_STEW_EFFECTS = valued("suspicious_stew_effects"); ++ /** ++ * Holds the contents in a Book and Quill. ++ */ ++ public static final DataComponentType.Valued WRITABLE_BOOK_CONTENT = valued("writable_book_content"); ++ /** ++ * Holds the contents and metadata of a Written Book. ++ */ ++ public static final DataComponentType.Valued WRITTEN_BOOK_CONTENT = valued("written_book_content"); ++ /** ++ * Holds the trims applied to an item in recipes ++ */ ++ public static final DataComponentType.Valued TRIM = valued("trim"); ++ // debug_stick_state - Block Property API ++ // entity_data ++ // bucket_entity_data ++ // block_entity_data ++ /** ++ * Holds the instrument type used by a Goat Horn. ++ */ ++ public static final DataComponentType.Valued INSTRUMENT = valued("instrument"); ++ /** ++ * Controls the amplifier amount for an Ominous Bottle's Bad Omen effect. ++ */ ++ public static final DataComponentType.Valued OMINOUS_BOTTLE_AMPLIFIER = valued("ominous_bottle_amplifier"); ++ /** ++ * List of recipes that should be unlocked when using the Knowledge Book item. ++ */ ++ public static final DataComponentType.Valued JUKEBOX_PLAYABLE = valued("jukebox_playable"); ++ public static final DataComponentType.Valued> RECIPES = valued("recipes"); ++ /** ++ * If present, specifies that the Compass is a Lodestone Compass. ++ */ ++ public static final DataComponentType.Valued LODESTONE_TRACKER = valued("lodestone_tracker"); ++ /** ++ * Stores the explosion crafted in a Firework Star. ++ */ ++ public static final DataComponentType.Valued FIREWORK_EXPLOSION = valued("firework_explosion"); ++ /** ++ * Stores all explosions crafted into a Firework Rocket, as well as flight duration. ++ */ ++ public static final DataComponentType.Valued FIREWORKS = valued("fireworks"); ++ /** ++ * Controls the skin displayed on a Player Head. ++ */ ++ public static final DataComponentType.Valued PROFILE = valued("profile"); ++ /** ++ * Controls the sound played by a Player Head when placed on a Note Block. ++ */ ++ public static final DataComponentType.Valued NOTE_BLOCK_SOUND = valued("note_block_sound"); ++ /** ++ * Stores the additional patterns applied to a Banner or Shield. ++ */ ++ public static final DataComponentType.Valued BANNER_PATTERNS = valued("banner_patterns"); ++ /** ++ * Stores the base color for a Shield. ++ */ ++ public static final DataComponentType.Valued BASE_COLOR = valued("base_color"); ++ /** ++ * Stores the Sherds applied to each side of a Decorated Pot. ++ */ ++ public static final DataComponentType.Valued POT_DECORATIONS = valued("pot_decorations"); ++ /** ++ * Holds the contents of container blocks (Chests, Shulker Boxes) in item form. ++ */ ++ public static final DataComponentType.Valued CONTAINER = valued("container"); ++ /** ++ * Holds block state properties to apply when placing a block. ++ */ ++ public static final DataComponentType.Valued BLOCK_DATA = valued("block_state"); ++ // bees ++ // /** ++ // * Holds the lock state of a container-like block, ++ // * copied to container block when placed. ++ // *
++ // * An item with a custom name of the same value must be used ++ // * to open this container. ++ // */ ++ // public static final DataComponentType.Valued LOCK = valued("lock"); ++ /** ++ * Holds the unresolved loot table and seed of a container-like block. ++ */ ++ public static final DataComponentType.Valued CONTAINER_LOOT = valued("container_loot"); ++ ++ private static DataComponentType.NonValued unvalued(final String name) { ++ return (DataComponentType.NonValued) requireNonNull(Registry.DATA_COMPONENT_TYPE.get(NamespacedKey.minecraft(name)), name + " unvalued data component type couldn't be found, this is a bug."); ++ } ++ ++ @SuppressWarnings("unchecked") ++ private static DataComponentType.Valued valued(final String name) { ++ return (DataComponentType.Valued) requireNonNull(Registry.DATA_COMPONENT_TYPE.get(NamespacedKey.minecraft(name)), name + " valued data component type couldn't be found, this is a bug."); ++ } ++ ++ private DataComponentTypes() { ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/BannerPatternLayers.java b/src/main/java/io/papermc/paper/datacomponent/item/BannerPatternLayers.java +new file mode 100644 +index 0000000000000000000000000000000000000000..12cfae82234b8c4cb231ab91e72ad82d28b85183 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/BannerPatternLayers.java +@@ -0,0 +1,66 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.Arrays; ++import java.util.List; ++import org.bukkit.block.banner.Pattern; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the layers of patterns on a banner. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#BANNER_PATTERNS ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface BannerPatternLayers { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static BannerPatternLayers bannerPatternLayers(final List patterns) { ++ return bannerPatternLayers().addAll(patterns).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static BannerPatternLayers.Builder bannerPatternLayers() { ++ return ItemComponentTypesBridge.bridge().bannerPatternLayers(); ++ } ++ ++ /** ++ * Gets the patterns on the banner. ++ * ++ * @return the patterns ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List patterns(); ++ ++ /** ++ * Builder for {@link BannerPatternLayers}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Adds a pattern to the banner. ++ * ++ * @param pattern the pattern ++ * @return the builder for chaining ++ * @see #patterns() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder add(Pattern pattern); ++ ++ /** ++ * Adds multiple patterns to the banner. ++ * ++ * @param patterns the patterns ++ * @return the builder for chaining ++ * @see #patterns() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addAll(List patterns); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/BlockItemDataProperties.java b/src/main/java/io/papermc/paper/datacomponent/item/BlockItemDataProperties.java +new file mode 100644 +index 0000000000000000000000000000000000000000..65f1bc8d1bea0042dca9683c439561132dbeea5c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/BlockItemDataProperties.java +@@ -0,0 +1,51 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.bukkit.block.BlockType; ++import org.bukkit.block.data.BlockData; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the {@link BlockData} properties of a block item. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#BLOCK_DATA ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface BlockItemDataProperties { ++ ++ @Contract(value = "-> new", pure = true) ++ static BlockItemDataProperties.Builder blockItemStateProperties() { ++ return ItemComponentTypesBridge.bridge().blockItemStateProperties(); ++ } ++ ++ /** ++ * Creates a new {@link BlockData} instance for the given {@link BlockType}. ++ * ++ * @param blockType the block type ++ * @return the block data ++ */ ++ @Contract(pure = true) ++ BlockData createBlockData(BlockType blockType); ++ ++ /** ++ * Applies the properties to the given {@link BlockData}. Doesn't ++ * mutate the parameter, but returns a new instance with the properties applied. ++ * ++ * @param blockData the block data to apply the properties to ++ * @return the block data with the properties applied ++ */ ++ @Contract(pure = true) ++ BlockData applyTo(BlockData blockData); ++ ++ /** ++ * Builder for {@link BlockItemDataProperties}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ // building this requires BlockProperty API, so an empty builder for now (essentially read-only) ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/BundleContents.java b/src/main/java/io/papermc/paper/datacomponent/item/BundleContents.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c0f671aef8225c87632d2368d1b28fc8b1bce686 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/BundleContents.java +@@ -0,0 +1,66 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.Arrays; ++import java.util.List; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds all items stored inside of a Bundle. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#BUNDLE_CONTENTS ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface BundleContents { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static BundleContents bundleContents(final List contents) { ++ return ItemComponentTypesBridge.bridge().bundleContents().addAll(contents).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static BundleContents.Builder bundleContents() { ++ return ItemComponentTypesBridge.bridge().bundleContents(); ++ } ++ ++ /** ++ * Lists the items that are currently stored inside of this component. ++ * ++ * @return items ++ */ ++ @Contract(value = "-> new", pure = true) ++ @Unmodifiable List contents(); ++ ++ /** ++ * Builder for {@link BundleContents}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Adds an item to this builder. ++ * ++ * @param stack item ++ * @return the builder for chaining ++ * @see #contents() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder add(ItemStack stack); ++ ++ /** ++ * Adds items to this builder. ++ * ++ * @param stacks items ++ * @return the builder for chaining ++ * @see #contents() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addAll(List stacks); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ChargedProjectiles.java b/src/main/java/io/papermc/paper/datacomponent/item/ChargedProjectiles.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d0a6e7db06f540e13ac00e8da3acabd9f7838f1f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ChargedProjectiles.java +@@ -0,0 +1,66 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.Arrays; ++import java.util.List; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds all projectiles that have been loaded into a Crossbow. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#CHARGED_PROJECTILES ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ChargedProjectiles { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static ChargedProjectiles chargedProjectiles(final List projectiles) { ++ return chargedProjectiles().addAll(projectiles).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static ChargedProjectiles.Builder chargedProjectiles() { ++ return ItemComponentTypesBridge.bridge().chargedProjectiles(); ++ } ++ ++ /** ++ * Lists the projectiles that are currently loaded into this component. ++ * ++ * @return the loaded projectiles ++ */ ++ @Contract(value = "-> new", pure = true) ++ @Unmodifiable List projectiles(); ++ ++ /** ++ * Builder for {@link ChargedProjectiles}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Adds a projectile to be loaded in this builder. ++ * ++ * @param stack projectile ++ * @return the builder for chaining ++ * @see #projectiles() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder add(ItemStack stack); ++ ++ /** ++ * Adds projectiles to be loaded in this builder. ++ * ++ * @param stacks projectiles ++ * @return the builder for chaining ++ * @see #projectiles() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addAll(List stacks); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Consumable.java b/src/main/java/io/papermc/paper/datacomponent/item/Consumable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a448fedb63ffce18b9f6a1bd0fecfc5cd90224a6 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/Consumable.java +@@ -0,0 +1,70 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.BuildableDataComponent; ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect; ++import io.papermc.paper.datacomponent.item.consumable.ItemUseAnimation; ++import java.util.Collection; ++import java.util.List; ++import net.kyori.adventure.key.Key; ++import org.checkerframework.checker.index.qual.NonNegative; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the properties for this item for when it is consumed. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#CONSUMABLE ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface Consumable extends BuildableDataComponent { ++ ++ @Contract(value = "-> new", pure = true) ++ static Consumable.Builder consumable() { ++ return ItemComponentTypesBridge.bridge().consumable(); ++ } ++ ++ @Contract(pure = true) ++ @NonNegative float consumeSeconds(); ++ ++ @Contract(pure = true) ++ ItemUseAnimation animation(); ++ ++ @Contract(pure = true) ++ Key sound(); ++ ++ @Contract(pure = true) ++ boolean hasConsumeParticles(); ++ ++ @Contract(pure = true) ++ @Unmodifiable List consumeEffects(); ++ ++ /** ++ * Builder for {@link Consumable}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder consumeSeconds(@NonNegative float consumeSeconds); ++ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder animation(ItemUseAnimation animation); ++ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder sound(Key sound); ++ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder hasConsumeParticles(boolean hasConsumeParticles); ++ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addEffect(ConsumeEffect effect); ++ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addEffects(List effects); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/CustomModelData.java b/src/main/java/io/papermc/paper/datacomponent/item/CustomModelData.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d416c9d25b3ab88bf1e208c6faf92a8e2378c376 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/CustomModelData.java +@@ -0,0 +1,28 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the custom model data. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#CUSTOM_MODEL_DATA ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface CustomModelData { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static CustomModelData customModelData(final int id) { ++ return ItemComponentTypesBridge.bridge().customModelData(id); ++ } ++ ++ /** ++ * Gets the custom model data id. ++ * ++ * @return the id ++ */ ++ @Contract(pure = true) ++ int id(); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/DamageResistant.java b/src/main/java/io/papermc/paper/datacomponent/item/DamageResistant.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6cbd73cb2a11f4858b44a2f57d2fe0acb1eb9fb5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/DamageResistant.java +@@ -0,0 +1,30 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.registry.tag.TagKey; ++import org.bukkit.damage.DamageType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the contents of damage types that the item entity containing this item is invincible to. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#DAMAGE_RESISTANT ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface DamageResistant { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static DamageResistant damageResistant(final TagKey types) { ++ return ItemComponentTypesBridge.bridge().damageResistant(types); ++ } ++ ++ /** ++ * The types that this damage type is invincible tp. ++ * ++ * @return item ++ */ ++ @Contract(value = "-> new", pure = true) ++ TagKey types(); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/DeathProtection.java b/src/main/java/io/papermc/paper/datacomponent/item/DeathProtection.java +new file mode 100644 +index 0000000000000000000000000000000000000000..87c2220708af7db06348994ad5940c7cecd9f691 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/DeathProtection.java +@@ -0,0 +1,48 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect; ++import java.util.Arrays; ++import java.util.Collection; ++import java.util.List; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Sets whether this item should protect the entity upon death, and what effects should be played. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#DEATH_PROTECTION ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface DeathProtection { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static DeathProtection deathProtection(final List deathEffects) { ++ return deathProtection().addEffects(deathEffects).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static DeathProtection.Builder deathProtection() { ++ return ItemComponentTypesBridge.bridge().deathProtection(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ @Unmodifiable List deathEffects(); ++ ++ /** ++ * Builder for {@link DeathProtection}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addEffect(ConsumeEffect effect); ++ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addEffects(List effects); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/DyedItemColor.java b/src/main/java/io/papermc/paper/datacomponent/item/DyedItemColor.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d80581fc8b894cc4d4af9741244b1bb03468b263 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/DyedItemColor.java +@@ -0,0 +1,53 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.bukkit.Color; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Represents a color applied to a dyeable item. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#DYED_COLOR ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface DyedItemColor extends ShownInTooltip { ++ ++ @Contract(value = "_, _ -> new", pure = true) ++ static DyedItemColor dyedItemColor(final Color color, final boolean showInTooltip) { ++ return dyedItemColor().color(color).showInTooltip(showInTooltip).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static DyedItemColor.Builder dyedItemColor() { ++ return ItemComponentTypesBridge.bridge().dyedItemColor(); ++ } ++ ++ /** ++ * Color of the item. ++ * ++ * @return color ++ */ ++ @Contract(value = "-> new", pure = true) ++ Color color(); ++ ++ /** ++ * Builder for {@link DyedItemColor}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends ShownInTooltip.Builder, DataComponentBuilder { ++ ++ /** ++ * Sets the color of this builder. ++ * ++ * @param color color ++ * @return the builder for chaining ++ * @see #color() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder color(Color color); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Enchantable.java b/src/main/java/io/papermc/paper/datacomponent/item/Enchantable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5169b9cd73dc0ffc8297f8d5f63d3d707a47d279 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/Enchantable.java +@@ -0,0 +1,31 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.checkerframework.checker.index.qual.Positive; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds if an item is enchantable, allowing for enchantments of the type to be seen in an enchanting table. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#ENCHANTABLE ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface Enchantable { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static Enchantable enchantable(final @Positive int level) { ++ return ItemComponentTypesBridge.bridge().enchantable(level); ++ } ++ ++ /** ++ * Gets the current enchantment value level allowed, ++ * a higher value allows enchantments with a higher cost to be picked. ++ * ++ * @see Minecraft Wiki ++ * @return the value ++ */ ++ @Contract(pure = true) ++ @Positive int value(); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Equippable.java b/src/main/java/io/papermc/paper/datacomponent/item/Equippable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7d84217814bba4ce826e33755fee0d5c3b280009 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/Equippable.java +@@ -0,0 +1,170 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.BuildableDataComponent; ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import io.papermc.paper.registry.set.RegistryKeySet; ++import net.kyori.adventure.key.Key; ++import org.bukkit.entity.EntityType; ++import org.bukkit.inventory.EquipmentSlot; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++ ++/** ++ * Holds the equippable properties of an item. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#EQUIPPABLE ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface Equippable extends BuildableDataComponent { ++ ++ /** ++ * Creates a new {@link Equippable.Builder} instance. ++ * @param slot The slot for the new equippable to be equippable in. ++ * ++ * @return a new builder ++ */ ++ @Contract(value = "_ -> new", pure = true) ++ static Equippable.Builder equippable(final EquipmentSlot slot) { ++ return ItemComponentTypesBridge.bridge().equippable(slot); ++ } ++ ++ /** ++ * Gets the equipment slot this item can be equipped in. ++ * ++ * @return the equipment slot ++ */ ++ @Contract(pure = true) ++ EquipmentSlot slot(); ++ ++ /** ++ * Gets the equip sound key. ++ * ++ * @return the equip sound key ++ */ ++ @Contract(pure = true) ++ Key equipSound(); ++ ++ /** ++ * Gets the model key if present. ++ * ++ * @return the model key or null ++ */ ++ @Contract(pure = true) ++ @Nullable Key model(); ++ ++ /** ++ * Gets the camera overlay key if present. ++ * ++ * @return the camera overlay key or null ++ */ ++ @Contract(pure = true) ++ @Nullable Key cameraOverlay(); ++ ++ /** ++ * Gets the set of allowed entities that can equip this item. ++ * May be null if all entities are allowed. ++ * ++ * @return the set of allowed entities ++ */ ++ @Contract(pure = true) ++ @Nullable RegistryKeySet allowedEntities(); ++ ++ /** ++ * Checks if the item is dispensable. ++ * ++ * @return true if dispensable, false otherwise ++ */ ++ @Contract(pure = true) ++ boolean dispensable(); ++ ++ /** ++ * Checks if the item is swappable. ++ * ++ * @return true if swappable, false otherwise ++ */ ++ @Contract(pure = true) ++ boolean swappable(); ++ ++ /** ++ * Checks if the item takes damage when the wearer is hurt. ++ * ++ * @return true if it damages on hurt, false otherwise ++ */ ++ @Contract(pure = true) ++ boolean damageOnHurt(); ++ ++ /** ++ * Builder for {@link Equippable}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets the equip sound key for this item. ++ * ++ * @param equipSound the equip sound key ++ * @return the builder for chaining ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder equipSound(Key equipSound); ++ ++ /** ++ * Sets the model key for this item. ++ * ++ * @param model the model key, nullable ++ * @return the builder for chaining ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder model(@Nullable Key model); ++ ++ /** ++ * Sets the camera overlay key for this item. ++ * ++ * @param cameraOverlay the camera overlay key, nullable ++ * @return the builder for chaining ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder cameraOverlay(@Nullable Key cameraOverlay); ++ ++ /** ++ * Sets the allowed entities that can equip this item. ++ * ++ * @param allowedEntities the set of allowed entity types, or null if any ++ * @return the builder for chaining ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder allowedEntities(@Nullable RegistryKeySet allowedEntities); ++ ++ /** ++ * Sets whether the item is dispensable. ++ * ++ * @param dispensable true if dispensable ++ * @return the builder for chaining ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder dispensable(boolean dispensable); ++ ++ /** ++ * Sets whether the item is swappable. ++ * ++ * @param swappable true if swappable ++ * @return the builder for chaining ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder swappable(boolean swappable); ++ ++ /** ++ * Sets whether the item takes damage when the wearer is hurt. ++ * ++ * @param damageOnHurt true if it damages on hurt ++ * @return the builder for chaining ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder damageOnHurt(boolean damageOnHurt); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Fireworks.java b/src/main/java/io/papermc/paper/datacomponent/item/Fireworks.java +new file mode 100644 +index 0000000000000000000000000000000000000000..72aa1b4bda2693e0cd78d93449dda23bd1b74062 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/Fireworks.java +@@ -0,0 +1,84 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.List; ++import org.bukkit.FireworkEffect; ++import org.checkerframework.common.value.qual.IntRange; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Stores all explosions crafted into a Firework Rocket, as well as flight duration. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#FIREWORKS ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface Fireworks { ++ ++ @Contract(value = "_, _ -> new", pure = true) ++ static Fireworks fireworks(final List effects, final int flightDuration) { ++ return fireworks().addEffects(effects).flightDuration(flightDuration).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static Fireworks.Builder fireworks() { ++ return ItemComponentTypesBridge.bridge().fireworks(); ++ } ++ ++ /** ++ * Lists the effects stored in this component. ++ * ++ * @return the effects ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List effects(); ++ ++ /** ++ * Number of gunpowder in this component. ++ * ++ * @return the flight duration ++ */ ++ @Contract(pure = true) ++ @IntRange(from = 0, to = 255) int flightDuration(); ++ ++ /** ++ * Builder for {@link Fireworks}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets the number of gunpowder used in this builder. ++ * ++ * @param duration duration ++ * @return the builder for chaining ++ * @see #flightDuration() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder flightDuration(@IntRange(from = 0, to = 255) int duration); ++ ++ /** ++ * Adds an explosion to this builder. ++ * ++ * @param effect effect ++ * @return the builder for chaining ++ * @see #effects() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addEffect(FireworkEffect effect); ++ ++ /** ++ * Adds explosions to this builder. ++ * ++ * @param effects effects ++ * @return the builder for chaining ++ * @see #effects() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addEffects(List effects); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/FoodProperties.java b/src/main/java/io/papermc/paper/datacomponent/item/FoodProperties.java +new file mode 100644 +index 0000000000000000000000000000000000000000..369208e15a0e7fc91a9505fef2097c4283445e4a +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/FoodProperties.java +@@ -0,0 +1,87 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.BuildableDataComponent; ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.checkerframework.checker.index.qual.NonNegative; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the food properties of an item. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#FOOD ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface FoodProperties extends BuildableDataComponent { ++ ++ @Contract(value = "-> new", pure = true) ++ static FoodProperties.Builder food() { ++ return ItemComponentTypesBridge.bridge().food(); ++ } ++ ++ /** ++ * Number of food points to restore when eaten. ++ * ++ * @return the nutrition ++ */ ++ @Contract(pure = true) ++ @NonNegative int nutrition(); ++ ++ /** ++ * Amount of saturation to restore when eaten. ++ * ++ * @return the saturation ++ */ ++ @Contract(pure = true) ++ float saturation(); ++ ++ /** ++ * If {@code true}, this food can be eaten even if not hungry. ++ * ++ * @return can always be eaten ++ */ ++ @Contract(pure = true) ++ boolean canAlwaysEat(); ++ ++ /** ++ * Builder for {@link FoodProperties}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Set if this food can always be eaten, even if the ++ * player is not hungry. ++ * ++ * @param canAlwaysEat true to allow always eating ++ * @return the builder for chaining ++ * @see #canAlwaysEat() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder canAlwaysEat(boolean canAlwaysEat); ++ ++ /** ++ * Sets the saturation of the food. ++ * ++ * @param saturation the saturation ++ * @return the builder for chaining ++ * @see #saturation() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder saturation(float saturation); ++ ++ /** ++ * Sets the nutrition of the food. ++ * ++ * @param nutrition the nutrition, must be non-negative ++ * @return the builder for chaining ++ * @see #nutrition() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder nutrition(@NonNegative int nutrition); ++ ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f5061d1f349b35e5ec57d2d1c64eafb096141404 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java +@@ -0,0 +1,65 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.block.BlockPredicate; ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.List; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Controls which blocks a player in Adventure mode can do a certain action with this item. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#CAN_BREAK ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#CAN_PLACE_ON ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ItemAdventurePredicate extends ShownInTooltip { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static ItemAdventurePredicate itemAdventurePredicate(final List predicates) { ++ return itemAdventurePredicate().addPredicates(predicates).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static ItemAdventurePredicate.Builder itemAdventurePredicate() { ++ return ItemComponentTypesBridge.bridge().itemAdventurePredicate(); ++ } ++ ++ /** ++ * List of block predicates that control if the action is allowed. ++ * ++ * @return predicates ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List predicates(); ++ ++ /** ++ * Builder for {@link ItemAdventurePredicate}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends ShownInTooltip.Builder, DataComponentBuilder { ++ /** ++ * Adds a block predicate to this builder. ++ * ++ * @param predicate predicate ++ * @return the builder for chaining ++ * @see #predicates() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addPredicate(BlockPredicate predicate); ++ ++ /** ++ * Adds block predicates to this builder. ++ * ++ * @param predicates predicates ++ * @return the builder for chaining ++ * @see #predicates() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addPredicates(List predicates); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemArmorTrim.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemArmorTrim.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0309ae59ab7945ddfb5410930d161e2ce3d1878a +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemArmorTrim.java +@@ -0,0 +1,53 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.bukkit.inventory.meta.trim.ArmorTrim; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the trims applied to an item. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#TRIM ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ItemArmorTrim extends ShownInTooltip { ++ ++ @Contract(value = "_, _ -> new", pure = true) ++ static ItemArmorTrim itemArmorTrim(final ArmorTrim armorTrim, final boolean showInTooltip) { ++ return itemArmorTrim(armorTrim).showInTooltip(showInTooltip).build(); ++ } ++ ++ @Contract(value = "_ -> new", pure = true) ++ static ItemArmorTrim.Builder itemArmorTrim(final ArmorTrim armorTrim) { ++ return ItemComponentTypesBridge.bridge().itemArmorTrim(armorTrim); ++ } ++ ++ /** ++ * Armor trim present on this item. ++ * ++ * @return trim ++ */ ++ @Contract(pure = true) ++ ArmorTrim armorTrim(); ++ ++ /** ++ * Builder for {@link ItemArmorTrim}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends ShownInTooltip.Builder, DataComponentBuilder { ++ ++ /** ++ * Sets the armor trim for this builder. ++ * ++ * @param armorTrim trim ++ * @return the builder for chaining ++ * @see #armorTrim() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder armorTrim(ArmorTrim armorTrim); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java +new file mode 100644 +index 0000000000000000000000000000000000000000..948505d38121d54df62e6a67d4597bc7d42c356f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java +@@ -0,0 +1,98 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.List; ++import org.bukkit.attribute.Attribute; ++import org.bukkit.attribute.AttributeModifier; ++import org.bukkit.inventory.EquipmentSlotGroup; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds attribute modifiers applied to any item. ++ * ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#ATTRIBUTE_MODIFIERS ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ItemAttributeModifiers extends ShownInTooltip { ++ ++ @Contract(value = "-> new", pure = true) ++ static ItemAttributeModifiers.Builder itemAttributes() { ++ return ItemComponentTypesBridge.bridge().modifiers(); ++ } ++ ++ /** ++ * Lists the attribute modifiers that are present on this item. ++ * ++ * @return modifiers ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List modifiers(); ++ ++ /** ++ * Holds an attribute entry. ++ */ ++ @ApiStatus.NonExtendable ++ interface Entry { ++ ++ /** ++ * Gets the target attribute for the paired modifier. ++ * ++ * @return the attribute ++ */ ++ @Contract(pure = true) ++ Attribute attribute(); ++ ++ /** ++ * The modifier for the paired attribute. ++ * ++ * @return the modifier ++ */ ++ @Contract(pure = true) ++ AttributeModifier modifier(); ++ ++ /** ++ * Gets the slot group for this attribute. ++ * ++ * @return the slot group ++ */ ++ default EquipmentSlotGroup getGroup() { ++ return this.modifier().getSlotGroup(); ++ } ++ } ++ ++ /** ++ * Builder for {@link ItemAttributeModifiers}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends ShownInTooltip.Builder, DataComponentBuilder { ++ ++ /** ++ * Adds a modifier to this builder. ++ * ++ * @param attribute attribute ++ * @param modifier modifier ++ * @return the builder for chaining ++ * @see #modifiers() ++ */ ++ @Contract(value = "_, _, _ -> this", mutates = "this") ++ Builder addModifier(Attribute attribute, AttributeModifier modifier); ++ ++ /** ++ * Adds a modifier to this builder. ++ * ++ * @param attribute attribute ++ * @param modifier modifier ++ * @param equipmentSlotGroup the slot group this modifier applies to (overrides any slot group in the modifier) ++ * @return the builder for chaining ++ * @see #modifiers() ++ */ ++ @Contract(value = "_, _, _ -> this", mutates = "this") ++ Builder addModifier(Attribute attribute, AttributeModifier modifier, EquipmentSlotGroup equipmentSlotGroup); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridge.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridge.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1ce34642371a65590ce1ac74b402ccfc301671d7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridge.java +@@ -0,0 +1,112 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.destroystokyo.paper.profile.PlayerProfile; ++import io.papermc.paper.registry.set.RegistryKeySet; ++import io.papermc.paper.registry.tag.TagKey; ++import io.papermc.paper.text.Filtered; ++import java.util.Optional; ++import java.util.ServiceLoader; ++import net.kyori.adventure.key.Key; ++import net.kyori.adventure.util.TriState; ++import org.bukkit.JukeboxSong; ++import org.bukkit.block.BlockType; ++import org.bukkit.damage.DamageType; ++import org.bukkit.inventory.EquipmentSlot; ++import org.bukkit.inventory.ItemStack; ++import org.bukkit.inventory.ItemType; ++import org.bukkit.inventory.meta.trim.ArmorTrim; ++import org.bukkit.map.MapCursor; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++@NullMarked ++@ApiStatus.Internal ++interface ItemComponentTypesBridge { ++ ++ Optional BRIDGE = ServiceLoader.load(ItemComponentTypesBridge.class).findFirst(); ++ ++ static ItemComponentTypesBridge bridge() { ++ return BRIDGE.orElseThrow(); ++ } ++ ++ ChargedProjectiles.Builder chargedProjectiles(); ++ ++ PotDecorations.Builder potDecorations(); ++ ++ Unbreakable.Builder unbreakable(); ++ ++ ItemLore.Builder lore(); ++ ++ ItemEnchantments.Builder enchantments(); ++ ++ ItemAttributeModifiers.Builder modifiers(); ++ ++ FoodProperties.Builder food(); ++ ++ DyedItemColor.Builder dyedItemColor(); ++ ++ PotionContents.Builder potionContents(); ++ ++ BundleContents.Builder bundleContents(); ++ ++ SuspiciousStewEffects.Builder suspiciousStewEffects(); ++ ++ MapItemColor.Builder mapItemColor(); ++ ++ MapDecorations.Builder mapDecorations(); ++ ++ MapDecorations.DecorationEntry decorationEntry(MapCursor.Type type, double x, double z, float rotation); ++ ++ SeededContainerLoot.Builder seededContainerLoot(Key lootTableKey); ++ ++ WrittenBookContent.Builder writtenBookContent(Filtered title, String author); ++ ++ WritableBookContent.Builder writeableBookContent(); ++ ++ ItemArmorTrim.Builder itemArmorTrim(ArmorTrim armorTrim); ++ ++ LodestoneTracker.Builder lodestoneTracker(); ++ ++ Fireworks.Builder fireworks(); ++ ++ ResolvableProfile.Builder resolvableProfile(); ++ ++ ResolvableProfile resolvableProfile(PlayerProfile profile); ++ ++ BannerPatternLayers.Builder bannerPatternLayers(); ++ ++ BlockItemDataProperties.Builder blockItemStateProperties(); ++ ++ ItemContainerContents.Builder itemContainerContents(); ++ ++ JukeboxPlayable.Builder jukeboxPlayable(JukeboxSong song); ++ ++ Tool.Builder tool(); ++ ++ Tool.Rule rule(RegistryKeySet blocks, @Nullable Float speed, TriState correctForDrops); ++ ++ ItemAdventurePredicate.Builder itemAdventurePredicate(); ++ ++ CustomModelData customModelData(int id); ++ ++ MapId mapId(int id); ++ ++ UseRemainder useRemainder(ItemStack itemStack); ++ ++ Consumable.Builder consumable(); ++ ++ UseCooldown.Builder useCooldown(final float seconds); ++ ++ DamageResistant damageResistant(TagKey types); ++ ++ Enchantable enchantable(int level); ++ ++ Repairable repairable(RegistryKeySet types); ++ ++ Equippable.Builder equippable(EquipmentSlot slot); ++ ++ DeathProtection.Builder deathProtection(); ++ ++ OminousBottleAmplifier ominousBottleAmplifier(int amplifier); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemContainerContents.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemContainerContents.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7d1c973ba566752d7a85496327b1352d973f2218 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemContainerContents.java +@@ -0,0 +1,63 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.Arrays; ++import java.util.List; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the contents of an item container. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#CONTAINER ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ItemContainerContents { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static ItemContainerContents containerContents(final List contents) { ++ return containerContents().addAll(contents).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static ItemContainerContents.Builder containerContents() { ++ return ItemComponentTypesBridge.bridge().itemContainerContents(); ++ } ++ ++ /** ++ * Gets the contents of the container. ++ * ++ * @return the contents ++ */ ++ @Contract(value = "-> new", pure = true) ++ @Unmodifiable List contents(); ++ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Adds an item stack to the container. ++ * ++ * @param stack the item stack ++ * @return the builder for chaining ++ * @see #contents() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder add(ItemStack stack); ++ ++ /** ++ * Adds item stacks to the container. ++ * ++ * @param stacks the item stacks ++ * @return the builder for chaining ++ * @see #contents() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addAll(List stacks); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fca271ea198209bd48cd02f4476e89e5e3e9f396 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java +@@ -0,0 +1,68 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.Map; ++import org.bukkit.enchantments.Enchantment; ++import org.checkerframework.common.value.qual.IntRange; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Stores a list of enchantments and their levels on an item. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#ENCHANTMENTS ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#STORED_ENCHANTMENTS ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ItemEnchantments extends ShownInTooltip { ++ ++ @Contract(value = "_, _ -> new", pure = true) ++ static ItemEnchantments itemEnchantments(final Map enchantments, final boolean showInTooltip) { ++ return itemEnchantments().addAll(enchantments).showInTooltip(showInTooltip).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static ItemEnchantments.Builder itemEnchantments() { ++ return ItemComponentTypesBridge.bridge().enchantments(); ++ } ++ ++ /** ++ * Enchantments currently present on this item. ++ * ++ * @return enchantments ++ */ ++ @Contract(pure = true) ++ @Unmodifiable Map enchantments(); ++ ++ /** ++ * Builder for {@link ItemEnchantments}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends ShownInTooltip.Builder, DataComponentBuilder { ++ ++ /** ++ * Adds an enchantment with the given level to this component. ++ * ++ * @param enchantment enchantment ++ * @param level level ++ * @return the builder for chaining ++ * @see #enchantments() ++ */ ++ @Contract(value = "_, _ -> this", mutates = "this") ++ Builder add(Enchantment enchantment, @IntRange(from = 1, to = 255) int level); ++ ++ /** ++ * Adds enchantments with the given level to this component. ++ * ++ * @param enchantments enchantments ++ * @return the builder for chaining ++ * @see #enchantments() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addAll(Map enchantments); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemLore.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemLore.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3be62f6005e0343c3a6ebd04e3ee824e0b969113 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemLore.java +@@ -0,0 +1,84 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.List; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.ComponentLike; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Additional lines to include in an item's tooltip. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#LORE ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ItemLore { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static ItemLore lore(final List lines) { ++ return lore().lines(lines).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static ItemLore.Builder lore() { ++ return ItemComponentTypesBridge.bridge().lore(); ++ } ++ ++ /** ++ * Lists the components that are added to an item's tooltip. ++ * ++ * @return component list ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List lines(); ++ ++ /** ++ * Lists the styled components (example: italicized and purple) that are added to an item's tooltip. ++ * ++ * @return component list ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List styledLines(); ++ ++ /** ++ * Builder for {@link ItemLore}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets the components of this lore. ++ * ++ * @param lines components ++ * @return the builder for chaining ++ * @see #lines() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder lines(List lines); ++ ++ /** ++ * Adds a component to the lore. ++ * ++ * @param line component ++ * @return the builder for chaining ++ * @see #lines() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addLine(ComponentLike line); ++ ++ /** ++ * Adds components to the lore. ++ * ++ * @param lines components ++ * @return the builder for chaining ++ * @see #lines() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addLines(List lines); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/JukeboxPlayable.java b/src/main/java/io/papermc/paper/datacomponent/item/JukeboxPlayable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c59942df7101c7630eabeb247b9690b9c4c76da4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/JukeboxPlayable.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.bukkit.JukeboxSong; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the jukebox song for an item. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#JUKEBOX_PLAYABLE ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface JukeboxPlayable extends ShownInTooltip { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static JukeboxPlayable.Builder jukeboxPlayable(final JukeboxSong song) { ++ return ItemComponentTypesBridge.bridge().jukeboxPlayable(song); ++ } ++ ++ @Contract(pure = true) ++ JukeboxSong jukeboxSong(); ++ ++ /** ++ * Builder for {@link JukeboxPlayable}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends ShownInTooltip.Builder, DataComponentBuilder { ++ ++ /** ++ * Sets the jukebox song. ++ * ++ * @param song the song ++ * @return the builder for chaining ++ * @see #jukeboxSong() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder jukeboxSong(JukeboxSong song); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/LodestoneTracker.java b/src/main/java/io/papermc/paper/datacomponent/item/LodestoneTracker.java +new file mode 100644 +index 0000000000000000000000000000000000000000..b919672ceea74ae09324653847b30fde293054d8 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/LodestoneTracker.java +@@ -0,0 +1,72 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.bukkit.Location; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++/** ++ * If present, specifies the target Lodestone that a Compass should point towards. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#LODESTONE_TRACKER ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface LodestoneTracker { ++ ++ @Contract(value = "_, _ -> new", pure = true) ++ static LodestoneTracker lodestoneTracker(final @Nullable Location location, final boolean tracked) { ++ return lodestoneTracker().location(location).tracked(tracked).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static LodestoneTracker.Builder lodestoneTracker() { ++ return ItemComponentTypesBridge.bridge().lodestoneTracker(); ++ } ++ ++ /** ++ * The location that the compass should point towards. ++ * ++ * @return location ++ */ ++ @Contract(value = "-> new", pure = true) ++ @Nullable Location location(); ++ ++ /** ++ * If {@code true}, when the Lodestone at the target position is removed, the component will be removed. ++ * ++ * @return tracked ++ */ ++ @Contract(pure = true) ++ boolean tracked(); ++ ++ /** ++ * Builder for {@link LodestoneTracker}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets the location to point towards for this builder. ++ * ++ * @param location location to point towards ++ * @return the builder for chaining ++ * @see #location() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder location(@Nullable Location location); ++ ++ /** ++ * Sets if this location lodestone is tracked for this builder. ++ * ++ * @param tracked is tracked ++ * @return the builder for chaining ++ * @see #tracked() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder tracked(boolean tracked); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/MapDecorations.java b/src/main/java/io/papermc/paper/datacomponent/item/MapDecorations.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1e611f1f918c33f8d89ad23cf2fc44a127af233c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/MapDecorations.java +@@ -0,0 +1,121 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.Map; ++import org.bukkit.map.MapCursor; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++/** ++ * Holds a list of markers to be placed on a Filled Map (used for Explorer Maps). ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#MAP_DECORATIONS ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface MapDecorations { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static MapDecorations mapDecorations(final Map entries) { ++ return mapDecorations().putAll(entries).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static MapDecorations.Builder mapDecorations() { ++ return ItemComponentTypesBridge.bridge().mapDecorations(); ++ } ++ ++ @Contract(value = "_, _, _, _ -> new", pure = true) ++ static DecorationEntry decorationEntry(final MapCursor.Type type, final double x, final double z, final float rotation) { ++ return ItemComponentTypesBridge.bridge().decorationEntry(type, x, z, rotation); ++ } ++ ++ /** ++ * Gets the decoration entry with the given id. ++ * ++ * @param id id ++ * @return decoration entry, or {@code null} if not present ++ */ ++ @Contract(pure = true) ++ @Nullable DecorationEntry decoration(String id); ++ ++ /** ++ * Gets the decoration entries. ++ * ++ * @return the decoration entries ++ */ ++ @Contract(pure = true) ++ @Unmodifiable Map decorations(); ++ ++ /** ++ * Decoration present on the map. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface DecorationEntry { ++ ++ /** ++ * Type of decoration. ++ * ++ * @return type ++ */ ++ @Contract(pure = true) ++ MapCursor.Type type(); ++ ++ /** ++ * X world coordinate of the decoration. ++ * ++ * @return x coordinate ++ */ ++ @Contract(pure = true) ++ double x(); ++ ++ /** ++ * Z world coordinate of the decoration. ++ * ++ * @return z coordinate ++ */ ++ @Contract(pure = true) ++ double z(); ++ ++ /** ++ * Clockwise rotation from north in degrees. ++ * ++ * @return rotation ++ */ ++ @Contract(pure = true) ++ float rotation(); ++ } ++ ++ /** ++ * Builder for {@link MapDecorations}. ++ */ ++ @ApiStatus.NonExtendable ++ @ApiStatus.Experimental ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Puts the decoration with the given id in this builder. ++ * ++ * @param id id ++ * @param entry decoration ++ * @return the builder for chaining ++ * @see #decorations() ++ */ ++ @Contract(value = "_, _ -> this", mutates = "this") ++ MapDecorations.Builder put(String id, DecorationEntry entry); ++ ++ /** ++ * Puts all the decoration with the given id in this builder. ++ * ++ * @param entries decorations ++ * @return the builder for chaining ++ * @see #decorations() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ MapDecorations.Builder putAll(Map entries); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/MapId.java b/src/main/java/io/papermc/paper/datacomponent/item/MapId.java +new file mode 100644 +index 0000000000000000000000000000000000000000..045bfe0ce5080b57a40be03a65b1a2aaf9089120 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/MapId.java +@@ -0,0 +1,28 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * References the shared map state holding map contents and markers for a Filled Map. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#MAP_ID ++ */ ++@NullMarked ++@ApiStatus.NonExtendable ++@ApiStatus.Experimental ++public interface MapId { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static MapId mapId(final int id) { ++ return ItemComponentTypesBridge.bridge().mapId(id); ++ } ++ ++ /** ++ * The map id. ++ * ++ * @return id ++ */ ++ @Contract(pure = true) ++ int id(); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/MapItemColor.java b/src/main/java/io/papermc/paper/datacomponent/item/MapItemColor.java +new file mode 100644 +index 0000000000000000000000000000000000000000..87845d19a25ed2ae79b868fcfe40b88a2dc83f97 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/MapItemColor.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.bukkit.Color; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Represents the tint of the decorations on the Filled Map item. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#MAP_COLOR ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface MapItemColor { ++ ++ @Contract(value = "-> new", pure = true) ++ static MapItemColor.Builder mapItemColor() { ++ return ItemComponentTypesBridge.bridge().mapItemColor(); ++ } ++ ++ /** ++ * The tint to apply. ++ * ++ * @return color ++ */ ++ Color color(); ++ ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets the tint color of this map. ++ * ++ * @param color tint color ++ * @return the builder for chaining ++ * @see #color() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder color(Color color); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/OminousBottleAmplifier.java b/src/main/java/io/papermc/paper/datacomponent/item/OminousBottleAmplifier.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4f16e08f04c2cea24f3cb132ff21f4bdd6b70582 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/OminousBottleAmplifier.java +@@ -0,0 +1,29 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.checkerframework.common.value.qual.IntRange; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the ominous bottle amplifier. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#OMINOUS_BOTTLE_AMPLIFIER ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface OminousBottleAmplifier { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static OminousBottleAmplifier amplifier(final @IntRange(from = 0, to = 4) int amplifier) { ++ return ItemComponentTypesBridge.bridge().ominousBottleAmplifier(amplifier); ++ } ++ ++ /** ++ * Gets the bottle amplifier. ++ * ++ * @return the amplifier ++ */ ++ @Contract(pure = true) ++ @IntRange(from = 0, to = 4) int amplifier(); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PotDecorations.java b/src/main/java/io/papermc/paper/datacomponent/item/PotDecorations.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6da78b8735a6cadd1282fa2fafd8b0f74f087fb4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PotDecorations.java +@@ -0,0 +1,109 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.bukkit.inventory.ItemType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++// CONTRIBUTORS: LEAVE THIS AS ITEM TYPE!!! ++/** ++ * Holds the item types for the decorations on a flower pot. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#POT_DECORATIONS ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface PotDecorations { ++ ++ @Contract(value = "_, _, _, _ -> new", pure = true) ++ static PotDecorations potDecorations(final @Nullable ItemType back, final @Nullable ItemType left, final @Nullable ItemType right, final @Nullable ItemType front) { ++ return potDecorations().back(back).left(left).right(right).front(front).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static PotDecorations.Builder potDecorations() { ++ return ItemComponentTypesBridge.bridge().potDecorations(); ++ } ++ ++ /** ++ * Get the item type for the back. ++ * ++ * @return the back item type. ++ */ ++ @Contract(pure = true) ++ @Nullable ItemType back(); ++ ++ /** ++ * Get the item type for the left. ++ * ++ * @return the left item type. ++ */ ++ @Contract(pure = true) ++ @Nullable ItemType left(); ++ ++ /** ++ * Get the item type for the right. ++ * ++ * @return the right item type. ++ */ ++ @Contract(pure = true) ++ @Nullable ItemType right(); ++ ++ /** ++ * Get the item type for the front. ++ * ++ * @return the front item type. ++ */ ++ @Contract(pure = true) ++ @Nullable ItemType front(); ++ ++ /** ++ * Builder for {@link PotDecorations}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Set the {@link ItemType} for the back. ++ * ++ * @param back item for the back ++ * @return the builder for chaining ++ * @see #back() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder back(@Nullable ItemType back); ++ ++ /** ++ * Set the {@link ItemType} for the left. ++ * ++ * @param left item for the left ++ * @return the builder for chaining ++ * @see #left() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder left(@Nullable ItemType left); ++ ++ /** ++ * Set the {@link ItemType} for the right. ++ * ++ * @param right item for the right ++ * @return the builder for chaining ++ * @see #right() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder right(@Nullable ItemType right); ++ ++ /** ++ * Set the {@link ItemType} for the front. ++ * ++ * @param front item for the front ++ * @return the builder for chaining ++ * @see #front() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder front(@Nullable ItemType front); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7cf05b382319064d45433a7e2678f65c25d11b14 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java +@@ -0,0 +1,120 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.List; ++import org.bukkit.Color; ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++/** ++ * Holds the contents of a potion (Potion, Splash Potion, Lingering Potion), or potion applied to a Tipped Arrow. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#POTION_CONTENTS ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface PotionContents { ++ ++ @Contract(value = "-> new", pure = true) ++ static PotionContents.Builder potionContents() { ++ return ItemComponentTypesBridge.bridge().potionContents(); ++ } ++ ++ /** ++ * The potion type in this item: the item will inherit all effects from this. ++ * ++ * @return potion type, or {@code null} if not present ++ */ ++ @Contract(pure = true) ++ @Nullable PotionType potion(); ++ ++ /** ++ * Overrides the visual color of the potion. ++ * ++ * @return color override, or {@code null} if not present ++ * @apiNote alpha channel of the color is only relevant ++ * for Tipped Arrow ++ */ ++ @Contract(pure = true) ++ @Nullable Color customColor(); ++ ++ /** ++ * Additional list of effect instances that this item should apply. ++ * ++ * @return effects ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List customEffects(); ++ ++ /** ++ * Suffix to the translation key of the potion item. ++ * ++ * @return translation key suffix, or {@code null} if not present ++ * @apiNote This is used in the display of tipped arrow and potion items. ++ */ ++ @Contract(pure = true) ++ @Nullable String customName(); ++ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets the potion type for this builder. ++ * ++ * @param type builder ++ * @return the builder for chaining ++ * @see #potion() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder potion(@Nullable PotionType type); ++ ++ /** ++ * Sets the color override for this builder. ++ * ++ * @param color color ++ * @return the builder for chaining ++ * @see #customColor() ++ * @apiNote alpha channel of the color is supported only for Tipped Arrow ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder customColor(@Nullable Color color); ++ ++ /** ++ * Sets the suffix to the translation key of the potion item. ++ * ++ * @param name name ++ * @return the builder for chaining ++ * @see #customName() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder customName(@Nullable String name); ++ ++ /** ++ * Adds a custom effect instance to this builder. ++ * ++ * @param effect effect ++ * @see #customEffects() ++ * @return the builder for chaining ++ * @see #customEffects() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addCustomEffect(PotionEffect effect); ++ ++ /** ++ * Adds custom effect instances to this builder. ++ * ++ * @param effects effects ++ * @see #customEffects() ++ * @return the builder for chaining ++ * @see #customEffects() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addCustomEffects(List effects); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Repairable.java b/src/main/java/io/papermc/paper/datacomponent/item/Repairable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ff84d9123aab0ad2f93b397e20a37f21894547a3 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/Repairable.java +@@ -0,0 +1,30 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.registry.set.RegistryKeySet; ++import org.bukkit.inventory.ItemType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds if this item is repairable, and what item types it can be repaired with. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#REPAIRABLE ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface Repairable { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static Repairable repairable(final RegistryKeySet types) { ++ return ItemComponentTypesBridge.bridge().repairable(types); ++ } ++ ++ /** ++ * The types that this item is repairable to. ++ * ++ * @return item ++ */ ++ @Contract(value = "-> new", pure = true) ++ RegistryKeySet types(); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java b/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java +new file mode 100644 +index 0000000000000000000000000000000000000000..dc6cd191553e7ca5b6c5768f594924e4c39fcbbe +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java +@@ -0,0 +1,123 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.destroystokyo.paper.profile.PlayerProfile; ++import com.destroystokyo.paper.profile.ProfileProperty; ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import java.util.Collection; ++import java.util.UUID; ++import java.util.concurrent.CompletableFuture; ++import org.intellij.lang.annotations.Pattern; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++/** ++ * Holds player profile data that can be resolved to a {@link PlayerProfile}. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#PROFILE ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ResolvableProfile { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static ResolvableProfile resolvableProfile(final PlayerProfile profile) { ++ return ItemComponentTypesBridge.bridge().resolvableProfile(profile); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static ResolvableProfile.Builder resolvableProfile() { ++ return ItemComponentTypesBridge.bridge().resolvableProfile(); ++ } ++ ++ @Contract(pure = true) ++ @Nullable UUID uuid(); ++ ++ @Contract(pure = true) ++ @Nullable String name(); ++ ++ @Contract(pure = true) ++ @Unmodifiable Collection properties(); ++ ++ /** ++ * Produces an updated player profile based on this. ++ *

++ * This tries to produce a completed profile by filling in missing ++ * properties (name, unique id, textures, etc.), and updates existing ++ * properties (e.g. name, textures, etc.) to their official and up-to-date ++ * values. This operation does not alter the current profile, but produces a ++ * new updated {@link PlayerProfile}. ++ *

++ * If no player exists for the unique id or name of this profile, this ++ * operation yields a profile that is equal to the current profile, which ++ * might not be complete. ++ *

++ * This is an asynchronous operation: Updating the profile can result in an ++ * outgoing connection in another thread in order to fetch the latest ++ * profile properties. The returned {@link CompletableFuture} will be ++ * completed once the updated profile is available. In order to not block ++ * the server's main thread, you should not wait for the result of the ++ * returned CompletableFuture on the server's main thread. Instead, if you ++ * want to do something with the updated player profile on the server's main ++ * thread once it is available, you could do something like this: ++ *

++     * profile.resolve().thenAcceptAsync(updatedProfile -> {
++     *     // Do something with the updated profile:
++     *     // ...
++     * }, runnable -> Bukkit.getScheduler().runTask(plugin, runnable));
++     * 
++ */ ++ @Contract(pure = true) ++ CompletableFuture resolve(); ++ ++ /** ++ * Builder for {@link ResolvableProfile}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets the name for this profile. Must be 16-or-less ++ * characters and not contain invalid characters. ++ * ++ * @param name the name ++ * @return the builder for chaining ++ * @see #name() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder name(@Pattern("^[!-~]{0,16}$") @Nullable String name); ++ ++ /** ++ * Sets the UUID for this profile. ++ * ++ * @param uuid the UUID ++ * @return the builder for chaining ++ * @see #uuid() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder uuid(@Nullable UUID uuid); ++ ++ /** ++ * Adds a property to this profile. ++ * ++ * @param property the property ++ * @return the builder for chaining ++ * @see #properties() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addProperty(ProfileProperty property); ++ ++ /** ++ * Adds properties to this profile. ++ * ++ * @param properties the properties ++ * @return the builder for chaining ++ * @see #properties() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addProperties(Collection properties); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/SeededContainerLoot.java b/src/main/java/io/papermc/paper/datacomponent/item/SeededContainerLoot.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f79af65e8f3f8ffbb9be1cf1c6b537cd1e2b1031 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/SeededContainerLoot.java +@@ -0,0 +1,71 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import net.kyori.adventure.key.Key; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the loot table and seed for a container. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#CONTAINER_LOOT ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface SeededContainerLoot { ++ ++ @Contract(value = "_, _ -> new", pure = true) ++ static SeededContainerLoot seededContainerLoot(final Key lootTableKey, final long seed) { ++ return SeededContainerLoot.seededContainerLoot(lootTableKey).seed(seed).build(); ++ } ++ ++ @Contract(value = "_ -> new", pure = true) ++ static SeededContainerLoot.Builder seededContainerLoot(final Key lootTableKey) { ++ return ItemComponentTypesBridge.bridge().seededContainerLoot(lootTableKey); ++ } ++ ++ /** ++ * Gets the loot table key. ++ * ++ * @return the loot table key ++ */ ++ @Contract(pure = true) ++ Key lootTable(); ++ ++ /** ++ * Gets the loot table seed. ++ * ++ * @return the seed ++ */ ++ @Contract(pure = true) ++ long seed(); ++ ++ /** ++ * Builder for {@link SeededContainerLoot}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets the loot table key. ++ * ++ * @param key the loot table key ++ * @return the builder for chaining ++ * @see #lootTable() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder lootTable(Key key); ++ ++ /** ++ * Sets the loot table seed. ++ * ++ * @param seed the seed ++ * @return the builder for chaining ++ * @see #seed() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder seed(long seed); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ShownInTooltip.java b/src/main/java/io/papermc/paper/datacomponent/item/ShownInTooltip.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7e058aebcbd768517f6db51540598721cdae4425 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ShownInTooltip.java +@@ -0,0 +1,52 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the state of whether a data component should be shown ++ * in an item's tooltip. ++ * @param the data component type ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ShownInTooltip { ++ ++ /** ++ * Gets if the data component should be shown in the item's tooltip. ++ * ++ * @return {@code true} to show in the tooltip ++ */ ++ @Contract(pure = true) ++ boolean showInTooltip(); ++ ++ /** ++ * Returns a copy of this data component with the specified ++ * show-in-tooltip state. ++ * @param showInTooltip {@code true} to show in the tooltip ++ * @return the new data component ++ */ ++ @Contract(value = "_ -> new", pure = true) ++ T showInTooltip(boolean showInTooltip); ++ ++ /** ++ * A builder for creating a {@link ShownInTooltip} data component. ++ * @param builder type ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder { ++ ++ /** ++ * Sets if the data component should be shown in the item's tooltip. ++ * ++ * @param showInTooltip {@code true} to show in the tooltip ++ * @return the builder for chaining ++ * @see #showInTooltip() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ B showInTooltip(boolean showInTooltip); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/SuspiciousStewEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/SuspiciousStewEffects.java +new file mode 100644 +index 0000000000000000000000000000000000000000..422bb5ccc42b94b60fba6714e9e6fb8aced6eb0c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/SuspiciousStewEffects.java +@@ -0,0 +1,67 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import io.papermc.paper.potion.SuspiciousEffectEntry; ++import java.util.Arrays; ++import java.util.Collection; ++import java.util.List; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the effects that will be applied when consuming Suspicious Stew. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#SUSPICIOUS_STEW_EFFECTS ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface SuspiciousStewEffects { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static SuspiciousStewEffects suspiciousStewEffects(final Collection effects) { ++ return suspiciousStewEffects().addAll(effects).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static SuspiciousStewEffects.Builder suspiciousStewEffects() { ++ return ItemComponentTypesBridge.bridge().suspiciousStewEffects(); ++ } ++ ++ /** ++ * Effects that will be applied when consuming Suspicious Stew. ++ * ++ * @return effects ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List effects(); ++ ++ /** ++ * Builder for {@link SuspiciousStewEffects}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Adds an effect applied to this builder. ++ * ++ * @param entry effect ++ * @return the builder for chaining ++ * @see #effects() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder add(SuspiciousEffectEntry entry); ++ ++ /** ++ * Adds effects applied to this builder. ++ * ++ * @param entries effect ++ * @return the builder for chaining ++ * @see #effects() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addAll(Collection entries); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Tool.java b/src/main/java/io/papermc/paper/datacomponent/item/Tool.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4e87feb83204266e1fefdafe7b7e5ac53da3160e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/Tool.java +@@ -0,0 +1,149 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import io.papermc.paper.registry.set.RegistryKeySet; ++import java.util.Collection; ++import java.util.List; ++import net.kyori.adventure.util.TriState; ++import org.bukkit.block.BlockType; ++import org.checkerframework.checker.index.qual.NonNegative; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++/** ++ * Controls the behavior of the item as a tool. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#TOOL ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface Tool { ++ ++ @Contract(value = "-> new", pure = true) ++ static Tool.Builder tool() { ++ return ItemComponentTypesBridge.bridge().tool(); ++ } ++ ++ /** ++ * Creates a mining rule that specifies how an item interacts with certain block types. ++ * ++ *

This method allows you to define a rule for a set of block types, optionally setting a custom mining speed ++ * and determining whether the item should correct for drops when mining these blocks.

++ * ++ * @param blocks The set of block types this rule applies to. ++ * @param speed The custom mining speed multiplier for these blocks. If {@code null}, the default speed is used. ++ * @param correctForDrops A {@link TriState} indicating how to handle item drops: ++ *
    ++ *
  • {@link TriState#TRUE} - Items will be dropped.
  • ++ *
  • {@link TriState#FALSE} - Items will not be dropped.
  • ++ *
  • {@link TriState#NOT_SET} - The default drop behavior is used.
  • ++ *
++ * @return A new {@link Rule} instance representing the mining rule. ++ */ ++ static Rule rule(final RegistryKeySet blocks, final @Nullable Float speed, final TriState correctForDrops) { ++ return ItemComponentTypesBridge.bridge().rule(blocks, speed, correctForDrops); ++ } ++ ++ /** ++ * Mining speed to use if no rules match and don't override mining speed. ++ * ++ * @return default mining speed ++ */ ++ @Contract(pure = true) ++ float defaultMiningSpeed(); ++ ++ /** ++ * Amount of durability to remove each time a block is mined with this tool. ++ * ++ * @return durability ++ */ ++ @Contract(pure = true) ++ @NonNegative int damagePerBlock(); ++ ++ /** ++ * List of rule entries. ++ * ++ * @return rules ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List rules(); ++ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Rule { ++ ++ /** ++ * Blocks to match. ++ * ++ * @return blocks ++ */ ++ RegistryKeySet blocks(); ++ ++ /** ++ * Overrides the mining speed if present and matched. ++ *

++ * {@code true} will cause the block to mine at its most efficient speed, and drop items if the targeted block requires that. ++ * ++ * @return speed override ++ */ ++ @Nullable Float speed(); ++ ++ /** ++ * Overrides whether this tool is considered 'correct' if present and matched. ++ * ++ * @return a tri-state ++ */ ++ TriState correctForDrops(); ++ } ++ ++ /** ++ * Builder for {@link Tool}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Controls the amount of durability to remove each time a block is mined with this tool. ++ * ++ * @param damage durability to remove ++ * @return the builder for chaining ++ * @see #damagePerBlock() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder damagePerBlock(@NonNegative int damage); ++ ++ /** ++ * Controls mining speed to use if no rules match and don't override mining speed. ++ * ++ * @param miningSpeed mining speed ++ * @return the builder for chaining ++ * @see #defaultMiningSpeed() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder defaultMiningSpeed(float miningSpeed); ++ ++ /** ++ * Adds a rule to the tool that controls the breaking speed / damage per block if matched. ++ * ++ * @param rule rule ++ * @return the builder for chaining ++ * @see #rules() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addRule(Rule rule); ++ ++ /** ++ * Adds rules to the tool that control the breaking speed / damage per block if matched. ++ * ++ * @param rules rules ++ * @return the builder for chaining ++ * @see #rules() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addRules(Collection rules); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Unbreakable.java b/src/main/java/io/papermc/paper/datacomponent/item/Unbreakable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..498eb479dce406d2b0b470b327eac8279a0d98bc +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/Unbreakable.java +@@ -0,0 +1,34 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * If set, the item will not lose any durability when used. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#UNBREAKABLE ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface Unbreakable extends ShownInTooltip { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static Unbreakable unbreakable(final boolean showInTooltip) { ++ return unbreakable().showInTooltip(showInTooltip).build(); ++ } ++ ++ @Contract(value = "-> new", pure = true) ++ static Unbreakable.Builder unbreakable() { ++ return ItemComponentTypesBridge.bridge().unbreakable(); ++ } ++ ++ /** ++ * Builder for {@link Unbreakable}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends ShownInTooltip.Builder, DataComponentBuilder { ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/UseCooldown.java b/src/main/java/io/papermc/paper/datacomponent/item/UseCooldown.java +new file mode 100644 +index 0000000000000000000000000000000000000000..57fc55ad1def2bb14fc0a95ee3c0c157b0ac53fb +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/UseCooldown.java +@@ -0,0 +1,65 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import net.kyori.adventure.key.Key; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++/** ++ * Holds the contents of cooldown information when an item is used. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#USE_COOLDOWN ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface UseCooldown { ++ ++ /** ++ * Creates a new builder for use cooldown. ++ * ++ * @param seconds the duration in seconds; must be positive ++ * @return builder ++ */ ++ @Contract(value = "_ -> new", pure = true) ++ static UseCooldown.Builder useCooldown(final float seconds) { ++ return ItemComponentTypesBridge.bridge().useCooldown(seconds); ++ } ++ ++ /** ++ * The amount of seconds the cooldown will be active for. ++ * ++ * @return cooldown seconds ++ */ ++ @Contract(pure = true) ++ float seconds(); ++ ++ /** ++ * The unique resource location to identify this cooldown group. ++ *

++ * This allows items to share cooldowns with other items in the same cooldown group, if present. ++ * ++ * @return cooldown group, or null if not present ++ */ ++ @Contract(pure = true) ++ @Nullable Key cooldownGroup(); ++ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets a unique resource location for this cooldown group. ++ *

++ * This allows items to share cooldowns with other items in the same cooldown group. ++ *

++ * ++ * @param key the unique resource location; can be null ++ * @return the builder for chaining ++ * @see #cooldownGroup() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder cooldownGroup(@Nullable Key key); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/UseRemainder.java b/src/main/java/io/papermc/paper/datacomponent/item/UseRemainder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..50e42e073311332142980828d0beec1828570512 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/UseRemainder.java +@@ -0,0 +1,31 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the contents of item transformation information when an item is used. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#USE_REMAINDER ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface UseRemainder { ++ ++ @Contract(value = "_ -> new", pure = true) ++ static UseRemainder useRemainder(final ItemStack itemStack) { ++ return ItemComponentTypesBridge.bridge().useRemainder(itemStack); ++ } ++ ++ /** ++ * The item that the item that is consumed is transformed into. ++ * ++ * @return item ++ */ ++ @Contract(value = "-> new", pure = true) ++ ItemStack transformInto(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/WritableBookContent.java b/src/main/java/io/papermc/paper/datacomponent/item/WritableBookContent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..828d3bb1c763e0f3c89a73d6b70d1f006258644f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/WritableBookContent.java +@@ -0,0 +1,80 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import io.papermc.paper.text.Filtered; ++import java.util.List; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the pages for a writable book. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#WRITABLE_BOOK_CONTENT ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface WritableBookContent { ++ ++ @Contract(value = "-> new", pure = true) ++ static WritableBookContent.Builder writeableBookContent() { ++ return ItemComponentTypesBridge.bridge().writeableBookContent(); ++ } ++ ++ /** ++ * Holds the pages that can be written to for this component. ++ * ++ * @return pages, as filtered objects ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List> pages(); ++ ++ /** ++ * Builder for {@link WritableBookContent}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Adds a page that can be written to for this builder. ++ * ++ * @param page page ++ * @return the builder for chaining ++ * @see #pages() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addPage(String page); ++ ++ /** ++ * Adds pages that can be written to for this builder. ++ * ++ * @param pages pages ++ * @return the builder for chaining ++ * @see #pages() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addPages(List pages); ++ ++ /** ++ * Adds a filterable page that can be written to for this builder. ++ * ++ * @param page page ++ * @return the builder for chaining ++ * @see #pages() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addFilteredPage(Filtered page); ++ ++ /** ++ * Adds filterable pages that can be written to for this builder. ++ * ++ * @param pages pages ++ * @return the builder for chaining ++ * @see #pages() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addFilteredPages(List> pages); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/WrittenBookContent.java b/src/main/java/io/papermc/paper/datacomponent/item/WrittenBookContent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..979bc05009b84b6fcdb59938cceace351e61c78b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/WrittenBookContent.java +@@ -0,0 +1,172 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.DataComponentBuilder; ++import io.papermc.paper.text.Filtered; ++import java.util.List; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.ComponentLike; ++import org.checkerframework.common.value.qual.IntRange; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds the contents and metadata of a Written Book. ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#WRITTEN_BOOK_CONTENT ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface WrittenBookContent { ++ ++ @Contract(value = "_, _ -> new", pure = true) ++ static WrittenBookContent.Builder writtenBookContent(final String title, final String author) { ++ return writtenBookContent(Filtered.of(title, null), author); ++ } ++ ++ @Contract(value = "_, _ -> new", pure = true) ++ static WrittenBookContent.Builder writtenBookContent(final Filtered title, final String author) { ++ return ItemComponentTypesBridge.bridge().writtenBookContent(title, author); ++ } ++ ++ /** ++ * Title of this book. ++ * ++ * @return title ++ */ ++ @Contract(pure = true) ++ Filtered title(); ++ ++ /** ++ * Player name of the author of this book. ++ * ++ * @return author ++ */ ++ @Contract(pure = true) ++ String author(); ++ ++ /** ++ * The number of times this book has been copied (0 = original). ++ * ++ * @return generation ++ */ ++ @Contract(pure = true) ++ @IntRange(from = 0, to = 3) int generation(); ++ ++ /** ++ * Gets the pages of this book. ++ * ++ * @return pages ++ */ ++ @Contract(pure = true) ++ @Unmodifiable List> pages(); ++ ++ /** ++ * If the chat components in this book have already been resolved (entity selectors, scores substituted). ++ * If {@code false}, will be resolved when opened by a player. ++ * ++ * @return resolved ++ */ ++ @Contract(pure = true) ++ boolean resolved(); ++ ++ /** ++ * Builder for {@link WrittenBookContent}. ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends DataComponentBuilder { ++ ++ /** ++ * Sets the title of this book. ++ * ++ * @param title the title ++ * @return the builder for chaining ++ * @see #title() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder title(String title); ++ ++ /** ++ * Sets the filterable title of this book. ++ * ++ * @param title the title ++ * @return the builder for chaining ++ * @see #title() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder filteredTitle(Filtered title); ++ ++ /** ++ * Sets the author of this book. ++ * ++ * @param author the author ++ * @return the builder for chaining ++ * @see #author() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder author(String author); ++ ++ /** ++ * Sets the generation of this book. ++ * ++ * @param generation the generation, [0-3] ++ * @return the builder for chaining ++ * @see #generation() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder generation(@IntRange(from = 0, to = 3) int generation); ++ ++ /** ++ * Sets if the chat components in this book have already been resolved (entity selectors, scores substituted). ++ * If {@code false}, will be resolved when opened by a player. ++ * ++ * @param resolved resolved ++ * @return the builder for chaining ++ * @see #resolved() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder resolved(boolean resolved); ++ ++ /** ++ * Adds a page to this book. ++ * ++ * @param page the page ++ * @return the builder for chaining ++ * @see #pages() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addPage(ComponentLike page); ++ ++ /** ++ * Adds pages to this book. ++ * ++ * @param page the pages ++ * @return the builder for chaining ++ * @see #pages() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addPages(List page); ++ ++ /** ++ * Adds a filterable page to this book. ++ * ++ * @param page the page ++ * @return the builder for chaining ++ * @see #pages() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addFilteredPage(Filtered page); ++ ++ /** ++ * Adds filterable pages to this book. ++ * ++ * @param pages the pages ++ * @return the builder for chaining ++ * @see #pages() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder addFilteredPages(List> pages); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a845ccfc21f101f0632249745bbd8b334f85e72c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java +@@ -0,0 +1,32 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++import io.papermc.paper.registry.set.RegistryKeySet; ++import java.util.List; ++import java.util.Optional; ++import java.util.ServiceLoader; ++import net.kyori.adventure.key.Key; ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionEffectType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++@NullMarked ++@ApiStatus.Internal ++interface ConsumableTypesBridge { ++ ++ Optional BRIDGE = ServiceLoader.load(ConsumableTypesBridge.class).findFirst(); ++ ++ static ConsumableTypesBridge bridge() { ++ return BRIDGE.orElseThrow(); ++ } ++ ++ ConsumeEffect.ApplyStatusEffects applyStatusEffects(List effectList, float probability); ++ ++ ConsumeEffect.RemoveStatusEffects removeStatusEffects(RegistryKeySet potionEffectTypeTagKey); ++ ++ ConsumeEffect.ClearAllStatusEffects clearAllStatusEffects(); ++ ++ ConsumeEffect.PlaySound playSoundEffect(Key sound); ++ ++ ConsumeEffect.TeleportRandomly teleportRandomlyEffect(float diameter); ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ff1a14e19c21dd22f249503a0b738f190a75aca0 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java +@@ -0,0 +1,150 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++import io.papermc.paper.registry.set.RegistryKeySet; ++import net.kyori.adventure.key.Key; ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionEffectType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++import java.util.List; ++ ++/** ++ * Effect that occurs when consuming an item. ++ */ ++@NullMarked ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ConsumeEffect { ++ ++ /** ++ * Creates a consume effect that randomly teleports the entity on consumption. ++ * ++ * @param diameter diameter of random teleportation ++ * @return the effect ++ */ ++ @Contract(value = "_ -> new", pure = true) ++ static TeleportRandomly teleportRandomlyEffect(final float diameter) { ++ return ConsumableTypesBridge.bridge().teleportRandomlyEffect(diameter); ++ } ++ ++ /** ++ * Creates a consume effect that gives status effects on consumption. ++ * ++ * @param key the sound effect to play ++ * @return the effect ++ */ ++ @Contract(value = "_ -> new", pure = true) ++ static RemoveStatusEffects removeEffects(final RegistryKeySet key) { ++ return ConsumableTypesBridge.bridge().removeStatusEffects(key); ++ } ++ ++ /** ++ * Creates a consume effect that plays a sound on consumption. ++ * ++ * @param key the sound effect to play ++ * @return the effect ++ */ ++ @Contract(value = "_ -> new", pure = true) ++ static PlaySound playSoundConsumeEffect(final Key key) { ++ return ConsumableTypesBridge.bridge().playSoundEffect(key); ++ } ++ ++ /** ++ * Creates a consume effect that clears all status effects. ++ * ++ * @return effect instance ++ */ ++ @Contract(value = "-> new", pure = true) ++ static ClearAllStatusEffects clearAllStatusEffects() { ++ return ConsumableTypesBridge.bridge().clearAllStatusEffects(); ++ } ++ ++ /** ++ * Creates a consume effect that gives status effects on consumption. ++ * ++ * @param effects the potion effects to apply ++ * @param probability the probability of these effects being applied, between 0 and 1 inclusive. ++ * @return the effect ++ */ ++ @Contract(value = "_, _ -> new", pure = true) ++ static ApplyStatusEffects applyStatusEffects(final List effects, final float probability) { ++ return ConsumableTypesBridge.bridge().applyStatusEffects(effects, probability); ++ } ++ ++ @NullMarked ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface TeleportRandomly extends ConsumeEffect { ++ ++ /** ++ * The max range that the entity can be teleported to. ++ * ++ * @return teleportation diameter ++ */ ++ float diameter(); ++ } ++ ++ /** ++ * Represents a consumable effect that removes status effects on consumption ++ */ ++ @NullMarked ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface RemoveStatusEffects extends ConsumeEffect { ++ ++ /** ++ * Potion effects to remove ++ * ++ * @return effects ++ */ ++ RegistryKeySet removeEffects(); ++ } ++ ++ /** ++ * Represents a consumable effect that plays a sound on consumption. ++ */ ++ @NullMarked ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface PlaySound extends ConsumeEffect { ++ ++ /** ++ * Sound effect to play in the world ++ * ++ * @return sound effect ++ */ ++ Key sound(); ++ } ++ ++ /** ++ * Represents a consumable effect that clears all effects on consumption. ++ */ ++ @NullMarked ++ interface ClearAllStatusEffects extends ConsumeEffect { ++ ++ } ++ ++ /** ++ * Represents a consumable effect that applies effects based on a probability on consumption. ++ */ ++ @NullMarked ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface ApplyStatusEffects extends ConsumeEffect { ++ ++ /** ++ * Effect instances to grant ++ * ++ * @return effect ++ */ ++ List effects(); ++ ++ /** ++ * Float between 0 and 1, chance for the effect to be applied. ++ * ++ * @return chance ++ */ ++ float probability(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ItemUseAnimation.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ItemUseAnimation.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8cd6dbe4ea5ee3270b9428a9c29cbd88823d9f6c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ItemUseAnimation.java +@@ -0,0 +1,17 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++/** ++ * Represents the hand animation that is used when a player is consuming this item. ++ */ ++public enum ItemUseAnimation { ++ NONE, ++ EAT, ++ DRINK, ++ BLOCK, ++ BOW, ++ SPEAR, ++ CROSSBOW, ++ SPYGLASS, ++ TOOT_HORN, ++ BRUSH ++} +diff --git a/src/main/java/io/papermc/paper/item/MapPostProcessing.java b/src/main/java/io/papermc/paper/item/MapPostProcessing.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5843768d0be2ae4a0219636ed7640727808da567 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/item/MapPostProcessing.java +@@ -0,0 +1,6 @@ ++package io.papermc.paper.item; ++ ++public enum MapPostProcessing { ++ LOCK, ++ SCALE ++} +diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java +index 9b39e33514b15a9d07104e2ad826d0da11f569d6..e5319bdb9f75358b8bb0ac35373125a7d94edfa6 100644 +--- a/src/main/java/io/papermc/paper/registry/RegistryKey.java ++++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java +@@ -1,5 +1,6 @@ + package io.papermc.paper.registry; + ++import io.papermc.paper.datacomponent.DataComponentType; + import net.kyori.adventure.key.Keyed; + import org.bukkit.Art; + import org.bukkit.Fluid; +@@ -124,6 +125,11 @@ public sealed interface RegistryKey extends Keyed permits RegistryKeyImpl { + * @see io.papermc.paper.registry.keys.SoundEventKeys + */ + RegistryKey SOUND_EVENT = create("sound_event"); ++ /** ++ * Built-in registry for data component types. ++ * ++ */ ++ RegistryKey DATA_COMPONENT_TYPE = create("data_component_type"); + + + +diff --git a/src/main/java/io/papermc/paper/text/Filtered.java b/src/main/java/io/papermc/paper/text/Filtered.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9e892621354c784632204559f9fdf0827b3bc4f1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/text/Filtered.java +@@ -0,0 +1,32 @@ ++package io.papermc.paper.text; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++ ++/** ++ * Denotes that this type is filterable by the client, and may be shown differently ++ * depending on the player's set configuration. ++ * ++ * @param type of value ++ */ ++@ApiStatus.Experimental ++@NullMarked ++public interface Filtered { ++ ++ @Contract(value = "_, _ -> new", pure = true) ++ static Filtered of(final T raw, final @Nullable T filtered) { ++ @ApiStatus.Internal ++ record Instance(T raw, @Nullable T filtered) implements Filtered {} ++ ++ return new Instance<>(raw, filtered); ++ } ++ ++ @Contract(pure = true) ++ T raw(); ++ ++ @Contract(pure = true) ++ @Nullable ++ T filtered(); ++} +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index 615eb24ffdd8f6d55ccd4f21760b809c1098bc68..c7ce8fa1ff9feda66d5a4e497112a24ff51c9d2b 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -137,7 +137,7 @@ import org.jetbrains.annotations.Nullable; + @SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper + public enum Material implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper + // +- AIR(9648, 0), ++ AIR(9648, 64), // Paper - air stacks to 64 + STONE(22948), + GRANITE(21091), + POLISHED_GRANITE(5477), +@@ -5784,6 +5784,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + */ + @ApiStatus.Internal + @Nullable ++ @org.jetbrains.annotations.Contract(pure = true) // Paper + public ItemType asItemType() { + return itemType.get(); + } +@@ -5796,7 +5797,47 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + */ + @ApiStatus.Internal + @Nullable ++ @org.jetbrains.annotations.Contract(pure = true) // Paper + public BlockType asBlockType() { + return blockType.get(); + } ++ ++ // Paper start - data component API ++ /** ++ * Gets the default value of the data component type for this item type. ++ * ++ * @param type the data component type ++ * @param the value type ++ * @return the default value or {@code null} if there is none ++ * @see #hasDefaultData(io.papermc.paper.datacomponent.DataComponentType) for DataComponentType.NonValued ++ * @throws IllegalArgumentException if {@link #isItem()} is {@code false} ++ */ ++ public @Nullable T getDefaultData(final io.papermc.paper.datacomponent.DataComponentType.@NotNull Valued type) { ++ Preconditions.checkArgument(this.asItemType() != null); ++ return this.asItemType().getDefaultData(type); ++ } ++ ++ /** ++ * Checks if the data component type has a default value for this item type. ++ * ++ * @param type the data component type ++ * @return {@code true} if there is a default value ++ * @throws IllegalArgumentException if {@link #isItem()} is {@code false} ++ */ ++ public boolean hasDefaultData(final io.papermc.paper.datacomponent.@NotNull DataComponentType type) { ++ Preconditions.checkArgument(this.asItemType() != null); ++ return this.asItemType().hasDefaultData(type); ++ } ++ ++ /** ++ * Gets the default data component types for this item type. ++ * ++ * @return an immutable set of data component types ++ * @throws IllegalArgumentException if {@link #isItem()} is {@code false} ++ */ ++ public java.util.@org.jetbrains.annotations.Unmodifiable @NotNull Set getDefaultDataTypes() { ++ Preconditions.checkArgument(this.asItemType() != null); ++ return this.asItemType().getDefaultDataTypes(); ++ } ++ // Paper end - data component API + } +diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java +index 7cf7c6d05aa6cbf3f0c8612831404552c6a7b84a..c60e31425efd7b863941f5538faef6c0552290ae 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -376,6 +376,7 @@ public interface Registry extends Iterable { + */ + Registry POTION_EFFECT_TYPE = EFFECT; + // Paper end - potion effect type registry ++ Registry DATA_COMPONENT_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.DATA_COMPONENT_TYPE); // Paper + /** + * Get the object by its key. + * +diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java +index ed534fe4983873a2d5f623f0d9d5e3ce254615eb..f019d490794b49d21057820bab047e2f909934a1 100644 +--- a/src/main/java/org/bukkit/block/BlockType.java ++++ b/src/main/java/org/bukkit/block/BlockType.java +@@ -128,7 +128,7 @@ import org.jetbrains.annotations.Nullable; + * official replacement for the aforementioned enum. Entirely incompatible + * changes may occur. Do not use this API in plugins. + */ +-@ApiStatus.Internal ++@org.jetbrains.annotations.ApiStatus.Experimental // Paper - data component API - already required for data component API + public interface BlockType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - add translatable & feature flag API + + /** +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..6e4ca7d95953a25c0aaafd35e54ef9254a1b5f0b 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -1137,4 +1137,185 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + return Bukkit.getUnsafe().computeTooltipLines(this, tooltipContext, player); + } + // Paper end - expose itemstack tooltip lines ++ ++ // Paper start - data component API ++ /** ++ * Gets the value for the data component type on this stack. ++ * ++ * @param type the data component type ++ * @param the value type ++ * @return the value for the data component type, or {@code null} if not set or marked as removed ++ * @see #hasData(io.papermc.paper.datacomponent.DataComponentType) for DataComponentType.NonValued ++ */ ++ @org.jetbrains.annotations.Contract(pure = true) ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public @Nullable T getData(final io.papermc.paper.datacomponent.DataComponentType.@NotNull Valued type) { ++ return this.craftDelegate.getData(type); ++ } ++ ++ /** ++ * Gets the value for the data component type on this stack with ++ * a fallback value. ++ * ++ * @param type the data component type ++ * @param fallback the fallback value if the value isn't present ++ * @param the value type ++ * @return the value for the data component type or the fallback value ++ */ ++ @Utility ++ @org.jetbrains.annotations.Contract(value = "_, !null -> !null", pure = true) ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public @Nullable T getDataOrDefault(final io.papermc.paper.datacomponent.DataComponentType.@NotNull Valued type, final @Nullable T fallback) { ++ final T object = this.getData(type); ++ return object != null ? object : fallback; ++ } ++ ++ /** ++ * Checks if the data component type is set on the itemstack. ++ * ++ * @param type the data component type ++ * @return {@code true} if set, {@code false} otherwise ++ */ ++ @org.jetbrains.annotations.Contract(pure = true) ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public boolean hasData(final io.papermc.paper.datacomponent.@NotNull DataComponentType type) { ++ return this.craftDelegate.hasData(type); ++ } ++ ++ /** ++ * Gets all the data component types set on this stack. ++ * ++ * @return an immutable set of data component types ++ */ ++ @org.jetbrains.annotations.Contract("-> new") ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public java.util.@org.jetbrains.annotations.Unmodifiable Set getDataTypes() { ++ return this.craftDelegate.getDataTypes(); ++ } ++ ++ /** ++ * Sets the value of the data component type for this itemstack. To ++ * reset the value to the default for the {@link #getType() item type}, use ++ * {@link #resetData(io.papermc.paper.datacomponent.DataComponentType)}. To mark the data component type ++ * as removed, use {@link #unsetData(io.papermc.paper.datacomponent.DataComponentType)}. ++ * ++ * @param type the data component type ++ * @param valueBuilder value builder ++ * @param value type ++ */ ++ @Utility ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public void setData(final io.papermc.paper.datacomponent.DataComponentType.@NotNull Valued type, final @NotNull io.papermc.paper.datacomponent.DataComponentBuilder valueBuilder) { ++ this.setData(type, valueBuilder.build()); ++ } ++ ++ // /** ++ // * Modifies the value of the specified data component type for this item stack based on the result ++ // * of applying a given function to the current value. ++ // * ++ // *

If the function returns {@code null}, the data component type will be reset using ++ // * {@link #unsetData(DataComponentType)}. Otherwise, the ++ // * component value will be updated with the new result using {@link #setData(DataComponentType.Valued, Object)}.

++ // * ++ // * @param the type of the data component's value ++ // * @param type the data component type to be modified ++ // * @param consumer a function that takes the current component value (can be {@code null}) and ++ // * returns the modified value (or {@code null} to unset) ++ // */ ++ // @Utility ++ // public void editData(final io.papermc.paper.datacomponent.DataComponentType.@NotNull Valued type, final @NotNull java.util.function.Function<@Nullable T, @Nullable T> consumer) { ++ // T value = getData(type); ++ // T newType = consumer.apply(value); ++ // if (newType == null) { ++ // unsetData(type); ++ // } else { ++ // setData(type, newType); ++ // } ++ // } ++ ++ /** ++ * Sets the value of the data component type for this itemstack. To ++ * reset the value to the default for the {@link #getType() item type}, use ++ * {@link #resetData(io.papermc.paper.datacomponent.DataComponentType)}. To mark the data component type ++ * as removed, use {@link #unsetData(io.papermc.paper.datacomponent.DataComponentType)}. ++ * ++ * @param type the data component type ++ * @param value value to set ++ * @param value type ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public void setData(final io.papermc.paper.datacomponent.DataComponentType.@NotNull Valued type, final @NotNull T value) { ++ this.craftDelegate.setData(type, value); ++ } ++ ++ /** ++ * Marks this non-valued data component type as present in this itemstack. ++ * ++ * @param type the data component type ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public void setData(final io.papermc.paper.datacomponent.DataComponentType.@NotNull NonValued type) { ++ this.craftDelegate.setData(type); ++ } ++ ++ /** ++ * Marks this data component as removed for this itemstack. ++ * ++ * @param type the data component type ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public void unsetData(final io.papermc.paper.datacomponent.@NotNull DataComponentType type) { ++ this.craftDelegate.unsetData(type); ++ } ++ ++ /** ++ * Resets the value of this component to be the default ++ * value for the item type from {@link Material#getDefaultData(io.papermc.paper.datacomponent.DataComponentType.Valued)}. ++ * ++ * @param type the data component type ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public void resetData(final io.papermc.paper.datacomponent.@NotNull DataComponentType type) { ++ this.craftDelegate.resetData(type); ++ } ++ ++ /** ++ * Checks if the data component type is overridden from the default for the ++ * item type. ++ * ++ * @param type the data component type ++ * @return {@code true} if the data type is overridden ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public boolean isDataOverridden(final io.papermc.paper.datacomponent.@NotNull DataComponentType type) { ++ return this.craftDelegate.isDataOverridden(type); ++ } ++ ++ /** ++ * Checks if this itemstack matches another given itemstack excluding the provided components. ++ * This is useful if you are wanting to ignore certain properties of itemstacks, such as durability. ++ * ++ * @param item the item to compare ++ * @param excludeTypes the data component types to ignore ++ * @return {@code true} if the provided item is equal, ignoring the provided components ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public boolean matchesWithoutData(final @NotNull ItemStack item, final @NotNull java.util.Set excludeTypes) { ++ return this.matchesWithoutData(item, excludeTypes, false); ++ } ++ ++ /** ++ * Checks if this itemstack matches another given itemstack excluding the provided components. ++ * This is useful if you are wanting to ignore certain properties of itemstacks, such as durability. ++ * ++ * @param item the item to compare ++ * @param excludeTypes the data component types to ignore ++ * @param ignoreCount ignore the count of the item ++ * @return {@code true} if the provided item is equal, ignoring the provided components ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public boolean matchesWithoutData(final @NotNull ItemStack item, final @NotNull java.util.Set excludeTypes, final boolean ignoreCount) { ++ return this.craftDelegate.matchesWithoutData(item, excludeTypes, ignoreCount); ++ } ++ // Paper end - data component API + } +diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java +index 72803c00e4af576f286d2af34bf300ee554a7f3c..2a3c4f055d0e4ef009caed95152570660ab100d5 100644 +--- a/src/main/java/org/bukkit/inventory/ItemType.java ++++ b/src/main/java/org/bukkit/inventory/ItemType.java +@@ -2483,4 +2483,33 @@ public interface ItemType extends Keyed, Translatable, net.kyori.adventure.trans + */ + @Nullable ItemRarity getItemRarity(); + // Paper end - expand ItemRarity API ++ // Paper start - data component API ++ /** ++ * Gets the default value of the data component type for this item type. ++ * ++ * @param type the data component type ++ * @param the value type ++ * @return the default value or {@code null} if there is none ++ * @see #hasDefaultData(io.papermc.paper.datacomponent.DataComponentType) for DataComponentType.NonValued ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ @Nullable T getDefaultData(io.papermc.paper.datacomponent.DataComponentType.@NotNull Valued type); ++ ++ /** ++ * Checks if the data component type has a default value for this item type. ++ * ++ * @param type the data component type ++ * @return {@code true} if there is a default value ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ boolean hasDefaultData(io.papermc.paper.datacomponent.@NotNull DataComponentType type); ++ ++ /** ++ * Gets the default data component types for this item type. ++ * ++ * @return an immutable set of data component types ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ java.util.@org.jetbrains.annotations.Unmodifiable @NotNull Set getDefaultDataTypes(); ++ // Paper end - data component API + } diff --git a/patches/api/0495-Optimise-color-distance-check-in-MapPalette-by-remov.patch b/patches/api/0496-Optimise-color-distance-check-in-MapPalette-by-remov.patch similarity index 100% rename from patches/api/0495-Optimise-color-distance-check-in-MapPalette-by-remov.patch rename to patches/api/0496-Optimise-color-distance-check-in-MapPalette-by-remov.patch diff --git a/patches/api/0497-Fix-incorrect-invulnerability-damage-reduction.patch b/patches/api/0497-Fix-incorrect-invulnerability-damage-reduction.patch new file mode 100644 index 0000000000..63a5ca94e0 --- /dev/null +++ b/patches/api/0497-Fix-incorrect-invulnerability-damage-reduction.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Bjarne Koll +Date: Mon, 11 Nov 2024 21:35:22 +0100 +Subject: [PATCH] Fix incorrect invulnerability damage reduction + +Fixes incorrect spigot handling of the invulnerability damage +reduction applied when an already invulnerable entity is damaged with a +larger damage amount than the initial damage. +Vanilla still damages entities even if invulnerable if the damage to be +applied is larger than the previous damage taken. In that case, vanilla +applies the difference between the previous damage taken and the +proposed damage. + +Spigot's damage modifier API takes over the computation of damage +reducing effects, however spigot invokes this handling with the initial +damage before computing the difference to the previous damage amount. +This leads to the reduction values to generally be larger than expected, +as they are computed on the not-yet-reduced value. +Spigot applies these reductions after calling the EntityDamageEvent and +*then* subtracts the previous damage point, leading to the final damage +amount being smaller than expected. + +This patch cannot simply call the EntityDamageEvent with the reduced +damage, as that would lead to EntityDamageEvent#getDamage() returning +the already reduced damage, which breaks its method contract. +Instead, this patch makes use of the DamageModifier API, implementing +the last-damage-reduction as a DamageModifier. + +diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java +index ef5b2a0f18c1c126db0b0c4a4d2a57483680665a..73aa5dc079ecb1c38c55ae1916b12edf81b723f5 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java +@@ -247,6 +247,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { + * raw {@link EntityDamageEvent#getDamage()}. + */ + BASE, ++ INVULNERABILITY_REDUCTION, // Paper - fix invulnerability reduction in EntityDamageEvent - needs to be right under BASE as its the first reduction all others are based on + /** + * This represents the damage increased by freezing status. + */ diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index f8a3cdbd39..5e156e9126 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -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 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); @@ -3915,7 +3915,7 @@ index 0000000000000000000000000000000000000000..97848869df61648fc415e4d39f409f43 +} diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java b/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java new file mode 100644 -index 0000000000000000000000000000000000000000..c125c70a68130be373acc989053a6c0e487be924 +index 0000000000000000000000000000000000000000..632920e04686d8a0fd0a60e87348be1fe7862a3c --- /dev/null +++ b/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java @@ -0,0 +1,101 @@ @@ -3923,15 +3923,15 @@ index 0000000000000000000000000000000000000000..c125c70a68130be373acc989053a6c0e + +import ca.spottedleaf.concurrentutil.executor.thread.PrioritisedThreadPool; +import ca.spottedleaf.moonrise.common.PlatformHooks; ++import com.mojang.logging.LogUtils; +import org.slf4j.Logger; -+import org.slf4j.LoggerFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; + +public final class MoonriseCommon { + -+ private static final Logger LOGGER = LoggerFactory.getLogger(MoonriseCommon.class); ++ private static final Logger LOGGER = LogUtils.getClassLogger(); + + public static final PrioritisedThreadPool WORKER_POOL = new PrioritisedThreadPool( + new Consumer<>() { @@ -4691,16 +4691,21 @@ index 0000000000000000000000000000000000000000..197224e31175252d8438a8df585bbb65 +} diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java new file mode 100644 -index 0000000000000000000000000000000000000000..422bc104e5bdd4ae786b14d97eb779dc76bfad69 +index 0000000000000000000000000000000000000000..e85e544506b4c762503a1cb490e6c0f5b1d563f4 --- /dev/null +++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -0,0 +1,190 @@ +@@ -0,0 +1,220 @@ +package io.papermc.paper.util; + ++import com.google.common.collect.Collections2; ++import com.google.common.collect.Lists; +import com.google.common.util.concurrent.ThreadFactoryBuilder; ++import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.math.BlockPosition; +import io.papermc.paper.math.FinePosition; +import io.papermc.paper.math.Position; ++import java.util.Collection; ++import java.util.Collections; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; @@ -4709,11 +4714,17 @@ index 0000000000000000000000000000000000000000..422bc104e5bdd4ae786b14d97eb779dc +import java.util.concurrent.TimeUnit; +import java.util.function.BiConsumer; +import java.util.function.Consumer; ++import java.util.function.Function; +import java.util.function.Supplier; ++import net.kyori.adventure.key.Key; +import net.minecraft.core.BlockPos; ++import net.minecraft.core.Holder; +import net.minecraft.core.Vec3i; ++import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceKey; ++import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; ++import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; @@ -4884,6 +4895,25 @@ index 0000000000000000000000000000000000000000..422bc104e5bdd4ae786b14d97eb779dc + public static NamespacedKey fromResourceKey(final ResourceKey key) { + return CraftNamespacedKey.fromMinecraft(key.location()); + } ++ ++ public static Holder keyToSound(Key key) { ++ ResourceLocation soundId = PaperAdventure.asVanilla(key); ++ return BuiltInRegistries.SOUND_EVENT.wrapAsHolder(BuiltInRegistries.SOUND_EVENT.getOptional(soundId).orElse(SoundEvent.createVariableRangeEvent(soundId))); ++ } ++ ++ public static List transformUnmodifiable(final List nms, final Function converter) { ++ return Collections.unmodifiableList(Lists.transform(nms, converter::apply)); ++ } ++ ++ public static Collection transformUnmodifiable(final Collection nms, final Function converter) { ++ return Collections.unmodifiableCollection(Collections2.transform(nms, converter::apply)); ++ } ++ ++ public static > void addAndConvert(final C target, final Collection toAdd, final Function converter) { ++ for (final A value : toAdd) { ++ target.add(converter.apply(value)); ++ } ++ } +} diff --git a/src/main/java/io/papermc/paper/util/StackWalkerUtil.java b/src/main/java/io/papermc/paper/util/StackWalkerUtil.java new file mode 100644 @@ -5426,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; } @@ -5471,21 +5501,26 @@ index f6a3606b972064c4ec78487374e6197c0c447e27..c6ded1ac73ddbc0336000f77c0f99fa2 + }); + return; + } -+ List 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> onLoad) { ++ List 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); @@ -5529,7 +5564,7 @@ index f6a3606b972064c4ec78487374e6197c0c447e27..c6ded1ac73ddbc0336000f77c0f99fa2 public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules()))); // Paper - create paper world configs diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0c211366be68e33b24da2b055142626968ed6b0b..32e7c6e6f09e53fe8b5ade22dad8142cd09e0163 100644 +index fd97a0e54ad8487b0c6f242fcb626f0b76f88274..785c7e11f92610be58b624d252d1858658496af7 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -309,6 +309,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -6166,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 { @@ -6189,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 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 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 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 chunks) -> { ++ cb.run(); ++ } ++ ); + } + + @Override @@ -6309,6 +6340,28 @@ index f6e6f0ddef6693c58f28b89cf3df005a8d47e08d..101eea3452c9e387e770b716543c3a4f public static net.minecraft.world.item.ItemStack asNMSCopy(ItemStack original) { if (original instanceof CraftItemStack) { CraftItemStack stack = (CraftItemStack) original; +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java b/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java +index 097996d3955ab5126b71f7bff1dd2c62becb5ffd..a8b46ea5e4b6260c2728c67e8651b74fe6356605 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java +@@ -40,6 +40,17 @@ public final class CraftLocation { + return new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + } + ++ // Paper start ++ public static net.minecraft.core.GlobalPos toGlobalPos(Location location) { ++ return net.minecraft.core.GlobalPos.of(((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle().dimension(), toBlockPosition(location)); ++ } ++ ++ public static Location fromGlobalPos(net.minecraft.core.GlobalPos globalPos) { ++ BlockPos pos = globalPos.pos(); ++ return new org.bukkit.Location(net.minecraft.server.MinecraftServer.getServer().getLevel(globalPos.dimension()).getWorld(), pos.getX(), pos.getY(), pos.getZ()); ++ } ++ // Paper end ++ + public static Vec3 toVec3D(Location location) { + return new Vec3(location.getX(), location.getY(), location.getZ()); + } diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java index b8a865305cc61954aeebff4a7cd1d1973c5f46ab..e444662ee4d9405eeea7caa41b9cd6b36586d840 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index b22e85c55b..5fc337c1e3 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -1161,10 +1161,10 @@ index 0000000000000000000000000000000000000000..2fd6c3e65354071af71c7d8ebb97b559 +} diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java new file mode 100644 -index 0000000000000000000000000000000000000000..161bc8c577643094d824ea96fb6974c76e5e77f0 +index 0000000000000000000000000000000000000000..610003a668c4a7fe53e3477accc6bafb8479b936 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java -@@ -0,0 +1,479 @@ +@@ -0,0 +1,483 @@ +package io.papermc.paper.adventure; + +import com.mojang.brigadier.StringReader; @@ -1314,6 +1314,10 @@ index 0000000000000000000000000000000000000000..161bc8c577643094d824ea96fb6974c7 + + // Key + ++ public static Key asAdventure(final ResourceLocation key) { ++ return Key.key(key.getNamespace(), key.getPath()); ++ } ++ + public static ResourceLocation asVanilla(final Key key) { + return ResourceLocation.fromNamespaceAndPath(key.namespace(), key.value()); + } @@ -2704,7 +2708,7 @@ index 709330ca9caa82a6de71767b3d5c32f97ea1d68b..daf20aa9a83a2583c0c61a4123cc2e52 public boolean logIPs() { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 32e7c6e6f09e53fe8b5ade22dad8142cd09e0163..4303bde198050cd037f006234d269af406606eff 100644 +index 785c7e11f92610be58b624d252d1858658496af7..99607edee9fba8df87f0525bf0eadee865ab38a4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -190,6 +190,7 @@ import net.minecraft.world.item.trading.MerchantOffers; @@ -3558,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 { @@ -3619,7 +3623,7 @@ index 8b58884d6cb1088a2fffb36a99bfe4dc568326d1..9a79b948264150d0f7a843a8ddd2ea92 private Map> gamerules; public synchronized Map> 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"); } @@ -3639,7 +3643,7 @@ index 8b58884d6cb1088a2fffb36a99bfe4dc568326d1..9a79b948264150d0f7a843a8ddd2ea92 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 94004204b6cdbbbf35263faae56e3e06cb6b650c..2e33acc428dbfd3e123dfd6ef90bc020b8a08daf 100644 +index 39126769594a535ebd4bf7052f42e9eda9d3e10a..41ceea1093edbf777f9ebe252114be7f75438420 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -20,6 +20,12 @@ public class Main { @@ -5202,7 +5206,7 @@ index c71a4971f127fdfc753306019313ce1a31201120..fd3b12477c30d1eabdbe57ea77902793 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 5dea83c1a0de4e5123430bf2f902a78969021167..2e524520308dda7ce7df98d91c89a9cfe7542862 100644 +index 2d68086ef09b5f2d6b3d3e6200e621c23747b25a..f3789ea732b17a311d8203a58a97d11370ec7863 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -1097,6 +1097,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { diff --git a/patches/server/0011-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0011-Use-TerminalConsoleAppender-for-console-improvements.patch index 2fdbc106eb..5163963488 100644 --- a/patches/server/0011-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0011-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -25,7 +25,7 @@ Other changes: Co-Authored-By: Emilia Kond diff --git a/build.gradle.kts b/build.gradle.kts -index 220d2696bf40d1657c87d049f563ccfffed2e8ad..c808f36b30d0f8edb8365875039fd20b8c20007d 100644 +index 220d2696bf40d1657c87d049f563ccfffed2e8ad..99e44684a3f6340ed3c0f73c690a9d4d51872f0d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,6 +5,12 @@ plugins { @@ -41,13 +41,14 @@ index 220d2696bf40d1657c87d049f563ccfffed2e8ad..c808f36b30d0f8edb8365875039fd20b // Paper start - configure mockito agent that is needed in newer java versions val mockitoAgent = configurations.register("mockitoAgent") abstract class MockitoAgentProvider : CommandLineArgumentProvider { -@@ -19,7 +25,21 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { +@@ -19,7 +25,22 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { dependencies { implementation(project(":paper-api")) - implementation("jline:jline:2.12.1") + // Paper start -+ implementation("org.jline:jline-terminal-jansi:3.21.0") ++ implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ ++ implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 + implementation("net.minecrell:terminalconsoleappender:1.3.0") + implementation("net.kyori:adventure-text-serializer-ansi:4.17.0") // Keep in sync with adventureVersion from Paper-API build file + /* @@ -64,7 +65,7 @@ index 220d2696bf40d1657c87d049f563ccfffed2e8ad..c808f36b30d0f8edb8365875039fd20b implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion implementation("org.ow2.asm:asm-commons:9.7.1") implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files -@@ -92,6 +112,19 @@ tasks.check { +@@ -92,6 +113,19 @@ tasks.check { dependsOn(scanJar) } // Paper end @@ -401,7 +402,7 @@ index 1333daa8666fe2ec4033a2f57ba6b716fcdd5343..8daa027a94602d7d556cf4fbfc8fcd97 this.bans = new UserBanList(PlayerList.USERBANLIST_FILE); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c3fc8b1abe843a19347509947f4b864c1b417800..e497da2dba83779c4ad1c45cea133bddadf61446 100644 +index c3774d9a253d4fda80f63d4040722ab5c1c94be4..41aa22f431c989d60dde5c85ca2821d5bcf613af 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -43,7 +43,7 @@ import java.util.logging.Level; @@ -428,7 +429,7 @@ index c3fc8b1abe843a19347509947f4b864c1b417800..e497da2dba83779c4ad1c45cea133bdd @Override public PluginCommand getPluginCommand(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 2e33acc428dbfd3e123dfd6ef90bc020b8a08daf..4a99cf5a146abe0d2b40ffc1189fdc5540f14d55 100644 +index 41ceea1093edbf777f9ebe252114be7f75438420..b6e449c2f29b0a201e5e7495de81d21a19f67a25 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -13,7 +13,6 @@ import java.util.logging.Logger; @@ -467,11 +468,12 @@ index 2e33acc428dbfd3e123dfd6ef90bc020b8a08daf..4a99cf5a146abe0d2b40ffc1189fdc55 } if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { -@@ -231,6 +241,7 @@ public class Main { +@@ -231,6 +241,8 @@ public class Main { } } + System.setProperty("library.jansi.version", "Paper"); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows ++ System.setProperty("jdk.console", "java.base"); // Paper - revert default console provider back to java.base so we can have our own jline System.out.println("Loading libraries, please wait..."); net.minecraft.server.Main.main(options); } catch (Throwable t) { diff --git a/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch index e5a313a4fa..82bd1e5d98 100644 --- a/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,10 +15,10 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/build.gradle.kts b/build.gradle.kts -index c808f36b30d0f8edb8365875039fd20b8c20007d..59f52f56dd9dc80a929f1ae754138e4ca2ecf493 100644 +index ad49cd6db794dc42dda6f72204d5f232aafde797..ec71e5a0fa0190b54828da9688281e72b21f733e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -35,7 +35,7 @@ dependencies { +@@ -36,7 +36,7 @@ dependencies { all its classes to check if they are plugins. Scanning takes about 1-2 seconds so adding this speeds up the server start. */ diff --git a/patches/server/0014-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch b/patches/server/0014-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch index 0a41ae4dbc..1c279a80e0 100644 --- a/patches/server/0014-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch +++ b/patches/server/0014-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread diff --git a/build.gradle.kts b/build.gradle.kts -index 59f52f56dd9dc80a929f1ae754138e4ca2ecf493..dde8718b8c0dab4b8bcd44de33117c48dc3ead0a 100644 +index ec71e5a0fa0190b54828da9688281e72b21f733e..3fb47580cd8de02574905384e455d87224864407 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -46,6 +46,7 @@ dependencies { +@@ -47,6 +47,7 @@ dependencies { implementation("commons-lang:commons-lang:2.6") runtimeOnly("org.xerial:sqlite-jdbc:3.46.1.3") runtimeOnly("com.mysql:mysql-connector-j:9.1.0") diff --git a/patches/server/0015-Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/0015-Deobfuscate-stacktraces-in-log-messages-crash-report.patch index f787f2060b..da0087b69e 100644 --- a/patches/server/0015-Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/0015-Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and diff --git a/build.gradle.kts b/build.gradle.kts -index dde8718b8c0dab4b8bcd44de33117c48dc3ead0a..429fcd5927cf3259e8cdc83fadf78b41a38eb3bf 100644 +index 3fb47580cd8de02574905384e455d87224864407..653b48c1bc28af6f88ec3bdd11b2d1a683dd3465 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -59,6 +59,7 @@ dependencies { +@@ -60,6 +60,7 @@ dependencies { mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions testImplementation("org.ow2.asm:asm-tree:9.7.1") testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest diff --git a/patches/server/0020-Plugin-remapping.patch b/patches/server/0020-Plugin-remapping.patch index b7aa91fe6c..b4c402e45d 100644 --- a/patches/server/0020-Plugin-remapping.patch +++ b/patches/server/0020-Plugin-remapping.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Plugin remapping Co-authored-by: Nassim Jahnke diff --git a/build.gradle.kts b/build.gradle.kts -index 429fcd5927cf3259e8cdc83fadf78b41a38eb3bf..fa3476acb77ce5d1247244808ead5b2a994e5fc7 100644 +index dd7900a126ab35ed00af5653a35d361d175f6f76..8678e5bd59a7e085cb1b4e38f29e06ce36d2c1de 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -60,6 +60,7 @@ dependencies { +@@ -61,6 +61,7 @@ dependencies { testImplementation("org.ow2.asm:asm-tree:9.7.1") testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling @@ -17,7 +17,7 @@ index 429fcd5927cf3259e8cdc83fadf78b41a38eb3bf..fa3476acb77ce5d1247244808ead5b2a } paperweight { -@@ -187,20 +188,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM +@@ -188,20 +189,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM runtime.filterNot { it.asFile.absolutePath == vanilla } } @@ -1904,7 +1904,7 @@ index 0000000000000000000000000000000000000000..73b20a92f330311e3fef8f03b51a0985 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 600e865688b423d9bb4338f413dc28418ba37748..ad699a4ad555a4d7c85727bd835ebacd24d02c2b 100644 +index 542ff64ce0cb93a9f996fa0a65e8dde7ed39c3a9..5c54c5c525c86bb8037982435b8769ec2ca2c6cb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1005,6 +1005,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch b/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch index 72febed91c..047ec2d29f 100644 --- a/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch +++ b/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Remap reflection calls in plugins using internals Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> diff --git a/build.gradle.kts b/build.gradle.kts -index fa3476acb77ce5d1247244808ead5b2a994e5fc7..47df5ac22b0fc97381364eb4d16e33768ff9794c 100644 +index 24f3d0c96fe9d70b1a7cf528e09ebfc4366577ed..7aee6d9849f0a9c64db0368d2faa03c0633a72a4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -61,6 +61,12 @@ dependencies { +@@ -62,6 +62,12 @@ dependencies { testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling implementation("net.neoforged:AutoRenamingTool:2.0.3") // Paper - remap plugins diff --git a/patches/server/0024-Remove-Spigot-timings.patch b/patches/server/0024-Remove-Spigot-timings.patch index 09a085b7b2..70af5840ee 100644 --- a/patches/server/0024-Remove-Spigot-timings.patch +++ b/patches/server/0024-Remove-Spigot-timings.patch @@ -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); } diff --git a/patches/server/0033-Expose-server-build-information.patch b/patches/server/0033-Expose-server-build-information.patch index 27bf934328..ef5f90d7d0 100644 --- a/patches/server/0033-Expose-server-build-information.patch +++ b/patches/server/0033-Expose-server-build-information.patch @@ -11,7 +11,7 @@ Co-authored-by: Jake Potrebic Co-authored-by: masmc05 diff --git a/build.gradle.kts b/build.gradle.kts -index 47df5ac22b0fc97381364eb4d16e33768ff9794c..dfc9ca34656cb48462354e7d35dee5ad54096c39 100644 +index 7aee6d9849f0a9c64db0368d2faa03c0633a72a4..40afa9e2cfb4518e9050ccac739aec3215f95d56 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ @@ -20,7 +20,7 @@ index 47df5ac22b0fc97381364eb4d16e33768ff9794c..dfc9ca34656cb48462354e7d35dee5ad plugins { java -@@ -78,18 +79,24 @@ tasks.jar { +@@ -79,18 +80,24 @@ tasks.jar { manifest { val git = Git(rootProject.layout.projectDirectory.path) @@ -659,7 +659,7 @@ index 16d2b3e59b8a6ef65b411afb9d94c61e6d797e36..e4335bfc98272c5499651977625e1f0c public List getOnlinePlayers() { return this.playerView; diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 6a3331eb45fdd2199fe41ab624d6dbb85bc04711..15ea3363127f315dc3aeb1482dd8a8637cc1a9e0 100644 +index 99bc6e3d472edc0a0182e7b53286cb6a0170ae80..44b6fd8a64e7d7756eb62cd3816b1c4dcc5c5927 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -15,6 +15,7 @@ import joptsimple.OptionSet; @@ -670,7 +670,7 @@ index 6a3331eb45fdd2199fe41ab624d6dbb85bc04711..15ea3363127f315dc3aeb1482dd8a863 public static boolean useJline = true; public static boolean useConsole = true; -@@ -241,15 +242,17 @@ public class Main { +@@ -241,7 +242,7 @@ public class Main { deadline.add(Calendar.DAY_OF_YEAR, -14); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); @@ -679,12 +679,12 @@ index 6a3331eb45fdd2199fe41ab624d6dbb85bc04711..15ea3363127f315dc3aeb1482dd8a863 System.err.println("*** Server will start in 20 seconds ***"); Thread.sleep(TimeUnit.SECONDS.toMillis(20)); } - } +@@ -249,8 +250,9 @@ public class Main { System.setProperty("library.jansi.version", "Paper"); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows + System.setProperty("jdk.console", "java.base"); // Paper - revert default console provider back to java.base so we can have our own jline - System.out.println("Loading libraries, please wait..."); - net.minecraft.server.Main.main(options); -+ + //System.out.println("Loading libraries, please wait..."); + //net.minecraft.server.Main.main(options); + io.papermc.paper.PaperBootstrap.boot(options); diff --git a/patches/server/0036-Entity-Origin-API.patch b/patches/server/0036-Entity-Origin-API.patch index 3f9282aee9..89116c4edf 100644 --- a/patches/server/0036-Entity-Origin-API.patch +++ b/patches/server/0036-Entity-Origin-API.patch @@ -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 diff --git a/patches/server/0040-Add-more-entities-to-activation-range-ignore-list.patch b/patches/server/0040-Add-more-entities-to-activation-range-ignore-list.patch index ad1700365a..f7bf86db8b 100644 --- a/patches/server/0040-Add-more-entities-to-activation-range-ignore-list.patch +++ b/patches/server/0040-Add-more-entities-to-activation-range-ignore-list.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add more entities to activation range ignore list diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 0338ceaddc1a0921f5f8796d5eac75c301bafac2..bd522080d17b5b470ec3ab42aa4ecc3082248c8a 100644 +index 0338ceaddc1a0921f5f8796d5eac75c301bafac2..3184090cfa1ce6ec01686a7651be01cff49f5951 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -92,6 +92,9 @@ public class ActivationRange @@ -14,7 +14,7 @@ index 0338ceaddc1a0921f5f8796d5eac75c301bafac2..bd522080d17b5b470ec3ab42aa4ecc30 || entity instanceof PrimedTnt + || entity instanceof net.minecraft.world.entity.item.FallingBlockEntity // Paper - Always tick falling blocks + || entity instanceof net.minecraft.world.entity.vehicle.AbstractMinecart // Paper -+ || entity instanceof net.minecraft.world.entity.vehicle.Boat // Paper ++ || entity instanceof net.minecraft.world.entity.vehicle.AbstractBoat // Paper || entity instanceof EndCrystal || entity instanceof FireworkRocketEntity || entity instanceof ThrownTrident ) diff --git a/patches/server/0045-Disable-thunder.patch b/patches/server/0045-Disable-thunder.patch index 78a2a9fd6a..7c2ce40c67 100644 --- a/patches/server/0045-Disable-thunder.patch +++ b/patches/server/0045-Disable-thunder.patch @@ -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"); diff --git a/patches/server/0046-Disable-ice-and-snow.patch b/patches/server/0046-Disable-ice-and-snow.patch index 73dcf9fa47..406de2d6a1 100644 --- a/patches/server/0046-Disable-ice-and-snow.patch +++ b/patches/server/0046-Disable-ice-and-snow.patch @@ -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"); diff --git a/patches/server/0076-Configurable-spawn-chances-for-skeleton-horses.patch b/patches/server/0076-Configurable-spawn-chances-for-skeleton-horses.patch index 4cf4bf1181..3133546f85 100644 --- a/patches/server/0076-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/patches/server/0076-Configurable-spawn-chances-for-skeleton-horses.patch @@ -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); diff --git a/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch index 2c0ae7a0fd..0a0bf28ff8 100644 --- a/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch @@ -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 diff --git a/patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 6e252c8f8b..9af9af8eb8 100644 --- a/patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -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) { diff --git a/patches/server/0101-Fix-global-sound-handling.patch b/patches/server/0101-Fix-global-sound-handling.patch index 8af9a82dea..303eeb7fe1 100644 --- a/patches/server/0101-Fix-global-sound-handling.patch +++ b/patches/server/0101-Fix-global-sound-handling.patch @@ -11,10 +11,10 @@ Co-authored-by: lexikiq Co-authored-by: Aikar 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(); } diff --git a/patches/server/0186-Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/server/0186-Expand-World.spawnParticle-API-and-add-Builder.patch index b38425e658..978cde4c95 100644 --- a/patches/server/0186-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/server/0186-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -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 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 { diff --git a/patches/server/0202-Expand-Explosions-API.patch b/patches/server/0202-Expand-Explosions-API.patch index 4c63639fb5..7bf62df21c 100644 --- a/patches/server/0202-Expand-Explosions-API.patch +++ b/patches/server/0202-Expand-Explosions-API.patch @@ -6,13 +6,13 @@ Subject: [PATCH] Expand Explosions API Add Entity as a Source capability, and add more API choices, and on Location. Co-authored-by: Esoteric Enderman <90862990+EsotericEnderman@users.noreply.github.com> -Co-authored-by: Bjarne Koll +Co-authored-by: Bjarne Koll 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 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 { diff --git a/patches/server/0207-InventoryCloseEvent-Reason-API.patch b/patches/server/0207-InventoryCloseEvent-Reason-API.patch index aa12e84c6f..5432df8ae8 100644 --- a/patches/server/0207-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0207-InventoryCloseEvent-Reason-API.patch @@ -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 { diff --git a/patches/server/0224-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/patches/server/0224-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 6cd73f5ba7..15dfd12d29 100644 --- a/patches/server/0224-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/patches/server/0224-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -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 diff --git a/patches/server/0278-Fixes-and-additions-to-the-spawn-reason-API.patch b/patches/server/0278-Fixes-and-additions-to-the-spawn-reason-API.patch index 7a914a84e5..00ad95502b 100644 --- a/patches/server/0278-Fixes-and-additions-to-the-spawn-reason-API.patch +++ b/patches/server/0278-Fixes-and-additions-to-the-spawn-reason-API.patch @@ -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 { diff --git a/patches/server/0301-Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/0301-Optimise-EntityGetter-getPlayerByUUID.patch index 26d9943b72..1f06a4645d 100644 --- a/patches/server/0301-Optimise-EntityGetter-getPlayerByUUID.patch +++ b/patches/server/0301-Optimise-EntityGetter-getPlayerByUUID.patch @@ -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 diff --git a/patches/server/0310-Add-debug-for-sync-chunk-loads.patch b/patches/server/0310-Add-debug-for-sync-chunk-loads.patch index 24b766de8a..b0b1810a80 100644 --- a/patches/server/0310-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0310-Add-debug-for-sync-chunk-loads.patch @@ -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 } diff --git a/patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index f3de36db4b..e37145e970 100644 --- a/patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -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 diff --git a/patches/server/0350-Implement-Mob-Goal-API.patch b/patches/server/0350-Implement-Mob-Goal-API.patch index 3069423277..18883d8d15 100644 --- a/patches/server/0350-Implement-Mob-Goal-API.patch +++ b/patches/server/0350-Implement-Mob-Goal-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index dfc9ca34656cb48462354e7d35dee5ad54096c39..92c1fe881f3bfedc2d773b1812772f16555a09d3 100644 +index 40afa9e2cfb4518e9050ccac739aec3215f95d56..fd687af4923208272b01fc03fe9b65867e49dd6e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -53,6 +53,7 @@ dependencies { +@@ -54,6 +54,7 @@ dependencies { runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") diff --git a/patches/server/0374-Add-BlockStateMeta-clearBlockState.patch b/patches/server/0373-Add-BlockStateMeta-clearBlockState.patch similarity index 100% rename from patches/server/0374-Add-BlockStateMeta-clearBlockState.patch rename to patches/server/0373-Add-BlockStateMeta-clearBlockState.patch diff --git a/patches/server/0373-Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/patches/server/0373-Add-Plugin-Tickets-to-API-Chunk-Methods.patch deleted file mode 100644 index 0341f94066..0000000000 --- a/patches/server/0373-Add-Plugin-Tickets-to-API-Chunk-Methods.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -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)); - }); - }); diff --git a/patches/server/0375-Convert-legacy-attributes-in-Item-Meta.patch b/patches/server/0374-Convert-legacy-attributes-in-Item-Meta.patch similarity index 97% rename from patches/server/0375-Convert-legacy-attributes-in-Item-Meta.patch rename to patches/server/0374-Convert-legacy-attributes-in-Item-Meta.patch index 87efb884b2..fcb2004735 100644 --- a/patches/server/0375-Convert-legacy-attributes-in-Item-Meta.patch +++ b/patches/server/0374-Convert-legacy-attributes-in-Item-Meta.patch @@ -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 { diff --git a/patches/server/0376-Do-not-accept-invalid-client-settings.patch b/patches/server/0375-Do-not-accept-invalid-client-settings.patch similarity index 100% rename from patches/server/0376-Do-not-accept-invalid-client-settings.patch rename to patches/server/0375-Do-not-accept-invalid-client-settings.patch diff --git a/patches/server/0377-Improve-fix-EntityTargetLivingEntityEvent.patch b/patches/server/0376-Improve-fix-EntityTargetLivingEntityEvent.patch similarity index 100% rename from patches/server/0377-Improve-fix-EntityTargetLivingEntityEvent.patch rename to patches/server/0376-Improve-fix-EntityTargetLivingEntityEvent.patch diff --git a/patches/server/0378-Add-entity-liquid-API.patch b/patches/server/0377-Add-entity-liquid-API.patch similarity index 100% rename from patches/server/0378-Add-entity-liquid-API.patch rename to patches/server/0377-Add-entity-liquid-API.patch diff --git a/patches/server/0379-Add-PrepareResultEvent.patch b/patches/server/0378-Add-PrepareResultEvent.patch similarity index 98% rename from patches/server/0379-Add-PrepareResultEvent.patch rename to patches/server/0378-Add-PrepareResultEvent.patch index 9a7c756812..6f987bb449 100644 --- a/patches/server/0379-Add-PrepareResultEvent.patch +++ b/patches/server/0378-Add-PrepareResultEvent.patch @@ -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 { diff --git a/patches/server/0380-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0379-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch similarity index 91% rename from patches/server/0380-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch rename to patches/server/0379-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index 444ff88b49..c4d04af351 100644 --- a/patches/server/0380-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/patches/server/0379-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -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 { diff --git a/patches/server/0381-Fix-arrows-never-despawning-MC-125757.patch b/patches/server/0380-Fix-arrows-never-despawning-MC-125757.patch similarity index 100% rename from patches/server/0381-Fix-arrows-never-despawning-MC-125757.patch rename to patches/server/0380-Fix-arrows-never-despawning-MC-125757.patch diff --git a/patches/server/0382-Thread-Safe-Vanilla-Command-permission-checking.patch b/patches/server/0381-Thread-Safe-Vanilla-Command-permission-checking.patch similarity index 100% rename from patches/server/0382-Thread-Safe-Vanilla-Command-permission-checking.patch rename to patches/server/0381-Thread-Safe-Vanilla-Command-permission-checking.patch diff --git a/patches/server/0383-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/0382-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch similarity index 100% rename from patches/server/0383-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch rename to patches/server/0382-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch diff --git a/patches/server/0384-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch b/patches/server/0383-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch similarity index 100% rename from patches/server/0384-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch rename to patches/server/0383-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch diff --git a/patches/server/0385-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server/0384-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch similarity index 100% rename from patches/server/0385-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch rename to patches/server/0384-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch diff --git a/patches/server/0386-Optimize-NetworkManager-Exception-Handling.patch b/patches/server/0385-Optimize-NetworkManager-Exception-Handling.patch similarity index 100% rename from patches/server/0386-Optimize-NetworkManager-Exception-Handling.patch rename to patches/server/0385-Optimize-NetworkManager-Exception-Handling.patch diff --git a/patches/server/0387-Fix-some-rails-connecting-improperly.patch b/patches/server/0386-Fix-some-rails-connecting-improperly.patch similarity index 100% rename from patches/server/0387-Fix-some-rails-connecting-improperly.patch rename to patches/server/0386-Fix-some-rails-connecting-improperly.patch diff --git a/patches/server/0388-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch b/patches/server/0387-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch similarity index 100% rename from patches/server/0388-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch rename to patches/server/0387-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch diff --git a/patches/server/0389-Brand-support.patch b/patches/server/0388-Brand-support.patch similarity index 96% rename from patches/server/0389-Brand-support.patch rename to patches/server/0388-Brand-support.patch index 445cf6f8a2..0b8173758c 100644 --- a/patches/server/0389-Brand-support.patch +++ b/patches/server/0388-Brand-support.patch @@ -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 { diff --git a/patches/server/0390-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/server/0389-Add-playPickupItemAnimation-to-LivingEntity.patch similarity index 100% rename from patches/server/0390-Add-playPickupItemAnimation-to-LivingEntity.patch rename to patches/server/0389-Add-playPickupItemAnimation-to-LivingEntity.patch diff --git a/patches/server/0391-Don-t-require-FACING-data.patch b/patches/server/0390-Don-t-require-FACING-data.patch similarity index 100% rename from patches/server/0391-Don-t-require-FACING-data.patch rename to patches/server/0390-Don-t-require-FACING-data.patch diff --git a/patches/server/0392-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0391-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch similarity index 90% rename from patches/server/0392-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch rename to patches/server/0391-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 3126cc1613..42aa6ace69 100644 --- a/patches/server/0392-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0391-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -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 { diff --git a/patches/server/0393-Add-moon-phase-API.patch b/patches/server/0392-Add-moon-phase-API.patch similarity index 100% rename from patches/server/0393-Add-moon-phase-API.patch rename to patches/server/0392-Add-moon-phase-API.patch diff --git a/patches/server/0394-Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/server/0393-Do-not-let-the-server-load-chunks-from-newer-version.patch similarity index 100% rename from patches/server/0394-Do-not-let-the-server-load-chunks-from-newer-version.patch rename to patches/server/0393-Do-not-let-the-server-load-chunks-from-newer-version.patch diff --git a/patches/server/0395-Prevent-headless-pistons-from-being-created.patch b/patches/server/0394-Prevent-headless-pistons-from-being-created.patch similarity index 100% rename from patches/server/0395-Prevent-headless-pistons-from-being-created.patch rename to patches/server/0394-Prevent-headless-pistons-from-being-created.patch diff --git a/patches/server/0396-Add-BellRingEvent.patch b/patches/server/0395-Add-BellRingEvent.patch similarity index 93% rename from patches/server/0396-Add-BellRingEvent.patch rename to patches/server/0395-Add-BellRingEvent.patch index 32c63afd37..c78e88ccaa 100644 --- a/patches/server/0396-Add-BellRingEvent.patch +++ b/patches/server/0395-Add-BellRingEvent.patch @@ -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 { diff --git a/patches/server/0397-Add-zombie-targets-turtle-egg-config.patch b/patches/server/0396-Add-zombie-targets-turtle-egg-config.patch similarity index 100% rename from patches/server/0397-Add-zombie-targets-turtle-egg-config.patch rename to patches/server/0396-Add-zombie-targets-turtle-egg-config.patch diff --git a/patches/server/0398-Buffer-joins-to-world.patch b/patches/server/0397-Buffer-joins-to-world.patch similarity index 100% rename from patches/server/0398-Buffer-joins-to-world.patch rename to patches/server/0397-Buffer-joins-to-world.patch diff --git a/patches/server/0399-Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/0398-Fix-hex-colors-not-working-in-some-kick-messages.patch similarity index 100% rename from patches/server/0399-Fix-hex-colors-not-working-in-some-kick-messages.patch rename to patches/server/0398-Fix-hex-colors-not-working-in-some-kick-messages.patch diff --git a/patches/server/0400-Add-more-Evoker-API.patch b/patches/server/0399-Add-more-Evoker-API.patch similarity index 100% rename from patches/server/0400-Add-more-Evoker-API.patch rename to patches/server/0399-Add-more-Evoker-API.patch diff --git a/patches/server/0401-Add-methods-to-get-translation-keys.patch b/patches/server/0400-Add-methods-to-get-translation-keys.patch similarity index 100% rename from patches/server/0401-Add-methods-to-get-translation-keys.patch rename to patches/server/0400-Add-methods-to-get-translation-keys.patch diff --git a/patches/server/0402-Create-HoverEvent-from-ItemStack-Entity.patch b/patches/server/0401-Create-HoverEvent-from-ItemStack-Entity.patch similarity index 100% rename from patches/server/0402-Create-HoverEvent-from-ItemStack-Entity.patch rename to patches/server/0401-Create-HoverEvent-from-ItemStack-Entity.patch diff --git a/patches/server/0403-Cache-block-data-strings.patch b/patches/server/0402-Cache-block-data-strings.patch similarity index 97% rename from patches/server/0403-Cache-block-data-strings.patch rename to patches/server/0402-Cache-block-data-strings.patch index 4c26cbbfcd..3871c96541 100644 --- a/patches/server/0403-Cache-block-data-strings.patch +++ b/patches/server/0402-Cache-block-data-strings.patch @@ -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 +Date: Tue, 25 Aug 2020 13:48:33 +0200 +Subject: [PATCH] Add PlayerItemCooldownEvent + + +diff --git a/src/main/java/net/minecraft/world/item/ItemCooldowns.java b/src/main/java/net/minecraft/world/item/ItemCooldowns.java +index 2add88d2543b2e1143bd4b1c53946d7ba3f399da..c7a21b33db802fa6b64865ff2b4f0941279b72cb 100644 +--- a/src/main/java/net/minecraft/world/item/ItemCooldowns.java ++++ b/src/main/java/net/minecraft/world/item/ItemCooldowns.java +@@ -56,6 +56,13 @@ public class ItemCooldowns { + } + + public void addCooldown(ResourceLocation groupId, int duration) { ++ // Paper start - Item cooldown events ++ this.addCooldown(groupId, duration, true); ++ } ++ ++ public void addCooldown(ResourceLocation groupId, int duration, boolean callEvent) { ++ // Event called in server override ++ // Paper end - Item cooldown events + this.cooldowns.put(groupId, new ItemCooldowns.CooldownInstance(this.tickCount, this.tickCount + duration)); + this.onCooldownStarted(groupId, duration); + } +diff --git a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java +index 3a45a149ec4a28f25ea9e45803ecbb7392b63f86..7b634a0a8639524a276cd6c5d6535e28a580b20a 100644 +--- a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java ++++ b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java +@@ -11,6 +11,39 @@ public class ServerItemCooldowns extends ItemCooldowns { + this.player = player; + } + ++ // Paper start - Add PlayerItemCooldownEvent ++ @Override ++ public void addCooldown(ItemStack item, int duration) { ++ final ResourceLocation cooldownGroup = this.getCooldownGroup(item); ++ final io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent( ++ this.player.getBukkitEntity(), ++ org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(item.getItem()), ++ org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cooldownGroup), ++ duration ++ ); ++ if (event.callEvent()) { ++ super.addCooldown(cooldownGroup, event.getCooldown(), false); ++ } ++ } ++ ++ @Override ++ public void addCooldown(ResourceLocation groupId, int duration, boolean callEvent) { ++ if (callEvent) { ++ final io.papermc.paper.event.player.PlayerItemGroupCooldownEvent event = new io.papermc.paper.event.player.PlayerItemGroupCooldownEvent( ++ this.player.getBukkitEntity(), ++ org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(groupId), ++ duration ++ ); ++ if (!event.callEvent()) { ++ return; ++ } ++ ++ duration = event.getCooldown(); ++ } ++ super.addCooldown(groupId, duration, false); ++ } ++ // Paper end - Add PlayerItemCooldownEvent ++ + @Override + protected void onCooldownStarted(ResourceLocation groupId, int duration) { + super.onCooldownStarted(groupId, duration); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +index 9022555db0df8c269fc039c895422cf36c08097e..8012ee71e1ce9f174eb5c4ac9eb8372b81e0a78c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +@@ -619,7 +619,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { + } + + ItemCooldowns.CooldownInstance cooldown = this.getHandle().getCooldowns().cooldowns.get(group); +- return (cooldown == null) ? 0 : Math.max(0, cooldown.endTime - this.getHandle().getCooldowns().tickCount); ++ return (cooldown == null) ? 0 : Math.max(0, cooldown.endTime() - this.getHandle().getCooldowns().tickCount); + } + + @Override diff --git a/patches/server/0432-Add-PlayerItemCooldownEvent.patch b/patches/server/0432-Add-PlayerItemCooldownEvent.patch deleted file mode 100644 index 954ff181f9..0000000000 --- a/patches/server/0432-Add-PlayerItemCooldownEvent.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Tue, 25 Aug 2020 13:48:33 +0200 -Subject: [PATCH] Add PlayerItemCooldownEvent - - -diff --git a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java -index 3a45a149ec4a28f25ea9e45803ecbb7392b63f86..2a80b8e962bf9d01e720b5967f0feac7d5dcaa28 100644 ---- a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java -+++ b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java -@@ -11,6 +11,16 @@ public class ServerItemCooldowns extends ItemCooldowns { - this.player = player; - } - -+ // Paper start - Add PlayerItemCooldownEvent -+ @Override -+ public void addCooldown(ItemStack item, int duration) { -+ io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(this.player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(item.getItem()), duration); -+ if (event.callEvent()) { -+ super.addCooldown(item, event.getCooldown()); -+ } -+ } -+ // Paper end - Add PlayerItemCooldownEvent -+ - @Override - protected void onCooldownStarted(ResourceLocation groupId, int duration) { - super.onCooldownStarted(groupId, duration); diff --git a/patches/server/0433-Significantly-improve-performance-of-the-end-generat.patch b/patches/server/0432-Significantly-improve-performance-of-the-end-generat.patch similarity index 100% rename from patches/server/0433-Significantly-improve-performance-of-the-end-generat.patch rename to patches/server/0432-Significantly-improve-performance-of-the-end-generat.patch diff --git a/patches/server/0434-More-lightning-API.patch b/patches/server/0433-More-lightning-API.patch similarity index 100% rename from patches/server/0434-More-lightning-API.patch rename to patches/server/0433-More-lightning-API.patch diff --git a/patches/server/0435-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0434-Climbing-should-not-bypass-cramming-gamerule.patch similarity index 97% rename from patches/server/0435-Climbing-should-not-bypass-cramming-gamerule.patch rename to patches/server/0434-Climbing-should-not-bypass-cramming-gamerule.patch index 41081acffa..f1a1607dd7 100644 --- a/patches/server/0435-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0434-Climbing-should-not-bypass-cramming-gamerule.patch @@ -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 { diff --git a/patches/server/0436-Add-missing-default-perms-for-commands.patch b/patches/server/0435-Add-missing-default-perms-for-commands.patch similarity index 100% rename from patches/server/0436-Add-missing-default-perms-for-commands.patch rename to patches/server/0435-Add-missing-default-perms-for-commands.patch diff --git a/patches/server/0437-Add-PlayerShearBlockEvent.patch b/patches/server/0436-Add-PlayerShearBlockEvent.patch similarity index 100% rename from patches/server/0437-Add-PlayerShearBlockEvent.patch rename to patches/server/0436-Add-PlayerShearBlockEvent.patch diff --git a/patches/server/0438-Limit-recipe-packets.patch b/patches/server/0437-Limit-recipe-packets.patch similarity index 100% rename from patches/server/0438-Limit-recipe-packets.patch rename to patches/server/0437-Limit-recipe-packets.patch diff --git a/patches/server/0439-Fix-CraftSound-backwards-compatibility.patch b/patches/server/0438-Fix-CraftSound-backwards-compatibility.patch similarity index 100% rename from patches/server/0439-Fix-CraftSound-backwards-compatibility.patch rename to patches/server/0438-Fix-CraftSound-backwards-compatibility.patch diff --git a/patches/server/0440-Player-Chunk-Load-Unload-Events.patch b/patches/server/0439-Player-Chunk-Load-Unload-Events.patch similarity index 100% rename from patches/server/0440-Player-Chunk-Load-Unload-Events.patch rename to patches/server/0439-Player-Chunk-Load-Unload-Events.patch diff --git a/patches/server/0441-Optimize-Dynamic-get-Missing-Keys.patch b/patches/server/0440-Optimize-Dynamic-get-Missing-Keys.patch similarity index 100% rename from patches/server/0441-Optimize-Dynamic-get-Missing-Keys.patch rename to patches/server/0440-Optimize-Dynamic-get-Missing-Keys.patch diff --git a/patches/server/0442-Expose-LivingEntity-hurt-direction.patch b/patches/server/0441-Expose-LivingEntity-hurt-direction.patch similarity index 100% rename from patches/server/0442-Expose-LivingEntity-hurt-direction.patch rename to patches/server/0441-Expose-LivingEntity-hurt-direction.patch diff --git a/patches/server/0443-Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/server/0442-Add-OBSTRUCTED-reason-to-BedEnterResult.patch similarity index 91% rename from patches/server/0443-Add-OBSTRUCTED-reason-to-BedEnterResult.patch rename to patches/server/0442-Add-OBSTRUCTED-reason-to-BedEnterResult.patch index c118aa890e..675b673d78 100644 --- a/patches/server/0443-Add-OBSTRUCTED-reason-to-BedEnterResult.patch +++ b/patches/server/0442-Add-OBSTRUCTED-reason-to-BedEnterResult.patch @@ -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 { diff --git a/patches/server/0444-Fix-crash-from-invalid-ingredient-lists-in-VillagerA.patch b/patches/server/0443-Fix-crash-from-invalid-ingredient-lists-in-VillagerA.patch similarity index 100% rename from patches/server/0444-Fix-crash-from-invalid-ingredient-lists-in-VillagerA.patch rename to patches/server/0443-Fix-crash-from-invalid-ingredient-lists-in-VillagerA.patch diff --git a/patches/server/0445-Add-TargetHitEvent.patch b/patches/server/0444-Add-TargetHitEvent.patch similarity index 100% rename from patches/server/0445-Add-TargetHitEvent.patch rename to patches/server/0444-Add-TargetHitEvent.patch diff --git a/patches/server/0446-MC-4-Fix-item-position-desync.patch b/patches/server/0445-MC-4-Fix-item-position-desync.patch similarity index 96% rename from patches/server/0446-MC-4-Fix-item-position-desync.patch rename to patches/server/0445-MC-4-Fix-item-position-desync.patch index dcfe9fecf4..a4ce339757 100644 --- a/patches/server/0446-MC-4-Fix-item-position-desync.patch +++ b/patches/server/0445-MC-4-Fix-item-position-desync.patch @@ -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 diff --git a/patches/server/0447-Additional-Block-Material-API.patch b/patches/server/0446-Additional-Block-Material-API.patch similarity index 100% rename from patches/server/0447-Additional-Block-Material-API.patch rename to patches/server/0446-Additional-Block-Material-API.patch diff --git a/patches/server/0448-API-to-get-Material-from-Boats-and-Minecarts.patch b/patches/server/0447-API-to-get-Material-from-Boats-and-Minecarts.patch similarity index 100% rename from patches/server/0448-API-to-get-Material-from-Boats-and-Minecarts.patch rename to patches/server/0447-API-to-get-Material-from-Boats-and-Minecarts.patch diff --git a/patches/server/0449-Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/0448-Allow-disabling-mob-spawner-spawn-egg-transformation.patch similarity index 100% rename from patches/server/0449-Allow-disabling-mob-spawner-spawn-egg-transformation.patch rename to patches/server/0448-Allow-disabling-mob-spawner-spawn-egg-transformation.patch diff --git a/patches/server/0450-Fix-Not-a-string-Map-Conversion-spam.patch b/patches/server/0449-Fix-Not-a-string-Map-Conversion-spam.patch similarity index 100% rename from patches/server/0450-Fix-Not-a-string-Map-Conversion-spam.patch rename to patches/server/0449-Fix-Not-a-string-Map-Conversion-spam.patch diff --git a/patches/server/0451-Add-PlayerFlowerPotManipulateEvent.patch b/patches/server/0450-Add-PlayerFlowerPotManipulateEvent.patch similarity index 100% rename from patches/server/0451-Add-PlayerFlowerPotManipulateEvent.patch rename to patches/server/0450-Add-PlayerFlowerPotManipulateEvent.patch diff --git a/patches/server/0452-Fix-interact-event-not-being-called-sometimes.patch b/patches/server/0451-Fix-interact-event-not-being-called-sometimes.patch similarity index 100% rename from patches/server/0452-Fix-interact-event-not-being-called-sometimes.patch rename to patches/server/0451-Fix-interact-event-not-being-called-sometimes.patch diff --git a/patches/server/0453-Zombie-API-breaking-doors.patch b/patches/server/0452-Zombie-API-breaking-doors.patch similarity index 100% rename from patches/server/0453-Zombie-API-breaking-doors.patch rename to patches/server/0452-Zombie-API-breaking-doors.patch diff --git a/patches/server/0454-Fix-nerfed-slime-when-splitting.patch b/patches/server/0453-Fix-nerfed-slime-when-splitting.patch similarity index 100% rename from patches/server/0454-Fix-nerfed-slime-when-splitting.patch rename to patches/server/0453-Fix-nerfed-slime-when-splitting.patch diff --git a/patches/server/0455-Add-EntityLoadCrossbowEvent.patch b/patches/server/0454-Add-EntityLoadCrossbowEvent.patch similarity index 100% rename from patches/server/0455-Add-EntityLoadCrossbowEvent.patch rename to patches/server/0454-Add-EntityLoadCrossbowEvent.patch diff --git a/patches/server/0456-Add-WorldGameRuleChangeEvent.patch b/patches/server/0455-Add-WorldGameRuleChangeEvent.patch similarity index 96% rename from patches/server/0456-Add-WorldGameRuleChangeEvent.patch rename to patches/server/0455-Add-WorldGameRuleChangeEvent.patch index de28ea7306..5e011c5b51 100644 --- a/patches/server/0456-Add-WorldGameRuleChangeEvent.patch +++ b/patches/server/0455-Add-WorldGameRuleChangeEvent.patch @@ -64,10 +64,10 @@ index 7ea92a0b0f5d4eb6bd873e61c42bc0499d5d2028..09299e45552eb998fd02123c3921c065 public int get() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 3ff0a43907cbe2cb4e54c57d9ac735dc0dd7f8f4..bacc00be9466d5253df668336bb83542b759f9d2 100644 +index 2ad9c104c7a99882417f9662d657841636751223..5304fb017b6ecda3ff96e1e44be444260fd8d715 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1891,9 +1891,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1879,9 +1879,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { if (rule == null || value == null) return false; if (!this.isGameRule(rule)) return false; @@ -83,7 +83,7 @@ index 3ff0a43907cbe2cb4e54c57d9ac735dc0dd7f8f4..bacc00be9466d5253df668336bb83542 handle.onChanged(this.getHandle()); return true; } -@@ -1928,9 +1933,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1916,9 +1921,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { Preconditions.checkArgument(newValue != null, "GameRule value cannot be null"); if (!this.isGameRule(rule.getName())) return false; diff --git a/patches/server/0457-Add-ServerResourcesReloadedEvent.patch b/patches/server/0456-Add-ServerResourcesReloadedEvent.patch similarity index 97% rename from patches/server/0457-Add-ServerResourcesReloadedEvent.patch rename to patches/server/0456-Add-ServerResourcesReloadedEvent.patch index 71fc31fbfd..8473de6cd2 100644 --- a/patches/server/0457-Add-ServerResourcesReloadedEvent.patch +++ b/patches/server/0456-Add-ServerResourcesReloadedEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f6667d9f514a821fd539e193dde1f78e77ca0fbf..264d0f57422b4fc03c5845d7456b22c9a48dd7ae 100644 +index a570de59700ace7f17268a220ed104464c7e6b15..3aed6821527133c7c0db9a04b9ac19ae5531d006 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2150,7 +2150,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { this.getServer().execute(() -> { diff --git a/patches/server/0465-Fix-villager-boat-exploit.patch b/patches/server/0464-Fix-villager-boat-exploit.patch similarity index 93% rename from patches/server/0465-Fix-villager-boat-exploit.patch rename to patches/server/0464-Fix-villager-boat-exploit.patch index adb461e1ed..f5548b98cc 100644 --- a/patches/server/0465-Fix-villager-boat-exploit.patch +++ b/patches/server/0464-Fix-villager-boat-exploit.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix villager boat exploit diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 819fb4ef54dce33ec91604491132771f157c8d83..1e5cc810748af34f591d305055fe00a688213617 100644 +index 8566e28d18a5b1221ba4e5d55e7788f80f956296..fbe10666c4ec6caa95aa38a6f99ccca700e9a4d2 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -544,6 +544,14 @@ public abstract class PlayerList { diff --git a/patches/server/0466-Add-sendOpLevel-API.patch b/patches/server/0465-Add-sendOpLevel-API.patch similarity index 96% rename from patches/server/0466-Add-sendOpLevel-API.patch rename to patches/server/0465-Add-sendOpLevel-API.patch index dc186c0c59..c781e09a03 100644 --- a/patches/server/0466-Add-sendOpLevel-API.patch +++ b/patches/server/0465-Add-sendOpLevel-API.patch @@ -32,7 +32,7 @@ index fbe10666c4ec6caa95aa38a6f99ccca700e9a4d2..061bba184c8bc2569ce1d413435ec136 public boolean isWhiteListed(GameProfile profile) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a631d35100b1910b717e359d3f27918a95a7a2cf..14adc60ba3e76ce71bc957d0a41383c3f1413b34 100644 +index c11c83376bd5e006bab86db6d8aa99b7ec371636..1cc89895a1e03d4b1734a81d89c8bc396bf2b343 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -682,6 +682,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch b/patches/server/0466-Add-RegistryAccess-for-managing-Registries.patch similarity index 99% rename from patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch rename to patches/server/0466-Add-RegistryAccess-for-managing-Registries.patch index 40062b9b22..55351393f7 100644 --- a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/0466-Add-RegistryAccess-for-managing-Registries.patch @@ -886,7 +886,7 @@ index 0d091c7b328fb70a82f5b5ded7dec61b7cd3d59a..249f0dcad04a35244da6dab837a461bb @Override public B get(NamespacedKey namespacedKey) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b19e04a7755cd66d136756fca86aad6282f64b15..e85a6f560cb8d88112f44b31d3d6d93096db182f 100644 +index f75d73402cf633254fe1ef4e919f09db48165190..5ae8f646083fb580ac8d28fcbfe8ed2208b45d09 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -284,7 +284,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0468-Add-StructuresLocateEvent.patch b/patches/server/0467-Add-StructuresLocateEvent.patch similarity index 100% rename from patches/server/0468-Add-StructuresLocateEvent.patch rename to patches/server/0467-Add-StructuresLocateEvent.patch diff --git a/patches/server/0469-Collision-option-for-requiring-a-player-participant.patch b/patches/server/0468-Collision-option-for-requiring-a-player-participant.patch similarity index 94% rename from patches/server/0469-Collision-option-for-requiring-a-player-participant.patch rename to patches/server/0468-Collision-option-for-requiring-a-player-participant.patch index ebae0a4ce9..407fffe0af 100644 --- a/patches/server/0469-Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/0468-Collision-option-for-requiring-a-player-participant.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Collision option for requiring a player participant diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 282863951033f7e036b0e58393651e1a22fada23..fa070c7243a4d800edc7bde2905773022788fa14 100644 +index e08d20b65fdea46be94228b4b10ba1cb7b3beeb6..0832d43ca1be2581bcda9fc32d3359689d8c0384 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2025,6 +2025,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -29,7 +29,7 @@ index a9661ab34bc98c19d525eb4b60b1f0d05d73241e..3590f4bc1af829cdb6e0cfdc8fa68571 if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -index fb9f0a62201dfeccd0eec9bb399f9edc6a01f1f0..9a864b4bacc5e180f36a6af2a0d63dc6d10ab0e5 100644 +index d01a588aea379c962dd63f1428f92cf2442f4d45..7e7a78ebbf128f7d29cf9eb349f25230c9c7d5d0 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java @@ -562,6 +562,7 @@ public abstract class AbstractMinecart extends VehicleEntity { diff --git a/patches/server/0470-Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/0469-Return-chat-component-with-empty-text-instead-of-thr.patch similarity index 100% rename from patches/server/0470-Return-chat-component-with-empty-text-instead-of-thr.patch rename to patches/server/0469-Return-chat-component-with-empty-text-instead-of-thr.patch diff --git a/patches/server/0471-Make-schedule-command-per-world.patch b/patches/server/0470-Make-schedule-command-per-world.patch similarity index 100% rename from patches/server/0471-Make-schedule-command-per-world.patch rename to patches/server/0470-Make-schedule-command-per-world.patch diff --git a/patches/server/0472-Configurable-max-leash-distance.patch b/patches/server/0471-Configurable-max-leash-distance.patch similarity index 100% rename from patches/server/0472-Configurable-max-leash-distance.patch rename to patches/server/0471-Configurable-max-leash-distance.patch diff --git a/patches/server/0473-Add-BlockPreDispenseEvent.patch b/patches/server/0472-Add-BlockPreDispenseEvent.patch similarity index 97% rename from patches/server/0473-Add-BlockPreDispenseEvent.patch rename to patches/server/0472-Add-BlockPreDispenseEvent.patch index d280bd07f1..58c12a1348 100644 --- a/patches/server/0473-Add-BlockPreDispenseEvent.patch +++ b/patches/server/0472-Add-BlockPreDispenseEvent.patch @@ -29,7 +29,7 @@ index 91b514967405115f22edf4255775361a672e5c2f..ddecf443df3679e3098eb54edd19585a } else { // CraftBukkit start - Fire event when pushing items into other inventories diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 1e918ef9296e5127b78a7eb0460225448982772e..a25e814978a2f19fa6fe74aaa5c529a524240d71 100644 +index 696867479e74c3c94e4131f2bbb97c857ed5e9dd..6d1d3451054af05e2381d70d71b99869f37c0901 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -2132,5 +2132,11 @@ public class CraftEventFactory { diff --git a/patches/server/0474-Add-PlayerChangeBeaconEffectEvent.patch b/patches/server/0473-Add-PlayerChangeBeaconEffectEvent.patch similarity index 100% rename from patches/server/0474-Add-PlayerChangeBeaconEffectEvent.patch rename to patches/server/0473-Add-PlayerChangeBeaconEffectEvent.patch diff --git a/patches/server/0475-Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/0474-Add-toggle-for-always-placing-the-dragon-egg.patch similarity index 100% rename from patches/server/0475-Add-toggle-for-always-placing-the-dragon-egg.patch rename to patches/server/0474-Add-toggle-for-always-placing-the-dragon-egg.patch diff --git a/patches/server/0476-Add-PlayerStonecutterRecipeSelectEvent.patch b/patches/server/0475-Add-PlayerStonecutterRecipeSelectEvent.patch similarity index 100% rename from patches/server/0476-Add-PlayerStonecutterRecipeSelectEvent.patch rename to patches/server/0475-Add-PlayerStonecutterRecipeSelectEvent.patch diff --git a/patches/server/0477-Expand-EntityUnleashEvent.patch b/patches/server/0476-Expand-EntityUnleashEvent.patch similarity index 99% rename from patches/server/0477-Expand-EntityUnleashEvent.patch rename to patches/server/0476-Expand-EntityUnleashEvent.patch index efca64ffff..9ca5dd92d0 100644 --- a/patches/server/0477-Expand-EntityUnleashEvent.patch +++ b/patches/server/0476-Expand-EntityUnleashEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expand EntityUnleashEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index fa070c7243a4d800edc7bde2905773022788fa14..963c190e4c445131659cc9e2e72b0272324666e2 100644 +index 0832d43ca1be2581bcda9fc32d3359689d8c0384..bac2165553262bc3b26cddd607d83ca15807e9d2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2690,12 +2690,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0478-Reset-shield-blocking-on-dimension-change.patch b/patches/server/0477-Reset-shield-blocking-on-dimension-change.patch similarity index 92% rename from patches/server/0478-Reset-shield-blocking-on-dimension-change.patch rename to patches/server/0477-Reset-shield-blocking-on-dimension-change.patch index c1bc7de4e1..6054c7c0be 100644 --- a/patches/server/0478-Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/0477-Reset-shield-blocking-on-dimension-change.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset shield blocking on dimension change diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0ae490bb9b4cd781876054d0824c5392060208eb..3a2a4f6bc1de45c0dc2020357ee308064666f8d5 100644 +index 0236a3db9b839f871a11b16615ab982069ebe34b..2b91b321f6652e10d6809d57e9f0ac1c5fb150f1 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1613,6 +1613,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0479-Add-DragonEggFormEvent.patch b/patches/server/0478-Add-DragonEggFormEvent.patch similarity index 100% rename from patches/server/0479-Add-DragonEggFormEvent.patch rename to patches/server/0478-Add-DragonEggFormEvent.patch diff --git a/patches/server/0480-Add-EntityMoveEvent.patch b/patches/server/0479-Add-EntityMoveEvent.patch similarity index 95% rename from patches/server/0480-Add-EntityMoveEvent.patch rename to patches/server/0479-Add-EntityMoveEvent.patch index 33f2f9fd9d..09eb20254f 100644 --- a/patches/server/0480-Add-EntityMoveEvent.patch +++ b/patches/server/0479-Add-EntityMoveEvent.patch @@ -17,7 +17,7 @@ index 3aed6821527133c7c0db9a04b9ac19ae5531d006..9e96998a36b63a1723406819eccb7841 gameprofilerfiller.push(() -> { String s = String.valueOf(worldserver); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0e984f3521b578779dd9d0142bce7db433b78f07..1c3f41d7ed7320342fe68c5ab6eb57dbdfd4bf69 100644 +index e4710b95685508a54d552cf916cbaa56ee48a11a..9d62a76a82097f1fc934312e6b764c66c673a8e8 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -229,6 +229,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -29,7 +29,7 @@ index 0e984f3521b578779dd9d0142bce7db433b78f07..1c3f41d7ed7320342fe68c5ab6eb57db public LevelChunk getChunkIfLoaded(int x, int z) { return this.chunkSource.getChunk(x, z, false); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 499e4fbb919ae3875aaa371d6ee206b8b144387b..a0b90b18e8f8970e722ebd0e78113f55ff54a55b 100644 +index b725bd297ed40aa8ccf3ad77f8652b39980efcf2..6b5d8328ae9ce819f6ff1b9ba109a67ce8f121e8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3627,6 +3627,20 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0481-added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/0480-added-option-to-disable-pathfinding-updates-on-block.patch similarity index 82% rename from patches/server/0481-added-option-to-disable-pathfinding-updates-on-block.patch rename to patches/server/0480-added-option-to-disable-pathfinding-updates-on-block.patch index d10ca06ced..d7fc759f02 100644 --- a/patches/server/0481-added-option-to-disable-pathfinding-updates-on-block.patch +++ b/patches/server/0480-added-option-to-disable-pathfinding-updates-on-block.patch @@ -5,10 +5,10 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 1c3f41d7ed7320342fe68c5ab6eb57dbdfd4bf69..cefd68cd2f28e5c14dba99b31d9a88125f169337 100644 +index 9d62a76a82097f1fc934312e6b764c66c673a8e8..d8eeedcc52ae939246caa61a6bacd3b15c8ae239 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1357,6 +1357,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1362,6 +1362,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.getChunkSource().blockChanged(pos); this.pathTypesByPosCache.invalidate(pos); @@ -16,7 +16,7 @@ index 1c3f41d7ed7320342fe68c5ab6eb57dbdfd4bf69..cefd68cd2f28e5c14dba99b31d9a8812 VoxelShape voxelshape = oldState.getCollisionShape(this, pos); VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); -@@ -1398,6 +1399,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1403,6 +1404,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } diff --git a/patches/server/0482-Inline-shift-direction-fields.patch b/patches/server/0481-Inline-shift-direction-fields.patch similarity index 100% rename from patches/server/0482-Inline-shift-direction-fields.patch rename to patches/server/0481-Inline-shift-direction-fields.patch diff --git a/patches/server/0483-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/0482-Allow-adding-items-to-BlockDropItemEvent.patch similarity index 95% rename from patches/server/0483-Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/server/0482-Allow-adding-items-to-BlockDropItemEvent.patch index 5fe7914ae0..7b84a8ac96 100644 --- a/patches/server/0483-Allow-adding-items-to-BlockDropItemEvent.patch +++ b/patches/server/0482-Allow-adding-items-to-BlockDropItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 5064dd8c97f45f0c4e2d1402500e7cf67a263dfa..a5c9ff3a2f06e7207ae4fcaf69be8bd0c874d4e2 100644 +index 697c69b60aa45b6a229f3bec77dc728e50a895ce..49efae40345fcfca8f80fcc541dcfde1b8a8b07b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -461,13 +461,30 @@ public class CraftEventFactory { diff --git a/patches/server/0484-Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/server/0483-Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/server/0484-Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/server/0483-Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/server/0485-living-entity-allow-attribute-registration.patch b/patches/server/0484-living-entity-allow-attribute-registration.patch similarity index 100% rename from patches/server/0485-living-entity-allow-attribute-registration.patch rename to patches/server/0484-living-entity-allow-attribute-registration.patch diff --git a/patches/server/0486-fix-dead-slime-setSize-invincibility.patch b/patches/server/0485-fix-dead-slime-setSize-invincibility.patch similarity index 100% rename from patches/server/0486-fix-dead-slime-setSize-invincibility.patch rename to patches/server/0485-fix-dead-slime-setSize-invincibility.patch diff --git a/patches/server/0487-Merchant-getRecipes-should-return-an-immutable-list.patch b/patches/server/0486-Merchant-getRecipes-should-return-an-immutable-list.patch similarity index 100% rename from patches/server/0487-Merchant-getRecipes-should-return-an-immutable-list.patch rename to patches/server/0486-Merchant-getRecipes-should-return-an-immutable-list.patch diff --git a/patches/server/0488-Expose-Tracked-Players.patch b/patches/server/0487-Expose-Tracked-Players.patch similarity index 100% rename from patches/server/0488-Expose-Tracked-Players.patch rename to patches/server/0487-Expose-Tracked-Players.patch diff --git a/patches/server/0489-Improve-ServerGUI.patch b/patches/server/0488-Improve-ServerGUI.patch similarity index 100% rename from patches/server/0489-Improve-ServerGUI.patch rename to patches/server/0488-Improve-ServerGUI.patch diff --git a/patches/server/0490-fix-converting-txt-to-json-file.patch b/patches/server/0489-fix-converting-txt-to-json-file.patch similarity index 97% rename from patches/server/0490-fix-converting-txt-to-json-file.patch rename to patches/server/0489-fix-converting-txt-to-json-file.patch index 130584b001..7f63558c05 100644 --- a/patches/server/0490-fix-converting-txt-to-json-file.patch +++ b/patches/server/0489-fix-converting-txt-to-json-file.patch @@ -48,7 +48,7 @@ index 9a3e73a5c206b78dfcf6f41a47b614342e52acc8..9d05e998d6df1069c2de69478a1f9688 if (!OldUsersConverter.serverReadyAfterUserconversion(this)) { return false; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 240a0e487ede08d1dd5050812ca4f68db4cd2dd1..82f5451add3652d9f1afba4f809f30ceaa1b2951 100644 +index 061bba184c8bc2569ce1d413435ec1360fa14007..e80e6e402ae286358b7f26073329b2e10604153b 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -179,6 +179,7 @@ public abstract class PlayerList { diff --git a/patches/server/0491-Add-worldborder-events.patch b/patches/server/0490-Add-worldborder-events.patch similarity index 100% rename from patches/server/0491-Add-worldborder-events.patch rename to patches/server/0490-Add-worldborder-events.patch diff --git a/patches/server/0492-Add-PlayerNameEntityEvent.patch b/patches/server/0491-Add-PlayerNameEntityEvent.patch similarity index 100% rename from patches/server/0492-Add-PlayerNameEntityEvent.patch rename to patches/server/0491-Add-PlayerNameEntityEvent.patch diff --git a/patches/server/0493-Add-recipe-to-cook-events.patch b/patches/server/0492-Add-recipe-to-cook-events.patch similarity index 100% rename from patches/server/0493-Add-recipe-to-cook-events.patch rename to patches/server/0492-Add-recipe-to-cook-events.patch diff --git a/patches/server/0494-Add-Block-isValidTool.patch b/patches/server/0493-Add-Block-isValidTool.patch similarity index 100% rename from patches/server/0494-Add-Block-isValidTool.patch rename to patches/server/0493-Add-Block-isValidTool.patch diff --git a/patches/server/0495-Allow-using-signs-inside-spawn-protection.patch b/patches/server/0494-Allow-using-signs-inside-spawn-protection.patch similarity index 100% rename from patches/server/0495-Allow-using-signs-inside-spawn-protection.patch rename to patches/server/0494-Allow-using-signs-inside-spawn-protection.patch diff --git a/patches/server/0496-Expand-world-key-API.patch b/patches/server/0495-Expand-world-key-API.patch similarity index 97% rename from patches/server/0496-Expand-world-key-API.patch rename to patches/server/0495-Expand-world-key-API.patch index 903e7ac8ea..f5b8dc10fe 100644 --- a/patches/server/0496-Expand-world-key-API.patch +++ b/patches/server/0495-Expand-world-key-API.patch @@ -20,7 +20,7 @@ index 15da29058f80a2d7cf2be26c48421c1746815a10..a070b2a83edaa702b13bc6d302691412 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 45ddb643d544dbcb35954108abb6f5d2454a555d..aeb6568c6a48d3448c5724896898371228313ceb 100644 +index 5ae8f646083fb580ac8d28fcbfe8ed2208b45d09..3cfacacd1d8fd17ec4b54936afd8124823b1a00b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1185,9 +1185,15 @@ public final class CraftServer implements Server { diff --git a/patches/server/0497-Add-fast-alternative-constructor-for-Rotations.patch b/patches/server/0496-Add-fast-alternative-constructor-for-Rotations.patch similarity index 100% rename from patches/server/0497-Add-fast-alternative-constructor-for-Rotations.patch rename to patches/server/0496-Add-fast-alternative-constructor-for-Rotations.patch diff --git a/patches/server/0498-Drop-carried-item-when-player-has-disconnected.patch b/patches/server/0497-Drop-carried-item-when-player-has-disconnected.patch similarity index 93% rename from patches/server/0498-Drop-carried-item-when-player-has-disconnected.patch rename to patches/server/0497-Drop-carried-item-when-player-has-disconnected.patch index bebcb8d121..42055a9f10 100644 --- a/patches/server/0498-Drop-carried-item-when-player-has-disconnected.patch +++ b/patches/server/0497-Drop-carried-item-when-player-has-disconnected.patch @@ -7,7 +7,7 @@ Fixes disappearance of held items, when a player gets disconnected and PlayerDro Closes #5036 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 82f5451add3652d9f1afba4f809f30ceaa1b2951..7a18061834096a73b140bee37b55b3c1724b51ef 100644 +index e80e6e402ae286358b7f26073329b2e10604153b..6ddcc928a49630e3a0f7f40cca496642419efa2c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -537,6 +537,14 @@ public abstract class PlayerList { diff --git a/patches/server/0499-forced-whitelist-use-configurable-kick-message.patch b/patches/server/0498-forced-whitelist-use-configurable-kick-message.patch similarity index 92% rename from patches/server/0499-forced-whitelist-use-configurable-kick-message.patch rename to patches/server/0498-forced-whitelist-use-configurable-kick-message.patch index e3d3ef89a7..9f6ee3c356 100644 --- a/patches/server/0499-forced-whitelist-use-configurable-kick-message.patch +++ b/patches/server/0498-forced-whitelist-use-configurable-kick-message.patch @@ -5,7 +5,7 @@ Subject: [PATCH] forced whitelist: use configurable kick message diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index a200aacb1eaa749baa36be8be63b3f1421913b60..67a9bc450f545dd7b05398968a278a14f1e518fe 100644 +index 9e96998a36b63a1723406819eccb7841a96753fb..c2e535834f6b94f52c835a8d89c98220eb13bce9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2325,7 +2325,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3a2a4f6bc1de45c0dc2020357ee308064666f8d5..262aa389b58708ed35ee88569be804c524f6e635 100644 +index 2b91b321f6652e10d6809d57e9f0ac1c5fb150f1..57253e59b6330be6176d3aa42f8f575ad1995bca 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1456,7 +1456,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0516-Introduce-beacon-activation-deactivation-events.patch b/patches/server/0515-Introduce-beacon-activation-deactivation-events.patch similarity index 100% rename from patches/server/0516-Introduce-beacon-activation-deactivation-events.patch rename to patches/server/0515-Introduce-beacon-activation-deactivation-events.patch diff --git a/patches/server/0517-Add-Channel-initialization-listeners.patch b/patches/server/0516-Add-Channel-initialization-listeners.patch similarity index 100% rename from patches/server/0517-Add-Channel-initialization-listeners.patch rename to patches/server/0516-Add-Channel-initialization-listeners.patch diff --git a/patches/server/0518-Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/0517-Send-empty-commands-if-tab-completion-is-disabled.patch similarity index 100% rename from patches/server/0518-Send-empty-commands-if-tab-completion-is-disabled.patch rename to patches/server/0517-Send-empty-commands-if-tab-completion-is-disabled.patch diff --git a/patches/server/0519-Add-more-WanderingTrader-API.patch b/patches/server/0518-Add-more-WanderingTrader-API.patch similarity index 100% rename from patches/server/0519-Add-more-WanderingTrader-API.patch rename to patches/server/0518-Add-more-WanderingTrader-API.patch diff --git a/patches/server/0520-Add-EntityBlockStorage-clearEntities.patch b/patches/server/0519-Add-EntityBlockStorage-clearEntities.patch similarity index 100% rename from patches/server/0520-Add-EntityBlockStorage-clearEntities.patch rename to patches/server/0519-Add-EntityBlockStorage-clearEntities.patch diff --git a/patches/server/0521-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/0520-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch similarity index 100% rename from patches/server/0521-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename to patches/server/0520-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch diff --git a/patches/server/0522-Add-HiddenPotionEffect-API.patch b/patches/server/0521-Add-HiddenPotionEffect-API.patch similarity index 100% rename from patches/server/0522-Add-HiddenPotionEffect-API.patch rename to patches/server/0521-Add-HiddenPotionEffect-API.patch diff --git a/patches/server/0523-Inventory-close.patch b/patches/server/0522-Inventory-close.patch similarity index 100% rename from patches/server/0523-Inventory-close.patch rename to patches/server/0522-Inventory-close.patch diff --git a/patches/server/0524-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/0523-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 100% rename from patches/server/0524-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/server/0523-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch diff --git a/patches/server/0525-Add-basic-Datapack-API.patch b/patches/server/0524-Add-basic-Datapack-API.patch similarity index 98% rename from patches/server/0525-Add-basic-Datapack-API.patch rename to patches/server/0524-Add-basic-Datapack-API.patch index 67c27be252..990697b9ea 100644 --- a/patches/server/0525-Add-basic-Datapack-API.patch +++ b/patches/server/0524-Add-basic-Datapack-API.patch @@ -176,7 +176,7 @@ index 0000000000000000000000000000000000000000..caa41c525d2b36b5a9f9942380f06c97 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 617eb11d17ef8791a8a8b0fddc19b6a3a8d0af36..10d7186b96038b03de8684c0ad09732a2f82e46f 100644 +index 3cfacacd1d8fd17ec4b54936afd8124823b1a00b..b4af066a21e4893b5ec146d109b5146b6996a0cf 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -308,6 +308,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0526-Add-environment-variable-to-disable-server-gui.patch b/patches/server/0525-Add-environment-variable-to-disable-server-gui.patch similarity index 100% rename from patches/server/0526-Add-environment-variable-to-disable-server-gui.patch rename to patches/server/0525-Add-environment-variable-to-disable-server-gui.patch diff --git a/patches/server/0527-Expand-PlayerGameModeChangeEvent.patch b/patches/server/0526-Expand-PlayerGameModeChangeEvent.patch similarity index 98% rename from patches/server/0527-Expand-PlayerGameModeChangeEvent.patch rename to patches/server/0526-Expand-PlayerGameModeChangeEvent.patch index e27b0c6d56..978d3da469 100644 --- a/patches/server/0527-Expand-PlayerGameModeChangeEvent.patch +++ b/patches/server/0526-Expand-PlayerGameModeChangeEvent.patch @@ -45,7 +45,7 @@ index 7f09119bc7d661e08a960dd2bd46006efe752d3e..d1da3600dc07107309b20ebe6e7c0c4d } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 262aa389b58708ed35ee88569be804c524f6e635..a022f0aee638bb12967b5fd20847fe20e6b286f3 100644 +index 57253e59b6330be6176d3aa42f8f575ad1995bca..254d9eede5a9a57280643284175df2e061aa78ea 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2335,10 +2335,18 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -147,7 +147,7 @@ index 2bd2f1cdf3467cacee55094d43bd3eccf61b9aa7..c3b4b800c5a34afa03ed7c31e14f26ca } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 14adc60ba3e76ce71bc957d0a41383c3f1413b34..394816148e549414bba31c334a13d50f5134c731 100644 +index 1cc89895a1e03d4b1734a81d89c8bc396bf2b343..2ebfc8744434dd4819f52201ae621268b0e04998 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1669,7 +1669,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0528-ItemStack-repair-check-API.patch b/patches/server/0527-ItemStack-repair-check-API.patch similarity index 100% rename from patches/server/0528-ItemStack-repair-check-API.patch rename to patches/server/0527-ItemStack-repair-check-API.patch diff --git a/patches/server/0529-More-Enchantment-API.patch b/patches/server/0528-More-Enchantment-API.patch similarity index 100% rename from patches/server/0529-More-Enchantment-API.patch rename to patches/server/0528-More-Enchantment-API.patch diff --git a/patches/server/0530-Move-range-check-for-block-placing-up.patch b/patches/server/0529-Move-range-check-for-block-placing-up.patch similarity index 100% rename from patches/server/0530-Move-range-check-for-block-placing-up.patch rename to patches/server/0529-Move-range-check-for-block-placing-up.patch diff --git a/patches/server/0531-Add-Mob-lookAt-API.patch b/patches/server/0530-Add-Mob-lookAt-API.patch similarity index 100% rename from patches/server/0531-Add-Mob-lookAt-API.patch rename to patches/server/0530-Add-Mob-lookAt-API.patch diff --git a/patches/server/0532-Correctly-check-if-bucket-dispenses-will-succeed-for.patch b/patches/server/0531-Correctly-check-if-bucket-dispenses-will-succeed-for.patch similarity index 100% rename from patches/server/0532-Correctly-check-if-bucket-dispenses-will-succeed-for.patch rename to patches/server/0531-Correctly-check-if-bucket-dispenses-will-succeed-for.patch diff --git a/patches/server/0533-Add-Unix-domain-socket-support.patch b/patches/server/0532-Add-Unix-domain-socket-support.patch similarity index 100% rename from patches/server/0533-Add-Unix-domain-socket-support.patch rename to patches/server/0532-Add-Unix-domain-socket-support.patch diff --git a/patches/server/0534-Add-EntityInsideBlockEvent.patch b/patches/server/0533-Add-EntityInsideBlockEvent.patch similarity index 100% rename from patches/server/0534-Add-EntityInsideBlockEvent.patch rename to patches/server/0533-Add-EntityInsideBlockEvent.patch diff --git a/patches/server/0535-Improve-item-default-attribute-API.patch b/patches/server/0534-Improve-item-default-attribute-API.patch similarity index 100% rename from patches/server/0535-Improve-item-default-attribute-API.patch rename to patches/server/0534-Improve-item-default-attribute-API.patch diff --git a/patches/server/0536-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/0535-Add-cause-to-Weather-ThunderChangeEvents.patch similarity index 93% rename from patches/server/0536-Add-cause-to-Weather-ThunderChangeEvents.patch rename to patches/server/0535-Add-cause-to-Weather-ThunderChangeEvents.patch index 5b9009dbbe..ef52ee655c 100644 --- a/patches/server/0536-Add-cause-to-Weather-ThunderChangeEvents.patch +++ b/patches/server/0535-Add-cause-to-Weather-ThunderChangeEvents.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index cefd68cd2f28e5c14dba99b31d9a88125f169337..f58069f0c9d836cb33f3ea09c562708951a91797 100644 +index d8eeedcc52ae939246caa61a6bacd3b15c8ae239..8e2edab16113128a755349d03d83dd46e8b806cb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -429,8 +429,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -434,8 +434,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.serverLevelData.setClearWeatherTime(clearDuration); this.serverLevelData.setRainTime(rainDuration); this.serverLevelData.setThunderTime(rainDuration); @@ -19,7 +19,7 @@ index cefd68cd2f28e5c14dba99b31d9a88125f169337..f58069f0c9d836cb33f3ea09c5627089 } @Override -@@ -846,8 +846,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -851,8 +851,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.serverLevelData.setThunderTime(j); this.serverLevelData.setRainTime(k); this.serverLevelData.setClearWeatherTime(i); @@ -30,7 +30,7 @@ index cefd68cd2f28e5c14dba99b31d9a88125f169337..f58069f0c9d836cb33f3ea09c5627089 } this.oThunderLevel = this.thunderLevel; -@@ -914,14 +914,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -919,14 +919,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @VisibleForTesting public void resetWeatherCycle() { // CraftBukkit start @@ -95,10 +95,10 @@ index 6a3959095e57f76b3a092b32d26ff91cf1c5e068..0fa16ff37f09ecfda104b751e48bf246 if (weather.isCancelled()) { return; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 5cbb66ad1eb2e54a4c6eb8ec9ff1c09d13d5e796..eaba5097bb8e0048c85ee1b3651644ef06efdc7d 100644 +index 75554719891cfeccfde1b6b58bf9861db1268adc..b2455a03d92187b35bb0efeb4b041bbf7936851e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1212,7 +1212,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1200,7 +1200,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void setStorm(boolean hasStorm) { @@ -107,7 +107,7 @@ index 5cbb66ad1eb2e54a4c6eb8ec9ff1c09d13d5e796..eaba5097bb8e0048c85ee1b3651644ef this.setWeatherDuration(0); // Reset weather duration (legacy behaviour) this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands) } -@@ -1234,7 +1234,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1222,7 +1222,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void setThundering(boolean thundering) { diff --git a/patches/server/0537-More-Lidded-Block-API.patch b/patches/server/0536-More-Lidded-Block-API.patch similarity index 100% rename from patches/server/0537-More-Lidded-Block-API.patch rename to patches/server/0536-More-Lidded-Block-API.patch diff --git a/patches/server/0538-Limit-item-frame-cursors-on-maps.patch b/patches/server/0537-Limit-item-frame-cursors-on-maps.patch similarity index 100% rename from patches/server/0538-Limit-item-frame-cursors-on-maps.patch rename to patches/server/0537-Limit-item-frame-cursors-on-maps.patch diff --git a/patches/server/0539-Add-PlayerKickEvent-causes.patch b/patches/server/0538-Add-PlayerKickEvent-causes.patch similarity index 99% rename from patches/server/0539-Add-PlayerKickEvent-causes.patch rename to patches/server/0538-Add-PlayerKickEvent-causes.patch index 1d360b711b..7ed95be99e 100644 --- a/patches/server/0539-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0538-Add-PlayerKickEvent-causes.patch @@ -495,7 +495,7 @@ index 9e2ad78b12cadbf0e2bda1e12fe844120529c347..6a7d7fad990fc44fdda6849d43dad141 } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 394816148e549414bba31c334a13d50f5134c731..c8db7c123d8a7e1063c732780f18fda1f8ae1225 100644 +index 2ebfc8744434dd4819f52201ae621268b0e04998..97046a2ae1ab30f4eefb64558afe312d2b9f55f8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -280,7 +280,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0540-Add-PufferFishStateChangeEvent.patch b/patches/server/0539-Add-PufferFishStateChangeEvent.patch similarity index 100% rename from patches/server/0540-Add-PufferFishStateChangeEvent.patch rename to patches/server/0539-Add-PufferFishStateChangeEvent.patch diff --git a/patches/server/0541-Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/server/0540-Fix-PlayerBucketEmptyEvent-result-itemstack.patch similarity index 100% rename from patches/server/0541-Fix-PlayerBucketEmptyEvent-result-itemstack.patch rename to patches/server/0540-Fix-PlayerBucketEmptyEvent-result-itemstack.patch diff --git a/patches/server/0542-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/server/0541-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch similarity index 100% rename from patches/server/0542-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch rename to patches/server/0541-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch diff --git a/patches/server/0543-Add-option-to-fix-items-merging-through-walls.patch b/patches/server/0542-Add-option-to-fix-items-merging-through-walls.patch similarity index 100% rename from patches/server/0543-Add-option-to-fix-items-merging-through-walls.patch rename to patches/server/0542-Add-option-to-fix-items-merging-through-walls.patch diff --git a/patches/server/0544-Add-BellRevealRaiderEvent.patch b/patches/server/0543-Add-BellRevealRaiderEvent.patch similarity index 100% rename from patches/server/0544-Add-BellRevealRaiderEvent.patch rename to patches/server/0543-Add-BellRevealRaiderEvent.patch diff --git a/patches/server/0545-Fix-invulnerable-end-crystals.patch b/patches/server/0544-Fix-invulnerable-end-crystals.patch similarity index 100% rename from patches/server/0545-Fix-invulnerable-end-crystals.patch rename to patches/server/0544-Fix-invulnerable-end-crystals.patch diff --git a/patches/server/0546-Add-ElderGuardianAppearanceEvent.patch b/patches/server/0545-Add-ElderGuardianAppearanceEvent.patch similarity index 100% rename from patches/server/0546-Add-ElderGuardianAppearanceEvent.patch rename to patches/server/0545-Add-ElderGuardianAppearanceEvent.patch diff --git a/patches/server/0547-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/patches/server/0546-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch similarity index 100% rename from patches/server/0547-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch rename to patches/server/0546-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch diff --git a/patches/server/0548-Line-Of-Sight-Changes.patch b/patches/server/0547-Line-Of-Sight-Changes.patch similarity index 97% rename from patches/server/0548-Line-Of-Sight-Changes.patch rename to patches/server/0547-Line-Of-Sight-Changes.patch index 1efc0eee46..7fa7d25951 100644 --- a/patches/server/0548-Line-Of-Sight-Changes.patch +++ b/patches/server/0547-Line-Of-Sight-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Line Of Sight Changes diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 6eda6f62e54eefddad51033e7d69c76ffc110a6d..5415cade10ab36709f722cabc20ea3f1b9c285d9 100644 +index 123f9a7675c1f194273fff0fdd804cb6ab409201..f240a63f39affc048d1c13eb184f4b07c6c52d3e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3906,7 +3906,8 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0549-add-per-world-spawn-limits.patch b/patches/server/0548-add-per-world-spawn-limits.patch similarity index 91% rename from patches/server/0549-add-per-world-spawn-limits.patch rename to patches/server/0548-add-per-world-spawn-limits.patch index a15efc15ab..430c3bbabc 100644 --- a/patches/server/0549-add-per-world-spawn-limits.patch +++ b/patches/server/0548-add-per-world-spawn-limits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] add per world spawn limits diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index eaba5097bb8e0048c85ee1b3651644ef06efdc7d..336daaaf9a8e1cfbc2682c2932add78db11afad3 100644 +index b2455a03d92187b35bb0efeb4b041bbf7936851e..6596af8332ca6abbcaa68cae60ba994c39767938 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -218,6 +218,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0550-Fix-potions-splash-events.patch b/patches/server/0549-Fix-potions-splash-events.patch similarity index 99% rename from patches/server/0550-Fix-potions-splash-events.patch rename to patches/server/0549-Fix-potions-splash-events.patch index 7d09edfbeb..68350d52f2 100644 --- a/patches/server/0550-Fix-potions-splash-events.patch +++ b/patches/server/0549-Fix-potions-splash-events.patch @@ -143,7 +143,7 @@ index 224e768963d6969f25608065d37ad72d82acda68..d6ac07d9d5ee0430a1d91b7084b378aa public boolean isLingering() { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a5c9ff3a2f06e7207ae4fcaf69be8bd0c874d4e2..e6b22f24eba945863bb625b40319e6874ff25534 100644 +index 49efae40345fcfca8f80fcc541dcfde1b8a8b07b..24f86724012bb8bcd6d24683a1c78ce66b42ca30 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -884,6 +884,32 @@ public class CraftEventFactory { diff --git a/patches/server/0551-Add-more-LimitedRegion-API.patch b/patches/server/0550-Add-more-LimitedRegion-API.patch similarity index 100% rename from patches/server/0551-Add-more-LimitedRegion-API.patch rename to patches/server/0550-Add-more-LimitedRegion-API.patch diff --git a/patches/server/0552-Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/0551-Fix-PlayerDropItemEvent-using-wrong-item.patch similarity index 97% rename from patches/server/0552-Fix-PlayerDropItemEvent-using-wrong-item.patch rename to patches/server/0551-Fix-PlayerDropItemEvent-using-wrong-item.patch index c6491e4898..37338dc0ee 100644 --- a/patches/server/0552-Fix-PlayerDropItemEvent-using-wrong-item.patch +++ b/patches/server/0551-Fix-PlayerDropItemEvent-using-wrong-item.patch @@ -31,7 +31,7 @@ index c81fd3e1108fb0a02f9240263404af2b968c8494..0d9de4c61c7b26a6ff37c12fde629161 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a022f0aee638bb12967b5fd20847fe20e6b286f3..7bcb3ef3cb498114428782848e0370ac2497ccdc 100644 +index 254d9eede5a9a57280643284175df2e061aa78ea..09798fc2d2d847f3ec705a2640f25ac08ca69f92 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2747,7 +2747,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0553-Missing-Entity-API.patch b/patches/server/0552-Missing-Entity-API.patch similarity index 100% rename from patches/server/0553-Missing-Entity-API.patch rename to patches/server/0552-Missing-Entity-API.patch diff --git a/patches/server/0554-Fix-return-value-of-Block-applyBoneMeal-always-being.patch b/patches/server/0553-Fix-return-value-of-Block-applyBoneMeal-always-being.patch similarity index 100% rename from patches/server/0554-Fix-return-value-of-Block-applyBoneMeal-always-being.patch rename to patches/server/0553-Fix-return-value-of-Block-applyBoneMeal-always-being.patch diff --git a/patches/server/0555-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/0554-Use-getChunkIfLoadedImmediately-in-places.patch similarity index 96% rename from patches/server/0555-Use-getChunkIfLoadedImmediately-in-places.patch rename to patches/server/0554-Use-getChunkIfLoadedImmediately-in-places.patch index 99a97d953d..2e754bbb7b 100644 --- a/patches/server/0555-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/patches/server/0554-Use-getChunkIfLoadedImmediately-in-places.patch @@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index f58069f0c9d836cb33f3ea09c562708951a91797..91fb83761885752743adb53cc9ed30ddc879263d 100644 +index 8e2edab16113128a755349d03d83dd46e8b806cb..57b82b90ab55922e57ccf79c57296d1d2e34d6a2 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -232,7 +232,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe diff --git a/patches/server/0556-Fix-commands-from-signs-not-firing-command-events.patch b/patches/server/0555-Fix-commands-from-signs-not-firing-command-events.patch similarity index 100% rename from patches/server/0556-Fix-commands-from-signs-not-firing-command-events.patch rename to patches/server/0555-Fix-commands-from-signs-not-firing-command-events.patch diff --git a/patches/server/0557-Add-PlayerArmSwingEvent.patch b/patches/server/0556-Add-PlayerArmSwingEvent.patch similarity index 100% rename from patches/server/0557-Add-PlayerArmSwingEvent.patch rename to patches/server/0556-Add-PlayerArmSwingEvent.patch diff --git a/patches/server/0558-Fix-kick-event-leave-message-not-being-sent.patch b/patches/server/0557-Fix-kick-event-leave-message-not-being-sent.patch similarity index 97% rename from patches/server/0558-Fix-kick-event-leave-message-not-being-sent.patch rename to patches/server/0557-Fix-kick-event-leave-message-not-being-sent.patch index 8334a5dd25..6d4ff398db 100644 --- a/patches/server/0558-Fix-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0557-Fix-kick-event-leave-message-not-being-sent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix kick event leave message not being sent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7bcb3ef3cb498114428782848e0370ac2497ccdc..99a634760cd04d5e3182254b1d0b817baf1cf87a 100644 +index 09798fc2d2d847f3ec705a2640f25ac08ca69f92..87652ea4f3950c2161b3405dcfef03bd196f1237 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -318,7 +318,6 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -101,7 +101,7 @@ index e48c6f37ba0ebe698e28042e9331ab2ec0c39e7c..0229b3e6c27b142ff726de8e2e15104a this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false); // Paper end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e6b92f085291aaf4fa78d96f8379aeef2200592b..2c810cb5d2fcf1a88423cfe4e063dd810ecaaeb0 100644 +index 26ba0cec3a8492d91df894a69cc1fc8076eeda0d..85bd61bd45690c5532f56d8f11b81f7a11f3e284 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -510,6 +510,11 @@ public abstract class PlayerList { diff --git a/patches/server/0559-Don-t-apply-cramming-damage-to-players.patch b/patches/server/0558-Don-t-apply-cramming-damage-to-players.patch similarity index 93% rename from patches/server/0559-Don-t-apply-cramming-damage-to-players.patch rename to patches/server/0558-Don-t-apply-cramming-damage-to-players.patch index a1e4db537b..c3598bbd22 100644 --- a/patches/server/0559-Don-t-apply-cramming-damage-to-players.patch +++ b/patches/server/0558-Don-t-apply-cramming-damage-to-players.patch @@ -11,7 +11,7 @@ It does not make a lot of sense to damage players if they get crammed, For those who really want it a config option is provided. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 99a634760cd04d5e3182254b1d0b817baf1cf87a..94cc69ed1ccbcfcc8f431762fef641c313b2f634 100644 +index 87652ea4f3950c2161b3405dcfef03bd196f1237..f0655e6c9c0f60b57912a76448706d49ce774dce 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1814,7 +1814,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0560-Rate-options-and-timings-for-sensors-and-behaviors.patch b/patches/server/0559-Rate-options-and-timings-for-sensors-and-behaviors.patch similarity index 100% rename from patches/server/0560-Rate-options-and-timings-for-sensors-and-behaviors.patch rename to patches/server/0559-Rate-options-and-timings-for-sensors-and-behaviors.patch diff --git a/patches/server/0561-Add-missing-forceDrop-toggles.patch b/patches/server/0560-Add-missing-forceDrop-toggles.patch similarity index 87% rename from patches/server/0561-Add-missing-forceDrop-toggles.patch rename to patches/server/0560-Add-missing-forceDrop-toggles.patch index acc8574a81..70612df277 100644 --- a/patches/server/0561-Add-missing-forceDrop-toggles.patch +++ b/patches/server/0560-Add-missing-forceDrop-toggles.patch @@ -52,6 +52,22 @@ index 705c26ceff9371b09311bd7fa796c0efde7ebfee..4f04170b3ec4ff59358e10ccfd0799af Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10; +diff --git a/src/main/java/net/minecraft/world/entity/monster/Bogged.java b/src/main/java/net/minecraft/world/entity/monster/Bogged.java +index 9d416f775fa19ad1978c7c9c9e0d5bc16728879d..be029746905aeba218684b883282649089657de3 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java +@@ -145,9 +145,11 @@ public class Bogged extends AbstractSkeleton implements Shearable { + } + + private void spawnShearedMushrooms(ServerLevel world, ItemStack shears) { ++ this.forceDrops = true; // Paper - Add missing forceDrop toggles + this.dropFromShearingLootTable(world, BuiltInLootTables.BOGGED_SHEAR, shears, (worldserver1, itemstack1) -> { + this.spawnAtLocation(worldserver1, itemstack1, this.getBbHeight()); + }); ++ this.forceDrops = false; // Paper - Add missing forceDrop toggles + } + + @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java index ec733e71e41a4c89ed9f35ad1d9d4fa912160d27..15a49e3541c8b45db5e472a64fa0cb94c5a72f67 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java diff --git a/patches/server/0562-Stinger-API.patch b/patches/server/0561-Stinger-API.patch similarity index 100% rename from patches/server/0562-Stinger-API.patch rename to patches/server/0561-Stinger-API.patch diff --git a/patches/server/0563-Add-System.out-err-catcher.patch b/patches/server/0562-Add-System.out-err-catcher.patch similarity index 98% rename from patches/server/0563-Add-System.out-err-catcher.patch rename to patches/server/0562-Add-System.out-err-catcher.patch index 1904f817de..8b01f8520a 100644 --- a/patches/server/0563-Add-System.out-err-catcher.patch +++ b/patches/server/0562-Add-System.out-err-catcher.patch @@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..a8e813ca89b033f061e695288b3383bd + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a17b26dadbbbf6e6c84f80f6fe8293d87ca19d0a..ecf7ee1ca39d58f1780580bd24366fc8037df34a 100644 +index b4af066a21e4893b5ec146d109b5146b6996a0cf..45d887f4143444321f563cdd7d084b2b9ccf911e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -310,6 +310,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0564-Prevent-AFK-kick-while-watching-end-credits.patch b/patches/server/0563-Prevent-AFK-kick-while-watching-end-credits.patch similarity index 100% rename from patches/server/0564-Prevent-AFK-kick-while-watching-end-credits.patch rename to patches/server/0563-Prevent-AFK-kick-while-watching-end-credits.patch diff --git a/patches/server/0565-Allow-skipping-writing-of-comments-to-server.propert.patch b/patches/server/0564-Allow-skipping-writing-of-comments-to-server.propert.patch similarity index 100% rename from patches/server/0565-Allow-skipping-writing-of-comments-to-server.propert.patch rename to patches/server/0564-Allow-skipping-writing-of-comments-to-server.propert.patch diff --git a/patches/server/0566-Add-PlayerSetSpawnEvent.patch b/patches/server/0565-Add-PlayerSetSpawnEvent.patch similarity index 98% rename from patches/server/0566-Add-PlayerSetSpawnEvent.patch rename to patches/server/0565-Add-PlayerSetSpawnEvent.patch index c3c3d162c0..b7be9c0d9d 100644 --- a/patches/server/0566-Add-PlayerSetSpawnEvent.patch +++ b/patches/server/0565-Add-PlayerSetSpawnEvent.patch @@ -49,7 +49,7 @@ index a2d0699e8427b2262a2396495111125eccafbb66..15db9368227dbc29d07d74e85bd126b3 } } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 94cc69ed1ccbcfcc8f431762fef641c313b2f634..c680b311760601bb539d685bceddba6712d141d4 100644 +index f0655e6c9c0f60b57912a76448706d49ce774dce..fe39d0ab5e99818356d4e1a600af4bdd3eb03b70 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1690,7 +1690,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -187,7 +187,7 @@ index db26b5a0464bd6087eeacaf6dd61eba37365df92..9117c035d5a6ff114b028fad3380ceb1 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c8db7c123d8a7e1063c732780f18fda1f8ae1225..85bbb04aa2f8db860780667994aba90f5b1d4d8a 100644 +index 97046a2ae1ab30f4eefb64558afe312d2b9f55f8..fe05fe8f9c24ad15c083cb63bc6b7e004a974832 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1418,9 +1418,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0567-Make-hoppers-respect-inventory-max-stack-size.patch b/patches/server/0566-Make-hoppers-respect-inventory-max-stack-size.patch similarity index 100% rename from patches/server/0567-Make-hoppers-respect-inventory-max-stack-size.patch rename to patches/server/0566-Make-hoppers-respect-inventory-max-stack-size.patch diff --git a/patches/server/0568-Optimize-entity-tracker-passenger-checks.patch b/patches/server/0567-Optimize-entity-tracker-passenger-checks.patch similarity index 100% rename from patches/server/0568-Optimize-entity-tracker-passenger-checks.patch rename to patches/server/0567-Optimize-entity-tracker-passenger-checks.patch diff --git a/patches/server/0569-Config-option-for-Piglins-guarding-chests.patch b/patches/server/0568-Config-option-for-Piglins-guarding-chests.patch similarity index 100% rename from patches/server/0569-Config-option-for-Piglins-guarding-chests.patch rename to patches/server/0568-Config-option-for-Piglins-guarding-chests.patch diff --git a/patches/server/0570-Add-EntityDamageItemEvent.patch b/patches/server/0569-Add-EntityDamageItemEvent.patch similarity index 100% rename from patches/server/0570-Add-EntityDamageItemEvent.patch rename to patches/server/0569-Add-EntityDamageItemEvent.patch diff --git a/patches/server/0571-Optimize-indirect-passenger-iteration.patch b/patches/server/0570-Optimize-indirect-passenger-iteration.patch similarity index 96% rename from patches/server/0571-Optimize-indirect-passenger-iteration.patch rename to patches/server/0570-Optimize-indirect-passenger-iteration.patch index 2db947b001..36c3804273 100644 --- a/patches/server/0571-Optimize-indirect-passenger-iteration.patch +++ b/patches/server/0570-Optimize-indirect-passenger-iteration.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize indirect passenger iteration diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 963c190e4c445131659cc9e2e72b0272324666e2..5ddab7fde91ab1089c9ea35f441a21dfd5df2ef8 100644 +index bac2165553262bc3b26cddd607d83ca15807e9d2..eede4aa2b0ed19b285b9cdfeb177cb5c2e1a13fb 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -4088,20 +4088,34 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0572-Configurable-item-frame-map-cursor-update-interval.patch b/patches/server/0571-Configurable-item-frame-map-cursor-update-interval.patch similarity index 100% rename from patches/server/0572-Configurable-item-frame-map-cursor-update-interval.patch rename to patches/server/0571-Configurable-item-frame-map-cursor-update-interval.patch diff --git a/patches/server/0573-Change-EnderEye-target-without-changing-other-things.patch b/patches/server/0572-Change-EnderEye-target-without-changing-other-things.patch similarity index 100% rename from patches/server/0573-Change-EnderEye-target-without-changing-other-things.patch rename to patches/server/0572-Change-EnderEye-target-without-changing-other-things.patch diff --git a/patches/server/0574-Add-BlockBreakBlockEvent.patch b/patches/server/0573-Add-BlockBreakBlockEvent.patch similarity index 100% rename from patches/server/0574-Add-BlockBreakBlockEvent.patch rename to patches/server/0573-Add-BlockBreakBlockEvent.patch diff --git a/patches/server/0575-Option-to-prevent-data-components-copy-in-smithing-r.patch b/patches/server/0574-Option-to-prevent-data-components-copy-in-smithing-r.patch similarity index 100% rename from patches/server/0575-Option-to-prevent-data-components-copy-in-smithing-r.patch rename to patches/server/0574-Option-to-prevent-data-components-copy-in-smithing-r.patch diff --git a/patches/server/0576-More-CommandBlock-API.patch b/patches/server/0575-More-CommandBlock-API.patch similarity index 100% rename from patches/server/0576-More-CommandBlock-API.patch rename to patches/server/0575-More-CommandBlock-API.patch diff --git a/patches/server/0577-Add-missing-team-sidebar-display-slots.patch b/patches/server/0576-Add-missing-team-sidebar-display-slots.patch similarity index 98% rename from patches/server/0577-Add-missing-team-sidebar-display-slots.patch rename to patches/server/0576-Add-missing-team-sidebar-display-slots.patch index 1306837f9f..de7d3fc8e5 100644 --- a/patches/server/0577-Add-missing-team-sidebar-display-slots.patch +++ b/patches/server/0576-Add-missing-team-sidebar-display-slots.patch @@ -9,7 +9,7 @@ public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations toBukkitSlo public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations fromBukkitSlot(Lorg/bukkit/scoreboard/DisplaySlot;)Lnet/minecraft/world/scores/DisplaySlot; diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java -index b5e0023e431f9fb43c93a3f977144b03545322bb..3ecb1dd1a835efd7026af45562cd3394417130aa 100644 +index 12fe2f8d0dcb715545e071023490a32125b9c4a4..fe29c08270854d37a4b111f66ebf261260200f28 100644 --- a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java +++ b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java @@ -35,6 +35,7 @@ public class FieldRename { diff --git a/patches/server/0578-Add-back-EntityPortalExitEvent.patch b/patches/server/0577-Add-back-EntityPortalExitEvent.patch similarity index 97% rename from patches/server/0578-Add-back-EntityPortalExitEvent.patch rename to patches/server/0577-Add-back-EntityPortalExitEvent.patch index 9eb82702cb..282d51195e 100644 --- a/patches/server/0578-Add-back-EntityPortalExitEvent.patch +++ b/patches/server/0577-Add-back-EntityPortalExitEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add back EntityPortalExitEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 5ddab7fde91ab1089c9ea35f441a21dfd5df2ef8..3d9bf236eb1535cc2547f1421ee2a09b2c44fc52 100644 +index eede4aa2b0ed19b285b9cdfeb177cb5c2e1a13fb..736569ea22a8b257fca6e4b9326f73ca8fbc803e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3492,6 +3492,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0579-Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/server/0578-Add-methods-to-find-targets-for-lightning-strikes.patch similarity index 88% rename from patches/server/0579-Add-methods-to-find-targets-for-lightning-strikes.patch rename to patches/server/0578-Add-methods-to-find-targets-for-lightning-strikes.patch index 70e628d8a9..01813e49c7 100644 --- a/patches/server/0579-Add-methods-to-find-targets-for-lightning-strikes.patch +++ b/patches/server/0578-Add-methods-to-find-targets-for-lightning-strikes.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Add methods to find targets for lightning strikes public net.minecraft.server.level.ServerLevel findLightningRod(Lnet/minecraft/core/BlockPos;)Ljava/util/Optional; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 91fb83761885752743adb53cc9ed30ddc879263d..3c281cdd24acbc9484c968c07f737d50be2deced 100644 +index 57b82b90ab55922e57ccf79c57296d1d2e34d6a2..50d4bd6223eb92c640a61ee61af862e794fbb519 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -735,6 +735,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -740,6 +740,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } protected BlockPos findLightningTargetAround(BlockPos pos) { @@ -22,7 +22,7 @@ index 91fb83761885752743adb53cc9ed30ddc879263d..3c281cdd24acbc9484c968c07f737d50 BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos); Optional optional = this.findLightningRod(blockposition1); -@@ -749,6 +754,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -754,6 +759,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (!list.isEmpty()) { return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition(); } else { @@ -31,10 +31,10 @@ index 91fb83761885752743adb53cc9ed30ddc879263d..3c281cdd24acbc9484c968c07f737d50 blockposition1 = blockposition1.above(2); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 336daaaf9a8e1cfbc2682c2932add78db11afad3..bb61295b8ae44eee9d0c7b12152a7d93d191bdfa 100644 +index 6596af8332ca6abbcaa68cae60ba994c39767938..1812dcd6e21d6de834ce6c39b5b69cee31a5fa06 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -687,6 +687,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -675,6 +675,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { return (LightningStrike) lightning.getBukkitEntity(); } diff --git a/patches/server/0580-Get-entity-default-attributes.patch b/patches/server/0579-Get-entity-default-attributes.patch similarity index 100% rename from patches/server/0580-Get-entity-default-attributes.patch rename to patches/server/0579-Get-entity-default-attributes.patch diff --git a/patches/server/0581-Left-handed-API.patch b/patches/server/0580-Left-handed-API.patch similarity index 100% rename from patches/server/0581-Left-handed-API.patch rename to patches/server/0580-Left-handed-API.patch diff --git a/patches/server/0582-Add-more-advancement-API.patch b/patches/server/0581-Add-more-advancement-API.patch similarity index 100% rename from patches/server/0582-Add-more-advancement-API.patch rename to patches/server/0581-Add-more-advancement-API.patch diff --git a/patches/server/0583-Add-ItemFactory-getSpawnEgg-API.patch b/patches/server/0582-Add-ItemFactory-getSpawnEgg-API.patch similarity index 100% rename from patches/server/0583-Add-ItemFactory-getSpawnEgg-API.patch rename to patches/server/0582-Add-ItemFactory-getSpawnEgg-API.patch diff --git a/patches/server/0584-Add-critical-damage-API.patch b/patches/server/0583-Add-critical-damage-API.patch similarity index 98% rename from patches/server/0584-Add-critical-damage-API.patch rename to patches/server/0583-Add-critical-damage-API.patch index 3ce4bba7c0..bef96face6 100644 --- a/patches/server/0584-Add-critical-damage-API.patch +++ b/patches/server/0583-Add-critical-damage-API.patch @@ -61,7 +61,7 @@ index bc167c21f82ad09952f6cdbf1016523062890f8b..44bcb1117cfa4d66c500011489ae193a int k = entity.getRemainingFireTicks(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index e6b22f24eba945863bb625b40319e6874ff25534..a9ba62a9d605234d993b6e5330889795099af391 100644 +index 24f86724012bb8bcd6d24683a1c78ce66b42ca30..a5285a8952b2d99bfbb928b1bb31d3ddcf8ed57b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1078,7 +1078,7 @@ public class CraftEventFactory { diff --git a/patches/server/0585-Fix-issues-with-mob-conversion.patch b/patches/server/0584-Fix-issues-with-mob-conversion.patch similarity index 100% rename from patches/server/0585-Fix-issues-with-mob-conversion.patch rename to patches/server/0584-Fix-issues-with-mob-conversion.patch diff --git a/patches/server/0586-Add-hasCollision-methods-to-various-places.patch b/patches/server/0585-Add-hasCollision-methods-to-various-places.patch similarity index 100% rename from patches/server/0586-Add-hasCollision-methods-to-various-places.patch rename to patches/server/0585-Add-hasCollision-methods-to-various-places.patch diff --git a/patches/server/0587-Goat-ram-API.patch b/patches/server/0586-Goat-ram-API.patch similarity index 100% rename from patches/server/0587-Goat-ram-API.patch rename to patches/server/0586-Goat-ram-API.patch diff --git a/patches/server/0588-Add-API-for-resetting-a-single-score.patch b/patches/server/0587-Add-API-for-resetting-a-single-score.patch similarity index 100% rename from patches/server/0588-Add-API-for-resetting-a-single-score.patch rename to patches/server/0587-Add-API-for-resetting-a-single-score.patch diff --git a/patches/server/0589-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0588-Add-Raw-Byte-Entity-Serialization.patch similarity index 100% rename from patches/server/0589-Add-Raw-Byte-Entity-Serialization.patch rename to patches/server/0588-Add-Raw-Byte-Entity-Serialization.patch diff --git a/patches/server/0590-Vanilla-command-permission-fixes.patch b/patches/server/0589-Vanilla-command-permission-fixes.patch similarity index 97% rename from patches/server/0590-Vanilla-command-permission-fixes.patch rename to patches/server/0589-Vanilla-command-permission-fixes.patch index f69e58a368..c1bd75dad5 100644 --- a/patches/server/0590-Vanilla-command-permission-fixes.patch +++ b/patches/server/0589-Vanilla-command-permission-fixes.patch @@ -51,7 +51,7 @@ index 7acd7f60327106d55e8f48247650bc0064dd1b58..bee79fab7f8195e14f6bd22d9cd59bfc } diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java -index 71bc74071e7bbce1d6aa5b0f0fb244c93dae168e..732655bf8dd279167f799e01b1516b4dd5fa7464 100644 +index 9b453830e4b949d67c2a01adc309ddc6ad019be1..35b05f9321ddbbbdf62f4bf726b58cf1205f0cfb 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java @@ -91,7 +91,21 @@ public final class VanillaCommandWrapper extends BukkitCommand { diff --git a/patches/server/0591-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/0590-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch similarity index 93% rename from patches/server/0591-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch rename to patches/server/0590-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch index 27c3f61502..b51374cebe 100644 --- a/patches/server/0591-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch +++ b/patches/server/0590-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch @@ -9,10 +9,10 @@ chunk through it. This should also be OK from a leak prevention/ state desync POV because the TE is getting unloaded anyways. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3c281cdd24acbc9484c968c07f737d50be2deced..ecb4dc0642685d67621c82bb24fb0e939c805ce4 100644 +index 50d4bd6223eb92c640a61ee61af862e794fbb519..a870349f1de975e46fe831ff32394d6dd80d388b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1239,9 +1239,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1244,9 +1244,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Spigot Start for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) { if (tileentity instanceof net.minecraft.world.Container) { @@ -28,7 +28,7 @@ index 3c281cdd24acbc9484c968c07f737d50be2deced..ecb4dc0642685d67621c82bb24fb0e93 } // 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 c680b311760601bb539d685bceddba6712d141d4..d2fbbdbb451d6c54d847b4ba125397ad41c4f7b4 100644 +index fe39d0ab5e99818356d4e1a600af4bdd3eb03b70..6f0955d58da2df5ffc4b81fc5c7b7c3846d65f52 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1983,6 +1983,18 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0592-Fix-GameProfileCache-concurrency.patch b/patches/server/0591-Fix-GameProfileCache-concurrency.patch similarity index 100% rename from patches/server/0592-Fix-GameProfileCache-concurrency.patch rename to patches/server/0591-Fix-GameProfileCache-concurrency.patch diff --git a/patches/server/0593-Improve-and-expand-AsyncCatcher.patch b/patches/server/0592-Improve-and-expand-AsyncCatcher.patch similarity index 96% rename from patches/server/0593-Improve-and-expand-AsyncCatcher.patch rename to patches/server/0592-Improve-and-expand-AsyncCatcher.patch index 8d0e995ef7..f2bb9da75a 100644 --- a/patches/server/0593-Improve-and-expand-AsyncCatcher.patch +++ b/patches/server/0592-Improve-and-expand-AsyncCatcher.patch @@ -29,7 +29,7 @@ index 70b891bd018029eda8cda4fb9f919e77524dbc5e..a4abcbc69ccd023a936d02d359ba4c08 if (player.isRemoved()) { LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName()); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5415cade10ab36709f722cabc20ea3f1b9c285d9..924db96764ef1d0b9596be01f344065f8e1a721e 100644 +index f240a63f39affc048d1c13eb184f4b07c6c52d3e..a06a696fcec124d307eb84c1ee4f20ec928bfaec 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1143,7 +1143,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -166,10 +166,10 @@ index 4eb0b0969325f39a7ae65492cccd482515a50142..5aa74c00a61282830d82359eae2b114e PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), reason}); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index bb61295b8ae44eee9d0c7b12152a7d93d191bdfa..38febc623ee84d7eeeb7359c299ad0dbd5086e5b 100644 +index 1812dcd6e21d6de834ce6c39b5b69cee31a5fa06..8fdae6c7d37d2403d95d37fe0dc35f168ce0f256 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1762,6 +1762,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1750,6 +1750,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void playSound(Location loc, Sound sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) { @@ -177,7 +177,7 @@ index bb61295b8ae44eee9d0c7b12152a7d93d191bdfa..38febc623ee84d7eeeb7359c299ad0db if (loc == null || sound == null || category == null) return; double x = loc.getX(); -@@ -1773,6 +1774,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1761,6 +1762,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void playSound(Location loc, String sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) { @@ -185,7 +185,7 @@ index bb61295b8ae44eee9d0c7b12152a7d93d191bdfa..38febc623ee84d7eeeb7359c299ad0db if (loc == null || sound == null || category == null) return; double x = loc.getX(); -@@ -1805,6 +1807,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1793,6 +1795,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void playSound(Entity entity, Sound sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) { @@ -193,7 +193,7 @@ index bb61295b8ae44eee9d0c7b12152a7d93d191bdfa..38febc623ee84d7eeeb7359c299ad0db if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return; ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(CraftSound.bukkitToMinecraftHolder(sound), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed); -@@ -1825,6 +1828,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1813,6 +1816,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void playSound(Entity entity, String sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) { diff --git a/patches/server/0594-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0593-Add-paper-mobcaps-and-paper-playermobcaps.patch similarity index 98% rename from patches/server/0594-Add-paper-mobcaps-and-paper-playermobcaps.patch rename to patches/server/0593-Add-paper-mobcaps-and-paper-playermobcaps.patch index 26e9f0584c..4f2526463b 100644 --- a/patches/server/0594-Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/0593-Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -278,7 +278,7 @@ index 606a60fe273974b71ed2bd40be819d848627e777..bf943feca387b77a3154773a59da7190 BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0c6fbba9d4c27d05c0a7ff0ba1f735abb6d1e6ed..9ee5c98af55e93e304c157d63f6ef4e5ebdc7fc3 100644 +index 45d887f4143444321f563cdd7d084b2b9ccf911e..33d9f3778996eedc83064332a2fbbdc7c6a8ba90 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2334,6 +2334,11 @@ public final class CraftServer implements Server { @@ -294,10 +294,10 @@ index 0c6fbba9d4c27d05c0a7ff0ba1f735abb6d1e6ed..9ee5c98af55e93e304c157d63f6ef4e5 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 38febc623ee84d7eeeb7359c299ad0dbd5086e5b..d3722ffa822f5716ba46dc620a36ab8b0cd7cafe 100644 +index 8fdae6c7d37d2403d95d37fe0dc35f168ce0f256..a6cb8225338a6450f13116aaec587d97ecbd5197 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1720,9 +1720,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1708,9 +1708,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null"); Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory); diff --git a/patches/server/0595-Sanitize-ResourceLocation-error-logging.patch b/patches/server/0594-Sanitize-ResourceLocation-error-logging.patch similarity index 100% rename from patches/server/0595-Sanitize-ResourceLocation-error-logging.patch rename to patches/server/0594-Sanitize-ResourceLocation-error-logging.patch diff --git a/patches/server/0596-Manually-inline-methods-in-BlockPosition.patch b/patches/server/0595-Manually-inline-methods-in-BlockPosition.patch similarity index 100% rename from patches/server/0596-Manually-inline-methods-in-BlockPosition.patch rename to patches/server/0595-Manually-inline-methods-in-BlockPosition.patch diff --git a/patches/server/0597-Name-craft-scheduler-threads-according-to-the-plugin.patch b/patches/server/0596-Name-craft-scheduler-threads-according-to-the-plugin.patch similarity index 100% rename from patches/server/0597-Name-craft-scheduler-threads-according-to-the-plugin.patch rename to patches/server/0596-Name-craft-scheduler-threads-according-to-the-plugin.patch diff --git a/patches/server/0598-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch b/patches/server/0597-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch similarity index 100% rename from patches/server/0598-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch rename to patches/server/0597-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch diff --git a/patches/server/0599-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch b/patches/server/0598-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch similarity index 100% rename from patches/server/0599-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch rename to patches/server/0598-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch diff --git a/patches/server/0600-Don-t-lookup-fluid-state-when-raytracing-skip-air-bl.patch b/patches/server/0599-Don-t-lookup-fluid-state-when-raytracing-skip-air-bl.patch similarity index 100% rename from patches/server/0600-Don-t-lookup-fluid-state-when-raytracing-skip-air-bl.patch rename to patches/server/0599-Don-t-lookup-fluid-state-when-raytracing-skip-air-bl.patch diff --git a/patches/server/0601-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0600-Oprimise-map-impl-for-tracked-players.patch similarity index 100% rename from patches/server/0601-Oprimise-map-impl-for-tracked-players.patch rename to patches/server/0600-Oprimise-map-impl-for-tracked-players.patch diff --git a/patches/server/0602-Add-missing-InventoryType.patch b/patches/server/0601-Add-missing-InventoryType.patch similarity index 100% rename from patches/server/0602-Add-missing-InventoryType.patch rename to patches/server/0601-Add-missing-InventoryType.patch diff --git a/patches/server/0603-Optimise-BlockSoil-nearby-water-lookup.patch b/patches/server/0602-Optimise-BlockSoil-nearby-water-lookup.patch similarity index 100% rename from patches/server/0603-Optimise-BlockSoil-nearby-water-lookup.patch rename to patches/server/0602-Optimise-BlockSoil-nearby-water-lookup.patch diff --git a/patches/server/0604-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0603-Fix-merchant-inventory-not-closing-on-entity-removal.patch similarity index 90% rename from patches/server/0604-Fix-merchant-inventory-not-closing-on-entity-removal.patch rename to patches/server/0603-Fix-merchant-inventory-not-closing-on-entity-removal.patch index 87e006c31f..73f23716d8 100644 --- a/patches/server/0604-Fix-merchant-inventory-not-closing-on-entity-removal.patch +++ b/patches/server/0603-Fix-merchant-inventory-not-closing-on-entity-removal.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ecb4dc0642685d67621c82bb24fb0e939c805ce4..3b3024fcf39266cc6ae61fb77dbffb391dc96c92 100644 +index a870349f1de975e46fe831ff32394d6dd80d388b..427a649e403c87aab0158e99e3aca105159a535c 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2298,6 +2298,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2303,6 +2303,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Spigot end // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message diff --git a/patches/server/0605-Check-requirement-before-suggesting-root-nodes.patch b/patches/server/0604-Check-requirement-before-suggesting-root-nodes.patch similarity index 100% rename from patches/server/0605-Check-requirement-before-suggesting-root-nodes.patch rename to patches/server/0604-Check-requirement-before-suggesting-root-nodes.patch diff --git a/patches/server/0606-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0605-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch similarity index 100% rename from patches/server/0606-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch rename to patches/server/0605-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch diff --git a/patches/server/0607-Add-packet-limiter-config.patch b/patches/server/0606-Add-packet-limiter-config.patch similarity index 100% rename from patches/server/0607-Add-packet-limiter-config.patch rename to patches/server/0606-Add-packet-limiter-config.patch diff --git a/patches/server/0608-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch b/patches/server/0607-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch similarity index 98% rename from patches/server/0608-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch rename to patches/server/0607-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch index c313451894..f5c3a81df3 100644 --- a/patches/server/0608-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch +++ b/patches/server/0607-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch @@ -1,5 +1,5 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll +From: Bjarne Koll Date: Sat, 6 Nov 2021 23:15:20 +0100 Subject: [PATCH] Fix setPatternColor on tropical fish bucket meta diff --git a/patches/server/0609-Ensure-valid-vehicle-status.patch b/patches/server/0608-Ensure-valid-vehicle-status.patch similarity index 91% rename from patches/server/0609-Ensure-valid-vehicle-status.patch rename to patches/server/0608-Ensure-valid-vehicle-status.patch index c4359b2054..30b9aa81a9 100644 --- a/patches/server/0609-Ensure-valid-vehicle-status.patch +++ b/patches/server/0608-Ensure-valid-vehicle-status.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure valid vehicle status diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d2fbbdbb451d6c54d847b4ba125397ad41c4f7b4..f72ab5e4e743cb0758ebca28e81f97c143c91b42 100644 +index 6f0955d58da2df5ffc4b81fc5c7b7c3846d65f52..3b5ff5eaed200d07cadf069d5657c9aeab8db90b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -698,7 +698,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0610-Prevent-softlocked-end-exit-portal-generation.patch b/patches/server/0609-Prevent-softlocked-end-exit-portal-generation.patch similarity index 100% rename from patches/server/0610-Prevent-softlocked-end-exit-portal-generation.patch rename to patches/server/0609-Prevent-softlocked-end-exit-portal-generation.patch diff --git a/patches/server/0611-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch b/patches/server/0610-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch similarity index 100% rename from patches/server/0611-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch rename to patches/server/0610-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch diff --git a/patches/server/0612-Don-t-log-debug-logging-being-disabled.patch b/patches/server/0611-Don-t-log-debug-logging-being-disabled.patch similarity index 100% rename from patches/server/0612-Don-t-log-debug-logging-being-disabled.patch rename to patches/server/0611-Don-t-log-debug-logging-being-disabled.patch diff --git a/patches/server/0613-fix-various-menus-with-empty-level-accesses.patch b/patches/server/0612-fix-various-menus-with-empty-level-accesses.patch similarity index 100% rename from patches/server/0613-fix-various-menus-with-empty-level-accesses.patch rename to patches/server/0612-fix-various-menus-with-empty-level-accesses.patch diff --git a/patches/server/0614-Preserve-overstacked-loot.patch b/patches/server/0613-Preserve-overstacked-loot.patch similarity index 100% rename from patches/server/0614-Preserve-overstacked-loot.patch rename to patches/server/0613-Preserve-overstacked-loot.patch diff --git a/patches/server/0615-Update-head-rotation-in-missing-places.patch b/patches/server/0614-Update-head-rotation-in-missing-places.patch similarity index 93% rename from patches/server/0615-Update-head-rotation-in-missing-places.patch rename to patches/server/0614-Update-head-rotation-in-missing-places.patch index 201c4c942d..65816d8278 100644 --- a/patches/server/0615-Update-head-rotation-in-missing-places.patch +++ b/patches/server/0614-Update-head-rotation-in-missing-places.patch @@ -8,7 +8,7 @@ This is because bukkit uses a separate head rotation field for yaw. This issue only applies to players. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9755d8a40a5a5b4863ce057f576f393773cee3e4..2ab2cfddae9f1bb3a1ca3c3bfd0916a14409b205 100644 +index 38147960aed55bb60b427d73739d8ec0b5b8b863..f8c3d239e4a87abd5e893726dcc5ccc07bda637e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1915,6 +1915,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0616-prevent-unintended-light-block-manipulation.patch b/patches/server/0615-prevent-unintended-light-block-manipulation.patch similarity index 100% rename from patches/server/0616-prevent-unintended-light-block-manipulation.patch rename to patches/server/0615-prevent-unintended-light-block-manipulation.patch diff --git a/patches/server/0617-Fix-CraftCriteria-defaults-map.patch b/patches/server/0616-Fix-CraftCriteria-defaults-map.patch similarity index 100% rename from patches/server/0617-Fix-CraftCriteria-defaults-map.patch rename to patches/server/0616-Fix-CraftCriteria-defaults-map.patch diff --git a/patches/server/0618-Fix-upstreams-block-state-factories.patch b/patches/server/0617-Fix-upstreams-block-state-factories.patch similarity index 100% rename from patches/server/0618-Fix-upstreams-block-state-factories.patch rename to patches/server/0617-Fix-upstreams-block-state-factories.patch diff --git a/patches/server/0619-Configurable-feature-seeds.patch b/patches/server/0618-Configurable-feature-seeds.patch similarity index 100% rename from patches/server/0619-Configurable-feature-seeds.patch rename to patches/server/0618-Configurable-feature-seeds.patch diff --git a/patches/server/0620-Add-root-admin-user-detection.patch b/patches/server/0619-Add-root-admin-user-detection.patch similarity index 100% rename from patches/server/0620-Add-root-admin-user-detection.patch rename to patches/server/0619-Add-root-admin-user-detection.patch diff --git a/patches/server/0621-don-t-attempt-to-teleport-dead-entities.patch b/patches/server/0620-don-t-attempt-to-teleport-dead-entities.patch similarity index 90% rename from patches/server/0621-don-t-attempt-to-teleport-dead-entities.patch rename to patches/server/0620-don-t-attempt-to-teleport-dead-entities.patch index 08f5268772..a7655c738c 100644 --- a/patches/server/0621-don-t-attempt-to-teleport-dead-entities.patch +++ b/patches/server/0620-don-t-attempt-to-teleport-dead-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] don't attempt to teleport dead entities diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2ab2cfddae9f1bb3a1ca3c3bfd0916a14409b205..d05fd90a000c723e9c3bef0fde1b59aea2367f7f 100644 +index f8c3d239e4a87abd5e893726dcc5ccc07bda637e..f7bd4f1e101330a8ac29cc8059a2f4263c382bfc 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -714,7 +714,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0622-Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/0621-Prevent-excessive-velocity-through-repeated-crits.patch similarity index 95% rename from patches/server/0622-Prevent-excessive-velocity-through-repeated-crits.patch rename to patches/server/0621-Prevent-excessive-velocity-through-repeated-crits.patch index 51b492f145..7d38deddec 100644 --- a/patches/server/0622-Prevent-excessive-velocity-through-repeated-crits.patch +++ b/patches/server/0621-Prevent-excessive-velocity-through-repeated-crits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 924db96764ef1d0b9596be01f344065f8e1a721e..f06fe310e8dd950fa68ed3b7a7ba5e43a23b9316 100644 +index a06a696fcec124d307eb84c1ee4f20ec928bfaec..f714569ebc0e6c43d4d879b2d7bb407b0eed77f6 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2864,17 +2864,29 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0623-Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/0622-Remove-client-side-code-using-deprecated-for-removal.patch similarity index 100% rename from patches/server/0623-Remove-client-side-code-using-deprecated-for-removal.patch rename to patches/server/0622-Remove-client-side-code-using-deprecated-for-removal.patch diff --git a/patches/server/0624-Fix-Spigot-growth-modifiers.patch b/patches/server/0623-Fix-Spigot-growth-modifiers.patch similarity index 100% rename from patches/server/0624-Fix-Spigot-growth-modifiers.patch rename to patches/server/0623-Fix-Spigot-growth-modifiers.patch diff --git a/patches/server/0625-Prevent-ContainerOpenersCounter-openCount-from-going.patch b/patches/server/0624-Prevent-ContainerOpenersCounter-openCount-from-going.patch similarity index 100% rename from patches/server/0625-Prevent-ContainerOpenersCounter-openCount-from-going.patch rename to patches/server/0624-Prevent-ContainerOpenersCounter-openCount-from-going.patch diff --git a/patches/server/0626-Add-PlayerItemFrameChangeEvent.patch b/patches/server/0625-Add-PlayerItemFrameChangeEvent.patch similarity index 100% rename from patches/server/0626-Add-PlayerItemFrameChangeEvent.patch rename to patches/server/0625-Add-PlayerItemFrameChangeEvent.patch diff --git a/patches/server/0627-Optimize-HashMapPalette.patch b/patches/server/0626-Optimize-HashMapPalette.patch similarity index 100% rename from patches/server/0627-Optimize-HashMapPalette.patch rename to patches/server/0626-Optimize-HashMapPalette.patch diff --git a/patches/server/0628-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch b/patches/server/0627-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch similarity index 100% rename from patches/server/0628-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch rename to patches/server/0627-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch diff --git a/patches/server/0629-Add-more-Campfire-API.patch b/patches/server/0628-Add-more-Campfire-API.patch similarity index 100% rename from patches/server/0629-Add-more-Campfire-API.patch rename to patches/server/0628-Add-more-Campfire-API.patch diff --git a/patches/server/0630-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch b/patches/server/0629-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch similarity index 100% rename from patches/server/0630-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch rename to patches/server/0629-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch diff --git a/patches/server/0631-Forward-CraftEntity-in-teleport-command.patch b/patches/server/0630-Forward-CraftEntity-in-teleport-command.patch similarity index 95% rename from patches/server/0631-Forward-CraftEntity-in-teleport-command.patch rename to patches/server/0630-Forward-CraftEntity-in-teleport-command.patch index d7c7c656a0..4a6aa85265 100644 --- a/patches/server/0631-Forward-CraftEntity-in-teleport-command.patch +++ b/patches/server/0630-Forward-CraftEntity-in-teleport-command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Forward CraftEntity in teleport command diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d05fd90a000c723e9c3bef0fde1b59aea2367f7f..0eda06b3919e0cc4ddaec4b644c17011a01ccdeb 100644 +index f7bd4f1e101330a8ac29cc8059a2f4263c382bfc..568e968af99cc97de5c32b432f8c1be9790b0bcd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3481,6 +3481,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0632-Improve-scoreboard-entries.patch b/patches/server/0631-Improve-scoreboard-entries.patch similarity index 100% rename from patches/server/0632-Improve-scoreboard-entries.patch rename to patches/server/0631-Improve-scoreboard-entries.patch diff --git a/patches/server/0633-Entity-powdered-snow-API.patch b/patches/server/0632-Entity-powdered-snow-API.patch similarity index 100% rename from patches/server/0633-Entity-powdered-snow-API.patch rename to patches/server/0632-Entity-powdered-snow-API.patch diff --git a/patches/server/0634-Add-API-for-item-entity-health.patch b/patches/server/0633-Add-API-for-item-entity-health.patch similarity index 100% rename from patches/server/0634-Add-API-for-item-entity-health.patch rename to patches/server/0633-Add-API-for-item-entity-health.patch diff --git a/patches/server/0635-Configurable-max-block-light-for-monster-spawning.patch b/patches/server/0634-Configurable-max-block-light-for-monster-spawning.patch similarity index 100% rename from patches/server/0635-Configurable-max-block-light-for-monster-spawning.patch rename to patches/server/0634-Configurable-max-block-light-for-monster-spawning.patch diff --git a/patches/server/0636-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch b/patches/server/0635-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch similarity index 100% rename from patches/server/0636-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch rename to patches/server/0635-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch diff --git a/patches/server/0637-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch b/patches/server/0636-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch similarity index 100% rename from patches/server/0637-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch rename to patches/server/0636-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch diff --git a/patches/server/0638-Bucketable-API.patch b/patches/server/0637-Bucketable-API.patch similarity index 100% rename from patches/server/0638-Bucketable-API.patch rename to patches/server/0637-Bucketable-API.patch diff --git a/patches/server/0639-Validate-usernames.patch b/patches/server/0638-Validate-usernames.patch similarity index 97% rename from patches/server/0639-Validate-usernames.patch rename to patches/server/0638-Validate-usernames.patch index 1845ec8d60..e8287bc641 100644 --- a/patches/server/0639-Validate-usernames.patch +++ b/patches/server/0638-Validate-usernames.patch @@ -32,7 +32,7 @@ index 1e4b288f20153ce0c91fabf164c5c8320c90ba7d..cb5dd77892283a1aaec45434fb99bb7f GameProfile gameprofile = this.server.getSingleplayerProfile(); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index a62858d3cd83358f2356c15fc102b99c41969a74..bb301d1ce9c1792ead2681c9f3d38bb2079b0112 100644 +index 05d2f3c26d10169f6cf43bcb6c48db5d27b5cbac..3a0e0196f5bfa554b23fff9ff1a18a189b36452e 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -627,7 +627,7 @@ public abstract class PlayerList { diff --git a/patches/server/0640-Make-water-animal-spawn-height-configurable.patch b/patches/server/0639-Make-water-animal-spawn-height-configurable.patch similarity index 100% rename from patches/server/0640-Make-water-animal-spawn-height-configurable.patch rename to patches/server/0639-Make-water-animal-spawn-height-configurable.patch diff --git a/patches/server/0641-Expose-vanilla-BiomeProvider-from-WorldInfo.patch b/patches/server/0640-Expose-vanilla-BiomeProvider-from-WorldInfo.patch similarity index 96% rename from patches/server/0641-Expose-vanilla-BiomeProvider-from-WorldInfo.patch rename to patches/server/0640-Expose-vanilla-BiomeProvider-from-WorldInfo.patch index 85ea766b6a..64fb16f6c5 100644 --- a/patches/server/0641-Expose-vanilla-BiomeProvider-from-WorldInfo.patch +++ b/patches/server/0640-Expose-vanilla-BiomeProvider-from-WorldInfo.patch @@ -18,10 +18,10 @@ index 8e0bc6559aad75a713e1760ea17e5004686d7e7a..0db44e8205d795cbeca1d6411aca0da5 biomeProvider = gen.getDefaultBiomeProvider(worldInfo); } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3b3024fcf39266cc6ae61fb77dbffb391dc96c92..2d77e9526917a83987ae0486a669538d5417b781 100644 +index 427a649e403c87aab0158e99e3aca105159a535c..4d53089f3fc6c76b8767efcae44522d710d406a7 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -357,7 +357,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -362,7 +362,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.serverLevelData.setWorld(this); if (biomeProvider != null) { @@ -31,7 +31,7 @@ index 3b3024fcf39266cc6ae61fb77dbffb391dc96c92..2d77e9526917a83987ae0486a669538d chunkgenerator = new NoiseBasedChunkGenerator(worldChunkManager, cga.settings); } else if (chunkgenerator instanceof FlatLevelSource cpf) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9ee5c98af55e93e304c157d63f6ef4e5ebdc7fc3..0939d4f1297296efdcc083b2a2b0aa987141d42f 100644 +index 33d9f3778996eedc83064332a2fbbdc7c6a8ba90..62ab88e022230d25ffb359981ce7da4e64a9be5a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1310,7 +1310,7 @@ public final class CraftServer implements Server { @@ -44,7 +44,7 @@ index 9ee5c98af55e93e304c157d63f6ef4e5ebdc7fc3..0939d4f1297296efdcc083b2a2b0aa98 biomeProvider = generator.getDefaultBiomeProvider(worldInfo); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d3722ffa822f5716ba46dc620a36ab8b0cd7cafe..f544aa7ce6ab98581c4dacf2a79b05ce80131729 100644 +index a6cb8225338a6450f13116aaec587d97ecbd5197..83771925dc7009d56fc3c8283d75880c7e61296a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -208,6 +208,39 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0642-Add-config-option-for-worlds-affected-by-time-cmd.patch b/patches/server/0641-Add-config-option-for-worlds-affected-by-time-cmd.patch similarity index 100% rename from patches/server/0642-Add-config-option-for-worlds-affected-by-time-cmd.patch rename to patches/server/0641-Add-config-option-for-worlds-affected-by-time-cmd.patch diff --git a/patches/server/0643-Add-missing-IAE-check-for-PersistentDataContainer-ha.patch b/patches/server/0642-Add-missing-IAE-check-for-PersistentDataContainer-ha.patch similarity index 100% rename from patches/server/0643-Add-missing-IAE-check-for-PersistentDataContainer-ha.patch rename to patches/server/0642-Add-missing-IAE-check-for-PersistentDataContainer-ha.patch diff --git a/patches/server/0644-Multiple-Entries-with-Scoreboards.patch b/patches/server/0643-Multiple-Entries-with-Scoreboards.patch similarity index 100% rename from patches/server/0644-Multiple-Entries-with-Scoreboards.patch rename to patches/server/0643-Multiple-Entries-with-Scoreboards.patch diff --git a/patches/server/0645-Reset-placed-block-on-exception.patch b/patches/server/0644-Reset-placed-block-on-exception.patch similarity index 100% rename from patches/server/0645-Reset-placed-block-on-exception.patch rename to patches/server/0644-Reset-placed-block-on-exception.patch diff --git a/patches/server/0646-Add-configurable-height-for-slime-spawn.patch b/patches/server/0645-Add-configurable-height-for-slime-spawn.patch similarity index 100% rename from patches/server/0646-Add-configurable-height-for-slime-spawn.patch rename to patches/server/0645-Add-configurable-height-for-slime-spawn.patch diff --git a/patches/server/0647-Fix-xp-reward-for-baby-zombies.patch b/patches/server/0646-Fix-xp-reward-for-baby-zombies.patch similarity index 100% rename from patches/server/0647-Fix-xp-reward-for-baby-zombies.patch rename to patches/server/0646-Fix-xp-reward-for-baby-zombies.patch diff --git a/patches/server/0648-Multi-Block-Change-API-Implementation.patch b/patches/server/0647-Multi-Block-Change-API-Implementation.patch similarity index 97% rename from patches/server/0648-Multi-Block-Change-API-Implementation.patch rename to patches/server/0647-Multi-Block-Change-API-Implementation.patch index 7544786e22..bfefeea7fa 100644 --- a/patches/server/0648-Multi-Block-Change-API-Implementation.patch +++ b/patches/server/0647-Multi-Block-Change-API-Implementation.patch @@ -24,7 +24,7 @@ index 926ff9be3d9e3f5d620e4c7ccb22b9f64865ff8c..1a37654aff9a9c86c9f7af10a1cf7213 buf.writeLong(this.sectionPos.asLong()); buf.writeVarInt(this.positions.length); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 85bbb04aa2f8db860780667994aba90f5b1d4d8a..ef10695d2c1c3041e5f84bdb6001c08004af9d6b 100644 +index fe05fe8f9c24ad15c083cb63bc6b7e004a974832..728a65ad7a826596530b12594db15c93f1af68fb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -935,6 +935,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0649-Fix-NotePlayEvent.patch b/patches/server/0648-Fix-NotePlayEvent.patch similarity index 100% rename from patches/server/0649-Fix-NotePlayEvent.patch rename to patches/server/0648-Fix-NotePlayEvent.patch diff --git a/patches/server/0650-Freeze-Tick-Lock-API.patch b/patches/server/0649-Freeze-Tick-Lock-API.patch similarity index 93% rename from patches/server/0650-Freeze-Tick-Lock-API.patch rename to patches/server/0649-Freeze-Tick-Lock-API.patch index 937e4ae987..1ac6ab0e8e 100644 --- a/patches/server/0650-Freeze-Tick-Lock-API.patch +++ b/patches/server/0649-Freeze-Tick-Lock-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Freeze Tick Lock API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0eda06b3919e0cc4ddaec4b644c17011a01ccdeb..a390e1791b4fb3eae5555fc9b760588e410be900 100644 +index 568e968af99cc97de5c32b432f8c1be9790b0bcd..775243c5a2c44300c00f4f674f40d6793f5a797d 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -415,6 +415,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -46,7 +46,7 @@ index 0eda06b3919e0cc4ddaec4b644c17011a01ccdeb..a390e1791b4fb3eae5555fc9b760588e } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f06fe310e8dd950fa68ed3b7a7ba5e43a23b9316..36277d10822a4fd19b6159a90a455c237b5b177f 100644 +index f714569ebc0e6c43d4d879b2d7bb407b0eed77f6..03285728ca3df70c487cd67e973812f3968218e2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3610,7 +3610,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -59,7 +59,7 @@ index f06fe310e8dd950fa68ed3b7a7ba5e43a23b9316..36277d10822a4fd19b6159a90a455c23 if (this.isInPowderSnow && this.canFreeze()) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 9693656418210957000add9b6670c4bee67f8462..4e6afa243d6108cb946a8a7cf96c4036a3c2ac0c 100644 +index 442b5f13e976dd63bf1dccc12eb8c3f16314c581..10fb64df10820974d11f142c102a11a5bd0f317c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -324,6 +324,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0651-More-PotionEffectType-API.patch b/patches/server/0650-More-PotionEffectType-API.patch similarity index 100% rename from patches/server/0651-More-PotionEffectType-API.patch rename to patches/server/0650-More-PotionEffectType-API.patch diff --git a/patches/server/0652-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch b/patches/server/0651-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch similarity index 100% rename from patches/server/0652-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch rename to patches/server/0651-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch diff --git a/patches/server/0653-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/server/0652-API-for-creating-command-sender-which-forwards-feedb.patch similarity index 97% rename from patches/server/0653-API-for-creating-command-sender-which-forwards-feedb.patch rename to patches/server/0652-API-for-creating-command-sender-which-forwards-feedb.patch index 981105e5be..f86274766d 100644 --- a/patches/server/0653-API-for-creating-command-sender-which-forwards-feedb.patch +++ b/patches/server/0652-API-for-creating-command-sender-which-forwards-feedb.patch @@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..e3a5f1ec376319bdfda87fa27ae217bf + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 23b2233f7435f03902e640152cc6fe1501fb3820..c89aee30e4a4f4eec48e23b04e0558e17d95587c 100644 +index 62ab88e022230d25ffb359981ce7da4e64a9be5a..3b01907bc119853e0676e912e9a29b05d9aa5763 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2165,6 +2165,13 @@ public final class CraftServer implements Server { @@ -153,7 +153,7 @@ index 7f22950ae61436e91a59cd29a345809c42bbe739..1e3091687735b461d3b6a313ab876112 protected ServerCommandSender() { diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java -index 732655bf8dd279167f799e01b1516b4dd5fa7464..4d4a1ac9d75908bbd105a1e5756d2c0932b2d238 100644 +index 35b05f9321ddbbbdf62f4bf726b58cf1205f0cfb..ce8683eff5b8ade57a2fcb77027cfe4b26986bc7 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java @@ -86,6 +86,11 @@ public final class VanillaCommandWrapper extends BukkitCommand { diff --git a/patches/server/0654-Add-missing-structure-set-seed-configs.patch b/patches/server/0653-Add-missing-structure-set-seed-configs.patch similarity index 100% rename from patches/server/0654-Add-missing-structure-set-seed-configs.patch rename to patches/server/0653-Add-missing-structure-set-seed-configs.patch diff --git a/patches/server/0655-Fix-cancelled-powdered-snow-bucket-placement.patch b/patches/server/0654-Fix-cancelled-powdered-snow-bucket-placement.patch similarity index 100% rename from patches/server/0655-Fix-cancelled-powdered-snow-bucket-placement.patch rename to patches/server/0654-Fix-cancelled-powdered-snow-bucket-placement.patch diff --git a/patches/server/0656-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch b/patches/server/0655-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch similarity index 92% rename from patches/server/0656-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch rename to patches/server/0655-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch index 3f4362495a..d5922672e4 100644 --- a/patches/server/0656-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch +++ b/patches/server/0655-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add missing Validate calls to CraftServer#getSpawnLimit Copies appropriate checks from CraftWorld#getSpawnLimit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9de7978c7383f8364feba82e9cd3efbfcce00e3c..c1bdefbad35fd259e3d90c6e330da14c9d072090 100644 +index 3b01907bc119853e0676e912e9a29b05d9aa5763..188e3066d6659b5e45cec0b50dcbd5d20659830a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2342,6 +2342,8 @@ public final class CraftServer implements Server { diff --git a/patches/server/0657-Add-GameEvent-tags.patch b/patches/server/0656-Add-GameEvent-tags.patch similarity index 97% rename from patches/server/0657-Add-GameEvent-tags.patch rename to patches/server/0656-Add-GameEvent-tags.patch index 43a634ea32..bb674d2f17 100644 --- a/patches/server/0657-Add-GameEvent-tags.patch +++ b/patches/server/0656-Add-GameEvent-tags.patch @@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..874c420e60b6be09c806d64f40cf6366 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f2041ade0818b0624da2487e19490d076107a8be..57802b168b7bc8502d800cc4ed3e47290cfe11e6 100644 +index 188e3066d6659b5e45cec0b50dcbd5d20659830a..72f8d3a89396f9289f5b451b24cc181e7ac3222e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2709,6 +2709,15 @@ public final class CraftServer implements Server { diff --git a/patches/server/0658-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch b/patches/server/0657-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch similarity index 100% rename from patches/server/0658-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch rename to patches/server/0657-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch diff --git a/patches/server/0659-Furnace-RecipesUsed-API.patch b/patches/server/0658-Furnace-RecipesUsed-API.patch similarity index 100% rename from patches/server/0659-Furnace-RecipesUsed-API.patch rename to patches/server/0658-Furnace-RecipesUsed-API.patch diff --git a/patches/server/0660-Configurable-sculk-sensor-listener-range.patch b/patches/server/0659-Configurable-sculk-sensor-listener-range.patch similarity index 100% rename from patches/server/0660-Configurable-sculk-sensor-listener-range.patch rename to patches/server/0659-Configurable-sculk-sensor-listener-range.patch diff --git a/patches/server/0661-Add-missing-block-data-API.patch b/patches/server/0660-Add-missing-block-data-API.patch similarity index 100% rename from patches/server/0661-Add-missing-block-data-API.patch rename to patches/server/0660-Add-missing-block-data-API.patch diff --git a/patches/server/0662-Option-to-have-default-CustomSpawners-in-custom-worl.patch b/patches/server/0661-Option-to-have-default-CustomSpawners-in-custom-worl.patch similarity index 100% rename from patches/server/0662-Option-to-have-default-CustomSpawners-in-custom-worl.patch rename to patches/server/0661-Option-to-have-default-CustomSpawners-in-custom-worl.patch diff --git a/patches/server/0663-Put-world-into-worldlist-before-initing-the-world.patch b/patches/server/0662-Put-world-into-worldlist-before-initing-the-world.patch similarity index 95% rename from patches/server/0663-Put-world-into-worldlist-before-initing-the-world.patch rename to patches/server/0662-Put-world-into-worldlist-before-initing-the-world.patch index 33e02c7284..56e3b2d29b 100644 --- a/patches/server/0663-Put-world-into-worldlist-before-initing-the-world.patch +++ b/patches/server/0662-Put-world-into-worldlist-before-initing-the-world.patch @@ -23,7 +23,7 @@ index df93afc35403db15aa8e09b7e36ca0bb630041eb..4cbb5fdcb8734d3944963b911bb75992 if (worlddata.getCustomBossEvents() != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 59690263f1cb27f2289b027ffd31c1e1ac4f2e69..fcd8b3ce258bdb12a87d41d348ac847d5dc603f8 100644 +index 72f8d3a89396f9289f5b451b24cc181e7ac3222e..75bd9617164c63a641602bf772a5e0f15a322c7e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1336,10 +1336,11 @@ public final class CraftServer implements Server { diff --git a/patches/server/0664-Custom-Potion-Mixes.patch b/patches/server/0663-Custom-Potion-Mixes.patch similarity index 99% rename from patches/server/0664-Custom-Potion-Mixes.patch rename to patches/server/0663-Custom-Potion-Mixes.patch index efbd12d0f6..94e9dddaeb 100644 --- a/patches/server/0664-Custom-Potion-Mixes.patch +++ b/patches/server/0663-Custom-Potion-Mixes.patch @@ -282,7 +282,7 @@ index e167c2834f1b7899a7d11cef782940deeb739a9c..2bafacd7bc56186d9105d2031180f8c4 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 83065cabdfe5277d2aaaa7f58ec13ff4bd387cad..5c13b2be698087dfac417864fe48eced28db460d 100644 +index 75bd9617164c63a641602bf772a5e0f15a322c7e..82e1c4713e043c4903b1f0154609da4558f90aef 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -311,6 +311,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0665-Force-close-world-loading-screen.patch b/patches/server/0664-Force-close-world-loading-screen.patch similarity index 95% rename from patches/server/0665-Force-close-world-loading-screen.patch rename to patches/server/0664-Force-close-world-loading-screen.patch index 376fbf1282..820a46bebe 100644 --- a/patches/server/0665-Force-close-world-loading-screen.patch +++ b/patches/server/0664-Force-close-world-loading-screen.patch @@ -10,7 +10,7 @@ so we do not need that. The client only needs the chunk it is currently in to be loaded to close the loading screen, so we just send an empty one. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index bb301d1ce9c1792ead2681c9f3d38bb2079b0112..11f86e1b119d20f668e67b83f09137dcb24d4bf1 100644 +index 3a0e0196f5bfa554b23fff9ff1a18a189b36452e..c8bb797a322220647d5839cc5d20b3ac7c01b8ba 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -406,6 +406,16 @@ public abstract class PlayerList { diff --git a/patches/server/0666-Fix-falling-block-spawn-methods.patch b/patches/server/0665-Fix-falling-block-spawn-methods.patch similarity index 95% rename from patches/server/0666-Fix-falling-block-spawn-methods.patch rename to patches/server/0665-Fix-falling-block-spawn-methods.patch index 4efd06371b..577c742f03 100644 --- a/patches/server/0666-Fix-falling-block-spawn-methods.patch +++ b/patches/server/0665-Fix-falling-block-spawn-methods.patch @@ -11,10 +11,10 @@ Restores the API behavior from previous versions of the server public net.minecraft.world.entity.item.FallingBlockEntity (Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f544aa7ce6ab98581c4dacf2a79b05ce80131729..f67fee006578719262e2e32b38e023acff63fd7d 100644 +index 83771925dc7009d56fc3c8283d75880c7e61296a..9b7304ea9a4f226872d13e64722adb267f727806 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1397,7 +1397,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1385,7 +1385,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { Preconditions.checkArgument(material != null, "Material cannot be null"); Preconditions.checkArgument(material.isBlock(), "Material.%s must be a block", material); @@ -28,7 +28,7 @@ index f544aa7ce6ab98581c4dacf2a79b05ce80131729..f67fee006578719262e2e32b38e023ac return (FallingBlock) entity.getBukkitEntity(); } -@@ -1406,7 +1411,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1394,7 +1399,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { Preconditions.checkArgument(location != null, "Location cannot be null"); Preconditions.checkArgument(data != null, "BlockData cannot be null"); diff --git a/patches/server/0667-Expose-furnace-minecart-push-values.patch b/patches/server/0666-Expose-furnace-minecart-push-values.patch similarity index 100% rename from patches/server/0667-Expose-furnace-minecart-push-values.patch rename to patches/server/0666-Expose-furnace-minecart-push-values.patch diff --git a/patches/server/0668-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch b/patches/server/0667-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch similarity index 100% rename from patches/server/0668-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch rename to patches/server/0667-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch diff --git a/patches/server/0669-More-Projectile-API.patch b/patches/server/0668-More-Projectile-API.patch similarity index 99% rename from patches/server/0669-More-Projectile-API.patch rename to patches/server/0668-More-Projectile-API.patch index afff65d722..c03e65b770 100644 --- a/patches/server/0669-More-Projectile-API.patch +++ b/patches/server/0668-More-Projectile-API.patch @@ -328,7 +328,7 @@ index 199d5836dc787cca54c6b653a4e67573f2f758a2..15d50a284cafc2eb59239ca009268365 } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java -index b79e72a77178f755957ef391b6444a357bdefbd0..39ea25d2145acaa7c7b458800adc674a3e73e7c1 100644 +index 0bafd3b1a55154c8e9eb37c96df9f5985640a675..0b9c4f9b61651660e821735f18b4f3cc7cfd164c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java @@ -442,7 +442,7 @@ public final class CraftEntityTypes { @@ -768,7 +768,7 @@ index e374b9f40eddca13b30855d25a2030f8df98138f..4fc893378fb0568ddcffc7593d66df6b // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a9ba62a9d605234d993b6e5330889795099af391..e0418c0c36aa99ea43dbf39fa176ddf8855e0568 100644 +index a5285a8952b2d99bfbb928b1bb31d3ddcf8ed57b..ca094e393de32b64db59c9fe906433761d70d29b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -841,19 +841,19 @@ public class CraftEventFactory { diff --git a/patches/server/0670-Fix-swamp-hut-cat-generation-deadlock.patch b/patches/server/0669-Fix-swamp-hut-cat-generation-deadlock.patch similarity index 100% rename from patches/server/0670-Fix-swamp-hut-cat-generation-deadlock.patch rename to patches/server/0669-Fix-swamp-hut-cat-generation-deadlock.patch diff --git a/patches/server/0671-Don-t-allow-vehicle-movement-from-players-while-tele.patch b/patches/server/0670-Don-t-allow-vehicle-movement-from-players-while-tele.patch similarity index 100% rename from patches/server/0671-Don-t-allow-vehicle-movement-from-players-while-tele.patch rename to patches/server/0670-Don-t-allow-vehicle-movement-from-players-while-tele.patch diff --git a/patches/server/0672-Implement-getComputedBiome-API.patch b/patches/server/0671-Implement-getComputedBiome-API.patch similarity index 100% rename from patches/server/0672-Implement-getComputedBiome-API.patch rename to patches/server/0671-Implement-getComputedBiome-API.patch diff --git a/patches/server/0673-Make-some-itemstacks-nonnull.patch b/patches/server/0672-Make-some-itemstacks-nonnull.patch similarity index 100% rename from patches/server/0673-Make-some-itemstacks-nonnull.patch rename to patches/server/0672-Make-some-itemstacks-nonnull.patch diff --git a/patches/server/0674-Implement-enchantWithLevels-API.patch b/patches/server/0673-Implement-enchantWithLevels-API.patch similarity index 100% rename from patches/server/0674-Implement-enchantWithLevels-API.patch rename to patches/server/0673-Implement-enchantWithLevels-API.patch diff --git a/patches/server/0675-Fix-saving-in-unloadWorld.patch b/patches/server/0674-Fix-saving-in-unloadWorld.patch similarity index 90% rename from patches/server/0675-Fix-saving-in-unloadWorld.patch rename to patches/server/0674-Fix-saving-in-unloadWorld.patch index a715afca0e..540896076f 100644 --- a/patches/server/0675-Fix-saving-in-unloadWorld.patch +++ b/patches/server/0674-Fix-saving-in-unloadWorld.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix saving in unloadWorld Change savingDisabled to false to ensure ServerLevel's saving logic gets called when unloadWorld is called with save = true diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3b48a8107bf0b4326b86ee08bb54341825be81c1..a504a6458423a997e703e95356dd2058d6c164e2 100644 +index 82e1c4713e043c4903b1f0154609da4558f90aef..430b35c35c7aa17d590031515063f2d24eeffe5c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1385,7 +1385,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0676-Buffer-OOB-setBlock-calls.patch b/patches/server/0675-Buffer-OOB-setBlock-calls.patch similarity index 100% rename from patches/server/0676-Buffer-OOB-setBlock-calls.patch rename to patches/server/0675-Buffer-OOB-setBlock-calls.patch diff --git a/patches/server/0677-Add-TameableDeathMessageEvent.patch b/patches/server/0676-Add-TameableDeathMessageEvent.patch similarity index 100% rename from patches/server/0677-Add-TameableDeathMessageEvent.patch rename to patches/server/0676-Add-TameableDeathMessageEvent.patch diff --git a/patches/server/0678-Fix-new-block-data-for-EntityChangeBlockEvent.patch b/patches/server/0677-Fix-new-block-data-for-EntityChangeBlockEvent.patch similarity index 99% rename from patches/server/0678-Fix-new-block-data-for-EntityChangeBlockEvent.patch rename to patches/server/0677-Fix-new-block-data-for-EntityChangeBlockEvent.patch index fce021dda2..941734df6f 100644 --- a/patches/server/0678-Fix-new-block-data-for-EntityChangeBlockEvent.patch +++ b/patches/server/0677-Fix-new-block-data-for-EntityChangeBlockEvent.patch @@ -196,7 +196,7 @@ index 674d710ff88db5eced9e017284d1b7ec7a4fe7cd..72320c6099a4b26235bab68570e7b7ef } // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index e0418c0c36aa99ea43dbf39fa176ddf8855e0568..f54a4c263eeb4df40c72c20c3c480ce74718a718 100644 +index ca094e393de32b64db59c9fe906433761d70d29b..fcc9fe8f5f57e9f6c28d762aa6585942e2b2698b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1378,11 +1378,11 @@ public class CraftEventFactory { diff --git a/patches/server/0679-fix-player-loottables-running-when-mob-loot-gamerule.patch b/patches/server/0678-fix-player-loottables-running-when-mob-loot-gamerule.patch similarity index 93% rename from patches/server/0679-fix-player-loottables-running-when-mob-loot-gamerule.patch rename to patches/server/0678-fix-player-loottables-running-when-mob-loot-gamerule.patch index 7a7f077e66..96f920f7d1 100644 --- a/patches/server/0679-fix-player-loottables-running-when-mob-loot-gamerule.patch +++ b/patches/server/0678-fix-player-loottables-running-when-mob-loot-gamerule.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix player loottables running when mob loot gamerule is false diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f72ab5e4e743cb0758ebca28e81f97c143c91b42..d723adaa7b1df4a1d5067298536b303992ac2c52 100644 +index 3b5ff5eaed200d07cadf069d5657c9aeab8db90b..cf674caab9e67a27f90ead557634949710c19ca3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1218,12 +1218,14 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0680-Ensure-entity-passenger-world-matches-ridden-entity.patch b/patches/server/0679-Ensure-entity-passenger-world-matches-ridden-entity.patch similarity index 91% rename from patches/server/0680-Ensure-entity-passenger-world-matches-ridden-entity.patch rename to patches/server/0679-Ensure-entity-passenger-world-matches-ridden-entity.patch index 60380e62f3..9e576da81a 100644 --- a/patches/server/0680-Ensure-entity-passenger-world-matches-ridden-entity.patch +++ b/patches/server/0679-Ensure-entity-passenger-world-matches-ridden-entity.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Ensure entity passenger world matches ridden entity Bad plugins doing this would cause some obvious problems... diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a390e1791b4fb3eae5555fc9b760588e410be900..612abe47627f0e7c69aa8bfaeee1de4fda528a57 100644 +index 775243c5a2c44300c00f4f674f40d6793f5a797d..4f9071362d556f6f7fd5948dab99e2d260ec60fd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2803,7 +2803,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0681-Cache-resource-keys-and-optimize-reference-Holder-ta.patch b/patches/server/0680-Cache-resource-keys-and-optimize-reference-Holder-ta.patch similarity index 100% rename from patches/server/0681-Cache-resource-keys-and-optimize-reference-Holder-ta.patch rename to patches/server/0680-Cache-resource-keys-and-optimize-reference-Holder-ta.patch diff --git a/patches/server/0682-Allow-changing-the-EnderDragon-podium.patch b/patches/server/0681-Allow-changing-the-EnderDragon-podium.patch similarity index 100% rename from patches/server/0682-Allow-changing-the-EnderDragon-podium.patch rename to patches/server/0681-Allow-changing-the-EnderDragon-podium.patch diff --git a/patches/server/0683-Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch b/patches/server/0682-Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch similarity index 100% rename from patches/server/0683-Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch rename to patches/server/0682-Fix-NBT-pieces-overriding-a-block-entity-during-worl.patch diff --git a/patches/server/0684-Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/0683-Prevent-tile-entity-copies-loading-chunks.patch similarity index 100% rename from patches/server/0684-Prevent-tile-entity-copies-loading-chunks.patch rename to patches/server/0683-Prevent-tile-entity-copies-loading-chunks.patch diff --git a/patches/server/0685-Use-username-instead-of-display-name-in-PlayerList-g.patch b/patches/server/0684-Use-username-instead-of-display-name-in-PlayerList-g.patch similarity index 92% rename from patches/server/0685-Use-username-instead-of-display-name-in-PlayerList-g.patch rename to patches/server/0684-Use-username-instead-of-display-name-in-PlayerList-g.patch index 3cb43bf449..5407679d61 100644 --- a/patches/server/0685-Use-username-instead-of-display-name-in-PlayerList-g.patch +++ b/patches/server/0684-Use-username-instead-of-display-name-in-PlayerList-g.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use username instead of display name in diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 11f86e1b119d20f668e67b83f09137dcb24d4bf1..6409463c9834a660f2a2e2b6bbfac8b3beb80db7 100644 +index c8bb797a322220647d5839cc5d20b3ac7c01b8ba..1456945e8d6e82c59bf09150bfe24bd1ae14a8c3 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1352,7 +1352,7 @@ public abstract class PlayerList { diff --git a/patches/server/0686-Expand-PlayerItemDamageEvent.patch b/patches/server/0685-Expand-PlayerItemDamageEvent.patch similarity index 100% rename from patches/server/0686-Expand-PlayerItemDamageEvent.patch rename to patches/server/0685-Expand-PlayerItemDamageEvent.patch diff --git a/patches/server/0687-WorldCreator-keepSpawnLoaded.patch b/patches/server/0686-WorldCreator-keepSpawnLoaded.patch similarity index 92% rename from patches/server/0687-WorldCreator-keepSpawnLoaded.patch rename to patches/server/0686-WorldCreator-keepSpawnLoaded.patch index 6712b0e0a3..ab38fc7006 100644 --- a/patches/server/0687-WorldCreator-keepSpawnLoaded.patch +++ b/patches/server/0686-WorldCreator-keepSpawnLoaded.patch @@ -5,7 +5,7 @@ Subject: [PATCH] WorldCreator#keepSpawnLoaded diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a504a6458423a997e703e95356dd2058d6c164e2..6ba912570ea66c3b0747beb4c168e351904cc31e 100644 +index 430b35c35c7aa17d590031515063f2d24eeffe5c..4b894223387bf4029bbfa15d9605247935d7f829 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1328,7 +1328,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0688-Fix-CME-in-CraftPersistentDataTypeRegistry.patch b/patches/server/0687-Fix-CME-in-CraftPersistentDataTypeRegistry.patch similarity index 100% rename from patches/server/0688-Fix-CME-in-CraftPersistentDataTypeRegistry.patch rename to patches/server/0687-Fix-CME-in-CraftPersistentDataTypeRegistry.patch diff --git a/patches/server/0689-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch b/patches/server/0688-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch similarity index 100% rename from patches/server/0689-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch rename to patches/server/0688-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch diff --git a/patches/server/0690-Add-EntityDyeEvent-and-CollarColorable-interface.patch b/patches/server/0689-Add-EntityDyeEvent-and-CollarColorable-interface.patch similarity index 100% rename from patches/server/0690-Add-EntityDyeEvent-and-CollarColorable-interface.patch rename to patches/server/0689-Add-EntityDyeEvent-and-CollarColorable-interface.patch diff --git a/patches/server/0691-Fire-CauldronLevelChange-on-initial-fill.patch b/patches/server/0690-Fire-CauldronLevelChange-on-initial-fill.patch similarity index 100% rename from patches/server/0691-Fire-CauldronLevelChange-on-initial-fill.patch rename to patches/server/0690-Fire-CauldronLevelChange-on-initial-fill.patch diff --git a/patches/server/0692-fix-powder-snow-cauldrons-not-turning-to-water.patch b/patches/server/0691-fix-powder-snow-cauldrons-not-turning-to-water.patch similarity index 100% rename from patches/server/0692-fix-powder-snow-cauldrons-not-turning-to-water.patch rename to patches/server/0691-fix-powder-snow-cauldrons-not-turning-to-water.patch diff --git a/patches/server/0693-Add-PlayerStopUsingItemEvent.patch b/patches/server/0692-Add-PlayerStopUsingItemEvent.patch similarity index 91% rename from patches/server/0693-Add-PlayerStopUsingItemEvent.patch rename to patches/server/0692-Add-PlayerStopUsingItemEvent.patch index b6d477aded..4471991148 100644 --- a/patches/server/0693-Add-PlayerStopUsingItemEvent.patch +++ b/patches/server/0692-Add-PlayerStopUsingItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerStopUsingItemEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 36277d10822a4fd19b6159a90a455c237b5b177f..aef73b8ebc6b7784dea32a70e972fa9adb7d303e 100644 +index 03285728ca3df70c487cd67e973812f3968218e2..d86f10107e5f580fe96ff6a3cd186ca16d24f3f9 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4203,6 +4203,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0694-Don-t-tick-markers.patch b/patches/server/0693-Don-t-tick-markers.patch similarity index 93% rename from patches/server/0694-Don-t-tick-markers.patch rename to patches/server/0693-Don-t-tick-markers.patch index 137b6302b6..81c5c7ea5c 100644 --- a/patches/server/0694-Don-t-tick-markers.patch +++ b/patches/server/0693-Don-t-tick-markers.patch @@ -23,10 +23,10 @@ index 9d9d133e0d973ecda1ef1efc872a51ee10463fd1..f671b74e4179fc29bc600b52e456ba9f } }); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2d77e9526917a83987ae0486a669538d5417b781..f4b1b5f1903015b3c4650186466c8183560c9de0 100644 +index 4d53089f3fc6c76b8767efcae44522d710d406a7..3e0563ae33a3ed8379939f92e72e9b9e0ea8ae3a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2219,6 +2219,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2224,6 +2224,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } public void onTickingStart(Entity entity) { diff --git a/patches/server/0695-Expand-FallingBlock-API.patch b/patches/server/0694-Expand-FallingBlock-API.patch similarity index 100% rename from patches/server/0695-Expand-FallingBlock-API.patch rename to patches/server/0694-Expand-FallingBlock-API.patch diff --git a/patches/server/0696-Add-support-for-Proxy-Protocol.patch b/patches/server/0695-Add-support-for-Proxy-Protocol.patch similarity index 97% rename from patches/server/0696-Add-support-for-Proxy-Protocol.patch rename to patches/server/0695-Add-support-for-Proxy-Protocol.patch index 554cb6491b..6387bf34f6 100644 --- a/patches/server/0696-Add-support-for-Proxy-Protocol.patch +++ b/patches/server/0695-Add-support-for-Proxy-Protocol.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add support for Proxy Protocol diff --git a/build.gradle.kts b/build.gradle.kts -index 92c1fe881f3bfedc2d773b1812772f16555a09d3..c2cd0db92d7f73c6b256440aa8f11e7bcc19e5b7 100644 +index d253682a020cc5cb41c9fdae48adf5c85258be62..9b514a9aa1d386481a1ee5077178564cd569117c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -40,6 +40,7 @@ dependencies { +@@ -41,6 +41,7 @@ dependencies { log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.19.0") // Paper - Needed to generate meta for our Log4j plugins runtimeOnly(log4jPlugins.output) alsoShade(log4jPlugins.output) diff --git a/patches/server/0697-Fix-OfflinePlayer-getBedSpawnLocation.patch b/patches/server/0696-Fix-OfflinePlayer-getBedSpawnLocation.patch similarity index 100% rename from patches/server/0697-Fix-OfflinePlayer-getBedSpawnLocation.patch rename to patches/server/0696-Fix-OfflinePlayer-getBedSpawnLocation.patch diff --git a/patches/server/0698-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch b/patches/server/0697-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch similarity index 100% rename from patches/server/0698-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch rename to patches/server/0697-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch diff --git a/patches/server/0699-Sanitize-sent-BlockEntity-NBT.patch b/patches/server/0698-Sanitize-sent-BlockEntity-NBT.patch similarity index 100% rename from patches/server/0699-Sanitize-sent-BlockEntity-NBT.patch rename to patches/server/0698-Sanitize-sent-BlockEntity-NBT.patch diff --git a/patches/server/0700-Disable-component-selector-resolving-in-books-by-def.patch b/patches/server/0699-Disable-component-selector-resolving-in-books-by-def.patch similarity index 100% rename from patches/server/0700-Disable-component-selector-resolving-in-books-by-def.patch rename to patches/server/0699-Disable-component-selector-resolving-in-books-by-def.patch diff --git a/patches/server/0701-Prevent-entity-loading-causing-async-lookups.patch b/patches/server/0700-Prevent-entity-loading-causing-async-lookups.patch similarity index 97% rename from patches/server/0701-Prevent-entity-loading-causing-async-lookups.patch rename to patches/server/0700-Prevent-entity-loading-causing-async-lookups.patch index 077b25253a..a355a7c5d0 100644 --- a/patches/server/0701-Prevent-entity-loading-causing-async-lookups.patch +++ b/patches/server/0700-Prevent-entity-loading-causing-async-lookups.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent entity loading causing async lookups diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 612abe47627f0e7c69aa8bfaeee1de4fda528a57..828535741f9e39693fe9055ae1f5af2258668ae3 100644 +index 4f9071362d556f6f7fd5948dab99e2d260ec60fd..8062809659eab4f3667e297fc085093d4eb64154 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -725,6 +725,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0702-Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/0701-Throw-exception-on-world-create-while-being-ticked.patch similarity index 97% rename from patches/server/0702-Throw-exception-on-world-create-while-being-ticked.patch rename to patches/server/0701-Throw-exception-on-world-create-while-being-ticked.patch index 61105fee38..5e7fab746b 100644 --- a/patches/server/0702-Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/0701-Throw-exception-on-world-create-while-being-ticked.patch @@ -45,7 +45,7 @@ index 57c52a30d284332361f28d6138d3c5f1fc6d52bd..25e2baf2109b27887e4b3631d948907d gameprofilerfiller.popPush("connection"); this.tickConnection(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6ba912570ea66c3b0747beb4c168e351904cc31e..2d16e96c7c329cde6369f1d5b739f60f1776bb4b 100644 +index 4b894223387bf4029bbfa15d9605247935d7f829..557eb1a75a3115c3215315deae56a42d665693df 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -919,6 +919,11 @@ public final class CraftServer implements Server { diff --git a/patches/server/0703-Dont-resent-entity-on-art-update.patch b/patches/server/0702-Dont-resent-entity-on-art-update.patch similarity index 100% rename from patches/server/0703-Dont-resent-entity-on-art-update.patch rename to patches/server/0702-Dont-resent-entity-on-art-update.patch diff --git a/patches/server/0704-Add-WardenAngerChangeEvent.patch b/patches/server/0703-Add-WardenAngerChangeEvent.patch similarity index 100% rename from patches/server/0704-Add-WardenAngerChangeEvent.patch rename to patches/server/0703-Add-WardenAngerChangeEvent.patch diff --git a/patches/server/0705-Add-option-for-strict-advancement-dimension-checks.patch b/patches/server/0704-Add-option-for-strict-advancement-dimension-checks.patch similarity index 96% rename from patches/server/0705-Add-option-for-strict-advancement-dimension-checks.patch rename to patches/server/0704-Add-option-for-strict-advancement-dimension-checks.patch index ca19dca53f..3b8d2aa02f 100644 --- a/patches/server/0705-Add-option-for-strict-advancement-dimension-checks.patch +++ b/patches/server/0704-Add-option-for-strict-advancement-dimension-checks.patch @@ -24,7 +24,7 @@ index 01b8f7024fbc965bc6a7f97f79ba3dec964ef769..801823d003a8e28a13fe90db4604cd09 } else { BlockPos blockPos = BlockPos.containing(x, y, z); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d723adaa7b1df4a1d5067298536b303992ac2c52..312225a15261f2e80fbf6133c75c567574ade181 100644 +index cf674caab9e67a27f90ead557634949710c19ca3..c98e07e1a507d5ffd3b16fa4bf3cdcc3b704e67d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1655,6 +1655,12 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0706-Add-missing-important-BlockStateListPopulator-method.patch b/patches/server/0705-Add-missing-important-BlockStateListPopulator-method.patch similarity index 100% rename from patches/server/0706-Add-missing-important-BlockStateListPopulator-method.patch rename to patches/server/0705-Add-missing-important-BlockStateListPopulator-method.patch diff --git a/patches/server/0707-Nameable-Banner-API.patch b/patches/server/0706-Nameable-Banner-API.patch similarity index 100% rename from patches/server/0707-Nameable-Banner-API.patch rename to patches/server/0706-Nameable-Banner-API.patch diff --git a/patches/server/0708-Don-t-broadcast-messages-to-command-blocks.patch b/patches/server/0707-Don-t-broadcast-messages-to-command-blocks.patch similarity index 95% rename from patches/server/0708-Don-t-broadcast-messages-to-command-blocks.patch rename to patches/server/0707-Don-t-broadcast-messages-to-command-blocks.patch index 428c5de1aa..e27e3d40a7 100644 --- a/patches/server/0708-Don-t-broadcast-messages-to-command-blocks.patch +++ b/patches/server/0707-Don-t-broadcast-messages-to-command-blocks.patch @@ -20,7 +20,7 @@ index a0e59b236dff1f861a0e987764a77ee203504412..5cb39f95bd2d45b6c18554605f01d2eb Date date = new Date(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2d16e96c7c329cde6369f1d5b739f60f1776bb4b..3deb58f3cd2e29b51944ac81cb3e0e52ec496242 100644 +index 557eb1a75a3115c3215315deae56a42d665693df..e890f87c66e95e7d4f130c4c659c6662b4f4bd94 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1928,7 +1928,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0709-Prevent-empty-items-from-being-added-to-world.patch b/patches/server/0708-Prevent-empty-items-from-being-added-to-world.patch similarity index 89% rename from patches/server/0709-Prevent-empty-items-from-being-added-to-world.patch rename to patches/server/0708-Prevent-empty-items-from-being-added-to-world.patch index 4b6241c770..4f718f2374 100644 --- a/patches/server/0709-Prevent-empty-items-from-being-added-to-world.patch +++ b/patches/server/0708-Prevent-empty-items-from-being-added-to-world.patch @@ -7,10 +7,10 @@ The previous solution caused a bunch of bandaid fixes inorder to resolve edge ca Just simply prevent them from being added to the world instead. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index f4b1b5f1903015b3c4650186466c8183560c9de0..f3f93e8cbc2a5c9d0a3841ec7de010477bfd976a 100644 +index 3e0563ae33a3ed8379939f92e72e9b9e0ea8ae3a..d090b46a6c6d7e99ec07623adc3fc77a9918b1da 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1200,6 +1200,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1205,6 +1205,7 @@ 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 { diff --git a/patches/server/0710-Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch b/patches/server/0709-Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch similarity index 100% rename from patches/server/0710-Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch rename to patches/server/0709-Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch diff --git a/patches/server/0711-Add-Player-getFishHook.patch b/patches/server/0710-Add-Player-getFishHook.patch similarity index 100% rename from patches/server/0711-Add-Player-getFishHook.patch rename to patches/server/0710-Add-Player-getFishHook.patch diff --git a/patches/server/0712-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch b/patches/server/0711-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch similarity index 100% rename from patches/server/0712-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch rename to patches/server/0711-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch diff --git a/patches/server/0713-Add-various-missing-EntityDropItemEvent-calls.patch b/patches/server/0712-Add-various-missing-EntityDropItemEvent-calls.patch similarity index 98% rename from patches/server/0713-Add-various-missing-EntityDropItemEvent-calls.patch rename to patches/server/0712-Add-various-missing-EntityDropItemEvent-calls.patch index 965a338282..3175db1ada 100644 --- a/patches/server/0713-Add-various-missing-EntityDropItemEvent-calls.patch +++ b/patches/server/0712-Add-various-missing-EntityDropItemEvent-calls.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add various missing EntityDropItemEvent calls diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 828535741f9e39693fe9055ae1f5af2258668ae3..7d4817cf9d2783f7be5882748323391a8cae5673 100644 +index 8062809659eab4f3667e297fc085093d4eb64154..1f40097a3cc2290516edc519313d139ea4ccd3cd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2673,6 +2673,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0714-Fix-Bee-flower-NPE.patch b/patches/server/0713-Fix-Bee-flower-NPE.patch similarity index 100% rename from patches/server/0714-Fix-Bee-flower-NPE.patch rename to patches/server/0713-Fix-Bee-flower-NPE.patch diff --git a/patches/server/0715-More-Teleport-API.patch b/patches/server/0714-More-Teleport-API.patch similarity index 99% rename from patches/server/0715-More-Teleport-API.patch rename to patches/server/0714-More-Teleport-API.patch index 59ddaae25c..a8459c765a 100644 --- a/patches/server/0715-More-Teleport-API.patch +++ b/patches/server/0714-More-Teleport-API.patch @@ -113,7 +113,7 @@ index 10fb64df10820974d11f142c102a11a5bd0f317c..8d2f6bb43fb69a4a1e2085960eb24f43 private final org.bukkit.entity.Entity.Spigot spigot = new org.bukkit.entity.Entity.Spigot() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ef10695d2c1c3041e5f84bdb6001c08004af9d6b..c87aed470ce2964815cb39f804e95f6c03553aba 100644 +index 728a65ad7a826596530b12594db15c93f1af68fb..87aa5f0d594ff697b87bc06019351d22b6c8c8e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1291,13 +1291,94 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0716-Add-EntityPortalReadyEvent.patch b/patches/server/0715-Add-EntityPortalReadyEvent.patch similarity index 100% rename from patches/server/0716-Add-EntityPortalReadyEvent.patch rename to patches/server/0715-Add-EntityPortalReadyEvent.patch diff --git a/patches/server/0717-Don-t-use-level-random-in-entity-constructors.patch b/patches/server/0716-Don-t-use-level-random-in-entity-constructors.patch similarity index 100% rename from patches/server/0717-Don-t-use-level-random-in-entity-constructors.patch rename to patches/server/0716-Don-t-use-level-random-in-entity-constructors.patch diff --git a/patches/server/0718-Send-block-entities-after-destroy-prediction.patch b/patches/server/0717-Send-block-entities-after-destroy-prediction.patch similarity index 100% rename from patches/server/0718-Send-block-entities-after-destroy-prediction.patch rename to patches/server/0717-Send-block-entities-after-destroy-prediction.patch diff --git a/patches/server/0719-Warn-on-plugins-accessing-faraway-chunks.patch b/patches/server/0718-Warn-on-plugins-accessing-faraway-chunks.patch similarity index 71% rename from patches/server/0719-Warn-on-plugins-accessing-faraway-chunks.patch rename to patches/server/0718-Warn-on-plugins-accessing-faraway-chunks.patch index 4a9129bd6b..504e0b4859 100644 --- a/patches/server/0719-Warn-on-plugins-accessing-faraway-chunks.patch +++ b/patches/server/0718-Warn-on-plugins-accessing-faraway-chunks.patch @@ -18,7 +18,7 @@ index 9afc0eaaca5ab7b6445d90ce53e31a6ae76f8848..f0c2187a92de633a1d4cc7e71ff62cbe private static boolean isOutsideSpawnableHeight(int y) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f67fee006578719262e2e32b38e023acff63fd7d..df0f83941215a098014936f22e1ba353b69204a7 100644 +index 9b7304ea9a4f226872d13e64722adb267f727806..431bd698e28b7731bf781e29de6c6a3fd936c71c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -301,9 +301,24 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -43,10 +43,10 @@ index f67fee006578719262e2e32b38e023acff63fd7d..df0f83941215a098014936f22e1ba353 @Override public Chunk getChunkAt(int x, int z) { + warnUnsafeChunk("getting a faraway chunk", x, z); // Paper - // 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) { -@@ -411,6 +426,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) this.world.getChunk(x, z, ChunkStatus.FULL, true); + return new CraftChunk(chunk); + } +@@ -399,6 +414,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { if (!unloadChunk0(x, z, false)) { return false; } @@ -54,7 +54,7 @@ index f67fee006578719262e2e32b38e023acff63fd7d..df0f83941215a098014936f22e1ba353 final long chunkKey = ChunkCoordIntPair.pair(x, z); world.getChunkProvider().unloadQueue.remove(chunkKey); -@@ -484,6 +500,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -472,6 +488,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot @@ -62,7 +62,7 @@ index f67fee006578719262e2e32b38e023acff63fd7d..df0f83941215a098014936f22e1ba353 ChunkAccess chunk = this.world.getChunkSource().getChunk(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); // Paper // If generate = false, but the chunk already exists, we will get this back. -@@ -516,6 +533,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -504,6 +521,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean addPluginChunkTicket(int x, int z, Plugin plugin) { @@ -70,7 +70,7 @@ index f67fee006578719262e2e32b38e023acff63fd7d..df0f83941215a098014936f22e1ba353 Preconditions.checkArgument(plugin != null, "null plugin"); Preconditions.checkArgument(plugin.isEnabled(), "plugin is not enabled"); -@@ -616,6 +634,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -604,6 +622,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void setChunkForceLoaded(int x, int z, boolean forced) { @@ -78,7 +78,7 @@ index f67fee006578719262e2e32b38e023acff63fd7d..df0f83941215a098014936f22e1ba353 this.getHandle().setChunkForced(x, z, forced); } -@@ -950,6 +969,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -938,6 +957,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) { @@ -86,11 +86,20 @@ index f67fee006578719262e2e32b38e023acff63fd7d..df0f83941215a098014936f22e1ba353 // Transient load for this tick return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z); } -@@ -2350,6 +2370,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { - // Spigot end +@@ -2339,6 +2359,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { // Paper start - public java.util.concurrent.CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent) { + @Override + public void getChunkAtAsync(int x, int z, boolean gen, boolean urgent, @NotNull Consumer cb) { + warnUnsafeChunk("getting a faraway chunk async", x, z); // Paper - if (Bukkit.isPrimaryThread()) { - net.minecraft.world.level.chunk.LevelChunk immediate = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z); - if (immediate != null) { + 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, +@@ -2351,6 +2372,8 @@ public class CraftWorld extends CraftRegionAccessor implements World { + + @Override + public void getChunksAtAsync(int minX, int minZ, int maxX, int maxZ, boolean urgent, Runnable cb) { ++ warnUnsafeChunk("getting a faraway chunk async", minX, minZ); // Paper ++ warnUnsafeChunk("getting a faraway chunk async", maxX, maxZ); // Paper + this.getHandle().loadChunks( + minX, minZ, maxX, maxZ, + urgent ? ca.spottedleaf.concurrentutil.util.Priority.HIGHER : ca.spottedleaf.concurrentutil.util.Priority.NORMAL, diff --git a/patches/server/0720-Custom-Chat-Completion-Suggestions-API.patch b/patches/server/0719-Custom-Chat-Completion-Suggestions-API.patch similarity index 94% rename from patches/server/0720-Custom-Chat-Completion-Suggestions-API.patch rename to patches/server/0719-Custom-Chat-Completion-Suggestions-API.patch index 87e2228947..11a0ecf025 100644 --- a/patches/server/0720-Custom-Chat-Completion-Suggestions-API.patch +++ b/patches/server/0719-Custom-Chat-Completion-Suggestions-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Custom Chat Completion Suggestions API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c87aed470ce2964815cb39f804e95f6c03553aba..ddf28d7fbecc70f4cba5f71d7d1d5908b4ad3c3a 100644 +index 87aa5f0d594ff697b87bc06019351d22b6c8c8e5..51b6b8d54b139bc89e0343c7c1ec5acedcf6f8a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -696,6 +696,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0721-Add-and-fix-missing-BlockFadeEvents.patch b/patches/server/0720-Add-and-fix-missing-BlockFadeEvents.patch similarity index 100% rename from patches/server/0721-Add-and-fix-missing-BlockFadeEvents.patch rename to patches/server/0720-Add-and-fix-missing-BlockFadeEvents.patch diff --git a/patches/server/0722-Collision-API.patch b/patches/server/0721-Collision-API.patch similarity index 100% rename from patches/server/0722-Collision-API.patch rename to patches/server/0721-Collision-API.patch diff --git a/patches/server/0723-Fix-suggest-command-message-for-brigadier-syntax-exc.patch b/patches/server/0722-Fix-suggest-command-message-for-brigadier-syntax-exc.patch similarity index 100% rename from patches/server/0723-Fix-suggest-command-message-for-brigadier-syntax-exc.patch rename to patches/server/0722-Fix-suggest-command-message-for-brigadier-syntax-exc.patch diff --git a/patches/server/0724-Block-Ticking-API.patch b/patches/server/0723-Block-Ticking-API.patch similarity index 100% rename from patches/server/0724-Block-Ticking-API.patch rename to patches/server/0723-Block-Ticking-API.patch diff --git a/patches/server/0725-Add-Velocity-IP-Forwarding-Support.patch b/patches/server/0724-Add-Velocity-IP-Forwarding-Support.patch similarity index 99% rename from patches/server/0725-Add-Velocity-IP-Forwarding-Support.patch rename to patches/server/0724-Add-Velocity-IP-Forwarding-Support.patch index d5eb9544e5..a276b2c88d 100644 --- a/patches/server/0725-Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/0724-Add-Velocity-IP-Forwarding-Support.patch @@ -228,7 +228,7 @@ index cb5dd77892283a1aaec45434fb99bb7f08ee5394..4a89b73d972f366e70f4d2bd96c6ee41 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3deb58f3cd2e29b51944ac81cb3e0e52ec496242..b84dc11212aba4c06375cdbefa91c09d86a2b957 100644 +index e890f87c66e95e7d4f130c4c659c6662b4f4bd94..927846bf3281771de0274216abe927e524df3493 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -848,7 +848,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0726-Add-NamespacedKey-biome-methods.patch b/patches/server/0725-Add-NamespacedKey-biome-methods.patch similarity index 100% rename from patches/server/0726-Add-NamespacedKey-biome-methods.patch rename to patches/server/0725-Add-NamespacedKey-biome-methods.patch diff --git a/patches/server/0727-Fix-plugin-loggers-on-server-shutdown.patch b/patches/server/0726-Fix-plugin-loggers-on-server-shutdown.patch similarity index 96% rename from patches/server/0727-Fix-plugin-loggers-on-server-shutdown.patch rename to patches/server/0726-Fix-plugin-loggers-on-server-shutdown.patch index 7f6f83f992..1b6830b082 100644 --- a/patches/server/0727-Fix-plugin-loggers-on-server-shutdown.patch +++ b/patches/server/0726-Fix-plugin-loggers-on-server-shutdown.patch @@ -49,7 +49,7 @@ index 25e2baf2109b27887e4b3631d948907d9d8d65a2..3fc8e626bc66f3cf32d165099ed7a6e4 } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 124aeebbbae7dc8cea1260bf3134a339c2e152ed..a7524d3853d5b67b6385d2b74832b9267503dfe6 100644 +index 29838b7c28409776e124641878def8d6d87630f5..be0d38544395a9b3befb898bb961f34e32fe9509 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -19,6 +19,12 @@ public class Main { diff --git a/patches/server/0728-Stop-large-look-changes-from-crashing-the-server.patch b/patches/server/0727-Stop-large-look-changes-from-crashing-the-server.patch similarity index 96% rename from patches/server/0728-Stop-large-look-changes-from-crashing-the-server.patch rename to patches/server/0727-Stop-large-look-changes-from-crashing-the-server.patch index cbf9f9f9f8..add808bade 100644 --- a/patches/server/0728-Stop-large-look-changes-from-crashing-the-server.patch +++ b/patches/server/0727-Stop-large-look-changes-from-crashing-the-server.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Stop large look changes from crashing the server Co-authored-by: Jaren Knodel diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index aef73b8ebc6b7784dea32a70e972fa9adb7d303e..5986af338ffadbfae32783178dfe0b145c875b73 100644 +index d86f10107e5f580fe96ff6a3cd186ca16d24f3f9..18c56cef30fca0174703e775b3bbbf6df4272585 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3271,37 +3271,15 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0729-Fire-EntityChangeBlockEvent-in-more-places.patch b/patches/server/0728-Fire-EntityChangeBlockEvent-in-more-places.patch similarity index 100% rename from patches/server/0729-Fire-EntityChangeBlockEvent-in-more-places.patch rename to patches/server/0728-Fire-EntityChangeBlockEvent-in-more-places.patch diff --git a/patches/server/0730-Missing-eating-regain-reason.patch b/patches/server/0729-Missing-eating-regain-reason.patch similarity index 100% rename from patches/server/0730-Missing-eating-regain-reason.patch rename to patches/server/0729-Missing-eating-regain-reason.patch diff --git a/patches/server/0731-Missing-effect-cause.patch b/patches/server/0730-Missing-effect-cause.patch similarity index 100% rename from patches/server/0731-Missing-effect-cause.patch rename to patches/server/0730-Missing-effect-cause.patch diff --git a/patches/server/0732-Added-byte-array-serialization-deserialization-for-P.patch b/patches/server/0731-Added-byte-array-serialization-deserialization-for-P.patch similarity index 100% rename from patches/server/0732-Added-byte-array-serialization-deserialization-for-P.patch rename to patches/server/0731-Added-byte-array-serialization-deserialization-for-P.patch diff --git a/patches/server/0733-Call-BlockPhysicsEvent-more-often.patch b/patches/server/0732-Call-BlockPhysicsEvent-more-often.patch similarity index 100% rename from patches/server/0733-Call-BlockPhysicsEvent-more-often.patch rename to patches/server/0732-Call-BlockPhysicsEvent-more-often.patch diff --git a/patches/server/0734-Configurable-chat-thread-limit.patch b/patches/server/0733-Configurable-chat-thread-limit.patch similarity index 100% rename from patches/server/0734-Configurable-chat-thread-limit.patch rename to patches/server/0733-Configurable-chat-thread-limit.patch diff --git a/patches/server/0735-Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch b/patches/server/0734-Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch similarity index 100% rename from patches/server/0735-Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch rename to patches/server/0734-Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch diff --git a/patches/server/0736-fix-Jigsaw-block-kicking-user.patch b/patches/server/0735-fix-Jigsaw-block-kicking-user.patch similarity index 100% rename from patches/server/0736-fix-Jigsaw-block-kicking-user.patch rename to patches/server/0735-fix-Jigsaw-block-kicking-user.patch diff --git a/patches/server/0737-use-BlockFormEvent-for-mud-converting-into-clay.patch b/patches/server/0736-use-BlockFormEvent-for-mud-converting-into-clay.patch similarity index 100% rename from patches/server/0737-use-BlockFormEvent-for-mud-converting-into-clay.patch rename to patches/server/0736-use-BlockFormEvent-for-mud-converting-into-clay.patch diff --git a/patches/server/0738-Add-getDrops-to-BlockState.patch b/patches/server/0737-Add-getDrops-to-BlockState.patch similarity index 100% rename from patches/server/0738-Add-getDrops-to-BlockState.patch rename to patches/server/0737-Add-getDrops-to-BlockState.patch diff --git a/patches/server/0739-Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/0738-Fix-a-bunch-of-vanilla-bugs.patch similarity index 98% rename from patches/server/0739-Fix-a-bunch-of-vanilla-bugs.patch rename to patches/server/0738-Fix-a-bunch-of-vanilla-bugs.patch index 14341b31e4..c8defc9dce 100644 --- a/patches/server/0739-Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/0738-Fix-a-bunch-of-vanilla-bugs.patch @@ -89,10 +89,10 @@ index 6854ca4d4fec2b4fa541c3fabf63787665572609..e7b444a10b244828827b3c66c5346520 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index f3f93e8cbc2a5c9d0a3841ec7de010477bfd976a..d01f42aad003c7b0ea5700d32109eed4a264fa4c 100644 +index d090b46a6c6d7e99ec07623adc3fc77a9918b1da..88e3408244f57e9138d7ca7f9b2b90d4f8b66f7e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -748,7 +748,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -753,7 +753,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } else { AABB axisalignedbb = AABB.encapsulatingFullBlocks(blockposition1, blockposition1.atY(this.getMaxY() + 1)).inflate(3.0D); List list = this.getEntitiesOfClass(LivingEntity.class, axisalignedbb, (entityliving) -> { @@ -128,7 +128,7 @@ index 51ee01dfe5e144cb881c9376e586b95790a9ab98..f5e05a34afee8f5750b3a7871083968c MutableComponent ichatmutablecomponent1 = Component.translatable("build.tooHigh", i).withStyle(ChatFormatting.RED); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 6409463c9834a660f2a2e2b6bbfac8b3beb80db7..9b01ef9e9b00274f1213c006a4cad0f75e412e13 100644 +index 1456945e8d6e82c59bf09150bfe24bd1ae14a8c3..4b8636c2107e6a16c26f259e0dbdbc40a1268e06 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -260,7 +260,7 @@ public abstract class PlayerList { diff --git a/patches/server/0740-Remove-unnecessary-onTrackingStart-during-navigation.patch b/patches/server/0739-Remove-unnecessary-onTrackingStart-during-navigation.patch similarity index 88% rename from patches/server/0740-Remove-unnecessary-onTrackingStart-during-navigation.patch rename to patches/server/0739-Remove-unnecessary-onTrackingStart-during-navigation.patch index ad0baf535f..1997aae5c2 100644 --- a/patches/server/0740-Remove-unnecessary-onTrackingStart-during-navigation.patch +++ b/patches/server/0739-Remove-unnecessary-onTrackingStart-during-navigation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary onTrackingStart during navigation warning diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index d01f42aad003c7b0ea5700d32109eed4a264fa4c..45e61a08152517a61260e662764d8bb0335537e3 100644 +index 88e3408244f57e9138d7ca7f9b2b90d4f8b66f7e..6db3418d839c0f4cd75ad822e605dc2105c3df53 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2237,7 +2237,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2242,7 +2242,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } if (entity instanceof Mob entityinsentient) { @@ -17,7 +17,7 @@ index d01f42aad003c7b0ea5700d32109eed4a264fa4c..45e61a08152517a61260e662764d8bb0 String s = "onTrackingStart called during navigation iteration"; Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")); -@@ -2317,7 +2317,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2322,7 +2322,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } if (entity instanceof Mob entityinsentient) { diff --git a/patches/server/0741-Fix-custom-piglin-loved-items.patch b/patches/server/0740-Fix-custom-piglin-loved-items.patch similarity index 100% rename from patches/server/0741-Fix-custom-piglin-loved-items.patch rename to patches/server/0740-Fix-custom-piglin-loved-items.patch diff --git a/patches/server/0742-EntityPickupItemEvent-fixes.patch b/patches/server/0741-EntityPickupItemEvent-fixes.patch similarity index 100% rename from patches/server/0742-EntityPickupItemEvent-fixes.patch rename to patches/server/0741-EntityPickupItemEvent-fixes.patch diff --git a/patches/server/0743-Correctly-handle-interactions-with-items-on-cooldown.patch b/patches/server/0742-Correctly-handle-interactions-with-items-on-cooldown.patch similarity index 97% rename from patches/server/0743-Correctly-handle-interactions-with-items-on-cooldown.patch rename to patches/server/0742-Correctly-handle-interactions-with-items-on-cooldown.patch index a86affadb8..d902a451c9 100644 --- a/patches/server/0743-Correctly-handle-interactions-with-items-on-cooldown.patch +++ b/patches/server/0742-Correctly-handle-interactions-with-items-on-cooldown.patch @@ -30,7 +30,7 @@ index a706f0855fdf88cc9aece3ba00ef574b9cd8bd11..2aee9c2fbe38076317a3de7c3fdbd698 this.interactResult = event.useItemInHand() == Event.Result.DENY; this.interactPosition = blockposition.immutable(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index f54a4c263eeb4df40c72c20c3c480ce74718a718..ea0241de1a7ef64059cddcb43c41f56b91901897 100644 +index fcc9fe8f5f57e9f6c28d762aa6585942e2b2698b..48d39015da2c91a27367d44e72b7dacddb41d6d6 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -555,6 +555,12 @@ public class CraftEventFactory { diff --git a/patches/server/0744-Add-PlayerInventorySlotChangeEvent.patch b/patches/server/0743-Add-PlayerInventorySlotChangeEvent.patch similarity index 97% rename from patches/server/0744-Add-PlayerInventorySlotChangeEvent.patch rename to patches/server/0743-Add-PlayerInventorySlotChangeEvent.patch index cca34b90d0..ba048c97a2 100644 --- a/patches/server/0744-Add-PlayerInventorySlotChangeEvent.patch +++ b/patches/server/0743-Add-PlayerInventorySlotChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerInventorySlotChangeEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 312225a15261f2e80fbf6133c75c567574ade181..04e3c75c9abfaccb6d2d59d234e5169258b77553 100644 +index c98e07e1a507d5ffd3b16fa4bf3cdcc3b704e67d..0929f399f0525d8cc886dc32392aa2d3096431b5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -381,6 +381,25 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0745-Elder-Guardian-appearance-API.patch b/patches/server/0744-Elder-Guardian-appearance-API.patch similarity index 90% rename from patches/server/0745-Elder-Guardian-appearance-API.patch rename to patches/server/0744-Elder-Guardian-appearance-API.patch index 2e672a8d57..64bfcb26e8 100644 --- a/patches/server/0745-Elder-Guardian-appearance-API.patch +++ b/patches/server/0744-Elder-Guardian-appearance-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Elder Guardian appearance API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ddf28d7fbecc70f4cba5f71d7d1d5908b4ad3c3a..9ebaa374c0a8ceff328f0686fe09b562f5e57008 100644 +index 51b6b8d54b139bc89e0343c7c1ec5acedcf6f8a2..1fb27bf5da9bb281d1ff6e863912dfac2588611f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -3308,6 +3308,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0746-Add-entity-knockback-API.patch b/patches/server/0745-Add-entity-knockback-API.patch similarity index 100% rename from patches/server/0746-Add-entity-knockback-API.patch rename to patches/server/0745-Add-entity-knockback-API.patch diff --git a/patches/server/0747-Detect-headless-JREs.patch b/patches/server/0746-Detect-headless-JREs.patch similarity index 100% rename from patches/server/0747-Detect-headless-JREs.patch rename to patches/server/0746-Detect-headless-JREs.patch diff --git a/patches/server/0748-fix-entity-vehicle-collision-event-not-called.patch b/patches/server/0747-fix-entity-vehicle-collision-event-not-called.patch similarity index 93% rename from patches/server/0748-fix-entity-vehicle-collision-event-not-called.patch rename to patches/server/0747-fix-entity-vehicle-collision-event-not-called.patch index 9b38b32086..5511a3cdd1 100644 --- a/patches/server/0748-fix-entity-vehicle-collision-event-not-called.patch +++ b/patches/server/0747-fix-entity-vehicle-collision-event-not-called.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix entity vehicle collision event not called diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -index ee7350e19a86ffa115e4bce6b186a2422951e89b..d8fcd6d1edec1f31a861fab4b86cbeb15ddc799d 100644 +index 7e7a78ebbf128f7d29cf9eb349f25230c9c7d5d0..f88c1becd08e7b10f228624160b85f89a379fbeb 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java @@ -157,7 +157,15 @@ public abstract class AbstractMinecart extends VehicleEntity { diff --git a/patches/server/0749-Add-EntityToggleSitEvent.patch b/patches/server/0748-Add-EntityToggleSitEvent.patch similarity index 100% rename from patches/server/0749-Add-EntityToggleSitEvent.patch rename to patches/server/0748-Add-EntityToggleSitEvent.patch diff --git a/patches/server/0750-Add-fire-tick-delay-option.patch b/patches/server/0749-Add-fire-tick-delay-option.patch similarity index 100% rename from patches/server/0750-Add-fire-tick-delay-option.patch rename to patches/server/0749-Add-fire-tick-delay-option.patch diff --git a/patches/server/0751-Add-Moving-Piston-API.patch b/patches/server/0750-Add-Moving-Piston-API.patch similarity index 100% rename from patches/server/0751-Add-Moving-Piston-API.patch rename to patches/server/0750-Add-Moving-Piston-API.patch diff --git a/patches/server/0752-Ignore-impossible-spawn-tick.patch b/patches/server/0751-Ignore-impossible-spawn-tick.patch similarity index 100% rename from patches/server/0752-Ignore-impossible-spawn-tick.patch rename to patches/server/0751-Ignore-impossible-spawn-tick.patch diff --git a/patches/server/0753-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch b/patches/server/0752-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch similarity index 100% rename from patches/server/0753-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch rename to patches/server/0752-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch diff --git a/patches/server/0754-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch b/patches/server/0753-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch similarity index 95% rename from patches/server/0754-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch rename to patches/server/0753-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch index 4ff7d42404..c12c95ac99 100644 --- a/patches/server/0754-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch +++ b/patches/server/0753-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix EntityCombustEvent cancellation cant fully prevent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7d4817cf9d2783f7be5882748323391a8cae5673..9b5af1041410be058afde31d2630d8dcb3b25179 100644 +index 1f40097a3cc2290516edc519313d139ea4ccd3cd..44d2c476981bc2c24f89009dcf628ece28fc8e32 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3321,6 +3321,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0755-Add-PrePlayerAttackEntityEvent.patch b/patches/server/0754-Add-PrePlayerAttackEntityEvent.patch similarity index 100% rename from patches/server/0755-Add-PrePlayerAttackEntityEvent.patch rename to patches/server/0754-Add-PrePlayerAttackEntityEvent.patch diff --git a/patches/server/0756-ensure-reset-EnderDragon-boss-event-name.patch b/patches/server/0755-ensure-reset-EnderDragon-boss-event-name.patch similarity index 100% rename from patches/server/0756-ensure-reset-EnderDragon-boss-event-name.patch rename to patches/server/0755-ensure-reset-EnderDragon-boss-event-name.patch diff --git a/patches/server/0757-Add-Player-Warden-Warning-API.patch b/patches/server/0756-Add-Player-Warden-Warning-API.patch similarity index 95% rename from patches/server/0757-Add-Player-Warden-Warning-API.patch rename to patches/server/0756-Add-Player-Warden-Warning-API.patch index 101d6fe52b..ee15f1630c 100644 --- a/patches/server/0757-Add-Player-Warden-Warning-API.patch +++ b/patches/server/0756-Add-Player-Warden-Warning-API.patch @@ -10,7 +10,7 @@ public net.minecraft.world.entity.monster.warden.WardenSpawnTracker cooldownTick public net.minecraft.world.entity.monster.warden.WardenSpawnTracker increaseWarningLevel()V diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9ebaa374c0a8ceff328f0686fe09b562f5e57008..b4de1600c9e5f5bf00cd4699993bd4a29a37e6cf 100644 +index 1fb27bf5da9bb281d1ff6e863912dfac2588611f..95f0e7e1248ded53ec5de684ec0cfb6343598f51 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -3313,6 +3313,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0758-More-vanilla-friendly-methods-to-update-trades.patch b/patches/server/0757-More-vanilla-friendly-methods-to-update-trades.patch similarity index 100% rename from patches/server/0758-More-vanilla-friendly-methods-to-update-trades.patch rename to patches/server/0757-More-vanilla-friendly-methods-to-update-trades.patch diff --git a/patches/server/0759-Add-paper-dumplisteners-command.patch b/patches/server/0758-Add-paper-dumplisteners-command.patch similarity index 100% rename from patches/server/0759-Add-paper-dumplisteners-command.patch rename to patches/server/0758-Add-paper-dumplisteners-command.patch diff --git a/patches/server/0760-check-global-player-list-where-appropriate.patch b/patches/server/0759-check-global-player-list-where-appropriate.patch similarity index 94% rename from patches/server/0760-check-global-player-list-where-appropriate.patch rename to patches/server/0759-check-global-player-list-where-appropriate.patch index a4e7a411b2..c8b1741440 100644 --- a/patches/server/0760-check-global-player-list-where-appropriate.patch +++ b/patches/server/0759-check-global-player-list-where-appropriate.patch @@ -7,10 +7,10 @@ Makes certain entities check all players when searching for a player instead of just checking players in their world. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 45e61a08152517a61260e662764d8bb0335537e3..b81d814619e4175f42aee397811b07cae420c2e8 100644 +index 6db3418d839c0f4cd75ad822e605dc2105c3df53..77c1ddc6fd14e0b033825909e5c814abd2306f8d 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2353,4 +2353,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2358,4 +2358,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity.updateDynamicGameEventListener(DynamicGameEventListener::move); } } @@ -24,7 +24,7 @@ index 45e61a08152517a61260e662764d8bb0335537e3..b81d814619e4175f42aee397811b07ca + // Paper end - check global player list where appropriate } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5986af338ffadbfae32783178dfe0b145c875b73..d121b28c8a79b6f5b690c53ae4fef7cd304afdaa 100644 +index 18c56cef30fca0174703e775b3bbbf6df4272585..d239108bd98fe885eba50a17855f2d62de02c70e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3866,7 +3866,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0761-Fix-async-entity-add-due-to-fungus-trees.patch b/patches/server/0760-Fix-async-entity-add-due-to-fungus-trees.patch similarity index 100% rename from patches/server/0761-Fix-async-entity-add-due-to-fungus-trees.patch rename to patches/server/0760-Fix-async-entity-add-due-to-fungus-trees.patch diff --git a/patches/server/0762-ItemStack-damage-API.patch b/patches/server/0761-ItemStack-damage-API.patch similarity index 100% rename from patches/server/0762-ItemStack-damage-API.patch rename to patches/server/0761-ItemStack-damage-API.patch diff --git a/patches/server/0763-Friction-API.patch b/patches/server/0762-Friction-API.patch similarity index 99% rename from patches/server/0763-Friction-API.patch rename to patches/server/0762-Friction-API.patch index e31a2d2226..d0219e68b9 100644 --- a/patches/server/0763-Friction-API.patch +++ b/patches/server/0762-Friction-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Friction API diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d121b28c8a79b6f5b690c53ae4fef7cd304afdaa..29c3db84b55e82e25d60c99c87f3472b30fc9239 100644 +index d239108bd98fe885eba50a17855f2d62de02c70e..cd2d6b55b494830797014dbc3cc1f0fbf6518249 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -296,6 +296,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0764-Ability-to-control-player-s-insomnia-and-phantoms.patch b/patches/server/0763-Ability-to-control-player-s-insomnia-and-phantoms.patch similarity index 100% rename from patches/server/0764-Ability-to-control-player-s-insomnia-and-phantoms.patch rename to patches/server/0763-Ability-to-control-player-s-insomnia-and-phantoms.patch diff --git a/patches/server/0765-Fix-premature-player-kicks-on-shutdown.patch b/patches/server/0764-Fix-premature-player-kicks-on-shutdown.patch similarity index 97% rename from patches/server/0765-Fix-premature-player-kicks-on-shutdown.patch rename to patches/server/0764-Fix-premature-player-kicks-on-shutdown.patch index 5a0d9d65c0..640595a34d 100644 --- a/patches/server/0765-Fix-premature-player-kicks-on-shutdown.patch +++ b/patches/server/0764-Fix-premature-player-kicks-on-shutdown.patch @@ -47,7 +47,7 @@ index 4d9f1fc884050993287adfa4578a87da710623fb..a8dfe7a4b3d01bf75587be078f471d1e this.disconnect((Component) Component.translatable("multiplayer.disconnect.server_shutdown")); } catch (ClassCastException classcastexception) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index cb40a2d855e7ac8c1c8b4ec679fd057a31f3fc6f..8f7a808b0c89953a7f2932e68e2c85f9330469f2 100644 +index 3fc8e626bc66f3cf32d165099ed7a6e4300e8146..741b5ba321d9bd854afb9b54f0e23c739c7f929c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2127,7 +2127,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 2.0F) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f059a2e5fbcdceb1a1e8601c7d1e3a3e438c599e..dbc642fd7c953ee8d1756cae079f410c03bb1cbd 100644 +index 02850d3ef48aecda5d9b543e23d43c9b19ff3a89..68296e776cda9983d2b3f1fdabe7fcaa2e631e86 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2591,6 +2591,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0779-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch b/patches/server/0778-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch similarity index 94% rename from patches/server/0779-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch rename to patches/server/0778-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch index 18b9184eff..e26237618f 100644 --- a/patches/server/0779-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch +++ b/patches/server/0778-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expose pre-collision moving velocity to diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4d9680748a00df783e9611a90c31e2665ce3d736..798fd11e76326ace74035cf782be9f4218fe5edc 100644 +index 4135eeab128fc989d9357dee59c779d2812106e8..61bd5290d0056656ab761ecf38cf8c8bbb80ab94 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -969,6 +969,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0780-config-for-disabling-entity-tag-tags.patch b/patches/server/0779-config-for-disabling-entity-tag-tags.patch similarity index 100% rename from patches/server/0780-config-for-disabling-entity-tag-tags.patch rename to patches/server/0779-config-for-disabling-entity-tag-tags.patch diff --git a/patches/server/0781-Use-single-player-info-update-packet-on-join.patch b/patches/server/0780-Use-single-player-info-update-packet-on-join.patch similarity index 97% rename from patches/server/0781-Use-single-player-info-update-packet-on-join.patch rename to patches/server/0780-Use-single-player-info-update-packet-on-join.patch index 550ded3d15..a4901625a7 100644 --- a/patches/server/0781-Use-single-player-info-update-packet-on-join.patch +++ b/patches/server/0780-Use-single-player-info-update-packet-on-join.patch @@ -18,7 +18,7 @@ index 762382b45afbc18810787858539fba62afc3e84c..66655aecd83138760e5d7601d22b95bb } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9b01ef9e9b00274f1213c006a4cad0f75e412e13..cbba549176b3acfc25ec42c2935b31ab2176e0fa 100644 +index 4b8636c2107e6a16c26f259e0dbdbc40a1268e06..7da3e315de67f3273997ce9160995183a3a1ce71 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -364,6 +364,7 @@ public abstract class PlayerList { diff --git a/patches/server/0782-Correctly-shrink-items-during-EntityResurrectEvent.patch b/patches/server/0781-Correctly-shrink-items-during-EntityResurrectEvent.patch similarity index 93% rename from patches/server/0782-Correctly-shrink-items-during-EntityResurrectEvent.patch rename to patches/server/0781-Correctly-shrink-items-during-EntityResurrectEvent.patch index 427a668981..d2f07ac306 100644 --- a/patches/server/0782-Correctly-shrink-items-during-EntityResurrectEvent.patch +++ b/patches/server/0781-Correctly-shrink-items-during-EntityResurrectEvent.patch @@ -1,5 +1,5 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll +From: Bjarne Koll Date: Tue, 10 Jan 2023 21:06:42 +0100 Subject: [PATCH] Correctly shrink items during EntityResurrectEvent @@ -22,7 +22,7 @@ This patch corrects this behaviour by only shrinking the item if a totem of undying was found and the event was called uncancelled. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 076c7828fdfa53c7453406beb937700e12b137d2..879ac6ec0b429ddb89ede2d51c8ccee9090fdc49 100644 +index cd2d6b55b494830797014dbc3cc1f0fbf6518249..633c37844062ad93c7241b78663a14a33570c30b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1672,7 +1672,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0783-Win-Screen-API.patch b/patches/server/0782-Win-Screen-API.patch similarity index 93% rename from patches/server/0783-Win-Screen-API.patch rename to patches/server/0782-Win-Screen-API.patch index f233f098bf..074d1e4455 100644 --- a/patches/server/0783-Win-Screen-API.patch +++ b/patches/server/0782-Win-Screen-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Win Screen API public net.minecraft.server.level.ServerPlayer seenCredits diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index dbc642fd7c953ee8d1756cae079f410c03bb1cbd..afd68e1f50dc2b2db9b77b3caf7b5d75cf31e8e1 100644 +index 68296e776cda9983d2b3f1fdabe7fcaa2e631e86..0eaae1dddf90a23210075b795116f74fad2e2d94 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1310,6 +1310,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0784-Remove-CraftItemStack-setAmount-null-assignment.patch b/patches/server/0783-Remove-CraftItemStack-setAmount-null-assignment.patch similarity index 100% rename from patches/server/0784-Remove-CraftItemStack-setAmount-null-assignment.patch rename to patches/server/0783-Remove-CraftItemStack-setAmount-null-assignment.patch diff --git a/patches/server/0785-Fix-force-opening-enchantment-tables.patch b/patches/server/0784-Fix-force-opening-enchantment-tables.patch similarity index 100% rename from patches/server/0785-Fix-force-opening-enchantment-tables.patch rename to patches/server/0784-Fix-force-opening-enchantment-tables.patch diff --git a/patches/server/0786-Add-Entity-Body-Yaw-API.patch b/patches/server/0785-Add-Entity-Body-Yaw-API.patch similarity index 100% rename from patches/server/0786-Add-Entity-Body-Yaw-API.patch rename to patches/server/0785-Add-Entity-Body-Yaw-API.patch diff --git a/patches/server/0787-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch b/patches/server/0786-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch similarity index 100% rename from patches/server/0787-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch rename to patches/server/0786-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch diff --git a/patches/server/0788-Add-EntityFertilizeEggEvent.patch b/patches/server/0787-Add-EntityFertilizeEggEvent.patch similarity index 98% rename from patches/server/0788-Add-EntityFertilizeEggEvent.patch rename to patches/server/0787-Add-EntityFertilizeEggEvent.patch index ea7e33d8b0..a5b9caf556 100644 --- a/patches/server/0788-Add-EntityFertilizeEggEvent.patch +++ b/patches/server/0787-Add-EntityFertilizeEggEvent.patch @@ -69,7 +69,7 @@ index 014e1ea1603bc7a7b42ae7ff7d12e5a41f331d2f..af2f6e690fc51d319b77d081466c2dc7 this.playSound(SoundEvents.SNIFFER_EGG_PLOP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 0.5F); } // Paper - Call EntityDropItemEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index ea0241de1a7ef64059cddcb43c41f56b91901897..d63b9c666cf6eb1de114c5c89867b8d233267c9e 100644 +index 48d39015da2c91a27367d44e72b7dacddb41d6d6..ec5c16f64d4e797b4c09bd0d3ae6f143d8795612 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -2195,4 +2195,28 @@ public class CraftEventFactory { diff --git a/patches/server/0789-Fix-HumanEntity-drop-not-updating-the-client-inv.patch b/patches/server/0788-Fix-HumanEntity-drop-not-updating-the-client-inv.patch similarity index 100% rename from patches/server/0789-Fix-HumanEntity-drop-not-updating-the-client-inv.patch rename to patches/server/0788-Fix-HumanEntity-drop-not-updating-the-client-inv.patch diff --git a/patches/server/0790-Add-CompostItemEvent-and-EntityCompostItemEvent.patch b/patches/server/0789-Add-CompostItemEvent-and-EntityCompostItemEvent.patch similarity index 100% rename from patches/server/0790-Add-CompostItemEvent-and-EntityCompostItemEvent.patch rename to patches/server/0789-Add-CompostItemEvent-and-EntityCompostItemEvent.patch diff --git a/patches/server/0791-Correctly-handle-ArmorStand-invisibility.patch b/patches/server/0790-Correctly-handle-ArmorStand-invisibility.patch similarity index 100% rename from patches/server/0791-Correctly-handle-ArmorStand-invisibility.patch rename to patches/server/0790-Correctly-handle-ArmorStand-invisibility.patch diff --git a/patches/server/0792-Fix-advancement-triggers-for-entity-damage.patch b/patches/server/0791-Fix-advancement-triggers-for-entity-damage.patch similarity index 97% rename from patches/server/0792-Fix-advancement-triggers-for-entity-damage.patch rename to patches/server/0791-Fix-advancement-triggers-for-entity-damage.patch index 1f72ba6104..5d63deeb0d 100644 --- a/patches/server/0792-Fix-advancement-triggers-for-entity-damage.patch +++ b/patches/server/0791-Fix-advancement-triggers-for-entity-damage.patch @@ -23,7 +23,7 @@ index 821bb93e1b055ba38fafe3b7079d79aa062ebe8a..221d73676fe2fd240a47cf312c1179e0 return !this.getResponse(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 0f20301c8194dcf9f3b42429437552ca0a613b13..c6fa51118232e5875779482ed1d694b7b9c7b861 100644 +index 633c37844062ad93c7241b78663a14a33570c30b..7bce1bd9ff1d76c5a238d03475d8bcdaaca680d3 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2464,7 +2464,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0793-Fix-text-display-error-on-spawn.patch b/patches/server/0792-Fix-text-display-error-on-spawn.patch similarity index 100% rename from patches/server/0793-Fix-text-display-error-on-spawn.patch rename to patches/server/0792-Fix-text-display-error-on-spawn.patch diff --git a/patches/server/0794-Fix-inventories-returning-null-Locations.patch b/patches/server/0793-Fix-inventories-returning-null-Locations.patch similarity index 100% rename from patches/server/0794-Fix-inventories-returning-null-Locations.patch rename to patches/server/0793-Fix-inventories-returning-null-Locations.patch diff --git a/patches/server/0795-Add-Shearable-API.patch b/patches/server/0794-Add-Shearable-API.patch similarity index 100% rename from patches/server/0795-Add-Shearable-API.patch rename to patches/server/0794-Add-Shearable-API.patch diff --git a/patches/server/0796-Fix-SpawnEggMeta-get-setSpawnedType.patch b/patches/server/0795-Fix-SpawnEggMeta-get-setSpawnedType.patch similarity index 100% rename from patches/server/0796-Fix-SpawnEggMeta-get-setSpawnedType.patch rename to patches/server/0795-Fix-SpawnEggMeta-get-setSpawnedType.patch diff --git a/patches/server/0797-Fix-crash-relating-to-bad-recipes-in-furnace-like-ti.patch b/patches/server/0796-Fix-crash-relating-to-bad-recipes-in-furnace-like-ti.patch similarity index 100% rename from patches/server/0797-Fix-crash-relating-to-bad-recipes-in-furnace-like-ti.patch rename to patches/server/0796-Fix-crash-relating-to-bad-recipes-in-furnace-like-ti.patch diff --git a/patches/server/0798-Treat-sequence-violations-like-they-should-be.patch b/patches/server/0797-Treat-sequence-violations-like-they-should-be.patch similarity index 100% rename from patches/server/0798-Treat-sequence-violations-like-they-should-be.patch rename to patches/server/0797-Treat-sequence-violations-like-they-should-be.patch diff --git a/patches/server/0799-Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/0798-Prevent-causing-expired-keys-from-impacting-new-join.patch similarity index 100% rename from patches/server/0799-Prevent-causing-expired-keys-from-impacting-new-join.patch rename to patches/server/0798-Prevent-causing-expired-keys-from-impacting-new-join.patch diff --git a/patches/server/0800-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch b/patches/server/0799-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch similarity index 86% rename from patches/server/0800-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch rename to patches/server/0799-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch index 5ddc60ef91..cf13c8d853 100644 --- a/patches/server/0800-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch +++ b/patches/server/0799-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent GameEvents being fired from unloaded chunks diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b81d814619e4175f42aee397811b07cae420c2e8..e9096a138175448279a03a55043982b6d83fbe12 100644 +index 77c1ddc6fd14e0b033825909e5c814abd2306f8d..5ba217ff42aaa3034eeb956f19ffaacde12e52dd 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1355,6 +1355,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1360,6 +1360,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public void gameEvent(Holder event, Vec3 emitterPos, GameEvent.Context emitter) { diff --git a/patches/server/0801-Use-array-for-gamerule-storage.patch b/patches/server/0800-Use-array-for-gamerule-storage.patch similarity index 100% rename from patches/server/0801-Use-array-for-gamerule-storage.patch rename to patches/server/0800-Use-array-for-gamerule-storage.patch diff --git a/patches/server/0802-Fix-a-couple-of-upstream-bed-issues.patch b/patches/server/0801-Fix-a-couple-of-upstream-bed-issues.patch similarity index 100% rename from patches/server/0802-Fix-a-couple-of-upstream-bed-issues.patch rename to patches/server/0801-Fix-a-couple-of-upstream-bed-issues.patch diff --git a/patches/server/0803-Fix-demo-flag-not-enabling-demo-mode.patch b/patches/server/0802-Fix-demo-flag-not-enabling-demo-mode.patch similarity index 100% rename from patches/server/0803-Fix-demo-flag-not-enabling-demo-mode.patch rename to patches/server/0802-Fix-demo-flag-not-enabling-demo-mode.patch diff --git a/patches/server/0804-Add-Mob-Experience-reward-API.patch b/patches/server/0803-Add-Mob-Experience-reward-API.patch similarity index 100% rename from patches/server/0804-Add-Mob-Experience-reward-API.patch rename to patches/server/0803-Add-Mob-Experience-reward-API.patch diff --git a/patches/server/0805-Break-redstone-on-top-of-trap-doors-early.patch b/patches/server/0804-Break-redstone-on-top-of-trap-doors-early.patch similarity index 100% rename from patches/server/0805-Break-redstone-on-top-of-trap-doors-early.patch rename to patches/server/0804-Break-redstone-on-top-of-trap-doors-early.patch diff --git a/patches/server/0806-Avoid-Lazy-Initialization-for-Enum-Fields.patch b/patches/server/0805-Avoid-Lazy-Initialization-for-Enum-Fields.patch similarity index 100% rename from patches/server/0806-Avoid-Lazy-Initialization-for-Enum-Fields.patch rename to patches/server/0805-Avoid-Lazy-Initialization-for-Enum-Fields.patch diff --git a/patches/server/0807-More-accurate-isInOpenWater-impl.patch b/patches/server/0806-More-accurate-isInOpenWater-impl.patch similarity index 100% rename from patches/server/0807-More-accurate-isInOpenWater-impl.patch rename to patches/server/0806-More-accurate-isInOpenWater-impl.patch diff --git a/patches/server/0808-Expand-PlayerItemMendEvent.patch b/patches/server/0807-Expand-PlayerItemMendEvent.patch similarity index 98% rename from patches/server/0808-Expand-PlayerItemMendEvent.patch rename to patches/server/0807-Expand-PlayerItemMendEvent.patch index 60044b0d82..32b28446d4 100644 --- a/patches/server/0808-Expand-PlayerItemMendEvent.patch +++ b/patches/server/0807-Expand-PlayerItemMendEvent.patch @@ -30,7 +30,7 @@ index 3a7af27bb1ce0cbe56bd3760cd400083daf98d4c..bf0838f574fa3fb9654e087d602b8d38 if (l > 0) { // this.value = l; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls // Paper - the value field should not be mutated here because it doesn't take "count" into account diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index afd68e1f50dc2b2db9b77b3caf7b5d75cf31e8e1..f3b06876567719c6f88db63019278dcdc849d0c1 100644 +index 0eaae1dddf90a23210075b795116f74fad2e2d94..9cddd440e50d8314b4e853fccee22fc4540ccae0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1863,11 +1863,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0809-Refresh-ProjectileSource-for-projectiles.patch b/patches/server/0808-Refresh-ProjectileSource-for-projectiles.patch similarity index 97% rename from patches/server/0809-Refresh-ProjectileSource-for-projectiles.patch rename to patches/server/0808-Refresh-ProjectileSource-for-projectiles.patch index 3c6865e72d..0041557448 100644 --- a/patches/server/0809-Refresh-ProjectileSource-for-projectiles.patch +++ b/patches/server/0808-Refresh-ProjectileSource-for-projectiles.patch @@ -14,7 +14,7 @@ clearing the owner. Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com> diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 798fd11e76326ace74035cf782be9f4218fe5edc..3d4d5d23623dccb8a5be85c2205dae11509a7119 100644 +index 61bd5290d0056656ab761ecf38cf8c8bbb80ab94..12f7ac6ecc8284fe4da83e09081a6e1c08f1b4de 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -394,6 +394,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0810-Add-transient-modifier-API.patch b/patches/server/0809-Add-transient-modifier-API.patch similarity index 100% rename from patches/server/0810-Add-transient-modifier-API.patch rename to patches/server/0809-Add-transient-modifier-API.patch diff --git a/patches/server/0811-Fix-block-place-logic.patch b/patches/server/0810-Fix-block-place-logic.patch similarity index 100% rename from patches/server/0811-Fix-block-place-logic.patch rename to patches/server/0810-Fix-block-place-logic.patch diff --git a/patches/server/0812-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch b/patches/server/0811-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch similarity index 100% rename from patches/server/0812-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch rename to patches/server/0811-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch diff --git a/patches/server/0813-Call-BlockGrowEvent-for-missing-blocks.patch b/patches/server/0812-Call-BlockGrowEvent-for-missing-blocks.patch similarity index 100% rename from patches/server/0813-Call-BlockGrowEvent-for-missing-blocks.patch rename to patches/server/0812-Call-BlockGrowEvent-for-missing-blocks.patch diff --git a/patches/server/0814-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch b/patches/server/0813-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch similarity index 94% rename from patches/server/0814-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch rename to patches/server/0813-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch index 4cc150197b..516bf15511 100644 --- a/patches/server/0814-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch +++ b/patches/server/0813-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't enforce icanhasbukkit default if alias block exists diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b84dc11212aba4c06375cdbefa91c09d86a2b957..a7b79c9ec51f037287fad609c29b240e2071f2f8 100644 +index 927846bf3281771de0274216abe927e524df3493..5c907eca23d936ba3095f2d81256775edaa737da 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -358,7 +358,11 @@ public final class CraftServer implements Server { diff --git a/patches/server/0815-fix-MapLike-spam-for-missing-key-selector.patch b/patches/server/0814-fix-MapLike-spam-for-missing-key-selector.patch similarity index 100% rename from patches/server/0815-fix-MapLike-spam-for-missing-key-selector.patch rename to patches/server/0814-fix-MapLike-spam-for-missing-key-selector.patch diff --git a/patches/server/0816-Fix-sniffer-removeExploredLocation.patch b/patches/server/0815-Fix-sniffer-removeExploredLocation.patch similarity index 100% rename from patches/server/0816-Fix-sniffer-removeExploredLocation.patch rename to patches/server/0815-Fix-sniffer-removeExploredLocation.patch diff --git a/patches/server/0817-Add-method-to-remove-all-active-potion-effects.patch b/patches/server/0816-Add-method-to-remove-all-active-potion-effects.patch similarity index 100% rename from patches/server/0817-Add-method-to-remove-all-active-potion-effects.patch rename to patches/server/0816-Add-method-to-remove-all-active-potion-effects.patch diff --git a/patches/server/0818-Add-event-for-player-editing-sign.patch b/patches/server/0817-Add-event-for-player-editing-sign.patch similarity index 100% rename from patches/server/0818-Add-event-for-player-editing-sign.patch rename to patches/server/0817-Add-event-for-player-editing-sign.patch diff --git a/patches/server/0819-Only-tick-item-frames-if-players-can-see-it.patch b/patches/server/0818-Only-tick-item-frames-if-players-can-see-it.patch similarity index 100% rename from patches/server/0819-Only-tick-item-frames-if-players-can-see-it.patch rename to patches/server/0818-Only-tick-item-frames-if-players-can-see-it.patch diff --git a/patches/server/0820-Fix-cmd-permission-levels-for-command-blocks.patch b/patches/server/0819-Fix-cmd-permission-levels-for-command-blocks.patch similarity index 100% rename from patches/server/0820-Fix-cmd-permission-levels-for-command-blocks.patch rename to patches/server/0819-Fix-cmd-permission-levels-for-command-blocks.patch diff --git a/patches/server/0821-Add-option-to-disable-block-updates.patch b/patches/server/0820-Add-option-to-disable-block-updates.patch similarity index 100% rename from patches/server/0821-Add-option-to-disable-block-updates.patch rename to patches/server/0820-Add-option-to-disable-block-updates.patch diff --git a/patches/server/0822-Call-missing-BlockDispenseEvent.patch b/patches/server/0821-Call-missing-BlockDispenseEvent.patch similarity index 98% rename from patches/server/0822-Call-missing-BlockDispenseEvent.patch rename to patches/server/0821-Call-missing-BlockDispenseEvent.patch index c8d68a1ed8..174a0ab4b6 100644 --- a/patches/server/0822-Call-missing-BlockDispenseEvent.patch +++ b/patches/server/0821-Call-missing-BlockDispenseEvent.patch @@ -50,7 +50,7 @@ index 5793569ae8a088f21b0d8d6771a5099b1e88be09..f8f570a97789ab16e57774f233506a28 for (int k = 0; k < 5; ++k) { worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index dd0d19faccbc49b5f9718e2df9f004bb17a9ef7e..38c8f69dff0abe62fc405a9fbb29c80d45aa675f 100644 +index 8fba20a2ff4ef43aa3bda1116f58b696bde2b9b8..28e56095ec4b6fb73df747ec796498f8692c2a24 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -2196,6 +2196,32 @@ public class CraftEventFactory { diff --git a/patches/server/0823-Don-t-load-chunks-for-supporting-block-checks.patch b/patches/server/0822-Don-t-load-chunks-for-supporting-block-checks.patch similarity index 90% rename from patches/server/0823-Don-t-load-chunks-for-supporting-block-checks.patch rename to patches/server/0822-Don-t-load-chunks-for-supporting-block-checks.patch index 5d7e485869..7440fc0c49 100644 --- a/patches/server/0823-Don-t-load-chunks-for-supporting-block-checks.patch +++ b/patches/server/0822-Don-t-load-chunks-for-supporting-block-checks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't load chunks for supporting block checks diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3d4d5d23623dccb8a5be85c2205dae11509a7119..c26c814e9a3a54fb7b46b0e5f51843621f179d3d 100644 +index 12f7ac6ecc8284fe4da83e09081a6e1c08f1b4de..4cced854e750ea9057b4a8d686245925e5dc2868 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1229,7 +1229,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0824-Optimize-player-lookups-for-beacons.patch b/patches/server/0823-Optimize-player-lookups-for-beacons.patch similarity index 100% rename from patches/server/0824-Optimize-player-lookups-for-beacons.patch rename to patches/server/0823-Optimize-player-lookups-for-beacons.patch diff --git a/patches/server/0825-More-Sign-Block-API.patch b/patches/server/0824-More-Sign-Block-API.patch similarity index 100% rename from patches/server/0825-More-Sign-Block-API.patch rename to patches/server/0824-More-Sign-Block-API.patch diff --git a/patches/server/0826-fix-item-meta-for-tadpole-buckets.patch b/patches/server/0825-fix-item-meta-for-tadpole-buckets.patch similarity index 97% rename from patches/server/0826-fix-item-meta-for-tadpole-buckets.patch rename to patches/server/0825-fix-item-meta-for-tadpole-buckets.patch index 04c4b6a873..0ad43795a2 100644 --- a/patches/server/0826-fix-item-meta-for-tadpole-buckets.patch +++ b/patches/server/0825-fix-item-meta-for-tadpole-buckets.patch @@ -30,7 +30,7 @@ index 27af7ca9d62bdb4a24be5af139c181d7bc271ba5..3ff0340c40e9dc9a6e690de15ccade7a Material.GLOW_ITEM_FRAME, Material.PAINTING diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index 50faaaa48dffcaf53823caed1e3f7263cd5c441f..ba5c958f322dc34baff3c9d1b99741a4ffeee135 100644 +index 6cc54035af870b75f45d836e5b60f5d9240dd7d0..c27f37fd8a0e90b1440bfd4329d044eb8df629d2 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -209,6 +209,27 @@ public class ItemMetaTest { diff --git a/patches/server/0827-Fix-BanList-API.patch b/patches/server/0826-Fix-BanList-API.patch similarity index 99% rename from patches/server/0827-Fix-BanList-API.patch rename to patches/server/0826-Fix-BanList-API.patch index 48283aa31e..39df7560c6 100644 --- a/patches/server/0827-Fix-BanList-API.patch +++ b/patches/server/0826-Fix-BanList-API.patch @@ -208,7 +208,7 @@ index 172202accf4448a933fcf1ff820316c7910dd7f7..50ee7656580d386db473c054f5c5ec57 return null; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f3b06876567719c6f88db63019278dcdc849d0c1..796a1540239362aec90f0a136bf7c28d282d5274 100644 +index 9cddd440e50d8314b4e853fccee22fc4540ccae0..b0b417d916c6c3099157f8279c346bc6670c0012 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1757,23 +1757,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0828-Determine-lava-and-water-fluid-explosion-resistance-.patch b/patches/server/0827-Determine-lava-and-water-fluid-explosion-resistance-.patch similarity index 100% rename from patches/server/0828-Determine-lava-and-water-fluid-explosion-resistance-.patch rename to patches/server/0827-Determine-lava-and-water-fluid-explosion-resistance-.patch diff --git a/patches/server/0829-Fix-possible-NPE-on-painting-creation.patch b/patches/server/0828-Fix-possible-NPE-on-painting-creation.patch similarity index 100% rename from patches/server/0829-Fix-possible-NPE-on-painting-creation.patch rename to patches/server/0828-Fix-possible-NPE-on-painting-creation.patch diff --git a/patches/server/0830-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch b/patches/server/0829-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch similarity index 100% rename from patches/server/0830-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch rename to patches/server/0829-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch diff --git a/patches/server/0831-ExperienceOrb-should-call-EntitySpawnEvent.patch b/patches/server/0830-ExperienceOrb-should-call-EntitySpawnEvent.patch similarity index 93% rename from patches/server/0831-ExperienceOrb-should-call-EntitySpawnEvent.patch rename to patches/server/0830-ExperienceOrb-should-call-EntitySpawnEvent.patch index 40dec00abb..da24259a50 100644 --- a/patches/server/0831-ExperienceOrb-should-call-EntitySpawnEvent.patch +++ b/patches/server/0830-ExperienceOrb-should-call-EntitySpawnEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ExperienceOrb should call EntitySpawnEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 38c8f69dff0abe62fc405a9fbb29c80d45aa675f..449380c97dc332ecd43e308fcf110c9548930600 100644 +index 28e56095ec4b6fb73df747ec796498f8692c2a24..b1ce440bc5c8b77654213a4630851daef3f15d60 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -744,7 +744,8 @@ public class CraftEventFactory { diff --git a/patches/server/0832-Make-Amethyst-throw-both-Spread-and-Grow-Events.patch b/patches/server/0831-Make-Amethyst-throw-both-Spread-and-Grow-Events.patch similarity index 100% rename from patches/server/0832-Make-Amethyst-throw-both-Spread-and-Grow-Events.patch rename to patches/server/0831-Make-Amethyst-throw-both-Spread-and-Grow-Events.patch diff --git a/patches/server/0833-Add-whitelist-events.patch b/patches/server/0832-Add-whitelist-events.patch similarity index 100% rename from patches/server/0833-Add-whitelist-events.patch rename to patches/server/0832-Add-whitelist-events.patch diff --git a/patches/server/0834-Implement-PlayerFailMoveEvent.patch b/patches/server/0833-Implement-PlayerFailMoveEvent.patch similarity index 100% rename from patches/server/0834-Implement-PlayerFailMoveEvent.patch rename to patches/server/0833-Implement-PlayerFailMoveEvent.patch diff --git a/patches/server/0835-Folia-scheduler-and-owned-region-API.patch b/patches/server/0834-Folia-scheduler-and-owned-region-API.patch similarity index 99% rename from patches/server/0835-Folia-scheduler-and-owned-region-API.patch rename to patches/server/0834-Folia-scheduler-and-owned-region-API.patch index 2c701102be..edcef4f99f 100644 --- a/patches/server/0835-Folia-scheduler-and-owned-region-API.patch +++ b/patches/server/0834-Folia-scheduler-and-owned-region-API.patch @@ -1185,7 +1185,7 @@ index 7da3e315de67f3273997ce9160995183a3a1ce71..3a6e918e9db6397b6f1cff5310416552 this.players.remove(entityplayer); this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c26c814e9a3a54fb7b46b0e5f51843621f179d3d..638b202519b0cca5ca7ba406e6f92c51a0ef990e 100644 +index 4cced854e750ea9057b4a8d686245925e5dc2868..5a2d33b7da60469f27f9782841b0cf879a780c8f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -263,10 +263,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1249,7 +1249,7 @@ index c26c814e9a3a54fb7b46b0e5f51843621f179d3d..638b202519b0cca5ca7ba406e6f92c51 public void setLevelCallback(EntityInLevelCallback changeListener) { this.levelCallback = changeListener; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b59dc253a086374e07338b989ba5835d138e5d72..190529d8f96b2cb4096a454aec37775388650af2 100644 +index 5c907eca23d936ba3095f2d81256775edaa737da..1bf51d4a1ffb6ab56c4023c49725e412f4350197 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -313,6 +313,76 @@ public final class CraftServer implements Server { @@ -1330,7 +1330,7 @@ index b59dc253a086374e07338b989ba5835d138e5d72..190529d8f96b2cb4096a454aec377753 ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); ConfigurationSerialization.registerClass(CraftPlayerProfile.class); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 4209434ff066670000dadb0c59fea297f03300f4..df199c1cffa7795126ab83af67e184238ddb211d 100644 +index e65d1ca701d835db0ed45e627c92c1c5ed384887..211726898275788e593002a279bf007c916de4de 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -71,6 +71,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0836-Only-erase-allay-memory-on-non-item-targets.patch b/patches/server/0835-Only-erase-allay-memory-on-non-item-targets.patch similarity index 93% rename from patches/server/0836-Only-erase-allay-memory-on-non-item-targets.patch rename to patches/server/0835-Only-erase-allay-memory-on-non-item-targets.patch index b26cfd040b..6342f7dee7 100644 --- a/patches/server/0836-Only-erase-allay-memory-on-non-item-targets.patch +++ b/patches/server/0835-Only-erase-allay-memory-on-non-item-targets.patch @@ -1,12 +1,12 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll +From: Bjarne Koll Date: Fri, 4 Aug 2023 15:53:36 +0200 Subject: [PATCH] Only erase allay memory on non-item targets Spigot incorrectly instanceOf checks the EntityTargetEvent#getTarget against the internal ItemEntity type and removes the nearest wanted item memory if said instanceOf check fails, (which is always the case) -causing allays to behave differently as they constantly loose their +causing allays to behave differently as they constantly lose their target item. This commit fixes the faulty behaviour by instance performing a check diff --git a/patches/server/0837-Fix-rotation-when-spawning-display-entities.patch b/patches/server/0836-Fix-rotation-when-spawning-display-entities.patch similarity index 96% rename from patches/server/0837-Fix-rotation-when-spawning-display-entities.patch rename to patches/server/0836-Fix-rotation-when-spawning-display-entities.patch index 240a093118..22ee667200 100644 --- a/patches/server/0837-Fix-rotation-when-spawning-display-entities.patch +++ b/patches/server/0836-Fix-rotation-when-spawning-display-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix rotation when spawning display entities diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java -index 8715d8e790b6735610e2f880f8c1f88a89967f21..6cf57640b3bd2bb0417129256ed77d9d67fcf04a 100644 +index e31aa2a499e894847f19800b6bceb17aba38a1c0..85b9224e9e999487abff15a008c7e37aae9b488b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java @@ -254,6 +254,7 @@ public final class CraftEntityTypes { diff --git a/patches/server/0838-Only-capture-actual-tree-growth.patch b/patches/server/0837-Only-capture-actual-tree-growth.patch similarity index 97% rename from patches/server/0838-Only-capture-actual-tree-growth.patch rename to patches/server/0837-Only-capture-actual-tree-growth.patch index f1dee3ad48..13fcd8afc3 100644 --- a/patches/server/0838-Only-capture-actual-tree-growth.patch +++ b/patches/server/0837-Only-capture-actual-tree-growth.patch @@ -17,10 +17,10 @@ index f8f570a97789ab16e57774f233506a289277d5d9..18304349c9ab24657c4152aff800dba9 } } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index e9096a138175448279a03a55043982b6d83fbe12..0db41d36d5daf015c750fb0246ab3e5da1cd81a2 100644 +index 5ba217ff42aaa3034eeb956f19ffaacde12e52dd..5770fa7a798c1c019bef27426f945f3cc0387a36 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2198,6 +2198,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2203,6 +2203,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe return range <= 0 ? 64.0 * 64.0 : range * range; // 64 is taken from default in ServerLevel#levelEvent } // Paper end - respect global sound events gamerule diff --git a/patches/server/0839-Use-correct-source-for-mushroom-block-spread-event.patch b/patches/server/0838-Use-correct-source-for-mushroom-block-spread-event.patch similarity index 100% rename from patches/server/0839-Use-correct-source-for-mushroom-block-spread-event.patch rename to patches/server/0838-Use-correct-source-for-mushroom-block-spread-event.patch diff --git a/patches/server/0840-Respect-randomizeData-on-more-entities-when-spawning.patch b/patches/server/0839-Respect-randomizeData-on-more-entities-when-spawning.patch similarity index 98% rename from patches/server/0840-Respect-randomizeData-on-more-entities-when-spawning.patch rename to patches/server/0839-Respect-randomizeData-on-more-entities-when-spawning.patch index 67a5238077..adf37e5cf2 100644 --- a/patches/server/0840-Respect-randomizeData-on-more-entities-when-spawning.patch +++ b/patches/server/0839-Respect-randomizeData-on-more-entities-when-spawning.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Respect randomizeData on more entities when spawning * ExperienceOrb diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java -index 6cf57640b3bd2bb0417129256ed77d9d67fcf04a..3b5277f90b5bba30d40d79ba67903a8d04d2c0df 100644 +index 85b9224e9e999487abff15a008c7e37aae9b488b..829d44c718bddf813d71a08097bc0fa1f5825476 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java @@ -255,6 +255,13 @@ public final class CraftEntityTypes { diff --git a/patches/server/0841-Use-correct-seed-on-api-world-load.patch b/patches/server/0840-Use-correct-seed-on-api-world-load.patch similarity index 92% rename from patches/server/0841-Use-correct-seed-on-api-world-load.patch rename to patches/server/0840-Use-correct-seed-on-api-world-load.patch index 997631e23b..298996ee0f 100644 --- a/patches/server/0841-Use-correct-seed-on-api-world-load.patch +++ b/patches/server/0840-Use-correct-seed-on-api-world-load.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use correct seed on api world load diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 46807d5d94a0f90b230dfaf4d37378a3bfa21414..da3819f49b105bd98ce94b5abdf1c7652ff625a4 100644 +index 1bf51d4a1ffb6ab56c4023c49725e412f4350197..d5e8cb8a907385e807c786815cf33f1cd9355f0c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1388,7 +1388,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0842-Remove-UpgradeData-neighbour-ticks-outside-of-range.patch b/patches/server/0841-Remove-UpgradeData-neighbour-ticks-outside-of-range.patch similarity index 100% rename from patches/server/0842-Remove-UpgradeData-neighbour-ticks-outside-of-range.patch rename to patches/server/0841-Remove-UpgradeData-neighbour-ticks-outside-of-range.patch diff --git a/patches/server/0843-Cache-map-ids-on-item-frames.patch b/patches/server/0842-Cache-map-ids-on-item-frames.patch similarity index 100% rename from patches/server/0843-Cache-map-ids-on-item-frames.patch rename to patches/server/0842-Cache-map-ids-on-item-frames.patch diff --git a/patches/server/0844-API-for-updating-recipes-on-clients.patch b/patches/server/0843-API-for-updating-recipes-on-clients.patch similarity index 97% rename from patches/server/0844-API-for-updating-recipes-on-clients.patch rename to patches/server/0843-API-for-updating-recipes-on-clients.patch index e0119725e2..fbced676d0 100644 --- a/patches/server/0844-API-for-updating-recipes-on-clients.patch +++ b/patches/server/0843-API-for-updating-recipes-on-clients.patch @@ -38,7 +38,7 @@ index 3a6e918e9db6397b6f1cff531041655298ce087d..efc12d629b71ba1da664d9ecfd4575be public void reloadRecipes() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 87bc228c121077815bdad7942df1c9576edac21b..a618258fde1226588ea447522ba4177aa9cf9016 100644 +index d5e8cb8a907385e807c786815cf33f1cd9355f0c..8e0d8fafa68d909d1d10c6d6a03cca371c0e6fb3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1178,6 +1178,18 @@ public final class CraftServer implements Server { diff --git a/patches/server/0845-Fix-custom-statistic-criteria-creation.patch b/patches/server/0844-Fix-custom-statistic-criteria-creation.patch similarity index 100% rename from patches/server/0845-Fix-custom-statistic-criteria-creation.patch rename to patches/server/0844-Fix-custom-statistic-criteria-creation.patch diff --git a/patches/server/0846-Bandaid-fix-for-Effect.patch b/patches/server/0845-Bandaid-fix-for-Effect.patch similarity index 98% rename from patches/server/0846-Bandaid-fix-for-Effect.patch rename to patches/server/0845-Bandaid-fix-for-Effect.patch index 7da01a3cd4..621a7cc2d2 100644 --- a/patches/server/0846-Bandaid-fix-for-Effect.patch +++ b/patches/server/0845-Bandaid-fix-for-Effect.patch @@ -68,10 +68,10 @@ index 71733f918ed84b9879ac1b142ef6205c5e768a9c..c856384019eff2f2d0bb831ebe1ccb0f break; case BONE_MEAL_USE: diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index df0f83941215a098014936f22e1ba353b69204a7..bfe7d57310f822edaa4ddb3ebddb2086ffee8a4a 100644 +index 431bd698e28b7731bf781e29de6c6a3fd936c71c..bca9e4908c7949a6f0b24fed2aa7332dd8f23e92 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1374,7 +1374,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1362,7 +1362,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { public void playEffect(Location loc, Effect effect, T data, int radius) { if (data != null) { Preconditions.checkArgument(effect.getData() != null, "Effect.%s does not have a valid Data", effect); diff --git a/patches/server/0847-SculkCatalyst-bloom-API.patch b/patches/server/0846-SculkCatalyst-bloom-API.patch similarity index 100% rename from patches/server/0847-SculkCatalyst-bloom-API.patch rename to patches/server/0846-SculkCatalyst-bloom-API.patch diff --git a/patches/server/0848-API-for-an-entity-s-scoreboard-name.patch b/patches/server/0847-API-for-an-entity-s-scoreboard-name.patch similarity index 100% rename from patches/server/0848-API-for-an-entity-s-scoreboard-name.patch rename to patches/server/0847-API-for-an-entity-s-scoreboard-name.patch diff --git a/patches/server/0849-Deprecate-and-replace-methods-with-old-StructureType.patch b/patches/server/0848-Deprecate-and-replace-methods-with-old-StructureType.patch similarity index 96% rename from patches/server/0849-Deprecate-and-replace-methods-with-old-StructureType.patch rename to patches/server/0848-Deprecate-and-replace-methods-with-old-StructureType.patch index 80817c1175..2b18283f26 100644 --- a/patches/server/0849-Deprecate-and-replace-methods-with-old-StructureType.patch +++ b/patches/server/0848-Deprecate-and-replace-methods-with-old-StructureType.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index fa505c0714bb95b2ab08b4bbb9ea79ce98898f4b..a1f2c8fd0348a6a5dad521430f473867bdadd1a5 100644 +index 8e0d8fafa68d909d1d10c6d6a03cca371c0e6fb3..ee79e3374b50ba21620a9685975a0341c15f313b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2007,6 +2007,11 @@ public final class CraftServer implements Server { diff --git a/patches/server/0850-Don-t-tab-complete-namespaced-commands-if-send-names.patch b/patches/server/0849-Don-t-tab-complete-namespaced-commands-if-send-names.patch similarity index 100% rename from patches/server/0850-Don-t-tab-complete-namespaced-commands-if-send-names.patch rename to patches/server/0849-Don-t-tab-complete-namespaced-commands-if-send-names.patch diff --git a/patches/server/0851-Properly-handle-BlockBreakEvent-isDropItems.patch b/patches/server/0850-Properly-handle-BlockBreakEvent-isDropItems.patch similarity index 100% rename from patches/server/0851-Properly-handle-BlockBreakEvent-isDropItems.patch rename to patches/server/0850-Properly-handle-BlockBreakEvent-isDropItems.patch diff --git a/patches/server/0852-Fire-entity-death-event-for-ender-dragon.patch b/patches/server/0851-Fire-entity-death-event-for-ender-dragon.patch similarity index 100% rename from patches/server/0852-Fire-entity-death-event-for-ender-dragon.patch rename to patches/server/0851-Fire-entity-death-event-for-ender-dragon.patch diff --git a/patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch b/patches/server/0852-Configurable-entity-tracking-range-by-Y-coordinate.patch similarity index 100% rename from patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch rename to patches/server/0852-Configurable-entity-tracking-range-by-Y-coordinate.patch diff --git a/patches/server/0854-Add-Listing-API-for-Player.patch b/patches/server/0853-Add-Listing-API-for-Player.patch similarity index 99% rename from patches/server/0854-Add-Listing-API-for-Player.patch rename to patches/server/0853-Add-Listing-API-for-Player.patch index 9917a8cbfa..a9183d8193 100644 --- a/patches/server/0854-Add-Listing-API-for-Player.patch +++ b/patches/server/0853-Add-Listing-API-for-Player.patch @@ -122,7 +122,7 @@ index efc12d629b71ba1da664d9ecfd4575bee9b45dc3..9067100a82a8c405cec0a19e53b3b245 // Paper end - Use single player info update packet on join player.sentListPacket = true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d903b9f1d62a826378b6d4b8458e5f675536fef2..512156b9c31cda88c444ab860ad9f39d73fb512b 100644 +index b397f784510d832d300a777b4c4a4de03c904b72..76ee6dcf028720f22ca6d0ba5975a8f1555cca37 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -206,6 +206,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0855-Configurable-Region-Compression-Format.patch b/patches/server/0854-Configurable-Region-Compression-Format.patch similarity index 100% rename from patches/server/0855-Configurable-Region-Compression-Format.patch rename to patches/server/0854-Configurable-Region-Compression-Format.patch diff --git a/patches/server/0856-Add-BlockFace-to-BlockDamageEvent.patch b/patches/server/0855-Add-BlockFace-to-BlockDamageEvent.patch similarity index 96% rename from patches/server/0856-Add-BlockFace-to-BlockDamageEvent.patch rename to patches/server/0855-Add-BlockFace-to-BlockDamageEvent.patch index 2dcf331517..a5b150b6fc 100644 --- a/patches/server/0856-Add-BlockFace-to-BlockDamageEvent.patch +++ b/patches/server/0855-Add-BlockFace-to-BlockDamageEvent.patch @@ -18,7 +18,7 @@ index 3bd4ab8161c29bb8df2ba496a4430393b6593476..0da6496c18341c01fc4551ead7e740a6 if (blockEvent.isCancelled()) { // Let the client know the block still exists diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 449380c97dc332ecd43e308fcf110c9548930600..c5f9d9aeeb1fc61edb0e57cef51f5f6371861000 100644 +index b1ce440bc5c8b77654213a4630851daef3f15d60..8853f0cfebfe56fd2aa3ec975701b5ffaad46257 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -660,13 +660,13 @@ public class CraftEventFactory { diff --git a/patches/server/0857-Fix-NPE-on-Boat-getStatus.patch b/patches/server/0856-Fix-NPE-on-Boat-getStatus.patch similarity index 100% rename from patches/server/0857-Fix-NPE-on-Boat-getStatus.patch rename to patches/server/0856-Fix-NPE-on-Boat-getStatus.patch diff --git a/patches/server/0858-Expand-Pose-API.patch b/patches/server/0857-Expand-Pose-API.patch similarity index 100% rename from patches/server/0858-Expand-Pose-API.patch rename to patches/server/0857-Expand-Pose-API.patch diff --git a/patches/server/0859-More-DragonBattle-API.patch b/patches/server/0858-More-DragonBattle-API.patch similarity index 100% rename from patches/server/0859-More-DragonBattle-API.patch rename to patches/server/0858-More-DragonBattle-API.patch diff --git a/patches/server/0860-Add-PlayerPickItemEvent.patch b/patches/server/0859-Add-PlayerPickItemEvent.patch similarity index 100% rename from patches/server/0860-Add-PlayerPickItemEvent.patch rename to patches/server/0859-Add-PlayerPickItemEvent.patch diff --git a/patches/server/0861-Allow-trident-custom-damage.patch b/patches/server/0860-Allow-trident-custom-damage.patch similarity index 100% rename from patches/server/0861-Allow-trident-custom-damage.patch rename to patches/server/0860-Allow-trident-custom-damage.patch diff --git a/patches/server/0862-Expose-hand-in-BlockCanBuildEvent.patch b/patches/server/0861-Expose-hand-in-BlockCanBuildEvent.patch similarity index 100% rename from patches/server/0862-Expose-hand-in-BlockCanBuildEvent.patch rename to patches/server/0861-Expose-hand-in-BlockCanBuildEvent.patch diff --git a/patches/server/0863-Optimize-nearest-structure-border-iteration.patch b/patches/server/0862-Optimize-nearest-structure-border-iteration.patch similarity index 100% rename from patches/server/0863-Optimize-nearest-structure-border-iteration.patch rename to patches/server/0862-Optimize-nearest-structure-border-iteration.patch diff --git a/patches/server/0864-Implement-OfflinePlayer-isConnected.patch b/patches/server/0863-Implement-OfflinePlayer-isConnected.patch similarity index 94% rename from patches/server/0864-Implement-OfflinePlayer-isConnected.patch rename to patches/server/0863-Implement-OfflinePlayer-isConnected.patch index ace0ea37ab..4e901ad769 100644 --- a/patches/server/0864-Implement-OfflinePlayer-isConnected.patch +++ b/patches/server/0863-Implement-OfflinePlayer-isConnected.patch @@ -23,7 +23,7 @@ index 2c2c4db31a746b4eb853dc04c6b3e5631bbfa034..4f4e3ee18d586f61706504218cddc06a public String getName() { Player player = this.getPlayer(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 334303fbb2cf0086ad133bdc07b27e833162f71a..de97ca0a25d70de50dfcc6b092f5e58facfb5a3a 100644 +index 76ee6dcf028720f22ca6d0ba5975a8f1555cca37..d8f0f8f0afd0a3705cf20b2670a6dd137cd70c15 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -261,6 +261,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0865-Fix-slot-desync.patch b/patches/server/0864-Fix-slot-desync.patch similarity index 98% rename from patches/server/0865-Fix-slot-desync.patch rename to patches/server/0864-Fix-slot-desync.patch index a1835267ae..e43a5e95b8 100644 --- a/patches/server/0865-Fix-slot-desync.patch +++ b/patches/server/0864-Fix-slot-desync.patch @@ -10,7 +10,7 @@ Co-authored-by: Minecrell Co-authored-by: Newwind diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f05a9fd321a4af28e9771bbf39d73f80dd4160c9..90aa8e401e1d092a31ff21699409b8366629cdcc 100644 +index 6a8a1c22e1bf53df7cf4b14daf9ff1de7017ef8b..678c31bcb98acb376e08de220f9fc9322c4f85fc 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -460,6 +460,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -40,7 +40,7 @@ index 38730e11118bf71d167a18b807e06c20ea0d63d0..5be7304c8417e2987837d1c6ce8b8023 if (event.isCancelled()) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8a0b26533e6bbabe829efbf5afcef1a79cdf0adb..4cd07d9a90885b59ef1b2be7562386d5e8c7b2ae 100644 +index e2ca84fb27cff54eada6ca1c7a96a29d1dbbb4e5..2342892db8b2bb1994727e611abb820f8104e486 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2753,8 +2753,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0866-Add-titleOverride-to-InventoryOpenEvent.patch b/patches/server/0865-Add-titleOverride-to-InventoryOpenEvent.patch similarity index 97% rename from patches/server/0866-Add-titleOverride-to-InventoryOpenEvent.patch rename to patches/server/0865-Add-titleOverride-to-InventoryOpenEvent.patch index 1b98c1b4a0..483c549c82 100644 --- a/patches/server/0866-Add-titleOverride-to-InventoryOpenEvent.patch +++ b/patches/server/0865-Add-titleOverride-to-InventoryOpenEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add titleOverride to InventoryOpenEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 90aa8e401e1d092a31ff21699409b8366629cdcc..419fcb4cd97cf10a2601e02024b999a51a0ff952 100644 +index 678c31bcb98acb376e08de220f9fc9322c4f85fc..e038664858c7af59f52a6328c73ecb27f8a16644 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1924,12 +1924,17 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -79,7 +79,7 @@ index 7dddf4dd090fcd9e86b147d7e4ddeaa99800713e..4312290ad970f71e1dc25b707ab312c5 if (!player.isImmobile()) player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper - Prevent opening inventories when frozen player.containerMenu = container; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index c5f9d9aeeb1fc61edb0e57cef51f5f6371861000..dbef230ae88ee1bfbc20ba53b534434c3ccac985 100644 +index 8853f0cfebfe56fd2aa3ec975701b5ffaad46257..b6c30bb70fb4746da024bc4d80b71aeb3558f101 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1401,10 +1401,21 @@ public class CraftEventFactory { diff --git a/patches/server/0867-Configure-sniffer-egg-hatch-time.patch b/patches/server/0866-Configure-sniffer-egg-hatch-time.patch similarity index 100% rename from patches/server/0867-Configure-sniffer-egg-hatch-time.patch rename to patches/server/0866-Configure-sniffer-egg-hatch-time.patch diff --git a/patches/server/0868-Do-crystal-portal-proximity-check-before-entity-look.patch b/patches/server/0867-Do-crystal-portal-proximity-check-before-entity-look.patch similarity index 100% rename from patches/server/0868-Do-crystal-portal-proximity-check-before-entity-look.patch rename to patches/server/0867-Do-crystal-portal-proximity-check-before-entity-look.patch diff --git a/patches/server/0869-Skip-POI-finding-if-stuck-in-vehicle.patch b/patches/server/0868-Skip-POI-finding-if-stuck-in-vehicle.patch similarity index 100% rename from patches/server/0869-Skip-POI-finding-if-stuck-in-vehicle.patch rename to patches/server/0868-Skip-POI-finding-if-stuck-in-vehicle.patch diff --git a/patches/server/0870-Add-slot-sanity-checks-in-container-clicks.patch b/patches/server/0869-Add-slot-sanity-checks-in-container-clicks.patch similarity index 100% rename from patches/server/0870-Add-slot-sanity-checks-in-container-clicks.patch rename to patches/server/0869-Add-slot-sanity-checks-in-container-clicks.patch diff --git a/patches/server/0871-Call-BlockRedstoneEvents-properly.patch b/patches/server/0870-Call-BlockRedstoneEvents-properly.patch similarity index 100% rename from patches/server/0871-Call-BlockRedstoneEvents-properly.patch rename to patches/server/0870-Call-BlockRedstoneEvents-properly.patch diff --git a/patches/server/0872-Allow-proper-checking-of-empty-item-stacks.patch b/patches/server/0871-Allow-proper-checking-of-empty-item-stacks.patch similarity index 100% rename from patches/server/0872-Allow-proper-checking-of-empty-item-stacks.patch rename to patches/server/0871-Allow-proper-checking-of-empty-item-stacks.patch diff --git a/patches/server/0873-Fix-silent-equipment-change-for-mobs.patch b/patches/server/0872-Fix-silent-equipment-change-for-mobs.patch similarity index 100% rename from patches/server/0873-Fix-silent-equipment-change-for-mobs.patch rename to patches/server/0872-Fix-silent-equipment-change-for-mobs.patch diff --git a/patches/server/0874-Fix-spigot-s-Forced-Stats.patch b/patches/server/0873-Fix-spigot-s-Forced-Stats.patch similarity index 100% rename from patches/server/0874-Fix-spigot-s-Forced-Stats.patch rename to patches/server/0873-Fix-spigot-s-Forced-Stats.patch diff --git a/patches/server/0875-Add-missing-InventoryHolders-to-inventories.patch b/patches/server/0874-Add-missing-InventoryHolders-to-inventories.patch similarity index 100% rename from patches/server/0875-Add-missing-InventoryHolders-to-inventories.patch rename to patches/server/0874-Add-missing-InventoryHolders-to-inventories.patch diff --git a/patches/server/0876-Do-not-read-tile-entities-in-chunks-that-are-positio.patch b/patches/server/0875-Do-not-read-tile-entities-in-chunks-that-are-positio.patch similarity index 100% rename from patches/server/0876-Do-not-read-tile-entities-in-chunks-that-are-positio.patch rename to patches/server/0875-Do-not-read-tile-entities-in-chunks-that-are-positio.patch diff --git a/patches/server/0877-Add-missing-logs-for-log-ips-config-option.patch b/patches/server/0876-Add-missing-logs-for-log-ips-config-option.patch similarity index 100% rename from patches/server/0877-Add-missing-logs-for-log-ips-config-option.patch rename to patches/server/0876-Add-missing-logs-for-log-ips-config-option.patch diff --git a/patches/server/0878-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch b/patches/server/0877-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch similarity index 100% rename from patches/server/0878-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch rename to patches/server/0877-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch diff --git a/patches/server/0879-Fix-NPE-in-AdvancementProgress-getDateAwarded.patch b/patches/server/0878-Fix-NPE-in-AdvancementProgress-getDateAwarded.patch similarity index 100% rename from patches/server/0879-Fix-NPE-in-AdvancementProgress-getDateAwarded.patch rename to patches/server/0878-Fix-NPE-in-AdvancementProgress-getDateAwarded.patch diff --git a/patches/server/0880-Fix-team-sidebar-objectives-not-being-cleared.patch b/patches/server/0879-Fix-team-sidebar-objectives-not-being-cleared.patch similarity index 100% rename from patches/server/0880-Fix-team-sidebar-objectives-not-being-cleared.patch rename to patches/server/0879-Fix-team-sidebar-objectives-not-being-cleared.patch diff --git a/patches/server/0881-Fix-missing-map-initialize-event-call.patch b/patches/server/0880-Fix-missing-map-initialize-event-call.patch similarity index 93% rename from patches/server/0881-Fix-missing-map-initialize-event-call.patch rename to patches/server/0880-Fix-missing-map-initialize-event-call.patch index 0eb662ab82..a3e1b9d535 100644 --- a/patches/server/0881-Fix-missing-map-initialize-event-call.patch +++ b/patches/server/0880-Fix-missing-map-initialize-event-call.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Fix missing map initialize event call public net.minecraft.world.level.storage.DimensionDataStorage readSavedData(Ljava/util/function/Function;Lnet/minecraft/util/datafix/DataFixTypes;Ljava/lang/String;)Lnet/minecraft/world/level/saveddata/SavedData; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0db41d36d5daf015c750fb0246ab3e5da1cd81a2..7cecbac43f1cd2d9516034ea9d2633c0c76e61f4 100644 +index 5770fa7a798c1c019bef27426f945f3cc0387a36..6923624f069c1aeb757386ef91d285769a2923a2 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1696,13 +1696,29 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1701,13 +1701,29 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Nullable @Override public MapItemSavedData getMapData(MapId id) { diff --git a/patches/server/0882-Update-entity-data-when-attaching-firework-to-entity.patch b/patches/server/0881-Update-entity-data-when-attaching-firework-to-entity.patch similarity index 100% rename from patches/server/0882-Update-entity-data-when-attaching-firework-to-entity.patch rename to patches/server/0881-Update-entity-data-when-attaching-firework-to-entity.patch diff --git a/patches/server/0883-Fix-UnsafeValues-loadAdvancement.patch b/patches/server/0882-Fix-UnsafeValues-loadAdvancement.patch similarity index 96% rename from patches/server/0883-Fix-UnsafeValues-loadAdvancement.patch rename to patches/server/0882-Fix-UnsafeValues-loadAdvancement.patch index 1fa31034dc..a2c8813abd 100644 --- a/patches/server/0883-Fix-UnsafeValues-loadAdvancement.patch +++ b/patches/server/0882-Fix-UnsafeValues-loadAdvancement.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index f15060bbe6dc0fbb4a81aee294d311047a3650b2..86c78365e7510140515b0f0f834113d01095b842 100644 +index 939bc76ca46081d51a6cb18ac39cd05d3ce58ac8..789f98d0a6bbe240714ae965dfa1312439ce09cf 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -303,9 +303,30 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0884-Add-player-idle-duration-API.patch b/patches/server/0883-Add-player-idle-duration-API.patch similarity index 91% rename from patches/server/0884-Add-player-idle-duration-API.patch rename to patches/server/0883-Add-player-idle-duration-API.patch index 1f020b6945..e74ebf914c 100644 --- a/patches/server/0884-Add-player-idle-duration-API.patch +++ b/patches/server/0883-Add-player-idle-duration-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add player idle duration API Implements API for getting and resetting a player's idle duration. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index eccc2d4fce0281307e263e6fe788ce225a7422d1..bfe2ed7a121f5e955edbf42a514e9a3b6ff8eee8 100644 +index d8f0f8f0afd0a3705cf20b2670a6dd137cd70c15..81455040c878b202cdb96a282fddfe4a65c7d0b7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -3429,6 +3429,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0885-Don-t-check-if-we-can-see-non-visible-entities.patch b/patches/server/0884-Don-t-check-if-we-can-see-non-visible-entities.patch similarity index 100% rename from patches/server/0885-Don-t-check-if-we-can-see-non-visible-entities.patch rename to patches/server/0884-Don-t-check-if-we-can-see-non-visible-entities.patch diff --git a/patches/server/0886-Fix-NPE-in-SculkBloomEvent-world-access.patch b/patches/server/0885-Fix-NPE-in-SculkBloomEvent-world-access.patch similarity index 100% rename from patches/server/0886-Fix-NPE-in-SculkBloomEvent-world-access.patch rename to patches/server/0885-Fix-NPE-in-SculkBloomEvent-world-access.patch diff --git a/patches/server/0887-Allow-null-itemstack-for-Player-sendEquipmentChange.patch b/patches/server/0886-Allow-null-itemstack-for-Player-sendEquipmentChange.patch similarity index 90% rename from patches/server/0887-Allow-null-itemstack-for-Player-sendEquipmentChange.patch rename to patches/server/0886-Allow-null-itemstack-for-Player-sendEquipmentChange.patch index c6e0416fd7..b540a94025 100644 --- a/patches/server/0887-Allow-null-itemstack-for-Player-sendEquipmentChange.patch +++ b/patches/server/0886-Allow-null-itemstack-for-Player-sendEquipmentChange.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow null itemstack for Player#sendEquipmentChange diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index bfe2ed7a121f5e955edbf42a514e9a3b6ff8eee8..69f2eb774b8aa364760b2e65a02bc547c1d89c9d 100644 +index 81455040c878b202cdb96a282fddfe4a65c7d0b7..273a94f727c6c736b2bdf98c1806431ebce4d90f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1132,7 +1132,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0888-Optimize-VarInts.patch b/patches/server/0887-Optimize-VarInts.patch similarity index 100% rename from patches/server/0888-Optimize-VarInts.patch rename to patches/server/0887-Optimize-VarInts.patch diff --git a/patches/server/0889-Add-API-to-get-the-collision-shape-of-a-block-before.patch b/patches/server/0888-Add-API-to-get-the-collision-shape-of-a-block-before.patch similarity index 100% rename from patches/server/0889-Add-API-to-get-the-collision-shape-of-a-block-before.patch rename to patches/server/0888-Add-API-to-get-the-collision-shape-of-a-block-before.patch diff --git a/patches/server/0890-Add-predicate-for-blocks-when-raytracing.patch b/patches/server/0889-Add-predicate-for-blocks-when-raytracing.patch similarity index 96% rename from patches/server/0890-Add-predicate-for-blocks-when-raytracing.patch rename to patches/server/0889-Add-predicate-for-blocks-when-raytracing.patch index b4282e60d7..1be78144b4 100644 --- a/patches/server/0890-Add-predicate-for-blocks-when-raytracing.patch +++ b/patches/server/0889-Add-predicate-for-blocks-when-raytracing.patch @@ -47,10 +47,10 @@ index 7e1a332168357b9af14dbe3299549c2c93903fa6..93738c7dea1ea3d19013a47380391274 Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo()); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index bfe7d57310f822edaa4ddb3ebddb2086ffee8a4a..acb9da6f6560f6cb4ac38c07aca449110d0e2e76 100644 +index bca9e4908c7949a6f0b24fed2aa7332dd8f23e92..d72ce4b4cd5bec76eb45d6f0027643740f9907fd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1108,9 +1108,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1096,9 +1096,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize, Predicate filter) { @@ -68,7 +68,7 @@ index bfe7d57310f822edaa4ddb3ebddb2086ffee8a4a..acb9da6f6560f6cb4ac38c07aca44911 Preconditions.checkArgument(direction != null, "Vector direction cannot be null"); direction.checkFinite(); -@@ -1160,9 +1166,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1148,9 +1154,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) { @@ -87,7 +87,7 @@ index bfe7d57310f822edaa4ddb3ebddb2086ffee8a4a..acb9da6f6560f6cb4ac38c07aca44911 Preconditions.checkArgument(direction != null, "Vector direction cannot be null"); direction.checkFinite(); -@@ -1175,16 +1188,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1163,16 +1176,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { } Vector dir = direction.clone().normalize().multiply(maxDistance); diff --git a/patches/server/0891-Broadcast-take-item-packets-with-collector-as-source.patch b/patches/server/0890-Broadcast-take-item-packets-with-collector-as-source.patch similarity index 92% rename from patches/server/0891-Broadcast-take-item-packets-with-collector-as-source.patch rename to patches/server/0890-Broadcast-take-item-packets-with-collector-as-source.patch index 6c7d603b8c..056419eb72 100644 --- a/patches/server/0891-Broadcast-take-item-packets-with-collector-as-source.patch +++ b/patches/server/0890-Broadcast-take-item-packets-with-collector-as-source.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Broadcast take item packets with collector as source This fixes players (which can't view the collector) seeing item pickups with themselves as the target. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index c6fa51118232e5875779482ed1d694b7b9c7b861..2bff94cef4fef66b81508a2ef4b5613e76044832 100644 +index 7bce1bd9ff1d76c5a238d03475d8bcdaaca680d3..84623aa24f8c90f0b51094c2d0773ee98c3a8524 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3892,7 +3892,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0892-Expand-LingeringPotion-API.patch b/patches/server/0891-Expand-LingeringPotion-API.patch similarity index 100% rename from patches/server/0892-Expand-LingeringPotion-API.patch rename to patches/server/0891-Expand-LingeringPotion-API.patch diff --git a/patches/server/0893-Fix-strikeLightningEffect-powers-lightning-rods-and-.patch b/patches/server/0892-Fix-strikeLightningEffect-powers-lightning-rods-and-.patch similarity index 96% rename from patches/server/0893-Fix-strikeLightningEffect-powers-lightning-rods-and-.patch rename to patches/server/0892-Fix-strikeLightningEffect-powers-lightning-rods-and-.patch index d23fba6176..1efd2d32b1 100644 --- a/patches/server/0893-Fix-strikeLightningEffect-powers-lightning-rods-and-.patch +++ b/patches/server/0892-Fix-strikeLightningEffect-powers-lightning-rods-and-.patch @@ -45,10 +45,10 @@ index 152ecd38814089333b8d61538297ce720756d2c3..12127b14babf646711d3a118416453c4 if (world instanceof ServerLevel) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index acb9da6f6560f6cb4ac38c07aca449110d0e2e76..305e1dc2d727841cd6dd23ec5ec0289e102552f8 100644 +index d72ce4b4cd5bec76eb45d6f0027643740f9907fd..b5b21852b4c3dc15e548afd81bdefbb83b9e7e9c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -734,7 +734,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -722,7 +722,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(this.world, EntitySpawnReason.COMMAND); lightning.moveTo(loc.getX(), loc.getY(), loc.getZ()); diff --git a/patches/server/0894-Add-hand-to-fish-event-for-all-player-interactions.patch b/patches/server/0893-Add-hand-to-fish-event-for-all-player-interactions.patch similarity index 100% rename from patches/server/0894-Add-hand-to-fish-event-for-all-player-interactions.patch rename to patches/server/0893-Add-hand-to-fish-event-for-all-player-interactions.patch diff --git a/patches/server/0895-Fix-several-issues-with-EntityBreedEvent.patch b/patches/server/0894-Fix-several-issues-with-EntityBreedEvent.patch similarity index 100% rename from patches/server/0895-Fix-several-issues-with-EntityBreedEvent.patch rename to patches/server/0894-Fix-several-issues-with-EntityBreedEvent.patch diff --git a/patches/server/0896-Add-UUID-attribute-modifier-API.patch b/patches/server/0895-Add-UUID-attribute-modifier-API.patch similarity index 100% rename from patches/server/0896-Add-UUID-attribute-modifier-API.patch rename to patches/server/0895-Add-UUID-attribute-modifier-API.patch diff --git a/patches/server/0897-Fix-missing-event-call-for-entity-teleport-API.patch b/patches/server/0896-Fix-missing-event-call-for-entity-teleport-API.patch similarity index 93% rename from patches/server/0897-Fix-missing-event-call-for-entity-teleport-API.patch rename to patches/server/0896-Fix-missing-event-call-for-entity-teleport-API.patch index c00c1e49bd..7f89636154 100644 --- a/patches/server/0897-Fix-missing-event-call-for-entity-teleport-API.patch +++ b/patches/server/0896-Fix-missing-event-call-for-entity-teleport-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix missing event call for entity teleport API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 11a08ff211a9a32a825519ddb1736e02cf7f685e..7536ab5c22d97a074c08a95fff6bc756d61e387d 100644 +index 7cd929d4b9ab60a585c2316b949fce2a0e97e467..2b1f3e27ce5cecc94297c27debe5e3bd64c08967 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -259,6 +259,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0898-Lazily-create-LootContext-for-criterions.patch b/patches/server/0897-Lazily-create-LootContext-for-criterions.patch similarity index 100% rename from patches/server/0898-Lazily-create-LootContext-for-criterions.patch rename to patches/server/0897-Lazily-create-LootContext-for-criterions.patch diff --git a/patches/server/0899-Don-t-fire-sync-events-during-worldgen.patch b/patches/server/0898-Don-t-fire-sync-events-during-worldgen.patch similarity index 97% rename from patches/server/0899-Don-t-fire-sync-events-during-worldgen.patch rename to patches/server/0898-Don-t-fire-sync-events-during-worldgen.patch index 4849f6aa02..60837d1de4 100644 --- a/patches/server/0899-Don-t-fire-sync-events-during-worldgen.patch +++ b/patches/server/0898-Don-t-fire-sync-events-during-worldgen.patch @@ -19,10 +19,10 @@ where generation happened directly to a ServerLevel and the entity still has the flag set. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 7cecbac43f1cd2d9516034ea9d2633c0c76e61f4..7a985c30a973efacf3e8b70e7163c550d86b0870 100644 +index 6923624f069c1aeb757386ef91d285769a2923a2..7ab4e93ae11e3a510cb58aeed8029c19dfccf31d 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1189,6 +1189,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1194,6 +1194,7 @@ 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 @@ -31,7 +31,7 @@ index 7cecbac43f1cd2d9516034ea9d2633c0c76e61f4..7a985c30a973efacf3e8b70e7163c550 if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable()); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4cd07d9a90885b59ef1b2be7562386d5e8c7b2ae..7657888bab53428fda9d3d10ac35bfddc5c16266 100644 +index 2342892db8b2bb1994727e611abb820f8104e486..12afae25cf60a402f92d1a4054738d50f076348c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -632,7 +632,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -68,7 +68,7 @@ index 64dc0bd1900575e40ac72a98c6df371223bd244c..c2693d530be00af16b2aa4ca4afd1d13 }, () -> { EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2bff94cef4fef66b81508a2ef4b5613e76044832..22c565fd6b14ae018f4526b174388ed5247600f6 100644 +index 84623aa24f8c90f0b51094c2d0773ee98c3a8524..3229db46d1efa2c58182043a3d2841040eb021f2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1159,6 +1159,11 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0900-Add-Structure-check-API.patch b/patches/server/0899-Add-Structure-check-API.patch similarity index 91% rename from patches/server/0900-Add-Structure-check-API.patch rename to patches/server/0899-Add-Structure-check-API.patch index ef58cef8a7..a7d968138a 100644 --- a/patches/server/0900-Add-Structure-check-API.patch +++ b/patches/server/0899-Add-Structure-check-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Structure check API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 305e1dc2d727841cd6dd23ec5ec0289e102552f8..e8b1d8fb12280f733b3d96a78991b14dcb4484c4 100644 +index b5b21852b4c3dc15e548afd81bdefbb83b9e7e9c..77faa873b22f59d27d5a99f4fef0d86a977875d0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -242,6 +242,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0901-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch b/patches/server/0900-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch similarity index 93% rename from patches/server/0901-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch rename to patches/server/0900-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch index db45e464ac..af848f2181 100644 --- a/patches/server/0901-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch +++ b/patches/server/0900-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix CraftMetaItem#getAttributeModifier duplication check diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index af78e73755743fb2db7a99b834affc963b44bc10..3bcc807005a677884255f1ee36cbf1653797ba55 100644 +index 43d1f278a56ff344ddf4e5d70471485b393a3b1d..2948fc39ad2f65739dea6b8256112b85ea755340 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -1666,7 +1666,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { diff --git a/patches/server/0902-Restore-vanilla-entity-drops-behavior.patch b/patches/server/0901-Restore-vanilla-entity-drops-behavior.patch similarity index 98% rename from patches/server/0902-Restore-vanilla-entity-drops-behavior.patch rename to patches/server/0901-Restore-vanilla-entity-drops-behavior.patch index 8ab0f9fb23..9bc5b11cbd 100644 --- a/patches/server/0902-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/0901-Restore-vanilla-entity-drops-behavior.patch @@ -9,7 +9,7 @@ on dropping the item instead of generalizing it for all dropped items like CB does. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 419fcb4cd97cf10a2601e02024b999a51a0ff952..df21cd1bd2a3dda7169edbea18bbfdf043db76f8 100644 +index e038664858c7af59f52a6328c73ecb27f8a16644..55a4424c47591d1bcaba306f6af877a4fb7144bf 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1235,20 +1235,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -37,7 +37,7 @@ index 419fcb4cd97cf10a2601e02024b999a51a0ff952..df21cd1bd2a3dda7169edbea18bbfdf0 loot.addAll(this.drops); this.drops.clear(); // SPIGOT-5188: make sure to clear diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7657888bab53428fda9d3d10ac35bfddc5c16266..b7594a0fd6fe7e25d13202c95b2c39a04e84abde 100644 +index 12afae25cf60a402f92d1a4054738d50f076348c..b2a62e6414abbe10b3338fcc1d68530856d59ba4 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2679,19 +2679,45 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -89,7 +89,7 @@ index 7657888bab53428fda9d3d10ac35bfddc5c16266..b7594a0fd6fe7e25d13202c95b2c39a0 return this.spawnAtLocation(world, entityitem); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 22c565fd6b14ae018f4526b174388ed5247600f6..8c3ec957210a259e26253dbb3a4191702ce6699c 100644 +index 3229db46d1efa2c58182043a3d2841040eb021f2..4fbd23d1783642becb39a404b988eb44c418c3b5 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -289,7 +289,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0903-Dont-resend-blocks-on-interactions.patch b/patches/server/0902-Dont-resend-blocks-on-interactions.patch similarity index 100% rename from patches/server/0903-Dont-resend-blocks-on-interactions.patch rename to patches/server/0902-Dont-resend-blocks-on-interactions.patch diff --git a/patches/server/0904-add-more-scoreboard-API.patch b/patches/server/0903-add-more-scoreboard-API.patch similarity index 100% rename from patches/server/0904-add-more-scoreboard-API.patch rename to patches/server/0903-add-more-scoreboard-API.patch diff --git a/patches/server/0905-Improve-Registry.patch b/patches/server/0904-Improve-Registry.patch similarity index 100% rename from patches/server/0905-Improve-Registry.patch rename to patches/server/0904-Improve-Registry.patch diff --git a/patches/server/0906-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch b/patches/server/0905-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch similarity index 97% rename from patches/server/0906-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch rename to patches/server/0905-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch index 0889a0b322..9f3a60df76 100644 --- a/patches/server/0906-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch +++ b/patches/server/0905-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch @@ -26,7 +26,7 @@ index c6dcc37ac5fcf50bcb246f533b99983dfc5c19c2..c13b6f14c3061710c2b27034db240cc9 d3 = to.getX(); d4 = to.getY(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8c3ec957210a259e26253dbb3a4191702ce6699c..0557a182a17a2891f2a9e0e4367d5102674e3b42 100644 +index 4fbd23d1783642becb39a404b988eb44c418c3b5..bd2df2a70e78b68b5eefd9c0b6fe14f9717fb1d7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4364,7 +4364,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0907-Add-experience-points-API.patch b/patches/server/0906-Add-experience-points-API.patch similarity index 97% rename from patches/server/0907-Add-experience-points-API.patch rename to patches/server/0906-Add-experience-points-API.patch index c202546913..b8ee3f5b5e 100644 --- a/patches/server/0907-Add-experience-points-API.patch +++ b/patches/server/0906-Add-experience-points-API.patch @@ -18,7 +18,7 @@ index aca888c2f02b09ac6739bdc81b194c4527dd69f5..a19a795deaa7f46c92b97912e2ade006 // Paper start - send while respecting visibility private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 69f2eb774b8aa364760b2e65a02bc547c1d89c9d..4b56cb08931b81f6ad81bd4e3ed991db7ab7629d 100644 +index 273a94f727c6c736b2bdf98c1806431ebce4d90f..a1c7e7b95718562d86ee8e6da1bb6e6b5d82ce7a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1931,6 +1931,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0908-Add-drops-to-shear-events.patch b/patches/server/0907-Add-drops-to-shear-events.patch similarity index 94% rename from patches/server/0908-Add-drops-to-shear-events.patch rename to patches/server/0907-Add-drops-to-shear-events.patch index 0ae1794dca..6e55898206 100644 --- a/patches/server/0908-Add-drops-to-shear-events.patch +++ b/patches/server/0907-Add-drops-to-shear-events.patch @@ -46,7 +46,7 @@ index 35076593f3ccd651295ae1fc9bcf8256c19672dd..8fda407c9fbfdde623564a7d9607275c + // Paper end - custom shear drops } diff --git a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java -index d4d343e2d75a3e3ea787c3c68c64970f5b239f81..feeb7bc34ae02e44d7f13f0bae5d175ef924c53a 100644 +index d4d343e2d75a3e3ea787c3c68c64970f5b239f81..eea02ea0d99425a60575f5fa729782494d579080 100644 --- a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java +++ b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java @@ -46,6 +46,7 @@ import net.minecraft.world.level.storage.loot.BuiltInLootTables; @@ -79,7 +79,7 @@ index d4d343e2d75a3e3ea787c3c68c64970f5b239f81..feeb7bc34ae02e44d7f13f0bae5d175e this.gameEvent(GameEvent.SHEAR, player); itemstack.hurtAndBreak(1, player, getSlotForHand(hand)); } -@@ -168,22 +176,32 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder { -+ for (final ItemStack drop : drops) { -+ ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(1.0D), this.getZ(), drop); -+ this.spawnAtLocation(world, entityitem); - } +- } - ++ // Paper start - custom shear drops; moved drop generation to separate method ++ drops.forEach(drop -> { ++ ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(1.0D), this.getZ(), drop); ++ this.spawnAtLocation(world, entityitem); + // Paper end - custom shear drops; moved drop generation to separate method }); }, EntityTransformEvent.TransformReason.SHEARED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED); // CraftBukkit } diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java -index 1bc638ab505850bffcbd08025de9664dd27e47c6..432ad1c785e133ef18390108fd342be50ec4dddc 100644 +index 1bc638ab505850bffcbd08025de9664dd27e47c6..0b7f8b8d8cd119d83e67a2cee389bd6117ac4cf7 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java +++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java @@ -173,11 +173,18 @@ public class Sheep extends Animal implements Shearable { @@ -150,7 +149,7 @@ index 1bc638ab505850bffcbd08025de9664dd27e47c6..432ad1c785e133ef18390108fd342be5 this.gameEvent(GameEvent.SHEAR, player); itemstack.hurtAndBreak(1, player, getSlotForHand(hand)); return InteractionResult.SUCCESS_SERVER; -@@ -192,9 +199,26 @@ public class Sheep extends Animal implements Shearable { +@@ -192,11 +199,28 @@ public class Sheep extends Animal implements Shearable { @Override public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears) { @@ -177,8 +176,11 @@ index 1bc638ab505850bffcbd08025de9664dd27e47c6..432ad1c785e133ef18390108fd342be5 + drops.forEach(itemstack1 -> { // Paper - custom drops - loop in generated default drops + if (true) { // Paper - custom drops - loop in generated default drops this.forceDrops = true; // CraftBukkit - ItemEntity entityitem = this.spawnAtLocation(worldserver1, itemstack1.copyWithCount(1), 1.0F); +- ItemEntity entityitem = this.spawnAtLocation(worldserver1, itemstack1.copyWithCount(1), 1.0F); ++ ItemEntity entityitem = this.spawnAtLocation(worldserver1, itemstack1, 1.0F); // Paper - custom drops - copy already done above this.forceDrops = false; // CraftBukkit + + if (entityitem != null) { diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java index 975a9e35303bec29aedfbd554c38e4331cdfb174..fd9f6c17448a4d87f940eb8f544ecb9669068582 100644 --- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java @@ -234,7 +236,7 @@ index 975a9e35303bec29aedfbd554c38e4331cdfb174..fd9f6c17448a4d87f940eb8f544ecb96 this.spawnAtLocation(worldserver1, itemstack1, this.getEyeHeight()); this.forceDrops = false; // CraftBukkit diff --git a/src/main/java/net/minecraft/world/entity/monster/Bogged.java b/src/main/java/net/minecraft/world/entity/monster/Bogged.java -index 9d416f775fa19ad1978c7c9c9e0d5bc16728879d..18dae37d65552077aa3825c76f433bbd31152db9 100644 +index be029746905aeba218684b883282649089657de3..975477663b6d76a69c006a89e440e21471b39b89 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java +++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java @@ -27,6 +27,7 @@ import net.minecraft.world.item.Items; @@ -257,7 +259,7 @@ index 9d416f775fa19ad1978c7c9c9e0d5bc16728879d..18dae37d65552077aa3825c76f433bbd + org.bukkit.event.player.PlayerShearEntityEvent event = CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops); + if (event != null) { + if (event.isCancelled()) { -+ this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients ++ // this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients // Paper - no longer needed + return InteractionResult.PASS; + } + drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops()); @@ -269,7 +271,7 @@ index 9d416f775fa19ad1978c7c9c9e0d5bc16728879d..18dae37d65552077aa3825c76f433bbd this.gameEvent(GameEvent.SHEAR, player); itemstack.hurtAndBreak(1, player, getSlotForHand(hand)); } -@@ -139,13 +147,32 @@ public class Bogged extends AbstractSkeleton implements Shearable { +@@ -139,14 +147,33 @@ public class Bogged extends AbstractSkeleton implements Shearable { @Override public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears) { @@ -296,17 +298,18 @@ index 9d416f775fa19ad1978c7c9c9e0d5bc16728879d..18dae37d65552077aa3825c76f433bbd } - private void spawnShearedMushrooms(ServerLevel world, ItemStack shears) { -- this.dropFromShearingLootTable(world, BuiltInLootTables.BOGGED_SHEAR, shears, (worldserver1, itemstack1) -> { + // Paper start - custom shear drops + private void spawnShearedMushrooms(ServerLevel world, ItemStack shears, java.util.List drops) { + final ServerLevel worldserver1 = world; // Named for lambda consumption + this.forceDrops = true; // Paper - Add missing forceDrop toggles +- this.dropFromShearingLootTable(world, BuiltInLootTables.BOGGED_SHEAR, shears, (worldserver1, itemstack1) -> { + drops.forEach(itemstack1 -> { + // Paper end - custom shear drops this.spawnAtLocation(worldserver1, itemstack1, this.getBbHeight()); }); - } + this.forceDrops = false; // Paper - Add missing forceDrop toggles diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a0455f590d549343d6d8fd7991ba1b87a87acdb8..e7749a3ef6289d73379649f2f76f4e4fdfac7a8b 100644 +index 1c87019f5eb8e51accef3dc7ee949cdf2bec8f72..ea4e1bf4bfe003c102ecce5958131aa86ec83864 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1689,20 +1689,20 @@ public class CraftEventFactory { diff --git a/patches/server/0909-Add-PlayerShieldDisableEvent.patch b/patches/server/0908-Add-PlayerShieldDisableEvent.patch similarity index 100% rename from patches/server/0909-Add-PlayerShieldDisableEvent.patch rename to patches/server/0908-Add-PlayerShieldDisableEvent.patch diff --git a/patches/server/0910-Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/0909-Validate-ResourceLocation-in-NBT-reading.patch similarity index 99% rename from patches/server/0910-Validate-ResourceLocation-in-NBT-reading.patch rename to patches/server/0909-Validate-ResourceLocation-in-NBT-reading.patch index 5374ae13cb..cbc12c1bb2 100644 --- a/patches/server/0910-Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/0909-Validate-ResourceLocation-in-NBT-reading.patch @@ -85,7 +85,7 @@ index b7721ed97305d1cd6725935f965c2effc1bef5a1..5f880a8809f9c20bc8e8c0b2d48590ba if (nbt.contains("leash", 11)) { Either either = (Either) NbtUtils.readBlockPos(nbt, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 97a524db692b7367f22a373439c1233b143f4a17..2fa73a9f444628a5e0df9f54e9bcd453973f0029 100644 +index bd2df2a70e78b68b5eefd9c0b6fe14f9717fb1d7..c1c92bdbe133bd60cf2920a2195bbb15d0f94455 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -909,11 +909,13 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0911-Properly-handle-experience-dropping-on-block-break.patch b/patches/server/0910-Properly-handle-experience-dropping-on-block-break.patch similarity index 100% rename from patches/server/0911-Properly-handle-experience-dropping-on-block-break.patch rename to patches/server/0910-Properly-handle-experience-dropping-on-block-break.patch diff --git a/patches/server/0912-Fixup-NamespacedKey-handling.patch b/patches/server/0911-Fixup-NamespacedKey-handling.patch similarity index 100% rename from patches/server/0912-Fixup-NamespacedKey-handling.patch rename to patches/server/0911-Fixup-NamespacedKey-handling.patch diff --git a/patches/server/0913-Expose-LootTable-of-DecoratedPot.patch b/patches/server/0912-Expose-LootTable-of-DecoratedPot.patch similarity index 100% rename from patches/server/0913-Expose-LootTable-of-DecoratedPot.patch rename to patches/server/0912-Expose-LootTable-of-DecoratedPot.patch diff --git a/patches/server/0914-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0913-Reduce-allocation-of-Vec3D-by-entity-tracker.patch similarity index 100% rename from patches/server/0914-Reduce-allocation-of-Vec3D-by-entity-tracker.patch rename to patches/server/0913-Reduce-allocation-of-Vec3D-by-entity-tracker.patch diff --git a/patches/server/0915-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch b/patches/server/0914-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch similarity index 100% rename from patches/server/0915-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch rename to patches/server/0914-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch diff --git a/patches/server/0916-Add-ShulkerDuplicateEvent.patch b/patches/server/0915-Add-ShulkerDuplicateEvent.patch similarity index 100% rename from patches/server/0916-Add-ShulkerDuplicateEvent.patch rename to patches/server/0915-Add-ShulkerDuplicateEvent.patch diff --git a/patches/server/0917-Add-api-for-spawn-egg-texture-colors.patch b/patches/server/0916-Add-api-for-spawn-egg-texture-colors.patch similarity index 100% rename from patches/server/0917-Add-api-for-spawn-egg-texture-colors.patch rename to patches/server/0916-Add-api-for-spawn-egg-texture-colors.patch diff --git a/patches/server/0918-Add-Lifecycle-Event-system.patch b/patches/server/0917-Add-Lifecycle-Event-system.patch similarity index 99% rename from patches/server/0918-Add-Lifecycle-Event-system.patch rename to patches/server/0917-Add-Lifecycle-Event-system.patch index 6b71908eac..b1b86fa7e1 100644 --- a/patches/server/0918-Add-Lifecycle-Event-system.patch +++ b/patches/server/0917-Add-Lifecycle-Event-system.patch @@ -727,7 +727,7 @@ index 2e96308696e131f3f013469a395e5ddda2c5d529..65a66e484c1c39c5f41d97db52f31c67 } catch (Throwable e) { LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9ab601a8e455196cd04dfa0fa81c4d356ec62b13..5112fdb9faf4b2761bb2b7107c49952f37be030c 100644 +index ee79e3374b50ba21620a9685975a0341c15f313b..7cc96d03472a4cb94e679251f0969995284f7eaa 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1050,6 +1050,11 @@ public final class CraftServer implements Server { diff --git a/patches/server/0919-ItemStack-Tooltip-API.patch b/patches/server/0918-ItemStack-Tooltip-API.patch similarity index 100% rename from patches/server/0919-ItemStack-Tooltip-API.patch rename to patches/server/0918-ItemStack-Tooltip-API.patch diff --git a/patches/server/0920-Add-getChunkSnapshot-includeLightData-parameter.patch b/patches/server/0919-Add-getChunkSnapshot-includeLightData-parameter.patch similarity index 100% rename from patches/server/0920-Add-getChunkSnapshot-includeLightData-parameter.patch rename to patches/server/0919-Add-getChunkSnapshot-includeLightData-parameter.patch diff --git a/patches/server/0921-Add-FluidState-API.patch b/patches/server/0920-Add-FluidState-API.patch similarity index 100% rename from patches/server/0921-Add-FluidState-API.patch rename to patches/server/0920-Add-FluidState-API.patch diff --git a/patches/server/0922-add-number-format-api.patch b/patches/server/0921-add-number-format-api.patch similarity index 100% rename from patches/server/0922-add-number-format-api.patch rename to patches/server/0921-add-number-format-api.patch diff --git a/patches/server/0923-improve-BanList-types.patch b/patches/server/0922-improve-BanList-types.patch similarity index 93% rename from patches/server/0923-improve-BanList-types.patch rename to patches/server/0922-improve-BanList-types.patch index c89914131f..4d46a5f1dc 100644 --- a/patches/server/0923-improve-BanList-types.patch +++ b/patches/server/0922-improve-BanList-types.patch @@ -5,7 +5,7 @@ Subject: [PATCH] improve BanList types diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a2c749b2997557fec5c978f3bed8c35d7614e740..6136037d3d096300d93b9710dd854224b30e0738 100644 +index 7cc96d03472a4cb94e679251f0969995284f7eaa..54ef70eff81194c85d6433d00382a5909b6d797f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2260,6 +2260,21 @@ public final class CraftServer implements Server { diff --git a/patches/server/0924-Expanded-Hopper-API.patch b/patches/server/0923-Expanded-Hopper-API.patch similarity index 100% rename from patches/server/0924-Expanded-Hopper-API.patch rename to patches/server/0923-Expanded-Hopper-API.patch diff --git a/patches/server/0925-Add-BlockBreakProgressUpdateEvent.patch b/patches/server/0924-Add-BlockBreakProgressUpdateEvent.patch similarity index 90% rename from patches/server/0925-Add-BlockBreakProgressUpdateEvent.patch rename to patches/server/0924-Add-BlockBreakProgressUpdateEvent.patch index 9b57c89df5..35b4cf39bc 100644 --- a/patches/server/0925-Add-BlockBreakProgressUpdateEvent.patch +++ b/patches/server/0924-Add-BlockBreakProgressUpdateEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockBreakProgressUpdateEvent diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 7a985c30a973efacf3e8b70e7163c550d86b0870..ea1281c9a3b83b17de64d583e029db9bacabcd88 100644 +index 7ab4e93ae11e3a510cb58aeed8029c19dfccf31d..b8c7894ad47280ecdc141e7075e3723156214e93 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1285,6 +1285,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1290,6 +1290,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (entity instanceof Player) entityhuman = (Player) entity; // CraftBukkit end diff --git a/patches/server/0926-Deprecate-ItemStack-setType.patch b/patches/server/0925-Deprecate-ItemStack-setType.patch similarity index 100% rename from patches/server/0926-Deprecate-ItemStack-setType.patch rename to patches/server/0925-Deprecate-ItemStack-setType.patch diff --git a/patches/server/0927-Add-CartographyItemEvent.patch b/patches/server/0926-Add-CartographyItemEvent.patch similarity index 100% rename from patches/server/0927-Add-CartographyItemEvent.patch rename to patches/server/0926-Add-CartographyItemEvent.patch diff --git a/patches/server/0928-More-Raid-API.patch b/patches/server/0927-More-Raid-API.patch similarity index 96% rename from patches/server/0928-More-Raid-API.patch rename to patches/server/0927-More-Raid-API.patch index 6fc560a121..c9f33a2368 100644 --- a/patches/server/0928-More-Raid-API.patch +++ b/patches/server/0927-More-Raid-API.patch @@ -86,10 +86,10 @@ index b8ce1c1c2447f9cff1717bfcfd6eb911ade0d4b3..51f21af9d75769abdcba713b9aa33392 + // Paper end - more Raid API } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index e8b1d8fb12280f733b3d96a78991b14dcb4484c4..86d653da7e0ed8123e769eb48c6de2e1396e4fe0 100644 +index 77faa873b22f59d27d5a99f4fef0d86a977875d0..06b73ace3ae89e8a9de592bb4b8439b4e0cac9f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2318,6 +2318,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2306,6 +2306,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { return (raid == null) ? null : new CraftRaid(raid); } diff --git a/patches/server/0929-Add-onboarding-message-for-initial-server-start.patch b/patches/server/0928-Add-onboarding-message-for-initial-server-start.patch similarity index 100% rename from patches/server/0929-Add-onboarding-message-for-initial-server-start.patch rename to patches/server/0928-Add-onboarding-message-for-initial-server-start.patch diff --git a/patches/server/0930-Configurable-max-block-fluid-ticks.patch b/patches/server/0929-Configurable-max-block-fluid-ticks.patch similarity index 87% rename from patches/server/0930-Configurable-max-block-fluid-ticks.patch rename to patches/server/0929-Configurable-max-block-fluid-ticks.patch index c93e0006cc..8f7fdf137d 100644 --- a/patches/server/0930-Configurable-max-block-fluid-ticks.patch +++ b/patches/server/0929-Configurable-max-block-fluid-ticks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max block/fluid ticks diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ea1281c9a3b83b17de64d583e029db9bacabcd88..711d5136124c0fa21015f0154057ab5742071e59 100644 +index b8c7894ad47280ecdc141e7075e3723156214e93..a0d663a8f041018b617099be86a133f814ad6356 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -489,9 +489,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -494,9 +494,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (!this.isDebug() && flag) { j = this.getGameTime(); gameprofilerfiller.push("blockTicks"); diff --git a/patches/server/0931-Fix-bees-aging-inside-hives.patch b/patches/server/0930-Fix-bees-aging-inside-hives.patch similarity index 100% rename from patches/server/0931-Fix-bees-aging-inside-hives.patch rename to patches/server/0930-Fix-bees-aging-inside-hives.patch diff --git a/patches/server/0932-Disable-memory-reserve-allocating.patch b/patches/server/0931-Disable-memory-reserve-allocating.patch similarity index 100% rename from patches/server/0932-Disable-memory-reserve-allocating.patch rename to patches/server/0931-Disable-memory-reserve-allocating.patch diff --git a/patches/server/0933-Fire-EntityDamageByEntityEvent-for-unowned-wither-sk.patch b/patches/server/0932-Fire-EntityDamageByEntityEvent-for-unowned-wither-sk.patch similarity index 100% rename from patches/server/0933-Fire-EntityDamageByEntityEvent-for-unowned-wither-sk.patch rename to patches/server/0932-Fire-EntityDamageByEntityEvent-for-unowned-wither-sk.patch diff --git a/patches/server/0934-Fix-DamageSource-API.patch b/patches/server/0933-Fix-DamageSource-API.patch similarity index 99% rename from patches/server/0934-Fix-DamageSource-API.patch rename to patches/server/0933-Fix-DamageSource-API.patch index d03ac9d5ef..641e4cb5ad 100644 --- a/patches/server/0934-Fix-DamageSource-API.patch +++ b/patches/server/0933-Fix-DamageSource-API.patch @@ -84,7 +84,7 @@ index fddbdb7322a2063996a28c5c3d93c265188b1256..be87cb3cfa15a7d889118cdc4b87232e public DamageSource sonicBoom(Entity attacker) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b7594a0fd6fe7e25d13202c95b2c39a04e84abde..6ebd653ea3c302f26d02f81b6718924708148e4c 100644 +index b2a62e6414abbe10b3338fcc1d68530856d59ba4..ef764777c3054522aa875026addd3d1e7cc3d2ec 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3389,7 +3389,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0935-Fix-creation-of-invalid-block-entity-during-world-ge.patch b/patches/server/0934-Fix-creation-of-invalid-block-entity-during-world-ge.patch similarity index 100% rename from patches/server/0935-Fix-creation-of-invalid-block-entity-during-world-ge.patch rename to patches/server/0934-Fix-creation-of-invalid-block-entity-during-world-ge.patch diff --git a/patches/server/0936-Fix-possible-StackOverflowError-and-NPE-for-some-dis.patch b/patches/server/0935-Fix-possible-StackOverflowError-and-NPE-for-some-dis.patch similarity index 100% rename from patches/server/0936-Fix-possible-StackOverflowError-and-NPE-for-some-dis.patch rename to patches/server/0935-Fix-possible-StackOverflowError-and-NPE-for-some-dis.patch diff --git a/patches/server/0937-Improve-tag-parser-handling.patch b/patches/server/0936-Improve-tag-parser-handling.patch similarity index 100% rename from patches/server/0937-Improve-tag-parser-handling.patch rename to patches/server/0936-Improve-tag-parser-handling.patch diff --git a/patches/server/0938-Item-Mutation-Fixes.patch b/patches/server/0937-Item-Mutation-Fixes.patch similarity index 100% rename from patches/server/0938-Item-Mutation-Fixes.patch rename to patches/server/0937-Item-Mutation-Fixes.patch diff --git a/patches/server/0939-Per-world-ticks-per-spawn-settings.patch b/patches/server/0938-Per-world-ticks-per-spawn-settings.patch similarity index 100% rename from patches/server/0939-Per-world-ticks-per-spawn-settings.patch rename to patches/server/0938-Per-world-ticks-per-spawn-settings.patch diff --git a/patches/server/0940-Properly-track-the-changed-item-from-dispense-events.patch b/patches/server/0939-Properly-track-the-changed-item-from-dispense-events.patch similarity index 100% rename from patches/server/0940-Properly-track-the-changed-item-from-dispense-events.patch rename to patches/server/0939-Properly-track-the-changed-item-from-dispense-events.patch diff --git a/patches/server/0941-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/0940-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch similarity index 100% rename from patches/server/0941-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch rename to patches/server/0940-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch diff --git a/patches/server/0942-Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/0941-Add-config-for-mobs-immune-to-default-effects.patch similarity index 100% rename from patches/server/0942-Add-config-for-mobs-immune-to-default-effects.patch rename to patches/server/0941-Add-config-for-mobs-immune-to-default-effects.patch diff --git a/patches/server/0943-Deep-clone-nbt-tags-in-PDC.patch b/patches/server/0942-Deep-clone-nbt-tags-in-PDC.patch similarity index 96% rename from patches/server/0943-Deep-clone-nbt-tags-in-PDC.patch rename to patches/server/0942-Deep-clone-nbt-tags-in-PDC.patch index 559c6cddea..f2a98afbc1 100644 --- a/patches/server/0943-Deep-clone-nbt-tags-in-PDC.patch +++ b/patches/server/0942-Deep-clone-nbt-tags-in-PDC.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Deep clone nbt tags in PDC diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 3bcc807005a677884255f1ee36cbf1653797ba55..8d13505c36d732f17293c6a6d65cac20919b8b7a 100644 +index 2948fc39ad2f65739dea6b8256112b85ea755340..8cfc5a381aa39b8ec396efeed6d456cbf3e792f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -372,7 +372,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { diff --git a/patches/server/0944-Support-old-UUID-format-for-NBT.patch b/patches/server/0943-Support-old-UUID-format-for-NBT.patch similarity index 100% rename from patches/server/0944-Support-old-UUID-format-for-NBT.patch rename to patches/server/0943-Support-old-UUID-format-for-NBT.patch diff --git a/patches/server/0945-Fix-shield-disable-inconsistency.patch b/patches/server/0944-Fix-shield-disable-inconsistency.patch similarity index 92% rename from patches/server/0945-Fix-shield-disable-inconsistency.patch rename to patches/server/0944-Fix-shield-disable-inconsistency.patch index 3dcabedf09..0c35d7cbf8 100644 --- a/patches/server/0945-Fix-shield-disable-inconsistency.patch +++ b/patches/server/0944-Fix-shield-disable-inconsistency.patch @@ -8,7 +8,7 @@ it will not disable the shield if the attacker is holding an axe item. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9154f43b578176e13604a7cbd8c210ff3b0ecce9..241c0b1d509bf60104820914a32b81edfdbb33c4 100644 +index c1c92bdbe133bd60cf2920a2195bbb15d0f94455..d08eec460a67fbd0b2ed2e0dd6d557dc629f4dfe 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2425,7 +2425,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0946-Handle-Large-Packets-disconnecting-client.patch b/patches/server/0945-Handle-Large-Packets-disconnecting-client.patch similarity index 100% rename from patches/server/0946-Handle-Large-Packets-disconnecting-client.patch rename to patches/server/0945-Handle-Large-Packets-disconnecting-client.patch diff --git a/patches/server/0947-Fix-ItemFlags.patch b/patches/server/0946-Fix-ItemFlags.patch similarity index 99% rename from patches/server/0947-Fix-ItemFlags.patch rename to patches/server/0946-Fix-ItemFlags.patch index e045394f3c..e37a753912 100644 --- a/patches/server/0947-Fix-ItemFlags.patch +++ b/patches/server/0946-Fix-ItemFlags.patch @@ -33,7 +33,7 @@ index 73fe41322e0349ad1d46a760f621b6c91112e90e..19af55ec2bf62b70bd3be44f499b32f5 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 8d13505c36d732f17293c6a6d65cac20919b8b7a..6b3eed94c26bc16177f9b9fadd140f9a89163af2 100644 +index 8cfc5a381aa39b8ec396efeed6d456cbf3e792f9..6641c72ddb9fd55f1c25f33a5272fd3c85a6cf5c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -275,6 +275,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { diff --git a/patches/server/0948-Fix-damage-modifier-inconsistencies.patch b/patches/server/0947-Fix-damage-modifier-inconsistencies.patch similarity index 94% rename from patches/server/0948-Fix-damage-modifier-inconsistencies.patch rename to patches/server/0947-Fix-damage-modifier-inconsistencies.patch index 1494c35c06..57f6c98116 100644 --- a/patches/server/0948-Fix-damage-modifier-inconsistencies.patch +++ b/patches/server/0947-Fix-damage-modifier-inconsistencies.patch @@ -8,7 +8,7 @@ reduction is not applied like in Vanilla. Additionally fix the "is_freezing" damage type tag. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 418e67ef5896325fe143501f5a4f1604b065ba0f..864e4c660bf3d381880e5928b6945bea213ac57e 100644 +index 41a0650bfd6e72b83364441dd76df3d561d3163e..deba03eb37012c638e08e20cd1c98e9db190c790 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1222,11 +1222,11 @@ public class CraftEventFactory { diff --git a/patches/server/0949-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch b/patches/server/0948-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch similarity index 96% rename from patches/server/0949-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch rename to patches/server/0948-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch index ce7f3d5550..811e5396d1 100644 --- a/patches/server/0949-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch +++ b/patches/server/0948-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Revert to vanilla handling of LivingEntity#actuallyHurt diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 241c0b1d509bf60104820914a32b81edfdbb33c4..fe545447bdb982355491ec83c14993325dcc799d 100644 +index d08eec460a67fbd0b2ed2e0dd6d557dc629f4dfe..555d1b05ef6278567de598488b9486db965b8587 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1455,7 +1455,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0950-improve-checking-handled-tags-in-itemmeta.patch b/patches/server/0949-improve-checking-handled-tags-in-itemmeta.patch similarity index 99% rename from patches/server/0950-improve-checking-handled-tags-in-itemmeta.patch rename to patches/server/0949-improve-checking-handled-tags-in-itemmeta.patch index 8d257c881d..f90c4b0ad0 100644 --- a/patches/server/0950-improve-checking-handled-tags-in-itemmeta.patch +++ b/patches/server/0949-improve-checking-handled-tags-in-itemmeta.patch @@ -456,7 +456,7 @@ index 4941e0afff8df5f10f06c715b54bf58eb86051c5..566d893a413fd04b99e83dc2da8fe958 getOrEmpty(tag, CraftMetaFirework.FIREWORKS).ifPresent((fireworks) -> { this.power = fireworks.flightDuration(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 6b3eed94c26bc16177f9b9fadd140f9a89163af2..13b19adc21ece31476b2980c5bc01a50f15df634 100644 +index 6641c72ddb9fd55f1c25f33a5272fd3c85a6cf5c..c42a6ced8c04dc04c918550ab8f9722d89183cca 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -389,7 +389,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { diff --git a/patches/server/0951-Expose-hasColor-to-leather-armor.patch b/patches/server/0950-Expose-hasColor-to-leather-armor.patch similarity index 100% rename from patches/server/0951-Expose-hasColor-to-leather-armor.patch rename to patches/server/0950-Expose-hasColor-to-leather-armor.patch diff --git a/patches/server/0952-Added-API-to-get-player-ha-proxy-address.patch b/patches/server/0951-Added-API-to-get-player-ha-proxy-address.patch similarity index 97% rename from patches/server/0952-Added-API-to-get-player-ha-proxy-address.patch rename to patches/server/0951-Added-API-to-get-player-ha-proxy-address.patch index c52dab2de0..b1e5e78bb0 100644 --- a/patches/server/0952-Added-API-to-get-player-ha-proxy-address.patch +++ b/patches/server/0951-Added-API-to-get-player-ha-proxy-address.patch @@ -35,7 +35,7 @@ index c62df32af11636ad408b584fcc590590ce4fb0d0..baed0bb80d44973f9323bbe536551182 } else { super.channelRead(ctx, msg); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 58d12409447903f855baa6beb149aa658bf7b1bb..766c1e80997d1bed99f4ebf9499eec60bf70a536 100644 +index a1c7e7b95718562d86ee8e6da1bb6e6b5d82ce7a..700751a1469dd99339e6502e96cd98e72feee803 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -270,7 +270,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0953-General-ItemMeta-fixes.patch b/patches/server/0952-General-ItemMeta-fixes.patch similarity index 100% rename from patches/server/0953-General-ItemMeta-fixes.patch rename to patches/server/0952-General-ItemMeta-fixes.patch diff --git a/patches/server/0954-More-Chest-Block-API.patch b/patches/server/0953-More-Chest-Block-API.patch similarity index 100% rename from patches/server/0954-More-Chest-Block-API.patch rename to patches/server/0953-More-Chest-Block-API.patch diff --git a/patches/server/0955-Print-data-component-type-on-encoding-error.patch b/patches/server/0954-Print-data-component-type-on-encoding-error.patch similarity index 100% rename from patches/server/0955-Print-data-component-type-on-encoding-error.patch rename to patches/server/0954-Print-data-component-type-on-encoding-error.patch diff --git a/patches/server/0956-Brigadier-based-command-API.patch b/patches/server/0955-Brigadier-based-command-API.patch similarity index 99% rename from patches/server/0956-Brigadier-based-command-API.patch rename to patches/server/0955-Brigadier-based-command-API.patch index 924a5f032b..9d2a8822f5 100644 --- a/patches/server/0956-Brigadier-based-command-API.patch +++ b/patches/server/0955-Brigadier-based-command-API.patch @@ -2376,7 +2376,7 @@ index c4ffa8519b520e0793af90e149518951d7ffb65b..688916c8fef40d4c81379ad38609a979 // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1827b6d6e1d14b89305da61b261cb3720690922f..0289bd3e047847a1ecd66ca30863bd0408645667 100644 +index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8ad87d16c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -275,11 +275,11 @@ public final class CraftServer implements Server { diff --git a/patches/server/0957-Fix-issues-with-Recipe-API.patch b/patches/server/0956-Fix-issues-with-Recipe-API.patch similarity index 100% rename from patches/server/0957-Fix-issues-with-Recipe-API.patch rename to patches/server/0956-Fix-issues-with-Recipe-API.patch diff --git a/patches/server/0958-Fix-equipment-slot-and-group-API.patch b/patches/server/0957-Fix-equipment-slot-and-group-API.patch similarity index 98% rename from patches/server/0958-Fix-equipment-slot-and-group-API.patch rename to patches/server/0957-Fix-equipment-slot-and-group-API.patch index 8c113014bb..aeb8a79cfa 100644 --- a/patches/server/0958-Fix-equipment-slot-and-group-API.patch +++ b/patches/server/0957-Fix-equipment-slot-and-group-API.patch @@ -52,7 +52,7 @@ index e62baea16df017f1e394e3c706157e158066eb93..656c9a6d8cd42891141ee29ec91ab5d1 throw new IllegalArgumentException("Could not get slot " + slot + " - not a valid slot for PlayerInventory"); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 71d0ade48d450b76be9cb396ac613fa4c783679e..b24857e34d87ea4fa9aa0db0ba684014c2625cc1 100644 +index 29946404ed7fe29c9f7457fcf5650111cd6411a9..37a8954f37a97afdbcc7b7c7026371f477cb3655 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -1704,7 +1704,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { diff --git a/patches/server/0959-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch b/patches/server/0958-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch similarity index 100% rename from patches/server/0959-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch rename to patches/server/0958-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch diff --git a/patches/server/0960-Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/0959-Prevent-sending-oversized-item-data-in-equipment-and.patch similarity index 99% rename from patches/server/0960-Prevent-sending-oversized-item-data-in-equipment-and.patch rename to patches/server/0959-Prevent-sending-oversized-item-data-in-equipment-and.patch index 58783adedb..75e7f6ee9d 100644 --- a/patches/server/0960-Prevent-sending-oversized-item-data-in-equipment-and.patch +++ b/patches/server/0959-Prevent-sending-oversized-item-data-in-equipment-and.patch @@ -222,7 +222,7 @@ index 688916c8fef40d4c81379ad38609a97993b4b702..6cf3b28749d92b4e33e2f88c6335c9a6 ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote(); // Paper - fix slot desync - always refresh player inventory diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index fe545447bdb982355491ec83c14993325dcc799d..6feab3d1b85857ab2c5b2228f2b0d5e6c2a5518d 100644 +index 555d1b05ef6278567de598488b9486db965b8587..e33130ca8f3d2572018dd782b366af2989a95fd6 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3461,7 +3461,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0961-Prevent-NPE-if-hooked-entity-was-cleared.patch b/patches/server/0960-Prevent-NPE-if-hooked-entity-was-cleared.patch similarity index 100% rename from patches/server/0961-Prevent-NPE-if-hooked-entity-was-cleared.patch rename to patches/server/0960-Prevent-NPE-if-hooked-entity-was-cleared.patch diff --git a/patches/server/0962-Fix-cancelling-BlockPlaceEvent-calling-onRemove.patch b/patches/server/0961-Fix-cancelling-BlockPlaceEvent-calling-onRemove.patch similarity index 100% rename from patches/server/0962-Fix-cancelling-BlockPlaceEvent-calling-onRemove.patch rename to patches/server/0961-Fix-cancelling-BlockPlaceEvent-calling-onRemove.patch diff --git a/patches/server/0963-Add-missing-fishing-event-state.patch b/patches/server/0962-Add-missing-fishing-event-state.patch similarity index 100% rename from patches/server/0963-Add-missing-fishing-event-state.patch rename to patches/server/0962-Add-missing-fishing-event-state.patch diff --git a/patches/server/0964-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch b/patches/server/0963-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch similarity index 100% rename from patches/server/0964-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch rename to patches/server/0963-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch diff --git a/patches/server/0965-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch b/patches/server/0964-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch similarity index 100% rename from patches/server/0965-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch rename to patches/server/0964-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch diff --git a/patches/server/0966-Adopt-MaterialRerouting.patch b/patches/server/0965-Adopt-MaterialRerouting.patch similarity index 99% rename from patches/server/0966-Adopt-MaterialRerouting.patch rename to patches/server/0965-Adopt-MaterialRerouting.patch index 648057e1dd..e66973fb9d 100644 --- a/patches/server/0966-Adopt-MaterialRerouting.patch +++ b/patches/server/0965-Adopt-MaterialRerouting.patch @@ -1,5 +1,5 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll +From: Bjarne Koll Date: Thu, 13 Jun 2024 11:02:36 +0200 Subject: [PATCH] Adopt MaterialRerouting diff --git a/patches/server/0967-Suspicious-Effect-Entry-API.patch b/patches/server/0966-Suspicious-Effect-Entry-API.patch similarity index 100% rename from patches/server/0967-Suspicious-Effect-Entry-API.patch rename to patches/server/0966-Suspicious-Effect-Entry-API.patch diff --git a/patches/server/0968-check-if-itemstack-is-stackable-first.patch b/patches/server/0967-check-if-itemstack-is-stackable-first.patch similarity index 100% rename from patches/server/0968-check-if-itemstack-is-stackable-first.patch rename to patches/server/0967-check-if-itemstack-is-stackable-first.patch diff --git a/patches/server/0969-Fix-removing-recipes-from-RecipeIterator.patch b/patches/server/0968-Fix-removing-recipes-from-RecipeIterator.patch similarity index 100% rename from patches/server/0969-Fix-removing-recipes-from-RecipeIterator.patch rename to patches/server/0968-Fix-removing-recipes-from-RecipeIterator.patch diff --git a/patches/server/0970-Configurable-damage-tick-when-blocking-with-shield.patch b/patches/server/0969-Configurable-damage-tick-when-blocking-with-shield.patch similarity index 89% rename from patches/server/0970-Configurable-damage-tick-when-blocking-with-shield.patch rename to patches/server/0969-Configurable-damage-tick-when-blocking-with-shield.patch index a161fd71b6..0c5196e832 100644 --- a/patches/server/0970-Configurable-damage-tick-when-blocking-with-shield.patch +++ b/patches/server/0969-Configurable-damage-tick-when-blocking-with-shield.patch @@ -1,11 +1,11 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll +From: Bjarne Koll Date: Thu, 13 Jun 2024 17:16:01 +0200 Subject: [PATCH] Configurable damage tick when blocking with shield diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 6feab3d1b85857ab2c5b2228f2b0d5e6c2a5518d..ff7616e1d6d6c821a75649812ec69e0dc6a8e378 100644 +index e33130ca8f3d2572018dd782b366af2989a95fd6..6a89a9af2ccb82ee1162b14f4be5a868b927a34d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2487,7 +2487,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0971-Properly-remove-the-experimental-smithing-inventory-.patch b/patches/server/0970-Properly-remove-the-experimental-smithing-inventory-.patch similarity index 100% rename from patches/server/0971-Properly-remove-the-experimental-smithing-inventory-.patch rename to patches/server/0970-Properly-remove-the-experimental-smithing-inventory-.patch diff --git a/patches/server/0972-disable-forced-empty-world-ticks.patch b/patches/server/0971-disable-forced-empty-world-ticks.patch similarity index 87% rename from patches/server/0972-disable-forced-empty-world-ticks.patch rename to patches/server/0971-disable-forced-empty-world-ticks.patch index ae366dd7f0..dd54449a10 100644 --- a/patches/server/0972-disable-forced-empty-world-ticks.patch +++ b/patches/server/0971-disable-forced-empty-world-ticks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] disable forced empty world ticks diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 711d5136124c0fa21015f0154057ab5742071e59..24df2baaeb34eccbe148ac0e518f44e9a869ffa5 100644 +index a0d663a8f041018b617099be86a133f814ad6356..b6b80285a54efd6012c4eedbdc5b2af702f27981 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -509,7 +509,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -514,7 +514,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.handlingTick = false; gameprofilerfiller.pop(); diff --git a/patches/server/0973-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch b/patches/server/0972-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch similarity index 100% rename from patches/server/0973-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch rename to patches/server/0972-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch diff --git a/patches/server/0974-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0973-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch similarity index 96% rename from patches/server/0974-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch rename to patches/server/0973-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index 8ab2de5f02..9962dfd635 100644 --- a/patches/server/0974-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/patches/server/0973-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -15,10 +15,10 @@ Additionally, numerous issues to player position tracking on maps has been fixed Feature patch diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 24df2baaeb34eccbe148ac0e518f44e9a869ffa5..ce148cf5930cdcf0163c7f6416cbbd89e4d22720 100644 +index b6b80285a54efd6012c4eedbdc5b2af702f27981..be35f9ab6d8877aad755a6ac0344a901b61a49de 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2333,6 +2333,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2338,6 +2338,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe { if ( iter.next().player == entity ) { @@ -27,7 +27,7 @@ index 24df2baaeb34eccbe148ac0e518f44e9a869ffa5..ce148cf5930cdcf0163c7f6416cbbd89 } } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index df21cd1bd2a3dda7169edbea18bbfdf043db76f8..b6b8687fc79c060cd65e04dc67c855c775ab7684 100644 +index 55a4424c47591d1bcaba306f6af877a4fb7144bf..a13f88ed2ce39848b1fe1673265cf6c62adbfb66 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2811,6 +2811,14 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { diff --git a/patches/server/0975-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0974-Optimize-Network-Manager-and-add-advanced-packet-sup.patch similarity index 100% rename from patches/server/0975-Optimize-Network-Manager-and-add-advanced-packet-sup.patch rename to patches/server/0974-Optimize-Network-Manager-and-add-advanced-packet-sup.patch diff --git a/patches/server/0976-Allow-Saving-of-Oversized-Chunks.patch b/patches/server/0975-Allow-Saving-of-Oversized-Chunks.patch similarity index 100% rename from patches/server/0976-Allow-Saving-of-Oversized-Chunks.patch rename to patches/server/0975-Allow-Saving-of-Oversized-Chunks.patch diff --git a/patches/server/0977-Flat-bedrock-generator-settings.patch b/patches/server/0976-Flat-bedrock-generator-settings.patch similarity index 100% rename from patches/server/0977-Flat-bedrock-generator-settings.patch rename to patches/server/0976-Flat-bedrock-generator-settings.patch diff --git a/patches/server/0978-Entity-Activation-Range-2.0.patch b/patches/server/0977-Entity-Activation-Range-2.0.patch similarity index 99% rename from patches/server/0978-Entity-Activation-Range-2.0.patch rename to patches/server/0977-Entity-Activation-Range-2.0.patch index c69bbf042a..d11a88d699 100644 --- a/patches/server/0978-Entity-Activation-Range-2.0.patch +++ b/patches/server/0977-Entity-Activation-Range-2.0.patch @@ -19,10 +19,10 @@ Feature patch public net.minecraft.world.entity.Entity isInsidePortal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ce148cf5930cdcf0163c7f6416cbbd89e4d22720..cd00b534e4c527e0b4a5ad78cde87c22c49b4c33 100644 +index be35f9ab6d8877aad755a6ac0344a901b61a49de..5b1ba650973a603ecb77324eb18dda4647e0340b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -962,11 +962,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -967,11 +967,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public void tickNonPassenger(Entity entity) { // Spigot start @@ -36,7 +36,7 @@ index ce148cf5930cdcf0163c7f6416cbbd89e4d22720..cd00b534e4c527e0b4a5ad78cde87c22 // Spigot end entity.setOldPosAndRot(); ProfilerFiller gameprofilerfiller = Profiler.get(); -@@ -976,20 +976,23 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -981,20 +981,23 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickNonPassenger"); @@ -62,7 +62,7 @@ index ce148cf5930cdcf0163c7f6416cbbd89e4d22720..cd00b534e4c527e0b4a5ad78cde87c22 if (!passenger.isRemoved() && passenger.getVehicle() == vehicle) { if (passenger instanceof Player || this.entityTickList.contains(passenger)) { passenger.setOldPosAndRot(); -@@ -1000,15 +1003,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1005,15 +1008,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickPassenger"); diff --git a/patches/server/0979-Anti-Xray.patch b/patches/server/0978-Anti-Xray.patch similarity index 99% rename from patches/server/0979-Anti-Xray.patch rename to patches/server/0978-Anti-Xray.patch index 89ade95f20..71308aabb0 100644 --- a/patches/server/0979-Anti-Xray.patch +++ b/patches/server/0978-Anti-Xray.patch @@ -1105,10 +1105,10 @@ index 183b2191fa1c1b27adedf39593e1b5a223fb1279..8ead66c134688b11dca15f6509147e72 private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index cd00b534e4c527e0b4a5ad78cde87c22c49b4c33..32f8186b1502b481c1100f7fdba0339ae3dd34fa 100644 +index 5b1ba650973a603ecb77324eb18dda4647e0340b..c5f3e4dff83a85a3a5f29534afd84d4a332b1d3e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -343,7 +343,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -348,7 +348,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Add env and gen to constructor, IWorldDataServer -> WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { @@ -1599,7 +1599,7 @@ index 5fc9e8e969debb3e15ed474b36a1c48b086d0449..f65cc95ab28e8a3b21eac2b16bd9ebe9 private static final byte[] EMPTY_LIGHT = new byte[2048]; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0289bd3e047847a1ecd66ca30863bd0408645667..a3c6ad1a53bdfd9bd928951983a503afba9eedc3 100644 +index c65a4bb7f1818378a5e571d39a5aabe8ad87d16c..758d86865136e5ef58f401f00c5e62fbb8cf25a3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2702,7 +2702,7 @@ public final class CraftServer implements Server { @@ -1612,10 +1612,10 @@ index 0289bd3e047847a1ecd66ca30863bd0408645667..a3c6ad1a53bdfd9bd928951983a503af @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 86d653da7e0ed8123e769eb48c6de2e1396e4fe0..d7726177e6085faa1169767835d5cb666e4a67bc 100644 +index 06b73ace3ae89e8a9de592bb4b8439b4e0cac9f2..5ce8d2a57fd2f29d227d223f1f5742540f1701bd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -464,11 +464,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -452,11 +452,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { List playersInRange = playerChunk.playerProvider.getPlayers(playerChunk.getPos(), false); if (playersInRange.isEmpty()) return; diff --git a/patches/server/0980-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/0979-Use-Velocity-compression-and-cipher-natives.patch similarity index 99% rename from patches/server/0980-Use-Velocity-compression-and-cipher-natives.patch rename to patches/server/0979-Use-Velocity-compression-and-cipher-natives.patch index 27356b9ab5..8459cc1aba 100644 --- a/patches/server/0980-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/0979-Use-Velocity-compression-and-cipher-natives.patch @@ -9,10 +9,10 @@ Feature patch private-f net.minecraft.network.CompressionDecoder inflater diff --git a/build.gradle.kts b/build.gradle.kts -index c2cd0db92d7f73c6b256440aa8f11e7bcc19e5b7..a6ae4494ab5970447625d332ef15a76baac9666e 100644 +index 9b514a9aa1d386481a1ee5077178564cd569117c..9e6c2a4630ce75e4115f76b5e7a1e0b50e8b3197 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -49,6 +49,11 @@ dependencies { +@@ -50,6 +50,11 @@ dependencies { runtimeOnly("org.xerial:sqlite-jdbc:3.46.1.3") runtimeOnly("com.mysql:mysql-connector-j:9.1.0") runtimeOnly("com.lmax:disruptor:3.4.4") // Paper diff --git a/patches/server/0981-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0980-Optimize-Collision-to-not-load-chunks.patch similarity index 100% rename from patches/server/0981-Optimize-Collision-to-not-load-chunks.patch rename to patches/server/0980-Optimize-Collision-to-not-load-chunks.patch diff --git a/patches/server/0982-Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/patches/server/0981-Optimize-GoalSelector-Goal.Flag-Set-operations.patch similarity index 100% rename from patches/server/0982-Optimize-GoalSelector-Goal.Flag-Set-operations.patch rename to patches/server/0981-Optimize-GoalSelector-Goal.Flag-Set-operations.patch diff --git a/patches/server/0983-Optimize-Hoppers.patch b/patches/server/0982-Optimize-Hoppers.patch similarity index 100% rename from patches/server/0983-Optimize-Hoppers.patch rename to patches/server/0982-Optimize-Hoppers.patch diff --git a/patches/server/0984-Optimize-Voxel-Shape-Merging.patch b/patches/server/0983-Optimize-Voxel-Shape-Merging.patch similarity index 100% rename from patches/server/0984-Optimize-Voxel-Shape-Merging.patch rename to patches/server/0983-Optimize-Voxel-Shape-Merging.patch diff --git a/patches/server/0985-Optimize-Bit-Operations-by-inlining.patch b/patches/server/0984-Optimize-Bit-Operations-by-inlining.patch similarity index 100% rename from patches/server/0985-Optimize-Bit-Operations-by-inlining.patch rename to patches/server/0984-Optimize-Bit-Operations-by-inlining.patch diff --git a/patches/server/0986-Remove-streams-from-hot-code.patch b/patches/server/0985-Remove-streams-from-hot-code.patch similarity index 99% rename from patches/server/0986-Remove-streams-from-hot-code.patch rename to patches/server/0985-Remove-streams-from-hot-code.patch index bab16c74ad..f1585163e2 100644 --- a/patches/server/0986-Remove-streams-from-hot-code.patch +++ b/patches/server/0985-Remove-streams-from-hot-code.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove streams from hot code Feature patch -Co-authored-by: Bjarne Koll +Co-authored-by: Bjarne Koll Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java diff --git a/patches/server/0987-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/patches/server/0986-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch similarity index 100% rename from patches/server/0987-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch rename to patches/server/0986-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch diff --git a/patches/server/0988-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/0987-Fix-entity-type-tags-suggestions-in-selectors.patch similarity index 100% rename from patches/server/0988-Fix-entity-type-tags-suggestions-in-selectors.patch rename to patches/server/0987-Fix-entity-type-tags-suggestions-in-selectors.patch diff --git a/patches/server/0989-Handle-Oversized-block-entities-in-chunks.patch b/patches/server/0988-Handle-Oversized-block-entities-in-chunks.patch similarity index 100% rename from patches/server/0989-Handle-Oversized-block-entities-in-chunks.patch rename to patches/server/0988-Handle-Oversized-block-entities-in-chunks.patch diff --git a/patches/server/0990-Check-distance-in-entity-interactions.patch b/patches/server/0989-Check-distance-in-entity-interactions.patch similarity index 97% rename from patches/server/0990-Check-distance-in-entity-interactions.patch rename to patches/server/0989-Check-distance-in-entity-interactions.patch index 2e36b3f8e3..bc351d5fd9 100644 --- a/patches/server/0990-Check-distance-in-entity-interactions.patch +++ b/patches/server/0989-Check-distance-in-entity-interactions.patch @@ -18,7 +18,7 @@ index 57223285860f61119b6cf348aa78e59384a04e22..ccfe9ef24dce9f34613692adb13738d3 }; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index ff7616e1d6d6c821a75649812ec69e0dc6a8e378..bd34c878d8ca6fb4e4f526761fd657b250c26d80 100644 +index 6a89a9af2ccb82ee1162b14f4be5a868b927a34d..ed26eb5e8cc9a46e4a4d2c58d587463d5571a8e0 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1467,7 +1467,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0991-Configurable-Sand-Duping.patch b/patches/server/0990-Configurable-Sand-Duping.patch similarity index 100% rename from patches/server/0991-Configurable-Sand-Duping.patch rename to patches/server/0990-Configurable-Sand-Duping.patch diff --git a/patches/server/0992-Properly-resend-entities.patch b/patches/server/0991-Properly-resend-entities.patch similarity index 99% rename from patches/server/0992-Properly-resend-entities.patch rename to patches/server/0991-Properly-resend-entities.patch index d8b50689d8..01b1658ae9 100644 --- a/patches/server/0992-Properly-resend-entities.patch +++ b/patches/server/0991-Properly-resend-entities.patch @@ -188,7 +188,7 @@ index 6a4f52342c5a195206ecf3ac118e8a4df4d2f3d2..20fcfb7d7d2541731452454d78f69672 public boolean equals(Object object) { return object instanceof Entity ? ((Entity) object).id == this.id : false; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index bd34c878d8ca6fb4e4f526761fd657b250c26d80..016be3addd3bf0ae3dd5f6094de3902206c5b43a 100644 +index ed26eb5e8cc9a46e4a4d2c58d587463d5571a8e0..5616391f02f8599f5786a6d8e740a0ed9290627f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4030,6 +4030,11 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0993-Registry-Modification-API.patch b/patches/server/0992-Registry-Modification-API.patch similarity index 99% rename from patches/server/0993-Registry-Modification-API.patch rename to patches/server/0992-Registry-Modification-API.patch index 17e32ead7f..bd82d9ecf8 100644 --- a/patches/server/0993-Registry-Modification-API.patch +++ b/patches/server/0992-Registry-Modification-API.patch @@ -11,7 +11,7 @@ public net.minecraft.resources.RegistryOps lookupProvider public net.minecraft.resources.RegistryOps$HolderLookupAdapter diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index 39120c63ed25d45a4083523fbfe79d871f4d892e..f563e6e7a558d22f571154640e99cc86718c89f5 100644 +index c6969f968b45eff2aeb44e647712abda10c7c113..d34ffad8a36abbb215491d74ae8d9b490a0bc64f 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -2,6 +2,7 @@ package io.papermc.paper.registry; diff --git a/patches/server/0994-Add-registry-entry-and-builders.patch b/patches/server/0993-Add-registry-entry-and-builders.patch similarity index 99% rename from patches/server/0994-Add-registry-entry-and-builders.patch rename to patches/server/0993-Add-registry-entry-and-builders.patch index be3eccb69a..37f4a6a8c0 100644 --- a/patches/server/0994-Add-registry-entry-and-builders.patch +++ b/patches/server/0993-Add-registry-entry-and-builders.patch @@ -1,5 +1,5 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll +From: Bjarne Koll Date: Thu, 13 Jun 2024 23:45:32 +0200 Subject: [PATCH] Add registry entry and builders diff --git a/patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch b/patches/server/0994-Proxy-ItemStack-to-CraftItemStack.patch similarity index 100% rename from patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch rename to patches/server/0994-Proxy-ItemStack-to-CraftItemStack.patch diff --git a/patches/server/0996-Make-a-PDC-view-accessible-directly-from-ItemStack.patch b/patches/server/0995-Make-a-PDC-view-accessible-directly-from-ItemStack.patch similarity index 100% rename from patches/server/0996-Make-a-PDC-view-accessible-directly-from-ItemStack.patch rename to patches/server/0995-Make-a-PDC-view-accessible-directly-from-ItemStack.patch diff --git a/patches/server/0997-Prioritize-Minecraft-commands-in-function-parsing-an.patch b/patches/server/0996-Prioritize-Minecraft-commands-in-function-parsing-an.patch similarity index 100% rename from patches/server/0997-Prioritize-Minecraft-commands-in-function-parsing-an.patch rename to patches/server/0996-Prioritize-Minecraft-commands-in-function-parsing-an.patch diff --git a/patches/server/0998-optimize-dirt-and-snow-spreading.patch b/patches/server/0997-optimize-dirt-and-snow-spreading.patch similarity index 100% rename from patches/server/0998-optimize-dirt-and-snow-spreading.patch rename to patches/server/0997-optimize-dirt-and-snow-spreading.patch diff --git a/patches/server/0999-Fix-NPE-for-Jukebox-setRecord.patch b/patches/server/0998-Fix-NPE-for-Jukebox-setRecord.patch similarity index 100% rename from patches/server/0999-Fix-NPE-for-Jukebox-setRecord.patch rename to patches/server/0998-Fix-NPE-for-Jukebox-setRecord.patch diff --git a/patches/server/1000-fix-horse-inventories.patch b/patches/server/0999-fix-horse-inventories.patch similarity index 100% rename from patches/server/1000-fix-horse-inventories.patch rename to patches/server/0999-fix-horse-inventories.patch diff --git a/patches/server/1001-Only-call-EntityDamageEvents-before-actuallyHurt.patch b/patches/server/1000-Only-call-EntityDamageEvents-before-actuallyHurt.patch similarity index 96% rename from patches/server/1001-Only-call-EntityDamageEvents-before-actuallyHurt.patch rename to patches/server/1000-Only-call-EntityDamageEvents-before-actuallyHurt.patch index df30fe3fdd..b607b89045 100644 --- a/patches/server/1001-Only-call-EntityDamageEvents-before-actuallyHurt.patch +++ b/patches/server/1000-Only-call-EntityDamageEvents-before-actuallyHurt.patch @@ -1,5 +1,5 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll +From: Bjarne Koll Date: Mon, 8 Jul 2024 22:01:08 +0200 Subject: [PATCH] Only call EntityDamageEvents before actuallyHurt @@ -12,7 +12,7 @@ This patch moves the invocation directly before the #actuallyHurt calls, respective invulnerable timings. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 61d4515cce2b5ed73a2202d43b8f96bb63b9a459..2edb4a4a7638f7bea2d50fa3ce8a5d9916c90a26 100644 +index 5616391f02f8599f5786a6d8e740a0ed9290627f..cfef1bff0080ffc662e3a4428116f7d4dc71eab2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1489,12 +1489,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1002-Add-ItemType-getItemRarity.patch b/patches/server/1001-Add-ItemType-getItemRarity.patch similarity index 100% rename from patches/server/1002-Add-ItemType-getItemRarity.patch rename to patches/server/1001-Add-ItemType-getItemRarity.patch diff --git a/patches/server/1003-Add-plugin-info-at-startup.patch b/patches/server/1002-Add-plugin-info-at-startup.patch similarity index 100% rename from patches/server/1003-Add-plugin-info-at-startup.patch rename to patches/server/1002-Add-plugin-info-at-startup.patch diff --git a/patches/server/1004-Make-interaction-leniency-distance-configurable.patch b/patches/server/1003-Make-interaction-leniency-distance-configurable.patch similarity index 100% rename from patches/server/1004-Make-interaction-leniency-distance-configurable.patch rename to patches/server/1003-Make-interaction-leniency-distance-configurable.patch diff --git a/patches/server/1005-Fix-PickupStatus-getting-reset.patch b/patches/server/1004-Fix-PickupStatus-getting-reset.patch similarity index 100% rename from patches/server/1005-Fix-PickupStatus-getting-reset.patch rename to patches/server/1004-Fix-PickupStatus-getting-reset.patch diff --git a/patches/server/1006-Check-for-block-type-in-SculkSensorBlock-canActivate.patch b/patches/server/1005-Check-for-block-type-in-SculkSensorBlock-canActivate.patch similarity index 100% rename from patches/server/1006-Check-for-block-type-in-SculkSensorBlock-canActivate.patch rename to patches/server/1005-Check-for-block-type-in-SculkSensorBlock-canActivate.patch diff --git a/patches/server/1007-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch b/patches/server/1006-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch similarity index 98% rename from patches/server/1007-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch rename to patches/server/1006-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch index 4dfddc64f0..67e1737740 100644 --- a/patches/server/1007-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch +++ b/patches/server/1006-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add API for CanPlaceOn and CanDestroy NBT values diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index b24857e34d87ea4fa9aa0db0ba684014c2625cc1..5bb37a77363d91222dae833d018da753e3549f93 100644 +index 37a8954f37a97afdbcc7b7c7026371f477cb3655..ab616f58e35458e52fb5a94e39875a188fd6a05b 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -2500,4 +2500,119 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { diff --git a/patches/server/1008-Configuration-for-horizontal-only-item-merging.patch b/patches/server/1007-Configuration-for-horizontal-only-item-merging.patch similarity index 100% rename from patches/server/1008-Configuration-for-horizontal-only-item-merging.patch rename to patches/server/1007-Configuration-for-horizontal-only-item-merging.patch diff --git a/patches/server/1009-Add-skipping-world-symlink-scan.patch b/patches/server/1008-Add-skipping-world-symlink-scan.patch similarity index 100% rename from patches/server/1009-Add-skipping-world-symlink-scan.patch rename to patches/server/1008-Add-skipping-world-symlink-scan.patch diff --git a/patches/server/1010-Add-even-more-Enchantment-API.patch b/patches/server/1009-Add-even-more-Enchantment-API.patch similarity index 100% rename from patches/server/1010-Add-even-more-Enchantment-API.patch rename to patches/server/1009-Add-even-more-Enchantment-API.patch diff --git a/patches/server/1011-Leashable-API.patch b/patches/server/1010-Leashable-API.patch similarity index 100% rename from patches/server/1011-Leashable-API.patch rename to patches/server/1010-Leashable-API.patch diff --git a/patches/server/1012-Fix-CraftBukkit-drag-system.patch b/patches/server/1011-Fix-CraftBukkit-drag-system.patch similarity index 100% rename from patches/server/1012-Fix-CraftBukkit-drag-system.patch rename to patches/server/1011-Fix-CraftBukkit-drag-system.patch diff --git a/patches/server/1013-Fix-SculkBloomEvent-firing-for-block-entity-loading.patch b/patches/server/1012-Fix-SculkBloomEvent-firing-for-block-entity-loading.patch similarity index 100% rename from patches/server/1013-Fix-SculkBloomEvent-firing-for-block-entity-loading.patch rename to patches/server/1012-Fix-SculkBloomEvent-firing-for-block-entity-loading.patch diff --git a/patches/server/1014-Remove-set-damage-lootable-item-function-from-compas.patch b/patches/server/1013-Remove-set-damage-lootable-item-function-from-compas.patch similarity index 100% rename from patches/server/1014-Remove-set-damage-lootable-item-function-from-compas.patch rename to patches/server/1013-Remove-set-damage-lootable-item-function-from-compas.patch diff --git a/patches/server/1015-Add-enchantment-seed-update-API.patch b/patches/server/1014-Add-enchantment-seed-update-API.patch similarity index 100% rename from patches/server/1015-Add-enchantment-seed-update-API.patch rename to patches/server/1014-Add-enchantment-seed-update-API.patch diff --git a/patches/server/1016-Fix-synchronise-sending-chat-to-client-with-updating.patch b/patches/server/1015-Fix-synchronise-sending-chat-to-client-with-updating.patch similarity index 100% rename from patches/server/1016-Fix-synchronise-sending-chat-to-client-with-updating.patch rename to patches/server/1015-Fix-synchronise-sending-chat-to-client-with-updating.patch diff --git a/patches/server/1017-Fix-InventoryOpenEvent-cancellation.patch b/patches/server/1016-Fix-InventoryOpenEvent-cancellation.patch similarity index 98% rename from patches/server/1017-Fix-InventoryOpenEvent-cancellation.patch rename to patches/server/1016-Fix-InventoryOpenEvent-cancellation.patch index 2ac771df85..eb14b552dc 100644 --- a/patches/server/1017-Fix-InventoryOpenEvent-cancellation.patch +++ b/patches/server/1016-Fix-InventoryOpenEvent-cancellation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix InventoryOpenEvent cancellation diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b6b8687fc79c060cd65e04dc67c855c775ab7684..e2527f3e2b96df539c765ae23c83a09d3298d430 100644 +index a13f88ed2ce39848b1fe1673265cf6c62adbfb66..08a82b7a3456f58b3d0fdbb8e8dbce6972ad1672 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1942,6 +1942,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -198,7 +198,7 @@ index 500c56c4ef0878434582a50d6dba2ccca9773275..5a6c153fa2873aecba0d0d02be2cc2a5 } diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java -index ef0d469176ee74b6bb5f9e9cc508735145fda5b8..ebb9baca7a65173f7c9fdf9bf47a8db876719625 100644 +index ef0d469176ee74b6bb5f9e9cc508735145fda5b8..2a207fb2e1c26b562de42240e11c856bd2a23458 100644 --- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java @@ -86,11 +86,13 @@ public class EnderChestBlock extends AbstractChestBlock i @@ -206,15 +206,16 @@ index ef0d469176ee74b6bb5f9e9cc508735145fda5b8..ebb9baca7a65173f7c9fdf9bf47a8db8 return InteractionResult.SUCCESS; } else { - if (world instanceof ServerLevel serverLevel) { +- playerEnderChestContainer.setActiveChest(enderChestBlockEntity); +- player.openMenu( +- new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) +- ); + // Paper start - Fix InventoryOpenEvent cancellation - moved up; ++ playerEnderChestContainer.setActiveChest(enderChestBlockEntity); // Needs to happen before ChestMenu.threeRows as it is required for opening animations + if (world instanceof ServerLevel serverLevel && player.openMenu( + new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) + ).isPresent()) { + // Paper end - Fix InventoryOpenEvent cancellation - moved up; - playerEnderChestContainer.setActiveChest(enderChestBlockEntity); -- player.openMenu( -- new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) -- ); + // Paper - Fix InventoryOpenEvent cancellation - moved up; player.awardStat(Stats.OPEN_ENDERCHEST); PiglinAi.angerNearbyPiglins(serverLevel, player, true); diff --git a/patches/server/1018-Fire-BlockExpEvent-on-grindstone-use.patch b/patches/server/1017-Fire-BlockExpEvent-on-grindstone-use.patch similarity index 100% rename from patches/server/1018-Fire-BlockExpEvent-on-grindstone-use.patch rename to patches/server/1017-Fire-BlockExpEvent-on-grindstone-use.patch diff --git a/patches/server/1019-Check-dead-flag-in-isAlive.patch b/patches/server/1018-Check-dead-flag-in-isAlive.patch similarity index 94% rename from patches/server/1019-Check-dead-flag-in-isAlive.patch rename to patches/server/1018-Check-dead-flag-in-isAlive.patch index c2653e4474..0641acbaa9 100644 --- a/patches/server/1019-Check-dead-flag-in-isAlive.patch +++ b/patches/server/1018-Check-dead-flag-in-isAlive.patch @@ -15,7 +15,7 @@ Also, even if the plugin is responsibly checking !isDead() before modifying heal I am currently unable to replicate, these "revived" entities can still appear diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2edb4a4a7638f7bea2d50fa3ce8a5d9916c90a26..4d75ce205d5a0d61780936aa522710f5f753b271 100644 +index cfef1bff0080ffc662e3a4428116f7d4dc71eab2..f2708479ccf994278ad1ab4665edc46672001e8a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2145,7 +2145,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1020-Add-FeatureFlag-API.patch b/patches/server/1019-Add-FeatureFlag-API.patch similarity index 99% rename from patches/server/1020-Add-FeatureFlag-API.patch rename to patches/server/1019-Add-FeatureFlag-API.patch index 43cb4f5162..ed2a09b0c6 100644 --- a/patches/server/1020-Add-FeatureFlag-API.patch +++ b/patches/server/1019-Add-FeatureFlag-API.patch @@ -162,10 +162,10 @@ index f0bd7d01f56bb792886354ca4f199e46c2cf7503..adc6741e0e017660fbd39a62b69be1e6 + // Paper end - feature flag API } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d7726177e6085faa1169767835d5cb666e4a67bc..0437eee2b34b2ad5799892390726ff79635b6baf 100644 +index 5ce8d2a57fd2f29d227d223f1f5742540f1701bd..61271ef3741656e81f30f9276ee48630ce97b3d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2371,10 +2371,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2359,10 +2359,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { return this.persistentDataContainer; } diff --git a/patches/server/1021-Tag-Lifecycle-Events.patch b/patches/server/1020-Tag-Lifecycle-Events.patch similarity index 99% rename from patches/server/1021-Tag-Lifecycle-Events.patch rename to patches/server/1020-Tag-Lifecycle-Events.patch index 943c370a5b..6b65432932 100644 --- a/patches/server/1021-Tag-Lifecycle-Events.patch +++ b/patches/server/1020-Tag-Lifecycle-Events.patch @@ -474,7 +474,7 @@ index fdc88e52235a152dbe3cca273990b4b68f8daaf8..13797035494a1e010e1da529fb46040f static void loadContentsFromNetwork( diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e3e3099bb33d21055e480fdbd2df2a3e159f0f1a..843f8ccce6302a6db6cc61c496a5eee21305a88f 100644 +index ff6f2dc31bbbaa420323a68282cb1ee3d8b98c0f..e18692ad6bdbc8bc2df605833501b1ad888b8b7d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2208,7 +2208,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop CODEC_WITH_ID = CODEC.validate( component -> component.getUnsafe().contains("id", 8) ? DataResult.success(component) : DataResult.error(() -> "Missing id for entity in: " + component) diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 83835e41034e79442177f19dcb18e7df5b0e296e..08d48cd55cfaf92530cc900f2f119ae3a258eb39 100644 +index f4ccdd848dd64e97796ef952d2aeacb3219da1bd..29d5fa49730d2161bb1b024995a533a08c57939b 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -527,6 +527,39 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/1023-Validate-slot-in-PlayerInventory-setSlot.patch b/patches/server/1022-Validate-slot-in-PlayerInventory-setSlot.patch similarity index 100% rename from patches/server/1023-Validate-slot-in-PlayerInventory-setSlot.patch rename to patches/server/1022-Validate-slot-in-PlayerInventory-setSlot.patch diff --git a/patches/server/1024-Remove-wall-time-unused-skip-tick-protection.patch b/patches/server/1023-Remove-wall-time-unused-skip-tick-protection.patch similarity index 99% rename from patches/server/1024-Remove-wall-time-unused-skip-tick-protection.patch rename to patches/server/1023-Remove-wall-time-unused-skip-tick-protection.patch index deaf422ec7..c25e6680dc 100644 --- a/patches/server/1024-Remove-wall-time-unused-skip-tick-protection.patch +++ b/patches/server/1023-Remove-wall-time-unused-skip-tick-protection.patch @@ -1,5 +1,5 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll +From: Bjarne Koll Date: Mon, 16 Sep 2024 23:07:29 +0200 Subject: [PATCH] Remove wall-time / unused skip tick protection diff --git a/patches/server/1025-Disable-pretty-printing-for-advancement-saving.patch b/patches/server/1024-Disable-pretty-printing-for-advancement-saving.patch similarity index 100% rename from patches/server/1025-Disable-pretty-printing-for-advancement-saving.patch rename to patches/server/1024-Disable-pretty-printing-for-advancement-saving.patch diff --git a/patches/server/1026-Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch b/patches/server/1025-Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch similarity index 100% rename from patches/server/1026-Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch rename to patches/server/1025-Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch diff --git a/patches/server/1027-Add-enchantWithLevels-with-enchantment-registry-set.patch b/patches/server/1026-Add-enchantWithLevels-with-enchantment-registry-set.patch similarity index 100% rename from patches/server/1027-Add-enchantWithLevels-with-enchantment-registry-set.patch rename to patches/server/1026-Add-enchantWithLevels-with-enchantment-registry-set.patch diff --git a/patches/server/1028-Improve-entity-effect-API.patch b/patches/server/1027-Improve-entity-effect-API.patch similarity index 98% rename from patches/server/1028-Improve-entity-effect-API.patch rename to patches/server/1027-Improve-entity-effect-API.patch index cc17e320f6..51c6f3ecf8 100644 --- a/patches/server/1028-Improve-entity-effect-API.patch +++ b/patches/server/1027-Improve-entity-effect-API.patch @@ -25,7 +25,7 @@ index d1d9916db7bd4886d30355e6a0ecb69cd21c2364..ddabaed899c755925ad8618b78c33dac + // Paper end - broadcast hurt animation } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index bcfbacf408d3bd043c3ecd8c3a43497bcff58343..55fa71403c6fe1fa1ffd00d9cecb6b67bd66e174 100644 +index 700751a1469dd99339e6502e96cd98e72feee803..0d3d565db8fdc30e44966492f2c30171b4dac7ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1282,6 +1282,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/1029-Add-recipeBrewTime.patch b/patches/server/1028-Add-recipeBrewTime.patch similarity index 100% rename from patches/server/1029-Add-recipeBrewTime.patch rename to patches/server/1028-Add-recipeBrewTime.patch diff --git a/patches/server/1030-Call-bucket-events-for-cauldrons.patch b/patches/server/1029-Call-bucket-events-for-cauldrons.patch similarity index 100% rename from patches/server/1030-Call-bucket-events-for-cauldrons.patch rename to patches/server/1029-Call-bucket-events-for-cauldrons.patch diff --git a/patches/server/1031-Add-PlayerInsertLecternBookEvent.patch b/patches/server/1030-Add-PlayerInsertLecternBookEvent.patch similarity index 100% rename from patches/server/1031-Add-PlayerInsertLecternBookEvent.patch rename to patches/server/1030-Add-PlayerInsertLecternBookEvent.patch diff --git a/patches/server/1032-Void-damage-configuration-API.patch b/patches/server/1031-Void-damage-configuration-API.patch similarity index 95% rename from patches/server/1032-Void-damage-configuration-API.patch rename to patches/server/1031-Void-damage-configuration-API.patch index 06ec44aacc..e1006ef695 100644 --- a/patches/server/1032-Void-damage-configuration-API.patch +++ b/patches/server/1031-Void-damage-configuration-API.patch @@ -20,7 +20,7 @@ index 20fcfb7d7d2541731452454d78f6967215c4fcd7..5949cbccb569ab1d518508d200e69ad9 && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { // Paper end - Configurable nether ceiling damage diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 99c98a91fe7471791fca8233acf6eeba516b10ed..4836b01323abb125289982ef3ceca09d6a9cfc3b 100644 +index f2708479ccf994278ad1ab4665edc46672001e8a..59c992173fda6153c58722caae061b0e6bee86a1 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2701,7 +2701,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -33,7 +33,7 @@ index 99c98a91fe7471791fca8233acf6eeba516b10ed..4836b01323abb125289982ef3ceca09d protected void updateSwingTime() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 0437eee2b34b2ad5799892390726ff79635b6baf..30dc6ac6c7da7397a113da2994b16ef375b067fa 100644 +index 61271ef3741656e81f30f9276ee48630ce97b3d3..4a5a0e33af16369f665bf39e70238e4e5a5486da 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -167,6 +167,41 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/1033-Add-Offline-PDC-API.patch b/patches/server/1032-Add-Offline-PDC-API.patch similarity index 100% rename from patches/server/1033-Add-Offline-PDC-API.patch rename to patches/server/1032-Add-Offline-PDC-API.patch diff --git a/patches/server/1034-Add-AnvilView-bypassEnchantmentLevelRestriction.patch b/patches/server/1033-Add-AnvilView-bypassEnchantmentLevelRestriction.patch similarity index 96% rename from patches/server/1034-Add-AnvilView-bypassEnchantmentLevelRestriction.patch rename to patches/server/1033-Add-AnvilView-bypassEnchantmentLevelRestriction.patch index f8c089a57c..7084bf9f8d 100644 --- a/patches/server/1034-Add-AnvilView-bypassEnchantmentLevelRestriction.patch +++ b/patches/server/1033-Add-AnvilView-bypassEnchantmentLevelRestriction.patch @@ -8,7 +8,7 @@ maximum level. The added API enables plugins to disable this behaviour, allowing enchantments that are overleveled to be applied via the anvil. diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -index cc5aae32f34305965847ade8b530272b1126b5c9..dc2bc53f6fa84fa09bd86450060ad9878307001c 100644 +index ae0ba6b0e1f0bee3c3a701b22725171e499b97a3..286ae002e1711ad9e800b7f2091988d66cd572a7 100644 --- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java @@ -54,6 +54,7 @@ public class AnvilMenu extends ItemCombinerMenu { diff --git a/patches/server/1035-Add-proper-async-player-disconnections.patch b/patches/server/1034-Add-proper-async-player-disconnections.patch similarity index 99% rename from patches/server/1035-Add-proper-async-player-disconnections.patch rename to patches/server/1034-Add-proper-async-player-disconnections.patch index 0da8a73aa2..eff84b6f89 100644 --- a/patches/server/1035-Add-proper-async-player-disconnections.patch +++ b/patches/server/1034-Add-proper-async-player-disconnections.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add proper async player disconnections Blocking can cause performance problems diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 90a2c61c42cba7e38f167eccdd7a951a947963c4..fff8d15d44613a075b9793c2a41520212166eb3b 100644 +index 36624d3dc7e3f2a64f88b01c5e906018fcee0015..d18af548fa6e979267347443b61efc58b271dfcf 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -844,6 +844,14 @@ public class Connection extends SimpleChannelInboundHandler> { diff --git a/patches/server/1035-DataComponent-API.patch b/patches/server/1035-DataComponent-API.patch new file mode 100644 index 0000000000..744404bca8 --- /dev/null +++ b/patches/server/1035-DataComponent-API.patch @@ -0,0 +1,4804 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 28 Apr 2024 19:53:01 -0400 +Subject: [PATCH] DataComponent API + +Exposes the data component logic used by vanilla ItemStack to API +consumers as a version-specific API. +The types and methods introduced by this patch do not follow the general +API deprecation contracts and will be adapted to each new minecraft +release without backwards compatibility measures. + +== AT == +public net/minecraft/world/item/component/ItemContainerContents MAX_SIZE +public net/minecraft/world/item/component/ItemContainerContents items + +diff --git a/src/main/java/io/papermc/paper/datacomponent/ComponentAdapter.java b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapter.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4a49f65cae1354afbcd4afda07581790e06094be +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapter.java +@@ -0,0 +1,36 @@ ++package io.papermc.paper.datacomponent; ++ ++import java.util.function.Function; ++import net.minecraft.core.component.DataComponentType; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.util.NullOps; ++import net.minecraft.util.Unit; ++import org.bukkit.craftbukkit.CraftRegistry; ++ ++public record ComponentAdapter( ++ DataComponentType type, ++ Function apiToVanilla, ++ Function vanillaToApi, ++ boolean codecValidation ++) { ++ static final Function API_TO_UNIT_CONVERTER = $ -> Unit.INSTANCE; ++ ++ public boolean isValued() { ++ return this.apiToVanilla != API_TO_UNIT_CONVERTER; ++ } ++ ++ public NMS toVanilla(final API value) { ++ final NMS nms = this.apiToVanilla.apply(value); ++ if (this.codecValidation) { ++ this.type.codecOrThrow().encodeStart(CraftRegistry.getMinecraftRegistry().createSerializationContext(NullOps.INSTANCE), nms).ifError(error -> { ++ throw new IllegalArgumentException("Failed to encode data component %s (%s)".formatted(BuiltInRegistries.DATA_COMPONENT_TYPE.getKey(this.type), error.message())); ++ }); ++ } ++ ++ return nms; ++ } ++ ++ public API fromVanilla(final NMS value) { ++ return this.vanillaToApi.apply(value); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c11de1f077c51483c61af6492f998781df866b88 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java +@@ -0,0 +1,168 @@ ++package io.papermc.paper.datacomponent; ++ ++import io.papermc.paper.adventure.PaperAdventure; ++import io.papermc.paper.datacomponent.item.PaperBannerPatternLayers; ++import io.papermc.paper.datacomponent.item.PaperBlockItemDataProperties; ++import io.papermc.paper.datacomponent.item.PaperBundleContents; ++import io.papermc.paper.datacomponent.item.PaperChargedProjectiles; ++import io.papermc.paper.datacomponent.item.PaperConsumable; ++import io.papermc.paper.datacomponent.item.PaperCustomModelData; ++import io.papermc.paper.datacomponent.item.PaperDamageResistant; ++import io.papermc.paper.datacomponent.item.PaperDeathProtection; ++import io.papermc.paper.datacomponent.item.PaperDyedItemColor; ++import io.papermc.paper.datacomponent.item.PaperEnchantable; ++import io.papermc.paper.datacomponent.item.PaperEquippable; ++import io.papermc.paper.datacomponent.item.PaperFireworks; ++import io.papermc.paper.datacomponent.item.PaperFoodProperties; ++import io.papermc.paper.datacomponent.item.PaperItemAdventurePredicate; ++import io.papermc.paper.datacomponent.item.PaperItemArmorTrim; ++import io.papermc.paper.datacomponent.item.PaperItemAttributeModifiers; ++import io.papermc.paper.datacomponent.item.PaperItemContainerContents; ++import io.papermc.paper.datacomponent.item.PaperItemEnchantments; ++import io.papermc.paper.datacomponent.item.PaperItemLore; ++import io.papermc.paper.datacomponent.item.PaperItemTool; ++import io.papermc.paper.datacomponent.item.PaperJukeboxPlayable; ++import io.papermc.paper.datacomponent.item.PaperLodestoneTracker; ++import io.papermc.paper.datacomponent.item.PaperMapDecorations; ++import io.papermc.paper.datacomponent.item.PaperMapId; ++import io.papermc.paper.datacomponent.item.PaperMapItemColor; ++import io.papermc.paper.datacomponent.item.PaperOminousBottleAmplifier; ++import io.papermc.paper.datacomponent.item.PaperPotDecorations; ++import io.papermc.paper.datacomponent.item.PaperPotionContents; ++import io.papermc.paper.datacomponent.item.PaperRepairable; ++import io.papermc.paper.datacomponent.item.PaperResolvableProfile; ++import io.papermc.paper.datacomponent.item.PaperSeededContainerLoot; ++import io.papermc.paper.datacomponent.item.PaperSuspiciousStewEffects; ++import io.papermc.paper.datacomponent.item.PaperUnbreakable; ++import io.papermc.paper.datacomponent.item.PaperUseCooldown; ++import io.papermc.paper.datacomponent.item.PaperUseRemainder; ++import io.papermc.paper.datacomponent.item.PaperWritableBookContent; ++import io.papermc.paper.datacomponent.item.PaperWrittenBookContent; ++import io.papermc.paper.registry.PaperRegistries; ++import java.util.HashMap; ++import java.util.Map; ++import java.util.function.Function; ++import net.minecraft.core.component.DataComponentType; ++import net.minecraft.core.component.DataComponents; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.resources.ResourceKey; ++import net.minecraft.util.Unit; ++import net.minecraft.world.item.Rarity; ++import net.minecraft.world.item.component.MapPostProcessing; ++import org.bukkit.DyeColor; ++import org.bukkit.craftbukkit.CraftMusicInstrument; ++import org.bukkit.craftbukkit.inventory.CraftMetaFirework; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.inventory.ItemRarity; ++ ++import static io.papermc.paper.datacomponent.ComponentUtils.transform; ++ ++public final class ComponentAdapters { ++ ++ static final Function UNIT_TO_API_CONVERTER = $ -> { ++ throw new UnsupportedOperationException("Cannot convert the Unit type to an API value"); ++ }; ++ ++ static final Map>, ComponentAdapter> ADAPTERS = new HashMap<>(); ++ ++ public static void bootstrap() { ++ registerIdentity(DataComponents.MAX_STACK_SIZE); ++ registerIdentity(DataComponents.MAX_DAMAGE); ++ registerIdentity(DataComponents.DAMAGE); ++ register(DataComponents.UNBREAKABLE, PaperUnbreakable::new); ++ register(DataComponents.CUSTOM_NAME, PaperAdventure::asAdventure, PaperAdventure::asVanilla); ++ register(DataComponents.ITEM_NAME, PaperAdventure::asAdventure, PaperAdventure::asVanilla); ++ register(DataComponents.ITEM_MODEL, CraftNamespacedKey::fromMinecraft, CraftNamespacedKey::toMinecraft); ++ register(DataComponents.LORE, PaperItemLore::new); ++ register(DataComponents.RARITY, nms -> ItemRarity.valueOf(nms.name()), api -> Rarity.valueOf(api.name())); ++ register(DataComponents.ENCHANTMENTS, PaperItemEnchantments::new); ++ register(DataComponents.CAN_PLACE_ON, PaperItemAdventurePredicate::new); ++ register(DataComponents.CAN_BREAK, PaperItemAdventurePredicate::new); ++ register(DataComponents.ATTRIBUTE_MODIFIERS, PaperItemAttributeModifiers::new); ++ register(DataComponents.CUSTOM_MODEL_DATA, PaperCustomModelData::new); ++ registerUntyped(DataComponents.HIDE_ADDITIONAL_TOOLTIP); ++ registerUntyped(DataComponents.HIDE_TOOLTIP); ++ registerIdentity(DataComponents.REPAIR_COST); ++ // registerUntyped(DataComponents.CREATIVE_SLOT_LOCK); ++ registerIdentity(DataComponents.ENCHANTMENT_GLINT_OVERRIDE); ++ registerUntyped(DataComponents.INTANGIBLE_PROJECTILE); ++ register(DataComponents.FOOD, PaperFoodProperties::new); ++ register(DataComponents.CONSUMABLE, PaperConsumable::new); ++ register(DataComponents.USE_REMAINDER, PaperUseRemainder::new); ++ register(DataComponents.USE_COOLDOWN, PaperUseCooldown::new); ++ register(DataComponents.DAMAGE_RESISTANT, PaperDamageResistant::new); ++ register(DataComponents.TOOL, PaperItemTool::new); ++ register(DataComponents.ENCHANTABLE, PaperEnchantable::new); ++ register(DataComponents.EQUIPPABLE, PaperEquippable::new); ++ register(DataComponents.REPAIRABLE, PaperRepairable::new); ++ registerUntyped(DataComponents.GLIDER); ++ register(DataComponents.TOOLTIP_STYLE, PaperAdventure::asAdventure, PaperAdventure::asVanilla); ++ register(DataComponents.DEATH_PROTECTION, PaperDeathProtection::new); ++ register(DataComponents.STORED_ENCHANTMENTS, PaperItemEnchantments::new); ++ register(DataComponents.DYED_COLOR, PaperDyedItemColor::new); ++ register(DataComponents.MAP_COLOR, PaperMapItemColor::new); ++ register(DataComponents.MAP_ID, PaperMapId::new); ++ register(DataComponents.MAP_DECORATIONS, PaperMapDecorations::new); ++ register(DataComponents.MAP_POST_PROCESSING, nms -> io.papermc.paper.item.MapPostProcessing.valueOf(nms.name()), api -> MapPostProcessing.valueOf(api.name())); ++ register(DataComponents.CHARGED_PROJECTILES, PaperChargedProjectiles::new); ++ register(DataComponents.BUNDLE_CONTENTS, PaperBundleContents::new); ++ register(DataComponents.POTION_CONTENTS, PaperPotionContents::new); ++ register(DataComponents.SUSPICIOUS_STEW_EFFECTS, PaperSuspiciousStewEffects::new); ++ register(DataComponents.WRITTEN_BOOK_CONTENT, PaperWrittenBookContent::new); ++ register(DataComponents.WRITABLE_BOOK_CONTENT, PaperWritableBookContent::new); ++ register(DataComponents.TRIM, PaperItemArmorTrim::new); ++ // debug stick state ++ // entity data ++ // bucket entity data ++ // block entity data ++ register(DataComponents.INSTRUMENT, CraftMusicInstrument::minecraftHolderToBukkit, CraftMusicInstrument::bukkitToMinecraftHolder); ++ register(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, PaperOminousBottleAmplifier::new); ++ register(DataComponents.JUKEBOX_PLAYABLE, PaperJukeboxPlayable::new); ++ register(DataComponents.RECIPES, nms -> transform(nms, PaperRegistries::fromNms), api -> transform(api, PaperRegistries::toNms)); ++ register(DataComponents.LODESTONE_TRACKER, PaperLodestoneTracker::new); ++ register(DataComponents.FIREWORK_EXPLOSION, CraftMetaFirework::getEffect, CraftMetaFirework::getExplosion); ++ register(DataComponents.FIREWORKS, PaperFireworks::new); ++ register(DataComponents.PROFILE, PaperResolvableProfile::new); ++ register(DataComponents.NOTE_BLOCK_SOUND, PaperAdventure::asAdventure, PaperAdventure::asVanilla); ++ register(DataComponents.BANNER_PATTERNS, PaperBannerPatternLayers::new); ++ register(DataComponents.BASE_COLOR, nms -> DyeColor.getByWoolData((byte) nms.getId()), api -> net.minecraft.world.item.DyeColor.byId(api.getWoolData())); ++ register(DataComponents.POT_DECORATIONS, PaperPotDecorations::new); ++ register(DataComponents.CONTAINER, PaperItemContainerContents::new); ++ register(DataComponents.BLOCK_STATE, PaperBlockItemDataProperties::new); ++ // bees ++ // register(DataComponents.LOCK, PaperLockCode::new); ++ register(DataComponents.CONTAINER_LOOT, PaperSeededContainerLoot::new); ++ ++ // TODO: REMOVE THIS... we want to build the PR... so lets just make things UNTYPED! ++ for (final Map.Entry>, DataComponentType> componentType : BuiltInRegistries.DATA_COMPONENT_TYPE.entrySet()) { ++ if (!ADAPTERS.containsKey(componentType.getKey())) { ++ registerUntyped((DataComponentType) componentType.getValue()); ++ } ++ } ++ } ++ ++ public static void registerUntyped(final DataComponentType type) { ++ registerInternal(type, UNIT_TO_API_CONVERTER, ComponentAdapter.API_TO_UNIT_CONVERTER, false); ++ } ++ ++ private static void registerIdentity(final DataComponentType type) { ++ registerInternal(type, Function.identity(), Function.identity(), true); ++ } ++ ++ private static > void register(final DataComponentType type, final Function vanillaToApi) { ++ registerInternal(type, vanillaToApi, Handleable::getHandle, false); ++ } ++ ++ private static void register(final DataComponentType type, final Function vanillaToApi, final Function apiToVanilla) { ++ registerInternal(type, vanillaToApi, apiToVanilla, false); ++ } ++ ++ private static void registerInternal(final DataComponentType type, final Function vanillaToApi, final Function apiToVanilla, final boolean codecValidation) { ++ final ResourceKey> key = BuiltInRegistries.DATA_COMPONENT_TYPE.getResourceKey(type).orElseThrow(); ++ if (ADAPTERS.containsKey(key)) { ++ throw new IllegalStateException("Duplicate adapter registration for " + key); ++ } ++ ADAPTERS.put(key, new ComponentAdapter<>(type, apiToVanilla, vanillaToApi, codecValidation && !type.isTransient())); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/ComponentUtils.java b/src/main/java/io/papermc/paper/datacomponent/ComponentUtils.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c95ffef54d7149cd8bb220533dddade515e48c8c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/ComponentUtils.java +@@ -0,0 +1,39 @@ ++package io.papermc.paper.datacomponent; ++ ++import com.google.common.collect.Collections2; ++import com.google.common.collect.Lists; ++import io.papermc.paper.adventure.PaperAdventure; ++import java.util.Collection; ++import java.util.Collections; ++import java.util.List; ++import java.util.function.Function; ++import net.kyori.adventure.key.Key; ++import net.minecraft.core.Holder; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.resources.ResourceLocation; ++import net.minecraft.sounds.SoundEvent; ++ ++public final class ComponentUtils { ++ ++ private ComponentUtils() { ++ } ++ ++ public static Holder keyToSound(Key key) { ++ ResourceLocation soundId = PaperAdventure.asVanilla(key); ++ return BuiltInRegistries.SOUND_EVENT.wrapAsHolder(BuiltInRegistries.SOUND_EVENT.getOptional(soundId).orElse(SoundEvent.createVariableRangeEvent(soundId))); ++ } ++ ++ public static List transform(final List nms, final Function converter) { ++ return Collections.unmodifiableList(Lists.transform(nms, converter::apply)); ++ } ++ ++ public static Collection transform(final Collection nms, final Function converter) { ++ return Collections.unmodifiableCollection(Collections2.transform(nms, converter::apply)); ++ } ++ ++ public static > void addAndConvert(final C target, final Collection toAdd, final Function converter) { ++ for (final A value : toAdd) { ++ target.add(converter.apply(value)); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/PaperComponentType.java b/src/main/java/io/papermc/paper/datacomponent/PaperComponentType.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f0d4ec462eee47840e91bac888ae46045b493f07 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/PaperComponentType.java +@@ -0,0 +1,109 @@ ++package io.papermc.paper.datacomponent; ++ ++import java.util.Collections; ++import java.util.HashSet; ++import java.util.Set; ++import net.minecraft.core.component.DataComponentMap; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.core.registries.Registries; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.bukkit.craftbukkit.CraftRegistry; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jspecify.annotations.Nullable; ++ ++public abstract class PaperComponentType implements DataComponentType, Handleable> { ++ ++ static { ++ ComponentAdapters.bootstrap(); ++ } ++ ++ public static net.minecraft.core.component.DataComponentType bukkitToMinecraft(final DataComponentType type) { ++ return CraftRegistry.bukkitToMinecraft(type); ++ } ++ ++ public static DataComponentType minecraftToBukkit(final net.minecraft.core.component.DataComponentType type) { ++ return CraftRegistry.minecraftToBukkit(type, Registries.DATA_COMPONENT_TYPE, Registry.DATA_COMPONENT_TYPE); ++ } ++ ++ public static Set minecraftToBukkit(final Set> nmsTypes) { ++ final Set types = new HashSet<>(nmsTypes.size()); ++ for (final net.minecraft.core.component.DataComponentType nmsType : nmsTypes) { ++ types.add(PaperComponentType.minecraftToBukkit(nmsType)); ++ } ++ return Collections.unmodifiableSet(types); ++ } ++ ++ public static @Nullable B convertDataComponentValue(final DataComponentMap map, final PaperComponentType.ValuedImpl type) { ++ final net.minecraft.core.component.DataComponentType nms = bukkitToMinecraft(type); ++ final M nmsValue = map.get(nms); ++ if (nmsValue == null) { ++ return null; ++ } ++ return type.getAdapter().fromVanilla(nmsValue); ++ } ++ ++ private final NamespacedKey key; ++ private final net.minecraft.core.component.DataComponentType type; ++ private final ComponentAdapter adapter; ++ ++ public PaperComponentType(final NamespacedKey key, final net.minecraft.core.component.DataComponentType type, final ComponentAdapter adapter) { ++ this.key = key; ++ this.type = type; ++ this.adapter = adapter; ++ } ++ ++ @Override ++ public NamespacedKey getKey() { ++ return this.key; ++ } ++ ++ @Override ++ public boolean isPersistent() { ++ return !this.type.isTransient(); ++ } ++ ++ public ComponentAdapter getAdapter() { ++ return this.adapter; ++ } ++ ++ @Override ++ public net.minecraft.core.component.DataComponentType getHandle() { ++ return this.type; ++ } ++ ++ @SuppressWarnings("unchecked") ++ public static DataComponentType of(final NamespacedKey key, final net.minecraft.core.component.DataComponentType type) { ++ final ComponentAdapter adapter = (ComponentAdapter) ComponentAdapters.ADAPTERS.get(BuiltInRegistries.DATA_COMPONENT_TYPE.getResourceKey(type).orElseThrow()); ++ if (adapter == null) { ++ throw new IllegalArgumentException("No adapter found for " + key); ++ } ++ if (adapter.isValued()) { ++ return new ValuedImpl<>(key, type, adapter); ++ } else { ++ return new NonValuedImpl<>(key, type, adapter); ++ } ++ } ++ ++ public static final class NonValuedImpl extends PaperComponentType implements NonValued { ++ ++ NonValuedImpl( ++ final NamespacedKey key, ++ final net.minecraft.core.component.DataComponentType type, ++ final ComponentAdapter adapter ++ ) { ++ super(key, type, adapter); ++ } ++ } ++ ++ public static final class ValuedImpl extends PaperComponentType implements Valued { ++ ++ ValuedImpl( ++ final NamespacedKey key, ++ final net.minecraft.core.component.DataComponentType type, ++ final ComponentAdapter adapter ++ ) { ++ super(key, type, adapter); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..14d039995a16a2c85569ca09e7f825c7de42fd6b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java +@@ -0,0 +1,239 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.destroystokyo.paper.profile.PlayerProfile; ++import com.google.common.base.Preconditions; ++import io.papermc.paper.registry.PaperRegistries; ++import io.papermc.paper.registry.set.PaperRegistrySets; ++import io.papermc.paper.registry.set.RegistryKeySet; ++import io.papermc.paper.registry.tag.TagKey; ++import io.papermc.paper.text.Filtered; ++import net.kyori.adventure.key.Key; ++import net.kyori.adventure.util.TriState; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.core.registries.Registries; ++import net.minecraft.world.item.component.OminousBottleAmplifier; ++import org.bukkit.JukeboxSong; ++import org.bukkit.block.BlockType; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.damage.DamageType; ++import org.bukkit.inventory.EquipmentSlot; ++import org.bukkit.inventory.ItemStack; ++import org.bukkit.inventory.ItemType; ++import org.bukkit.inventory.meta.trim.ArmorTrim; ++import org.bukkit.map.MapCursor; ++import org.jspecify.annotations.Nullable; ++ ++public final class ItemComponentTypesBridgesImpl implements ItemComponentTypesBridge { ++ ++ @Override ++ public ChargedProjectiles.Builder chargedProjectiles() { ++ return new PaperChargedProjectiles.BuilderImpl(); ++ } ++ ++ @Override ++ public PotDecorations.Builder potDecorations() { ++ return new PaperPotDecorations.BuilderImpl(); ++ } ++ ++ @Override ++ public Unbreakable.Builder unbreakable() { ++ return new PaperUnbreakable.BuilderImpl(); ++ } ++ ++ @Override ++ public ItemLore.Builder lore() { ++ return new PaperItemLore.BuilderImpl(); ++ } ++ ++ @Override ++ public ItemEnchantments.Builder enchantments() { ++ return new PaperItemEnchantments.BuilderImpl(); ++ } ++ ++ @Override ++ public ItemAttributeModifiers.Builder modifiers() { ++ return new PaperItemAttributeModifiers.BuilderImpl(); ++ } ++ ++ @Override ++ public FoodProperties.Builder food() { ++ return new PaperFoodProperties.BuilderImpl(); ++ } ++ ++ @Override ++ public DyedItemColor.Builder dyedItemColor() { ++ return new PaperDyedItemColor.BuilderImpl(); ++ } ++ ++ @Override ++ public PotionContents.Builder potionContents() { ++ return new PaperPotionContents.BuilderImpl(); ++ } ++ ++ @Override ++ public BundleContents.Builder bundleContents() { ++ return new PaperBundleContents.BuilderImpl(); ++ } ++ ++ @Override ++ public SuspiciousStewEffects.Builder suspiciousStewEffects() { ++ return new PaperSuspiciousStewEffects.BuilderImpl(); ++ } ++ ++ @Override ++ public MapItemColor.Builder mapItemColor() { ++ return new PaperMapItemColor.BuilderImpl(); ++ } ++ ++ @Override ++ public MapDecorations.Builder mapDecorations() { ++ return new PaperMapDecorations.BuilderImpl(); ++ } ++ ++ @Override ++ public MapDecorations.DecorationEntry decorationEntry(final MapCursor.Type type, final double x, final double z, final float rotation) { ++ return PaperMapDecorations.PaperDecorationEntry.toApi(type, x, z, rotation); ++ } ++ ++ @Override ++ public SeededContainerLoot.Builder seededContainerLoot(final Key lootTableKey) { ++ return new PaperSeededContainerLoot.BuilderImpl(lootTableKey); ++ } ++ ++ @Override ++ public ItemContainerContents.Builder itemContainerContents() { ++ return new PaperItemContainerContents.BuilderImpl(); ++ } ++ ++ @Override ++ public JukeboxPlayable.Builder jukeboxPlayable(final JukeboxSong song) { ++ return new PaperJukeboxPlayable.BuilderImpl(song); ++ } ++ ++ @Override ++ public Tool.Builder tool() { ++ return new PaperItemTool.BuilderImpl(); ++ } ++ ++ @Override ++ public Tool.Rule rule(final RegistryKeySet blocks, final @Nullable Float speed, final TriState correctForDrops) { ++ return PaperItemTool.PaperRule.fromUnsafe(blocks, speed, correctForDrops); ++ } ++ ++ @Override ++ public ItemAdventurePredicate.Builder itemAdventurePredicate() { ++ return new PaperItemAdventurePredicate.BuilderImpl(); ++ } ++ ++ @Override ++ public WrittenBookContent.Builder writtenBookContent(final Filtered title, final String author) { ++ return new PaperWrittenBookContent.BuilderImpl(title, author); ++ } ++ ++ @Override ++ public WritableBookContent.Builder writeableBookContent() { ++ return new PaperWritableBookContent.BuilderImpl(); ++ } ++ ++ @Override ++ public ItemArmorTrim.Builder itemArmorTrim(final ArmorTrim armorTrim) { ++ return new PaperItemArmorTrim.BuilderImpl(armorTrim); ++ } ++ ++ @Override ++ public LodestoneTracker.Builder lodestoneTracker() { ++ return new PaperLodestoneTracker.BuilderImpl(); ++ } ++ ++ @Override ++ public Fireworks.Builder fireworks() { ++ return new PaperFireworks.BuilderImpl(); ++ } ++ ++ @Override ++ public ResolvableProfile.Builder resolvableProfile() { ++ return new PaperResolvableProfile.BuilderImpl(); ++ } ++ ++ @Override ++ public ResolvableProfile resolvableProfile(final PlayerProfile profile) { ++ return PaperResolvableProfile.toApi(profile); ++ } ++ ++ @Override ++ public BannerPatternLayers.Builder bannerPatternLayers() { ++ return new PaperBannerPatternLayers.BuilderImpl(); ++ } ++ ++ @Override ++ public BlockItemDataProperties.Builder blockItemStateProperties() { ++ return new PaperBlockItemDataProperties.BuilderImpl(); ++ } ++ ++ @Override ++ public MapId mapId(final int id) { ++ return new PaperMapId(new net.minecraft.world.level.saveddata.maps.MapId(id)); ++ } ++ ++ @Override ++ public UseRemainder useRemainder(final ItemStack itemStack) { ++ Preconditions.checkNotNull(itemStack); ++ Preconditions.checkArgument(!itemStack.isEmpty(), "Remaining item cannot be empty!"); ++ return new PaperUseRemainder( ++ new net.minecraft.world.item.component.UseRemainder(CraftItemStack.asNMSCopy(itemStack)) ++ ); ++ } ++ ++ @Override ++ public Consumable.Builder consumable() { ++ return new PaperConsumable.BuilderImpl(); ++ } ++ ++ @Override ++ public UseCooldown.Builder useCooldown(final float seconds) { ++ Preconditions.checkArgument(seconds > 0, "seconds must be positive, was %s", seconds); ++ return new PaperUseCooldown.BuilderImpl(seconds); ++ } ++ ++ @Override ++ public DamageResistant damageResistant(final TagKey types) { ++ return new PaperDamageResistant(new net.minecraft.world.item.component.DamageResistant(PaperRegistries.toNms(types))); ++ } ++ ++ @Override ++ public Enchantable enchantable(final int level) { ++ return new PaperEnchantable(new net.minecraft.world.item.enchantment.Enchantable(level)); ++ } ++ ++ @Override ++ public Repairable repairable(final RegistryKeySet types) { ++ return new PaperRepairable(new net.minecraft.world.item.enchantment.Repairable( ++ PaperRegistrySets.convertToNms(Registries.ITEM, BuiltInRegistries.BUILT_IN_CONVERSIONS.lookup(), types) ++ )); ++ } ++ ++ @Override ++ public Equippable.Builder equippable(EquipmentSlot slot) { ++ return new PaperEquippable.BuilderImpl(slot); ++ } ++ ++ @Override ++ public DeathProtection.Builder deathProtection() { ++ return new PaperDeathProtection.BuilderImpl(); ++ } ++ ++ @Override ++ public CustomModelData customModelData(final int id) { ++ return new PaperCustomModelData(new net.minecraft.world.item.component.CustomModelData(id)); ++ } ++ ++ @Override ++ public PaperOminousBottleAmplifier ominousBottleAmplifier(final int amplifier) { ++ Preconditions.checkArgument(OminousBottleAmplifier.MIN_AMPLIFIER <= amplifier && amplifier <= OminousBottleAmplifier.MAX_AMPLIFIER, ++ "amplifier must be between %s-%s, was %s", OminousBottleAmplifier.MIN_AMPLIFIER, OminousBottleAmplifier.MAX_AMPLIFIER, amplifier ++ ); ++ return new PaperOminousBottleAmplifier( ++ new OminousBottleAmplifier(amplifier) ++ ); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperBannerPatternLayers.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperBannerPatternLayers.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9fde759d57bb9f54e32ce2e7ac36876079013c2b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperBannerPatternLayers.java +@@ -0,0 +1,62 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.registry.RegistryAccess; ++import io.papermc.paper.registry.RegistryKey; ++import io.papermc.paper.util.MCUtil; ++import java.util.List; ++import java.util.Objects; ++import java.util.Optional; ++import org.bukkit.DyeColor; ++import org.bukkit.block.banner.Pattern; ++import org.bukkit.block.banner.PatternType; ++import org.bukkit.craftbukkit.CraftRegistry; ++import org.bukkit.craftbukkit.block.banner.CraftPatternType; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++public record PaperBannerPatternLayers( ++ net.minecraft.world.level.block.entity.BannerPatternLayers impl ++) implements BannerPatternLayers, Handleable { ++ ++ private static List convert(final net.minecraft.world.level.block.entity.BannerPatternLayers nmsPatterns) { ++ return MCUtil.transformUnmodifiable(nmsPatterns.layers(), input -> { ++ final Optional type = CraftRegistry.unwrapAndConvertHolder(RegistryAccess.registryAccess().getRegistry(RegistryKey.BANNER_PATTERN), input.pattern()); ++ return new Pattern(Objects.requireNonNull(DyeColor.getByWoolData((byte) input.color().getId())), type.orElseThrow(() -> new IllegalStateException("Inline banner patterns are not supported yet in the API!"))); ++ }); ++ } ++ ++ @Override ++ public net.minecraft.world.level.block.entity.BannerPatternLayers getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Unmodifiable List patterns() { ++ return convert(impl); ++ } ++ ++ static final class BuilderImpl implements BannerPatternLayers.Builder { ++ ++ private final net.minecraft.world.level.block.entity.BannerPatternLayers.Builder builder = new net.minecraft.world.level.block.entity.BannerPatternLayers.Builder(); ++ ++ @Override ++ public BannerPatternLayers.Builder add(final Pattern pattern) { ++ this.builder.add( ++ CraftPatternType.bukkitToMinecraftHolder(pattern.getPattern()), ++ net.minecraft.world.item.DyeColor.byId(pattern.getColor().getWoolData()) ++ ); ++ return this; ++ } ++ ++ @Override ++ public BannerPatternLayers.Builder addAll(final List patterns) { ++ patterns.forEach(this::add); ++ return this; ++ } ++ ++ @Override ++ public BannerPatternLayers build() { ++ return new PaperBannerPatternLayers(this.builder.build()); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperBlockItemDataProperties.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperBlockItemDataProperties.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5757e16c5948a6897bc61005ea7260940a49abfe +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperBlockItemDataProperties.java +@@ -0,0 +1,50 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; ++import java.util.Map; ++import net.minecraft.world.item.component.BlockItemStateProperties; ++import net.minecraft.world.level.block.Block; ++import net.minecraft.world.level.block.state.BlockState; ++import org.bukkit.block.BlockType; ++import org.bukkit.block.data.BlockData; ++import org.bukkit.craftbukkit.block.CraftBlockType; ++import org.bukkit.craftbukkit.block.data.CraftBlockData; ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperBlockItemDataProperties( ++ BlockItemStateProperties impl ++) implements BlockItemDataProperties, Handleable { ++ ++ @Override ++ public BlockData createBlockData(final BlockType blockType) { ++ final Block block = CraftBlockType.bukkitToMinecraftNew(blockType); ++ final BlockState defaultState = block.defaultBlockState(); ++ return this.impl.apply(defaultState).createCraftBlockData(); ++ } ++ ++ @Override ++ public BlockData applyTo(final BlockData blockData) { ++ final BlockState state = ((CraftBlockData) blockData).getState(); ++ return this.impl.apply(state).createCraftBlockData(); ++ } ++ ++ @Override ++ public BlockItemStateProperties getHandle() { ++ return this.impl; ++ } ++ ++ static final class BuilderImpl implements BlockItemDataProperties.Builder { ++ ++ private final Map properties = new Object2ObjectOpenHashMap<>(); ++ ++ // TODO when BlockProperty API is merged ++ ++ @Override ++ public BlockItemDataProperties build() { ++ if (this.properties.isEmpty()) { ++ return new PaperBlockItemDataProperties(BlockItemStateProperties.EMPTY); ++ } ++ return new PaperBlockItemDataProperties(new BlockItemStateProperties(new Object2ObjectOpenHashMap<>(this.properties))); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperBundleContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperBundleContents.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a59a98bdb15d2f4595d5ea651bfdf62542d80b2b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperBundleContents.java +@@ -0,0 +1,51 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.List; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.inventory.ItemStack; ++ ++public record PaperBundleContents( ++ net.minecraft.world.item.component.BundleContents impl ++) implements BundleContents, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.BundleContents getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public List contents() { ++ return MCUtil.transformUnmodifiable((List) this.impl.items(), CraftItemStack::asBukkitCopy); ++ } ++ ++ static final class BuilderImpl implements BundleContents.Builder { ++ ++ private final List items = new ObjectArrayList<>(); ++ ++ @Override ++ public BundleContents.Builder add(final ItemStack stack) { ++ Preconditions.checkNotNull(stack, "stack cannot be null"); ++ Preconditions.checkArgument(!stack.isEmpty(), "stack cannot be empty"); ++ this.items.add(CraftItemStack.asNMSCopy(stack)); ++ return this; ++ } ++ ++ @Override ++ public BundleContents.Builder addAll(final List stacks) { ++ stacks.forEach(this::add); ++ return this; ++ } ++ ++ @Override ++ public BundleContents build() { ++ if (this.items.isEmpty()) { ++ return new PaperBundleContents(net.minecraft.world.item.component.BundleContents.EMPTY); ++ } ++ return new PaperBundleContents(new net.minecraft.world.item.component.BundleContents(new ObjectArrayList<>(this.items))); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperChargedProjectiles.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperChargedProjectiles.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3aa8b905748f2b82e1c464272d4b9da0c20086ad +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperChargedProjectiles.java +@@ -0,0 +1,51 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.util.MCUtil; ++import java.util.ArrayList; ++import java.util.List; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.inventory.ItemStack; ++ ++public record PaperChargedProjectiles( ++ net.minecraft.world.item.component.ChargedProjectiles impl ++) implements ChargedProjectiles, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.ChargedProjectiles getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public List projectiles() { ++ return MCUtil.transformUnmodifiable(this.impl.getItems() /*makes copies internally*/, CraftItemStack::asCraftMirror); ++ } ++ ++ static final class BuilderImpl implements ChargedProjectiles.Builder { ++ ++ private final List items = new ArrayList<>(); ++ ++ @Override ++ public ChargedProjectiles.Builder add(final ItemStack stack) { ++ Preconditions.checkNotNull(stack, "stack cannot be null"); ++ Preconditions.checkArgument(!stack.isEmpty(), "stack cannot be empty"); ++ this.items.add(CraftItemStack.asNMSCopy(stack)); ++ return this; ++ } ++ ++ @Override ++ public ChargedProjectiles.Builder addAll(final List stacks) { ++ stacks.forEach(this::add); ++ return this; ++ } ++ ++ @Override ++ public ChargedProjectiles build() { ++ if (this.items.isEmpty()) { ++ return new PaperChargedProjectiles(net.minecraft.world.item.component.ChargedProjectiles.EMPTY); ++ } ++ return new PaperChargedProjectiles(net.minecraft.world.item.component.ChargedProjectiles.of(this.items)); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperConsumable.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperConsumable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9badd3859745c0090c782fdccdd6fe8830f36b49 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperConsumable.java +@@ -0,0 +1,134 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.adventure.PaperAdventure; ++import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect; ++import io.papermc.paper.datacomponent.item.consumable.ItemUseAnimation; ++import io.papermc.paper.datacomponent.item.consumable.PaperConsumableEffects; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.List; ++import net.kyori.adventure.key.Key; ++import net.minecraft.core.Holder; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.resources.ResourceLocation; ++import net.minecraft.sounds.SoundEvent; ++import net.minecraft.sounds.SoundEvents; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.checkerframework.checker.index.qual.NonNegative; ++import org.jetbrains.annotations.Unmodifiable; ++ ++public record PaperConsumable( ++ net.minecraft.world.item.component.Consumable impl ++) implements Consumable, Handleable { ++ ++ private static final ItemUseAnimation[] VALUES = ItemUseAnimation.values(); ++ ++ @Override ++ public net.minecraft.world.item.component.Consumable getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @NonNegative float consumeSeconds() { ++ return this.impl.consumeSeconds(); ++ } ++ ++ @Override ++ public ItemUseAnimation animation() { ++ return VALUES[this.impl.animation().ordinal()]; ++ } ++ ++ @Override ++ public Key sound() { ++ return PaperAdventure.asAdventure(this.impl.sound().value().location()); ++ } ++ ++ @Override ++ public boolean hasConsumeParticles() { ++ return this.impl.hasConsumeParticles(); ++ } ++ ++ @Override ++ public @Unmodifiable List consumeEffects() { ++ return MCUtil.transformUnmodifiable(impl.onConsumeEffects(), PaperConsumableEffects::fromNms); ++ } ++ ++ @Override ++ public Consumable.Builder toBuilder() { ++ return new BuilderImpl() ++ .consumeSeconds(this.consumeSeconds()) ++ .animation(this.animation()) ++ .sound(this.sound()) ++ .addEffects(this.consumeEffects()); ++ } ++ ++ static final class BuilderImpl implements Builder { ++ ++ private static final net.minecraft.world.item.ItemUseAnimation[] VALUES = net.minecraft.world.item.ItemUseAnimation.values(); ++ ++ private float consumeSeconds = net.minecraft.world.item.component.Consumable.DEFAULT_CONSUME_SECONDS; ++ private net.minecraft.world.item.ItemUseAnimation consumeAnimation = net.minecraft.world.item.ItemUseAnimation.EAT; ++ private Holder eatSound = SoundEvents.GENERIC_EAT; ++ private boolean hasConsumeParticles = true; ++ private final List effects = new ObjectArrayList<>(); ++ ++ @Override ++ public Builder consumeSeconds(final @NonNegative float consumeSeconds) { ++ Preconditions.checkArgument(consumeSeconds >= 0, "consumeSeconds must be non-negative, was %s", consumeSeconds); ++ this.consumeSeconds = consumeSeconds; ++ return this; ++ } ++ ++ @Override ++ public Builder animation(final ItemUseAnimation animation) { ++ this.consumeAnimation = VALUES[animation.ordinal()]; ++ return this; ++ } ++ ++ @Override ++ public Builder sound(final Key sound) { ++ final ResourceLocation keySound = PaperAdventure.asVanilla(sound); ++ this.eatSound = BuiltInRegistries.SOUND_EVENT.wrapAsHolder( ++ BuiltInRegistries.SOUND_EVENT.getOptional(keySound).orElse( ++ SoundEvent.createVariableRangeEvent(keySound) ++ ) ++ ); ++ ++ return this; ++ } ++ ++ @Override ++ public Builder hasConsumeParticles(final boolean hasConsumeParticles) { ++ this.hasConsumeParticles = hasConsumeParticles; ++ return this; ++ } ++ ++ @Override ++ public Builder addEffect(final ConsumeEffect effect) { ++ this.effects.add(PaperConsumableEffects.toNms(effect)); ++ return this; ++ } ++ ++ @Override ++ public Builder addEffects(final List effects) { ++ for (final ConsumeEffect effect : effects) { ++ this.effects.add(PaperConsumableEffects.toNms(effect)); ++ } ++ return this; ++ } ++ ++ @Override ++ public Consumable build() { ++ return new PaperConsumable( ++ new net.minecraft.world.item.component.Consumable( ++ this.consumeSeconds, ++ this.consumeAnimation, ++ this.eatSound, ++ this.hasConsumeParticles, ++ new ObjectArrayList<>(this.effects) ++ ) ++ ); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperCustomModelData.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperCustomModelData.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8373d882e8b927e74961d5ed2d548b2db6dacdaf +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperCustomModelData.java +@@ -0,0 +1,18 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperCustomModelData( ++ net.minecraft.world.item.component.CustomModelData impl ++) implements CustomModelData, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.CustomModelData getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public int id() { ++ return this.impl.value(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperDamageResistant.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperDamageResistant.java +new file mode 100644 +index 0000000000000000000000000000000000000000..adc986c8b3d65e3fb91a8951048194bbe4052b74 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperDamageResistant.java +@@ -0,0 +1,21 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.registry.PaperRegistries; ++import io.papermc.paper.registry.tag.TagKey; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.damage.DamageType; ++ ++public record PaperDamageResistant( ++ net.minecraft.world.item.component.DamageResistant impl ++) implements DamageResistant, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.DamageResistant getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public TagKey types() { ++ return PaperRegistries.fromNms(this.impl.types()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperDeathProtection.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperDeathProtection.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6184acced73d8e99c0fa8b0df03680ad9b84f689 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperDeathProtection.java +@@ -0,0 +1,50 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect; ++import io.papermc.paper.datacomponent.item.consumable.PaperConsumableEffects; ++import io.papermc.paper.util.MCUtil; ++import java.util.ArrayList; ++import java.util.List; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++public record PaperDeathProtection( ++ net.minecraft.world.item.component.DeathProtection impl ++) implements DeathProtection, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.DeathProtection getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Unmodifiable List deathEffects() { ++ return MCUtil.transformUnmodifiable(impl.deathEffects(), PaperConsumableEffects::fromNms); ++ } ++ ++ static final class BuilderImpl implements Builder { ++ ++ private final List effects = new ArrayList<>(); ++ ++ @Override ++ public Builder addEffect(final ConsumeEffect effect) { ++ this.effects.add(PaperConsumableEffects.toNms(effect)); ++ return this; ++ } ++ ++ @Override ++ public Builder addEffects(final List effects) { ++ for (final ConsumeEffect effect : effects) { ++ this.effects.add(PaperConsumableEffects.toNms(effect)); ++ } ++ return this; ++ } ++ ++ @Override ++ public DeathProtection build() { ++ return new PaperDeathProtection( ++ new net.minecraft.world.item.component.DeathProtection(this.effects) ++ ); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperDyedItemColor.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperDyedItemColor.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2407d79e2e77e8be6de8e65769efc4d79e3be9db +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperDyedItemColor.java +@@ -0,0 +1,52 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.bukkit.Color; ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperDyedItemColor( ++ net.minecraft.world.item.component.DyedItemColor impl ++) implements DyedItemColor, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.DyedItemColor getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public Color color() { ++ return Color.fromRGB(this.impl.rgb() & 0x00FFFFFF); // skip alpha channel ++ } ++ ++ @Override ++ public boolean showInTooltip() { ++ return this.impl.showInTooltip(); ++ } ++ ++ @Override ++ public DyedItemColor showInTooltip(final boolean showInTooltip) { ++ return new PaperDyedItemColor(this.impl.withTooltip(showInTooltip)); ++ } ++ ++ static final class BuilderImpl implements DyedItemColor.Builder { ++ ++ private Color color = Color.WHITE; ++ private boolean showInToolTip = true; ++ ++ @Override ++ public DyedItemColor.Builder color(final Color color) { ++ this.color = color; ++ return this; ++ } ++ ++ @Override ++ public DyedItemColor.Builder showInTooltip(final boolean showInTooltip) { ++ this.showInToolTip = showInTooltip; ++ return this; ++ } ++ ++ @Override ++ public DyedItemColor build() { ++ return new PaperDyedItemColor(new net.minecraft.world.item.component.DyedItemColor(this.color.asRGB(), this.showInToolTip)); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperEnchantable.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperEnchantable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..422e1a4d606481f0dc68843fbbc8126ccfda1cc3 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperEnchantable.java +@@ -0,0 +1,18 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperEnchantable( ++ net.minecraft.world.item.enchantment.Enchantable impl ++) implements Enchantable, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.enchantment.Enchantable getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public int value() { ++ return this.impl.value(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperEquippable.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperEquippable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..dbf8d060ab20b9cf31f209f26a8ad4d0cf05d6db +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperEquippable.java +@@ -0,0 +1,169 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.adventure.PaperAdventure; ++import io.papermc.paper.registry.RegistryKey; ++import io.papermc.paper.registry.set.PaperRegistrySets; ++import io.papermc.paper.registry.set.RegistryKeySet; ++import io.papermc.paper.util.MCUtil; ++import java.util.Optional; ++import net.kyori.adventure.key.Key; ++import net.minecraft.core.Holder; ++import net.minecraft.core.HolderSet; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.core.registries.Registries; ++import net.minecraft.resources.ResourceLocation; ++import net.minecraft.sounds.SoundEvent; ++import net.minecraft.sounds.SoundEvents; ++import org.bukkit.craftbukkit.CraftEquipmentSlot; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.entity.EntityType; ++import org.bukkit.inventory.EquipmentSlot; ++import org.checkerframework.checker.nullness.qual.Nullable; ++ ++public record PaperEquippable( ++ net.minecraft.world.item.equipment.Equippable impl ++) implements Equippable, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.equipment.Equippable getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public EquipmentSlot slot() { ++ return CraftEquipmentSlot.getSlot(this.impl.slot()); ++ } ++ ++ @Override ++ public Key equipSound() { ++ return PaperAdventure.asAdventure(this.impl.equipSound().value().location()); ++ } ++ ++ @Override ++ public @Nullable Key model() { ++ return this.impl.model() ++ .map(PaperAdventure::asAdventure) ++ .orElse(null); ++ } ++ ++ @Override ++ public @Nullable Key cameraOverlay() { ++ return this.impl.cameraOverlay() ++ .map(PaperAdventure::asAdventure) ++ .orElse(null); ++ } ++ ++ @Override ++ public @Nullable RegistryKeySet allowedEntities() { ++ return this.impl.allowedEntities() ++ .map((set) -> PaperRegistrySets.convertToApi(RegistryKey.ENTITY_TYPE, set)) ++ .orElse(null); ++ } ++ ++ @Override ++ public boolean dispensable() { ++ return this.impl.dispensable(); ++ } ++ ++ @Override ++ public boolean swappable() { ++ return this.impl.swappable(); ++ } ++ ++ @Override ++ public boolean damageOnHurt() { ++ return this.impl.damageOnHurt(); ++ } ++ ++ @Override ++ public Builder toBuilder() { ++ return new BuilderImpl(this.slot()) ++ .equipSound(this.equipSound()) ++ .model(this.model()) ++ .cameraOverlay(this.cameraOverlay()) ++ .allowedEntities(this.allowedEntities()) ++ .dispensable(this.dispensable()) ++ .swappable(this.swappable()) ++ .damageOnHurt(this.damageOnHurt()); ++ } ++ ++ ++ static final class BuilderImpl implements Builder { ++ ++ private final net.minecraft.world.entity.EquipmentSlot equipmentSlot; ++ private Holder equipSound = SoundEvents.ARMOR_EQUIP_GENERIC; ++ private Optional model = Optional.empty(); ++ private Optional cameraOverlay = Optional.empty(); ++ private Optional>> allowedEntities = Optional.empty(); ++ private boolean dispensable = true; ++ private boolean swappable = true; ++ private boolean damageOnHurt = true; ++ ++ BuilderImpl(final EquipmentSlot equipmentSlot) { ++ this.equipmentSlot = CraftEquipmentSlot.getNMS(equipmentSlot); ++ } ++ ++ @Override ++ public Builder equipSound(final Key equipSound) { ++ this.equipSound = MCUtil.keyToSound(equipSound); ++ return this; ++ } ++ ++ @Override ++ public Builder model(final @Nullable Key model) { ++ this.model = Optional.ofNullable(model) ++ .map(PaperAdventure::asVanilla); ++ ++ return this; ++ } ++ ++ @Override ++ public Builder cameraOverlay(@Nullable final Key cameraOverlay) { ++ this.cameraOverlay = Optional.ofNullable(cameraOverlay) ++ .map(PaperAdventure::asVanilla); ++ ++ return this; ++ } ++ ++ @Override ++ public Builder allowedEntities(final @Nullable RegistryKeySet allowedEntities) { ++ this.allowedEntities = Optional.ofNullable(allowedEntities) ++ .map((set) -> PaperRegistrySets.convertToNms(Registries.ENTITY_TYPE, BuiltInRegistries.BUILT_IN_CONVERSIONS.lookup(), set)); ++ return this; ++ } ++ ++ @Override ++ public Builder dispensable(final boolean dispensable) { ++ this.dispensable = dispensable; ++ return this; ++ } ++ ++ @Override ++ public Builder swappable(final boolean swappable) { ++ this.swappable = swappable; ++ return this; ++ } ++ ++ @Override ++ public Builder damageOnHurt(final boolean damageOnHurt) { ++ this.damageOnHurt = damageOnHurt; ++ return this; ++ } ++ ++ @Override ++ public Equippable build() { ++ return new PaperEquippable( ++ new net.minecraft.world.item.equipment.Equippable( ++ this.equipmentSlot, ++ this.equipSound, ++ this.model, ++ this.cameraOverlay, ++ this.allowedEntities, ++ this.dispensable, ++ this.swappable, ++ this.damageOnHurt ++ ) ++ ); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperFireworks.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperFireworks.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d7002c97086b55af851faaf8c65ad05c75381b02 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperFireworks.java +@@ -0,0 +1,73 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.List; ++import net.minecraft.world.item.component.FireworkExplosion; ++import org.bukkit.FireworkEffect; ++import org.bukkit.craftbukkit.inventory.CraftMetaFirework; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++public record PaperFireworks( ++ net.minecraft.world.item.component.Fireworks impl ++) implements Fireworks, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.Fireworks getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Unmodifiable List effects() { ++ return MCUtil.transformUnmodifiable(impl.explosions(), CraftMetaFirework::getEffect); ++ } ++ ++ @Override ++ public int flightDuration() { ++ return this.impl.flightDuration(); ++ } ++ ++ static final class BuilderImpl implements Fireworks.Builder { ++ ++ private final List effects = new ObjectArrayList<>(); ++ private int duration = 0; // default set from nms Fireworks component ++ ++ @Override ++ public Fireworks.Builder flightDuration(final int duration) { ++ Preconditions.checkArgument(duration >= 0 && duration <= 0xFF, "duration must be an unsigned byte ([%s, %s]), was %s", 0, 0xFF, duration); ++ this.duration = duration; ++ return this; ++ } ++ ++ @Override ++ public Fireworks.Builder addEffect(final FireworkEffect effect) { ++ Preconditions.checkArgument( ++ this.effects.size() + 1 <= net.minecraft.world.item.component.Fireworks.MAX_EXPLOSIONS, ++ "Cannot have more than %s effects, had %s", ++ net.minecraft.world.item.component.Fireworks.MAX_EXPLOSIONS, ++ this.effects.size() + 1 ++ ); ++ this.effects.add(CraftMetaFirework.getExplosion(effect)); ++ return this; ++ } ++ ++ @Override ++ public Fireworks.Builder addEffects(final List effects) { ++ Preconditions.checkArgument( ++ this.effects.size() + effects.size() <= net.minecraft.world.item.component.Fireworks.MAX_EXPLOSIONS, ++ "Cannot have more than %s effects, had %s", ++ net.minecraft.world.item.component.Fireworks.MAX_EXPLOSIONS, ++ this.effects.size() + effects.size() ++ ); ++ MCUtil.addAndConvert(this.effects, effects, CraftMetaFirework::getExplosion); ++ return this; ++ } ++ ++ @Override ++ public Fireworks build() { ++ return new PaperFireworks(new net.minecraft.world.item.component.Fireworks(this.duration, new ObjectArrayList<>(this.effects))); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperFoodProperties.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperFoodProperties.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2a043bb9001048f66d3a6aa8cb896b35bd2df606 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperFoodProperties.java +@@ -0,0 +1,72 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperFoodProperties( ++ net.minecraft.world.food.FoodProperties impl ++) implements FoodProperties, Handleable { ++ ++ @Override ++ public int nutrition() { ++ return this.impl.nutrition(); ++ } ++ ++ @Override ++ public float saturation() { ++ return this.impl.saturation(); ++ } ++ ++ @Override ++ public boolean canAlwaysEat() { ++ return this.impl.canAlwaysEat(); ++ } ++ ++ @Override ++ public FoodProperties.Builder toBuilder() { ++ return new BuilderImpl() ++ .nutrition(this.nutrition()) ++ .saturation(this.saturation()) ++ .canAlwaysEat(this.canAlwaysEat()); ++ } ++ ++ @Override ++ public net.minecraft.world.food.FoodProperties getHandle() { ++ return this.impl; ++ } ++ ++ static final class BuilderImpl implements FoodProperties.Builder { ++ ++ private boolean canAlwaysEat = false; ++ private float saturation = 0; ++ private int nutrition = 0; ++ ++ @Override ++ public FoodProperties.Builder canAlwaysEat(final boolean canAlwaysEat) { ++ this.canAlwaysEat = canAlwaysEat; ++ return this; ++ } ++ ++ @Override ++ public FoodProperties.Builder saturation(final float saturation) { ++ this.saturation = saturation; ++ return this; ++ } ++ ++ @Override ++ public FoodProperties.Builder nutrition(final int nutrition) { ++ Preconditions.checkArgument(nutrition >= 0, "nutrition must be non-negative, was %s", nutrition); ++ this.nutrition = nutrition; ++ return this; ++ } ++ ++ @Override ++ public FoodProperties build() { ++ return new PaperFoodProperties(new net.minecraft.world.food.FoodProperties( ++ this.nutrition, ++ this.saturation, ++ this.canAlwaysEat ++ )); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperItemAdventurePredicate.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemAdventurePredicate.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c7e40bd15b7063f155b2065927e8201f80fb6d0e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemAdventurePredicate.java +@@ -0,0 +1,75 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.block.BlockPredicate; ++import io.papermc.paper.registry.RegistryKey; ++import io.papermc.paper.registry.set.PaperRegistrySets; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.List; ++import java.util.Optional; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.core.registries.Registries; ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperItemAdventurePredicate( ++ net.minecraft.world.item.AdventureModePredicate impl ++) implements ItemAdventurePredicate, Handleable { ++ ++ private static List convert(final net.minecraft.world.item.AdventureModePredicate nmsModifiers) { ++ return MCUtil.transformUnmodifiable(nmsModifiers.predicates, nms -> BlockPredicate.predicate() ++ .blocks(nms.blocks().map(blocks -> PaperRegistrySets.convertToApi(RegistryKey.BLOCK, blocks)).orElse(null)).build()); ++ } ++ ++ @Override ++ public net.minecraft.world.item.AdventureModePredicate getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public boolean showInTooltip() { ++ return this.impl.showInTooltip(); ++ } ++ ++ @Override ++ public PaperItemAdventurePredicate showInTooltip(final boolean showInTooltip) { ++ return new PaperItemAdventurePredicate(this.impl.withTooltip(showInTooltip)); ++ } ++ ++ @Override ++ public List predicates() { ++ return convert(this.impl); ++ } ++ ++ static final class BuilderImpl implements ItemAdventurePredicate.Builder { ++ ++ private final List predicates = new ObjectArrayList<>(); ++ private boolean showInTooltip = net.minecraft.world.item.component.ItemAttributeModifiers.EMPTY.showInTooltip(); ++ ++ @Override ++ public ItemAdventurePredicate.Builder addPredicate(final BlockPredicate predicate) { ++ this.predicates.add(new net.minecraft.advancements.critereon.BlockPredicate(Optional.ofNullable(predicate.blocks()).map( ++ blocks -> PaperRegistrySets.convertToNms(Registries.BLOCK, BuiltInRegistries.BUILT_IN_CONVERSIONS.lookup(), blocks) ++ ), Optional.empty(), Optional.empty())); ++ return this; ++ } ++ ++ @Override ++ public Builder addPredicates(final List predicates) { ++ for (final BlockPredicate predicate : predicates) { ++ this.addPredicate(predicate); ++ } ++ return this; ++ } ++ ++ @Override ++ public ItemAdventurePredicate.Builder showInTooltip(final boolean showInTooltip) { ++ this.showInTooltip = showInTooltip; ++ return this; ++ } ++ ++ @Override ++ public ItemAdventurePredicate build() { ++ return new PaperItemAdventurePredicate(new net.minecraft.world.item.AdventureModePredicate(new ObjectArrayList<>(this.predicates), this.showInTooltip)); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperItemArmorTrim.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemArmorTrim.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5d060c907f4b1bc2bae063ca1e3baf35140215b6 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemArmorTrim.java +@@ -0,0 +1,62 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.bukkit.craftbukkit.inventory.trim.CraftTrimMaterial; ++import org.bukkit.craftbukkit.inventory.trim.CraftTrimPattern; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.inventory.meta.trim.ArmorTrim; ++ ++public record PaperItemArmorTrim( ++ net.minecraft.world.item.equipment.trim.ArmorTrim impl ++) implements ItemArmorTrim, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.equipment.trim.ArmorTrim getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public boolean showInTooltip() { ++ return this.impl.showInTooltip(); ++ } ++ ++ @Override ++ public ItemArmorTrim showInTooltip(final boolean showInTooltip) { ++ return new PaperItemArmorTrim(this.impl.withTooltip(showInTooltip)); ++ } ++ ++ @Override ++ public ArmorTrim armorTrim() { ++ return new ArmorTrim(CraftTrimMaterial.minecraftHolderToBukkit(this.impl.material()), CraftTrimPattern.minecraftHolderToBukkit(this.impl.pattern())); ++ } ++ ++ static final class BuilderImpl implements ItemArmorTrim.Builder { ++ ++ private ArmorTrim armorTrim; ++ private boolean showInTooltip = true; ++ ++ BuilderImpl(final ArmorTrim armorTrim) { ++ this.armorTrim = armorTrim; ++ } ++ ++ @Override ++ public ItemArmorTrim.Builder showInTooltip(final boolean showInTooltip) { ++ this.showInTooltip = showInTooltip; ++ return this; ++ } ++ ++ @Override ++ public ItemArmorTrim.Builder armorTrim(final ArmorTrim armorTrim) { ++ this.armorTrim = armorTrim; ++ return this; ++ } ++ ++ @Override ++ public ItemArmorTrim build() { ++ return new PaperItemArmorTrim(new net.minecraft.world.item.equipment.trim.ArmorTrim( ++ CraftTrimMaterial.bukkitToMinecraftHolder(this.armorTrim.getMaterial()), ++ CraftTrimPattern.bukkitToMinecraftHolder(this.armorTrim.getPattern()), ++ this.showInTooltip ++ )); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperItemAttributeModifiers.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemAttributeModifiers.java +new file mode 100644 +index 0000000000000000000000000000000000000000..47ca2b8eb1c1483b6049cf18c7d8a40dd20e7cab +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemAttributeModifiers.java +@@ -0,0 +1,97 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.List; ++import org.bukkit.attribute.Attribute; ++import org.bukkit.attribute.AttributeModifier; ++import org.bukkit.craftbukkit.CraftEquipmentSlot; ++import org.bukkit.craftbukkit.attribute.CraftAttribute; ++import org.bukkit.craftbukkit.attribute.CraftAttributeInstance; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.inventory.EquipmentSlotGroup; ++import org.jetbrains.annotations.Unmodifiable; ++ ++public record PaperItemAttributeModifiers( ++ net.minecraft.world.item.component.ItemAttributeModifiers impl ++) implements ItemAttributeModifiers, Handleable { ++ ++ private static List convert(final net.minecraft.world.item.component.ItemAttributeModifiers nmsModifiers) { ++ return MCUtil.transformUnmodifiable(nmsModifiers.modifiers(), nms -> new PaperEntry( ++ CraftAttribute.minecraftHolderToBukkit(nms.attribute()), ++ CraftAttributeInstance.convert(nms.modifier(), nms.slot()) ++ )); ++ } ++ ++ @Override ++ public net.minecraft.world.item.component.ItemAttributeModifiers getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public boolean showInTooltip() { ++ return this.impl.showInTooltip(); ++ } ++ ++ @Override ++ public ItemAttributeModifiers showInTooltip(final boolean showInTooltip) { ++ return new PaperItemAttributeModifiers(this.impl.withTooltip(showInTooltip)); ++ } ++ ++ @Override ++ public @Unmodifiable List modifiers() { ++ return convert(this.impl); ++ } ++ ++ public record PaperEntry(Attribute attribute, AttributeModifier modifier) implements ItemAttributeModifiers.Entry { ++ } ++ ++ static final class BuilderImpl implements ItemAttributeModifiers.Builder { ++ ++ private final List entries = new ObjectArrayList<>(); ++ private boolean showInTooltip = net.minecraft.world.item.component.ItemAttributeModifiers.EMPTY.showInTooltip(); ++ ++ @Override ++ public Builder addModifier(final Attribute attribute, final AttributeModifier modifier) { ++ return this.addModifier(attribute, modifier, modifier.getSlotGroup()); ++ } ++ ++ @Override ++ public ItemAttributeModifiers.Builder addModifier(final Attribute attribute, final AttributeModifier modifier, final EquipmentSlotGroup equipmentSlotGroup) { ++ Preconditions.checkArgument( ++ this.entries.stream().noneMatch(e -> ++ e.modifier().id().equals(CraftNamespacedKey.toMinecraft(modifier.getKey())) && e.attribute().is(CraftNamespacedKey.toMinecraft(attribute.getKey())) ++ ), ++ "Cannot add 2 modifiers with identical keys on the same attribute (modifier %s for attribute %s)", ++ modifier.getKey(), attribute.getKey() ++ ); ++ ++ this.entries.add(new net.minecraft.world.item.component.ItemAttributeModifiers.Entry( ++ CraftAttribute.bukkitToMinecraftHolder(attribute), ++ CraftAttributeInstance.convert(modifier), ++ CraftEquipmentSlot.getNMSGroup(equipmentSlotGroup) ++ )); ++ return this; ++ } ++ ++ @Override ++ public ItemAttributeModifiers.Builder showInTooltip(final boolean showInTooltip) { ++ this.showInTooltip = showInTooltip; ++ return this; ++ } ++ ++ @Override ++ public ItemAttributeModifiers build() { ++ if (this.entries.isEmpty()) { ++ return new PaperItemAttributeModifiers(net.minecraft.world.item.component.ItemAttributeModifiers.EMPTY.withTooltip(this.showInTooltip)); ++ } ++ ++ return new PaperItemAttributeModifiers(new net.minecraft.world.item.component.ItemAttributeModifiers( ++ new ObjectArrayList<>(this.entries), ++ this.showInTooltip ++ )); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperItemContainerContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemContainerContents.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e65603e711ecd08039361d291a0aac761a2f9349 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemContainerContents.java +@@ -0,0 +1,65 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.List; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.inventory.ItemStack; ++ ++public record PaperItemContainerContents( ++ net.minecraft.world.item.component.ItemContainerContents impl ++) implements ItemContainerContents, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.ItemContainerContents getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public List contents() { ++ return MCUtil.transformUnmodifiable(this.impl.items, CraftItemStack::asBukkitCopy); ++ } ++ ++ static final class BuilderImpl implements ItemContainerContents.Builder { ++ ++ private final List items = new ObjectArrayList<>(); ++ ++ @Override ++ public ItemContainerContents.Builder add(final ItemStack stack) { ++ Preconditions.checkNotNull(stack); ++ Preconditions.checkArgument( ++ this.items.size() + 1 <= net.minecraft.world.item.component.ItemContainerContents.MAX_SIZE, ++ "Cannot have more than %s items, had %s", ++ net.minecraft.world.item.component.ItemContainerContents.MAX_SIZE, ++ this.items.size() + 1 ++ ); ++ this.items.add(CraftItemStack.asNMSCopy(stack)); ++ return this; ++ } ++ ++ @Override ++ public ItemContainerContents.Builder addAll(final List stacks) { ++ Preconditions.checkArgument( ++ this.items.size() + stacks.size() <= net.minecraft.world.item.component.ItemContainerContents.MAX_SIZE, ++ "Cannot have more than %s items, had %s", ++ net.minecraft.world.item.component.ItemContainerContents.MAX_SIZE, ++ this.items.size() + stacks.size() ++ ); ++ MCUtil.addAndConvert(this.items, stacks, itemStack -> { ++ Preconditions.checkNotNull(itemStack, "Cannot pass null itemstacks!"); ++ return CraftItemStack.asNMSCopy(itemStack); ++ }); ++ return this; ++ } ++ ++ @Override ++ public ItemContainerContents build() { ++ if (this.items.isEmpty()) { ++ return new PaperItemContainerContents(net.minecraft.world.item.component.ItemContainerContents.EMPTY); ++ } ++ return new PaperItemContainerContents(net.minecraft.world.item.component.ItemContainerContents.fromItems(this.items)); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperItemEnchantments.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemEnchantments.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3cfb18f6a4868ff32e2b118c5833b1b9864e967c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemEnchantments.java +@@ -0,0 +1,92 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import it.unimi.dsi.fastutil.objects.Object2IntMap; ++import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; ++import java.util.Collections; ++import java.util.HashMap; ++import java.util.Map; ++import net.minecraft.core.Holder; ++import org.bukkit.craftbukkit.enchantments.CraftEnchantment; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.enchantments.Enchantment; ++ ++public record PaperItemEnchantments( ++ net.minecraft.world.item.enchantment.ItemEnchantments impl, ++ Map enchantments // API values are stored externally as the concept of a lazy key transformer map does not make much sense ++) implements ItemEnchantments, Handleable { ++ ++ public PaperItemEnchantments(final net.minecraft.world.item.enchantment.ItemEnchantments itemEnchantments) { ++ this(itemEnchantments, convert(itemEnchantments)); ++ } ++ ++ private static Map convert(final net.minecraft.world.item.enchantment.ItemEnchantments itemEnchantments) { ++ if (itemEnchantments.isEmpty()) { ++ return Collections.emptyMap(); ++ } ++ final Map map = new HashMap<>(itemEnchantments.size()); ++ for (final Object2IntMap.Entry> entry : itemEnchantments.entrySet()) { ++ map.put(CraftEnchantment.minecraftHolderToBukkit(entry.getKey()), entry.getIntValue()); ++ } ++ return Collections.unmodifiableMap(map); // TODO look into making a "transforming" map maybe? ++ } ++ ++ @Override ++ public boolean showInTooltip() { ++ return this.impl.showInTooltip; ++ } ++ ++ @Override ++ public ItemEnchantments showInTooltip(final boolean showInTooltip) { ++ return new PaperItemEnchantments(this.impl.withTooltip(showInTooltip), this.enchantments); ++ } ++ ++ @Override ++ public net.minecraft.world.item.enchantment.ItemEnchantments getHandle() { ++ return this.impl; ++ } ++ ++ static final class BuilderImpl implements ItemEnchantments.Builder { ++ ++ private final Map enchantments = new Object2ObjectOpenHashMap<>(); ++ private boolean showInTooltip = true; ++ ++ @Override ++ public ItemEnchantments.Builder add(final Enchantment enchantment, final int level) { ++ Preconditions.checkArgument( ++ level >= 1 && level <= net.minecraft.world.item.enchantment.Enchantment.MAX_LEVEL, ++ "level must be between %s and %s, was %s", ++ 1, net.minecraft.world.item.enchantment.Enchantment.MAX_LEVEL, ++ level ++ ); ++ this.enchantments.put(enchantment, level); ++ return this; ++ } ++ ++ @Override ++ public ItemEnchantments.Builder addAll(final Map enchantments) { ++ enchantments.forEach(this::add); ++ return this; ++ } ++ ++ @Override ++ public ItemEnchantments.Builder showInTooltip(final boolean showInTooltip) { ++ this.showInTooltip = showInTooltip; ++ return this; ++ } ++ ++ @Override ++ public ItemEnchantments build() { ++ final net.minecraft.world.item.enchantment.ItemEnchantments initialEnchantments = net.minecraft.world.item.enchantment.ItemEnchantments.EMPTY.withTooltip(this.showInTooltip); ++ if (this.enchantments.isEmpty()) { ++ return new PaperItemEnchantments(initialEnchantments); ++ } ++ ++ final net.minecraft.world.item.enchantment.ItemEnchantments.Mutable mutable = new net.minecraft.world.item.enchantment.ItemEnchantments.Mutable(initialEnchantments); ++ this.enchantments.forEach((enchantment, level) -> ++ mutable.set(CraftEnchantment.bukkitToMinecraftHolder(enchantment), level) ++ ); ++ return new PaperItemEnchantments(mutable.toImmutable()); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperItemLore.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemLore.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8f58b6869bb79428288a4be05424ace4d77c3845 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemLore.java +@@ -0,0 +1,77 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.adventure.PaperAdventure; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.ArrayList; ++import java.util.List; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.ComponentLike; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++public record PaperItemLore( ++ net.minecraft.world.item.component.ItemLore impl ++) implements ItemLore, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.ItemLore getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Unmodifiable List lines() { ++ return MCUtil.transformUnmodifiable(impl.lines(), PaperAdventure::asAdventure); ++ } ++ ++ @Override ++ public @Unmodifiable List styledLines() { ++ return MCUtil.transformUnmodifiable(impl.styledLines(), PaperAdventure::asAdventure); ++ } ++ ++ static final class BuilderImpl implements ItemLore.Builder { ++ ++ private List lines = new ObjectArrayList<>(); ++ ++ private static void validateLineCount(final int current, final int add) { ++ final int newSize = current + add; ++ Preconditions.checkArgument( ++ newSize <= net.minecraft.world.item.component.ItemLore.MAX_LINES, ++ "Cannot have more than %s lines, had %s", ++ net.minecraft.world.item.component.ItemLore.MAX_LINES, ++ newSize ++ ); ++ } ++ ++ @Override ++ public ItemLore.Builder lines(final List lines) { ++ validateLineCount(0, lines.size()); ++ this.lines = new ArrayList<>(ComponentLike.asComponents(lines)); ++ return this; ++ } ++ ++ @Override ++ public ItemLore.Builder addLine(final ComponentLike line) { ++ validateLineCount(this.lines.size(), 1); ++ this.lines.add(line.asComponent()); ++ return this; ++ } ++ ++ @Override ++ public ItemLore.Builder addLines(final List lines) { ++ validateLineCount(this.lines.size(), lines.size()); ++ this.lines.addAll(ComponentLike.asComponents(lines)); ++ return this; ++ } ++ ++ @Override ++ public ItemLore build() { ++ if (this.lines.isEmpty()) { ++ return new PaperItemLore(net.minecraft.world.item.component.ItemLore.EMPTY); ++ } ++ ++ return new PaperItemLore(new net.minecraft.world.item.component.ItemLore(PaperAdventure.asVanilla(this.lines))); // asVanilla does a list clone ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperItemTool.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemTool.java +new file mode 100644 +index 0000000000000000000000000000000000000000..538a61eaa02c029b4d92f938e0ffde8aa6cf027c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemTool.java +@@ -0,0 +1,100 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.registry.RegistryKey; ++import io.papermc.paper.registry.set.PaperRegistrySets; ++import io.papermc.paper.registry.set.RegistryKeySet; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.Collection; ++import java.util.List; ++import java.util.Optional; ++import net.kyori.adventure.util.TriState; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.core.registries.Registries; ++import org.bukkit.block.BlockType; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++public record PaperItemTool( ++ net.minecraft.world.item.component.Tool impl ++) implements Tool, Handleable { ++ ++ private static List convert(final List tool) { ++ return MCUtil.transformUnmodifiable(tool, nms -> new PaperRule( ++ PaperRegistrySets.convertToApi(RegistryKey.BLOCK, nms.blocks()), ++ nms.speed().orElse(null), ++ TriState.byBoolean(nms.correctForDrops().orElse(null)) ++ )); ++ } ++ ++ @Override ++ public net.minecraft.world.item.component.Tool getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Unmodifiable List rules() { ++ return convert(this.impl.rules()); ++ } ++ ++ @Override ++ public float defaultMiningSpeed() { ++ return this.impl.defaultMiningSpeed(); ++ } ++ ++ @Override ++ public int damagePerBlock() { ++ return this.impl.damagePerBlock(); ++ } ++ ++ record PaperRule(RegistryKeySet blocks, @Nullable Float speed, TriState correctForDrops) implements Rule { ++ ++ public static PaperRule fromUnsafe(final RegistryKeySet blocks, final @Nullable Float speed, final TriState correctForDrops) { ++ Preconditions.checkArgument(speed == null || speed > 0, "speed must be positive"); ++ return new PaperRule(blocks, speed, correctForDrops); ++ } ++ } ++ ++ static final class BuilderImpl implements Builder { ++ ++ private final List rules = new ObjectArrayList<>(); ++ private int damage = 1; ++ private float miningSpeed = 1.0F; ++ ++ @Override ++ public Builder damagePerBlock(final int damage) { ++ Preconditions.checkArgument(damage >= 0, "damage must be non-negative, was %s", damage); ++ this.damage = damage; ++ return this; ++ } ++ ++ @Override ++ public Builder defaultMiningSpeed(final float miningSpeed) { ++ this.miningSpeed = miningSpeed; ++ return this; ++ } ++ ++ @Override ++ public Builder addRule(final Rule rule) { ++ this.rules.add(new net.minecraft.world.item.component.Tool.Rule( ++ PaperRegistrySets.convertToNms(Registries.BLOCK, BuiltInRegistries.BUILT_IN_CONVERSIONS.lookup(), rule.blocks()), ++ Optional.ofNullable(rule.speed()), ++ Optional.ofNullable(rule.correctForDrops().toBoolean()) ++ )); ++ return this; ++ } ++ ++ @Override ++ public Builder addRules(final Collection rules) { ++ rules.forEach(this::addRule); ++ return this; ++ } ++ ++ @Override ++ public Tool build() { ++ return new PaperItemTool(new net.minecraft.world.item.component.Tool(new ObjectArrayList<>(this.rules), this.miningSpeed, this.damage)); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperJukeboxPlayable.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperJukeboxPlayable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..eb7209d42e7c44ae7c9b31663aa94ed6cc77f592 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperJukeboxPlayable.java +@@ -0,0 +1,58 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import net.minecraft.world.item.EitherHolder; ++import org.bukkit.JukeboxSong; ++import org.bukkit.craftbukkit.CraftJukeboxSong; ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperJukeboxPlayable( ++ net.minecraft.world.item.JukeboxPlayable impl ++) implements JukeboxPlayable, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.JukeboxPlayable getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public boolean showInTooltip() { ++ return this.impl.showInTooltip(); ++ } ++ ++ @Override ++ public PaperJukeboxPlayable showInTooltip(final boolean showInTooltip) { ++ return new PaperJukeboxPlayable(this.impl.withTooltip(showInTooltip)); ++ } ++ ++ @Override ++ public JukeboxSong jukeboxSong() { ++ return this.impl.song().holder().map(CraftJukeboxSong::minecraftHolderToBukkit).orElseThrow(); ++ } ++ ++ static final class BuilderImpl implements JukeboxPlayable.Builder { ++ ++ private JukeboxSong song; ++ private boolean showInTooltip = true; ++ ++ BuilderImpl(final JukeboxSong song) { ++ this.song = song; ++ } ++ ++ @Override ++ public JukeboxPlayable.Builder showInTooltip(final boolean showInTooltip) { ++ this.showInTooltip = showInTooltip; ++ return this; ++ } ++ ++ @Override ++ public JukeboxPlayable.Builder jukeboxSong(final JukeboxSong song) { ++ this.song = song; ++ return this; ++ } ++ ++ @Override ++ public JukeboxPlayable build() { ++ return new PaperJukeboxPlayable(new net.minecraft.world.item.JukeboxPlayable(new EitherHolder<>(CraftJukeboxSong.bukkitToMinecraftHolder(this.song)), this.showInTooltip)); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperLodestoneTracker.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperLodestoneTracker.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5b97249f6ae90bc1a10c2089e39f064068d7cd2c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperLodestoneTracker.java +@@ -0,0 +1,53 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import java.util.Optional; ++import org.bukkit.Location; ++import org.bukkit.craftbukkit.util.CraftLocation; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jspecify.annotations.Nullable; ++ ++public record PaperLodestoneTracker( ++ net.minecraft.world.item.component.LodestoneTracker impl ++) implements LodestoneTracker, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.LodestoneTracker getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Nullable Location location() { ++ return this.impl.target().map(CraftLocation::fromGlobalPos).orElse(null); ++ } ++ ++ @Override ++ public boolean tracked() { ++ return this.impl.tracked(); ++ } ++ ++ static final class BuilderImpl implements LodestoneTracker.Builder { ++ ++ private @Nullable Location location; ++ private boolean tracked = true; ++ ++ @Override ++ public LodestoneTracker.Builder location(final @Nullable Location location) { ++ this.location = location; ++ return this; ++ } ++ ++ @Override ++ public LodestoneTracker.Builder tracked(final boolean tracked) { ++ this.tracked = tracked; ++ return this; ++ } ++ ++ @Override ++ public LodestoneTracker build() { ++ return new PaperLodestoneTracker(new net.minecraft.world.item.component.LodestoneTracker( ++ Optional.ofNullable(this.location).map(CraftLocation::toGlobalPos), ++ this.tracked ++ )); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperMapDecorations.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperMapDecorations.java +new file mode 100644 +index 0000000000000000000000000000000000000000..322a1285b0c5127abb67ccab478f1b16b44d0be4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperMapDecorations.java +@@ -0,0 +1,97 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; ++import java.util.Collections; ++import java.util.Map; ++import java.util.Set; ++import org.bukkit.craftbukkit.map.CraftMapCursor; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.map.MapCursor; ++import org.jspecify.annotations.Nullable; ++ ++public record PaperMapDecorations( ++ net.minecraft.world.item.component.MapDecorations impl ++) implements MapDecorations, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.MapDecorations getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Nullable DecorationEntry decoration(final String id) { ++ final net.minecraft.world.item.component.MapDecorations.Entry decoration = this.impl.decorations().get(id); ++ if (decoration == null) { ++ return null; ++ } ++ ++ return new PaperDecorationEntry(decoration); ++ } ++ ++ @Override ++ public Map decorations() { ++ if (this.impl.decorations().isEmpty()) { ++ return Collections.emptyMap(); ++ } ++ ++ final Set> entries = this.impl.decorations().entrySet(); ++ final Map decorations = new Object2ObjectOpenHashMap<>(entries.size()); ++ for (final Map.Entry entry : entries) { ++ decorations.put(entry.getKey(), new PaperDecorationEntry(entry.getValue())); ++ } ++ ++ return Collections.unmodifiableMap(decorations); ++ } ++ ++ public record PaperDecorationEntry(net.minecraft.world.item.component.MapDecorations.Entry entry) implements DecorationEntry { ++ ++ public static DecorationEntry toApi(final MapCursor.Type type, final double x, final double z, final float rotation) { ++ return new PaperDecorationEntry(new net.minecraft.world.item.component.MapDecorations.Entry(CraftMapCursor.CraftType.bukkitToMinecraftHolder(type), x, z, rotation)); ++ } ++ ++ @Override ++ public MapCursor.Type type() { ++ return CraftMapCursor.CraftType.minecraftHolderToBukkit(this.entry.type()); ++ } ++ ++ @Override ++ public double x() { ++ return this.entry.x(); ++ } ++ ++ @Override ++ public double z() { ++ return this.entry.z(); ++ } ++ ++ @Override ++ public float rotation() { ++ return this.entry.rotation(); ++ } ++ } ++ ++ static final class BuilderImpl implements Builder { ++ ++ private final Map entries = new Object2ObjectOpenHashMap<>(); ++ ++ @Override ++ public MapDecorations.Builder put(final String id, final DecorationEntry entry) { ++ this.entries.put(id, new net.minecraft.world.item.component.MapDecorations.Entry(CraftMapCursor.CraftType.bukkitToMinecraftHolder(entry.type()), entry.x(), entry.z(), entry.rotation())); ++ return this; ++ } ++ ++ @Override ++ public Builder putAll(final Map entries) { ++ entries.forEach(this::put); ++ return this; ++ } ++ ++ @Override ++ public MapDecorations build() { ++ if (this.entries.isEmpty()) { ++ return new PaperMapDecorations(net.minecraft.world.item.component.MapDecorations.EMPTY); ++ } ++ return new PaperMapDecorations(new net.minecraft.world.item.component.MapDecorations(new Object2ObjectOpenHashMap<>(this.entries))); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperMapId.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperMapId.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a2b4cc372bb154bbc741ad1bf47cba210f292c5c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperMapId.java +@@ -0,0 +1,19 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperMapId( ++ net.minecraft.world.level.saveddata.maps.MapId impl ++) implements MapId, Handleable { ++ ++ @Override ++ public net.minecraft.world.level.saveddata.maps.MapId getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public int id() { ++ return this.impl.id(); ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperMapItemColor.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperMapItemColor.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9b6fdfc9c1248bac426ce24d7b66610a6eff3b8f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperMapItemColor.java +@@ -0,0 +1,35 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.bukkit.Color; ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperMapItemColor( ++ net.minecraft.world.item.component.MapItemColor impl ++) implements MapItemColor, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.MapItemColor getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public Color color() { ++ return Color.fromRGB(this.impl.rgb() & 0x00FFFFFF); // skip alpha channel ++ } ++ ++ static final class BuilderImpl implements Builder { ++ ++ private Color color = Color.fromRGB(net.minecraft.world.item.component.MapItemColor.DEFAULT.rgb()); ++ ++ @Override ++ public Builder color(final Color color) { ++ this.color = color; ++ return this; ++ } ++ ++ @Override ++ public MapItemColor build() { ++ return new PaperMapItemColor(new net.minecraft.world.item.component.MapItemColor(this.color.asRGB())); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperOminousBottleAmplifier.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperOminousBottleAmplifier.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a7ed2aa21d0384384a4c5830ead544cb064b15b6 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperOminousBottleAmplifier.java +@@ -0,0 +1,18 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperOminousBottleAmplifier( ++ net.minecraft.world.item.component.OminousBottleAmplifier impl ++) implements OminousBottleAmplifier, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.OminousBottleAmplifier getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public int amplifier() { ++ return this.impl.value(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperPotDecorations.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperPotDecorations.java +new file mode 100644 +index 0000000000000000000000000000000000000000..bde757b51d0ae6a36870c789d416ec0e05c4cadf +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperPotDecorations.java +@@ -0,0 +1,83 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import java.util.Optional; ++import org.bukkit.craftbukkit.inventory.CraftItemType; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.inventory.ItemType; ++import org.jspecify.annotations.Nullable; ++ ++public record PaperPotDecorations( ++ net.minecraft.world.level.block.entity.PotDecorations impl ++) implements PotDecorations, Handleable { ++ ++ @Override ++ public @Nullable ItemType back() { ++ return this.impl.back().map(CraftItemType::minecraftToBukkitNew).orElse(null); ++ } ++ ++ @Override ++ public @Nullable ItemType left() { ++ return this.impl.left().map(CraftItemType::minecraftToBukkitNew).orElse(null); ++ } ++ ++ @Override ++ public @Nullable ItemType right() { ++ return this.impl.right().map(CraftItemType::minecraftToBukkitNew).orElse(null); ++ } ++ ++ @Override ++ public @Nullable ItemType front() { ++ return this.impl.front().map(CraftItemType::minecraftToBukkitNew).orElse(null); ++ } ++ ++ @Override ++ public net.minecraft.world.level.block.entity.PotDecorations getHandle() { ++ return this.impl; ++ } ++ ++ static final class BuilderImpl implements PotDecorations.Builder { ++ ++ private @Nullable ItemType back; ++ private @Nullable ItemType left; ++ private @Nullable ItemType right; ++ private @Nullable ItemType front; ++ ++ @Override ++ public PotDecorations.Builder back(final @Nullable ItemType back) { ++ this.back = back; ++ return this; ++ } ++ ++ @Override ++ public PotDecorations.Builder left(final @Nullable ItemType left) { ++ this.left = left; ++ return this; ++ } ++ ++ @Override ++ public PotDecorations.Builder right(final @Nullable ItemType right) { ++ this.right = right; ++ return this; ++ } ++ ++ @Override ++ public PotDecorations.Builder front(final @Nullable ItemType front) { ++ this.front = front; ++ return this; ++ } ++ ++ @Override ++ public PotDecorations build() { ++ if (this.back == null && this.left == null && this.right == null && this.front == null) { ++ return new PaperPotDecorations(net.minecraft.world.level.block.entity.PotDecorations.EMPTY); ++ } ++ ++ return new PaperPotDecorations(new net.minecraft.world.level.block.entity.PotDecorations( ++ Optional.ofNullable(this.back).map(CraftItemType::bukkitToMinecraftNew), ++ Optional.ofNullable(this.left).map(CraftItemType::bukkitToMinecraftNew), ++ Optional.ofNullable(this.right).map(CraftItemType::bukkitToMinecraftNew), ++ Optional.ofNullable(this.front).map(CraftItemType::bukkitToMinecraftNew) ++ )); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperPotionContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperPotionContents.java +new file mode 100644 +index 0000000000000000000000000000000000000000..196297175610644a5a4cad8e619303b4517df274 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperPotionContents.java +@@ -0,0 +1,103 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.List; ++import java.util.Optional; ++import net.minecraft.world.effect.MobEffectInstance; ++import org.bukkit.Color; ++import org.bukkit.craftbukkit.potion.CraftPotionType; ++import org.bukkit.craftbukkit.potion.CraftPotionUtil; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionType; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++public record PaperPotionContents( ++ net.minecraft.world.item.alchemy.PotionContents impl ++) implements PotionContents, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.alchemy.PotionContents getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Unmodifiable List customEffects() { ++ return MCUtil.transformUnmodifiable(impl.customEffects(), CraftPotionUtil::toBukkit); ++ } ++ ++ @Override ++ public @Nullable PotionType potion() { ++ return this.impl.potion() ++ .map(CraftPotionType::minecraftHolderToBukkit) ++ .orElse(null); ++ } ++ ++ @Override ++ public @Nullable Color customColor() { ++ return this.impl.customColor() ++ .map(Color::fromARGB) // alpha channel is supported for tipped arrows, so let's just leave it in ++ .orElse(null); ++ } ++ ++ @Override ++ public @Nullable String customName() { ++ return this.impl.customName().orElse(null); ++ } ++ ++ static final class BuilderImpl implements PotionContents.Builder { ++ ++ private final List customEffects = new ObjectArrayList<>(); ++ private @Nullable PotionType type; ++ private @Nullable Color color; ++ private @Nullable String customName; ++ ++ @Override ++ public PotionContents.Builder potion(final @Nullable PotionType type) { ++ this.type = type; ++ return this; ++ } ++ ++ @Override ++ public PotionContents.Builder customColor(final @Nullable Color color) { ++ this.color = color; ++ return this; ++ } ++ ++ @Override ++ public Builder customName(final @Nullable String name) { ++ Preconditions.checkArgument(name == null || name.length() <= Short.MAX_VALUE, "Custom name is longer than %s characters", Short.MAX_VALUE); ++ this.customName = name; ++ return this; ++ } ++ ++ @Override ++ public PotionContents.Builder addCustomEffect(final PotionEffect effect) { ++ this.customEffects.add(CraftPotionUtil.fromBukkit(effect)); ++ return this; ++ } ++ ++ @Override ++ public PotionContents.Builder addCustomEffects(final List effects) { ++ effects.forEach(this::addCustomEffect); ++ return this; ++ } ++ ++ @Override ++ public PotionContents build() { ++ if (this.type == null && this.color == null && this.customEffects.isEmpty() && this.customName == null) { ++ return new PaperPotionContents(net.minecraft.world.item.alchemy.PotionContents.EMPTY); ++ } ++ ++ return new PaperPotionContents(new net.minecraft.world.item.alchemy.PotionContents( ++ Optional.ofNullable(this.type).map(CraftPotionType::bukkitToMinecraftHolder), ++ Optional.ofNullable(this.color).map(Color::asARGB), ++ new ObjectArrayList<>(this.customEffects), ++ Optional.ofNullable(this.customName) ++ )); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperRepairable.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperRepairable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..96345e051c4aa77820e857a02768b684d52d7096 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperRepairable.java +@@ -0,0 +1,22 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.registry.RegistryKey; ++import io.papermc.paper.registry.set.PaperRegistrySets; ++import io.papermc.paper.registry.set.RegistryKeySet; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.inventory.ItemType; ++ ++public record PaperRepairable( ++ net.minecraft.world.item.enchantment.Repairable impl ++) implements Repairable, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.enchantment.Repairable getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public RegistryKeySet types() { ++ return PaperRegistrySets.convertToApi(RegistryKey.ITEM, this.impl.items()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperResolvableProfile.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperResolvableProfile.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2c59b17f58502402c3234289b38da28672244cbb +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperResolvableProfile.java +@@ -0,0 +1,105 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.destroystokyo.paper.profile.CraftPlayerProfile; ++import com.destroystokyo.paper.profile.PlayerProfile; ++import com.destroystokyo.paper.profile.ProfileProperty; ++import com.google.common.base.Preconditions; ++import com.mojang.authlib.properties.Property; ++import com.mojang.authlib.properties.PropertyMap; ++import io.papermc.paper.util.MCUtil; ++import java.util.Collection; ++import java.util.Optional; ++import java.util.UUID; ++import java.util.concurrent.CompletableFuture; ++import net.minecraft.util.StringUtil; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++public record PaperResolvableProfile( ++ net.minecraft.world.item.component.ResolvableProfile impl ++) implements ResolvableProfile, Handleable { ++ ++ static PaperResolvableProfile toApi(final PlayerProfile profile) { ++ return new PaperResolvableProfile(new net.minecraft.world.item.component.ResolvableProfile(CraftPlayerProfile.asAuthlibCopy(profile))); ++ } ++ ++ @Override ++ public net.minecraft.world.item.component.ResolvableProfile getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Nullable UUID uuid() { ++ return this.impl.id().orElse(null); ++ } ++ ++ @Override ++ public @Nullable String name() { ++ return this.impl.name().orElse(null); ++ } ++ ++ @Override ++ public @Unmodifiable Collection properties() { ++ return MCUtil.transformUnmodifiable(impl.properties().values(), input -> new ProfileProperty(input.name(), input.value(), input.signature())); ++ } ++ ++ @Override ++ public CompletableFuture resolve() { ++ return this.impl.resolve().thenApply(resolvableProfile -> CraftPlayerProfile.asBukkitCopy(resolvableProfile.gameProfile())); ++ } ++ ++ static final class BuilderImpl implements ResolvableProfile.Builder { ++ ++ private final PropertyMap propertyMap = new PropertyMap(); ++ private @Nullable String name; ++ private @Nullable UUID uuid; ++ ++ @Override ++ public ResolvableProfile.Builder name(final @Nullable String name) { ++ if (name != null) { ++ Preconditions.checkArgument(name.length() <= 16, "name cannot be more than 16 characters, was %s", name.length()); ++ Preconditions.checkArgument(StringUtil.isValidPlayerName(name), "name cannot include invalid characters, was %s", name); ++ } ++ this.name = name; ++ return this; ++ } ++ ++ @Override ++ public ResolvableProfile.Builder uuid(final @Nullable UUID uuid) { ++ this.uuid = uuid; ++ return this; ++ } ++ ++ @Override ++ public ResolvableProfile.Builder addProperty(final ProfileProperty property) { ++ // ProfileProperty constructor already has specific validations ++ final Property newProperty = new Property(property.getName(), property.getValue(), property.getSignature()); ++ if (!this.propertyMap.containsEntry(property.getName(), newProperty)) { // underlying map is a multimap that doesn't allow duplicate key-value pair ++ final int newSize = this.propertyMap.size() + 1; ++ Preconditions.checkArgument(newSize <= 16, "Cannot have more than 16 properties, was %s", newSize); ++ } ++ ++ this.propertyMap.put(property.getName(), newProperty); ++ return this; ++ } ++ ++ @Override ++ public ResolvableProfile.Builder addProperties(final Collection properties) { ++ properties.forEach(this::addProperty); ++ return this; ++ } ++ ++ @Override ++ public ResolvableProfile build() { ++ final PropertyMap shallowCopy = new PropertyMap(); ++ shallowCopy.putAll(this.propertyMap); ++ ++ return new PaperResolvableProfile(new net.minecraft.world.item.component.ResolvableProfile( ++ Optional.ofNullable(this.name), ++ Optional.ofNullable(this.uuid), ++ shallowCopy ++ )); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperSeededContainerLoot.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperSeededContainerLoot.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1ee469b3b690a877e066dbca79706678cd915fa8 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperSeededContainerLoot.java +@@ -0,0 +1,59 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.adventure.PaperAdventure; ++import net.kyori.adventure.key.Key; ++import net.minecraft.core.registries.Registries; ++import net.minecraft.resources.ResourceKey; ++import net.minecraft.world.level.storage.loot.LootTable; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperSeededContainerLoot( ++ net.minecraft.world.item.component.SeededContainerLoot impl ++) implements SeededContainerLoot, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.SeededContainerLoot getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public Key lootTable() { ++ return CraftNamespacedKey.fromMinecraft(this.impl.lootTable().location()); ++ } ++ ++ @Override ++ public long seed() { ++ return this.impl.seed(); ++ } ++ ++ static final class BuilderImpl implements SeededContainerLoot.Builder { ++ ++ private long seed = LootTable.RANDOMIZE_SEED; ++ private Key key; ++ ++ BuilderImpl(final Key key) { ++ this.key = key; ++ } ++ ++ @Override ++ public SeededContainerLoot.Builder lootTable(final Key key) { ++ this.key = key; ++ return this; ++ } ++ ++ @Override ++ public SeededContainerLoot.Builder seed(final long seed) { ++ this.seed = seed; ++ return this; ++ } ++ ++ @Override ++ public SeededContainerLoot build() { ++ return new PaperSeededContainerLoot(new net.minecraft.world.item.component.SeededContainerLoot( ++ ResourceKey.create(Registries.LOOT_TABLE, PaperAdventure.asVanilla(this.key)), ++ this.seed ++ )); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperSuspiciousStewEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperSuspiciousStewEffects.java +new file mode 100644 +index 0000000000000000000000000000000000000000..69801d8f22945b9818299d8e770fe80a28da7018 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperSuspiciousStewEffects.java +@@ -0,0 +1,58 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.potion.SuspiciousEffectEntry; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.Collection; ++import java.util.List; ++import org.bukkit.craftbukkit.potion.CraftPotionEffectType; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++import static io.papermc.paper.potion.SuspiciousEffectEntry.create; ++ ++public record PaperSuspiciousStewEffects( ++ net.minecraft.world.item.component.SuspiciousStewEffects impl ++) implements SuspiciousStewEffects, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.SuspiciousStewEffects getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Unmodifiable List effects() { ++ return MCUtil.transformUnmodifiable(impl.effects(), entry -> create(CraftPotionEffectType.minecraftHolderToBukkit(entry.effect()), entry.duration())); ++ } ++ ++ static final class BuilderImpl implements Builder { ++ ++ private final List effects = new ObjectArrayList<>(); ++ ++ @Override ++ public Builder add(final SuspiciousEffectEntry entry) { ++ this.effects.add(new net.minecraft.world.item.component.SuspiciousStewEffects.Entry( ++ org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraftHolder(entry.effect()), ++ entry.duration() ++ )); ++ return this; ++ } ++ ++ @Override ++ public Builder addAll(final Collection entries) { ++ entries.forEach(this::add); ++ return this; ++ } ++ ++ @Override ++ public SuspiciousStewEffects build() { ++ if (this.effects.isEmpty()) { ++ return new PaperSuspiciousStewEffects(net.minecraft.world.item.component.SuspiciousStewEffects.EMPTY); ++ } ++ ++ return new PaperSuspiciousStewEffects( ++ new net.minecraft.world.item.component.SuspiciousStewEffects(new ObjectArrayList<>(this.effects)) ++ ); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperUnbreakable.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperUnbreakable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..edeb3308af4c359d1930fdbc5417727451b6f0eb +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperUnbreakable.java +@@ -0,0 +1,39 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public record PaperUnbreakable( ++ net.minecraft.world.item.component.Unbreakable impl ++) implements Unbreakable, Handleable { ++ ++ @Override ++ public boolean showInTooltip() { ++ return this.impl.showInTooltip(); ++ } ++ ++ @Override ++ public Unbreakable showInTooltip(final boolean showInTooltip) { ++ return new PaperUnbreakable(this.impl.withTooltip(showInTooltip)); ++ } ++ ++ @Override ++ public net.minecraft.world.item.component.Unbreakable getHandle() { ++ return this.impl; ++ } ++ ++ static final class BuilderImpl implements Unbreakable.Builder { ++ ++ private boolean showInTooltip = true; ++ ++ @Override ++ public Unbreakable.Builder showInTooltip(final boolean showInTooltip) { ++ this.showInTooltip = showInTooltip; ++ return this; ++ } ++ ++ @Override ++ public Unbreakable build() { ++ return new PaperUnbreakable(new net.minecraft.world.item.component.Unbreakable(this.showInTooltip)); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperUseCooldown.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperUseCooldown.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1aeab920faaf5653ddb8e77372060fb8d3226641 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperUseCooldown.java +@@ -0,0 +1,56 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import io.papermc.paper.adventure.PaperAdventure; ++import java.util.Optional; ++import net.kyori.adventure.key.Key; ++import net.minecraft.resources.ResourceLocation; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jspecify.annotations.Nullable; ++ ++public record PaperUseCooldown( ++ net.minecraft.world.item.component.UseCooldown impl ++) implements UseCooldown, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.UseCooldown getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public float seconds() { ++ return this.impl.seconds(); ++ } ++ ++ @Override ++ public @Nullable Key cooldownGroup() { ++ return this.impl.cooldownGroup() ++ .map(PaperAdventure::asAdventure) ++ .orElse(null); ++ } ++ ++ ++ static final class BuilderImpl implements Builder { ++ ++ private final float seconds; ++ private Optional cooldownGroup = Optional.empty(); ++ ++ BuilderImpl(final float seconds) { ++ this.seconds = seconds; ++ } ++ ++ @Override ++ public Builder cooldownGroup(@Nullable final Key key) { ++ this.cooldownGroup = Optional.ofNullable(key) ++ .map(PaperAdventure::asVanilla); ++ ++ return this; ++ } ++ ++ @Override ++ public UseCooldown build() { ++ return new PaperUseCooldown( ++ new net.minecraft.world.item.component.UseCooldown(this.seconds, this.cooldownGroup) ++ ); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperUseRemainder.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperUseRemainder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c2c04506940704c2ec9a5e6bb469c4771e2d49c2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperUseRemainder.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.bukkit.inventory.ItemStack; ++ ++public record PaperUseRemainder( ++ net.minecraft.world.item.component.UseRemainder impl ++) implements UseRemainder, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.UseRemainder getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public ItemStack transformInto() { ++ return CraftItemStack.asBukkitCopy(this.impl.convertInto()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperWritableBookContent.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperWritableBookContent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..563ac5345efe68cfe223853df13d5f07cc48e850 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperWritableBookContent.java +@@ -0,0 +1,105 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.text.Filtered; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.List; ++import java.util.Optional; ++import net.minecraft.server.network.Filterable; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++import static io.papermc.paper.text.Filtered.of; ++ ++public record PaperWritableBookContent( ++ net.minecraft.world.item.component.WritableBookContent impl ++) implements WritableBookContent, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.WritableBookContent getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public @Unmodifiable List> pages() { ++ return MCUtil.transformUnmodifiable(impl.pages(), input -> of(input.raw(), input.filtered().orElse(null))); ++ } ++ ++ static final class BuilderImpl implements WritableBookContent.Builder { ++ ++ private final List> pages = new ObjectArrayList<>(); ++ ++ private static void validatePageLength(final String page) { ++ Preconditions.checkArgument( ++ page.length() <= net.minecraft.world.item.component.WritableBookContent.PAGE_EDIT_LENGTH, ++ "Cannot have page length more than %s, had %s", ++ net.minecraft.world.item.component.WritableBookContent.PAGE_EDIT_LENGTH, ++ page.length() ++ ); ++ } ++ ++ private static void validatePageCount(final int current, final int add) { ++ final int newSize = current + add; ++ Preconditions.checkArgument( ++ newSize <= net.minecraft.world.item.component.WritableBookContent.MAX_PAGES, ++ "Cannot have more than %s pages, had %s", ++ net.minecraft.world.item.component.WritableBookContent.MAX_PAGES, ++ newSize ++ ); ++ } ++ ++ @Override ++ public WritableBookContent.Builder addPage(final String page) { ++ validatePageLength(page); ++ validatePageCount(this.pages.size(), 1); ++ this.pages.add(Filterable.passThrough(page)); ++ return this; ++ } ++ ++ @Override ++ public WritableBookContent.Builder addPages(final List pages) { ++ validatePageCount(this.pages.size(), pages.size()); ++ for (final String page : pages) { ++ validatePageLength(page); ++ this.pages.add(Filterable.passThrough(page)); ++ } ++ return this; ++ } ++ ++ @Override ++ public WritableBookContent.Builder addFilteredPage(final Filtered page) { ++ validatePageLength(page.raw()); ++ if (page.filtered() != null) { ++ validatePageLength(page.filtered()); ++ } ++ validatePageCount(this.pages.size(), 1); ++ this.pages.add(new Filterable<>(page.raw(), Optional.ofNullable(page.filtered()))); ++ return this; ++ } ++ ++ @Override ++ public WritableBookContent.Builder addFilteredPages(final List> pages) { ++ validatePageCount(this.pages.size(), pages.size()); ++ for (final Filtered page : pages) { ++ validatePageLength(page.raw()); ++ if (page.filtered() != null) { ++ validatePageLength(page.filtered()); ++ } ++ this.pages.add(new Filterable<>(page.raw(), Optional.ofNullable(page.filtered()))); ++ } ++ return this; ++ } ++ ++ @Override ++ public WritableBookContent build() { ++ if (this.pages.isEmpty()) { ++ return new PaperWritableBookContent(net.minecraft.world.item.component.WritableBookContent.EMPTY); ++ } ++ ++ return new PaperWritableBookContent( ++ new net.minecraft.world.item.component.WritableBookContent(new ObjectArrayList<>(this.pages)) ++ ); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperWrittenBookContent.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperWrittenBookContent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e6ce137806cd789586108fef5a5da508b19b7131 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperWrittenBookContent.java +@@ -0,0 +1,183 @@ ++package io.papermc.paper.datacomponent.item; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.adventure.PaperAdventure; ++import io.papermc.paper.text.Filtered; ++import io.papermc.paper.util.MCUtil; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; ++import java.util.List; ++import java.util.Optional; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.ComponentLike; ++import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; ++import net.minecraft.server.network.Filterable; ++import net.minecraft.util.GsonHelper; ++import org.bukkit.craftbukkit.util.Handleable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++import static io.papermc.paper.adventure.PaperAdventure.asAdventure; ++import static io.papermc.paper.adventure.PaperAdventure.asVanilla; ++ ++public record PaperWrittenBookContent( ++ net.minecraft.world.item.component.WrittenBookContent impl ++) implements WrittenBookContent, Handleable { ++ ++ @Override ++ public net.minecraft.world.item.component.WrittenBookContent getHandle() { ++ return this.impl; ++ } ++ ++ @Override ++ public Filtered title() { ++ return Filtered.of(this.impl.title().raw(), this.impl.title().filtered().orElse(null)); ++ } ++ ++ @Override ++ public String author() { ++ return this.impl.author(); ++ } ++ ++ @Override ++ public int generation() { ++ return this.impl.generation(); ++ } ++ ++ @Override ++ public @Unmodifiable List> pages() { ++ return MCUtil.transformUnmodifiable( ++ impl.pages(), ++ page -> Filtered.of(asAdventure(page.raw()), page.filtered().map(PaperAdventure::asAdventure).orElse(null)) ++ ); ++ } ++ ++ @Override ++ public boolean resolved() { ++ return this.impl.resolved(); ++ } ++ ++ static final class BuilderImpl implements WrittenBookContent.Builder { ++ ++ private final List> pages = new ObjectArrayList<>(); ++ private Filterable title; ++ private String author; ++ private int generation = 0; ++ private boolean resolved = false; ++ ++ BuilderImpl(final Filtered title, final String author) { ++ validateTitle(title.raw()); ++ if (title.filtered() != null) { ++ validateTitle(title.filtered()); ++ } ++ this.title = new Filterable<>(title.raw(), Optional.ofNullable(title.filtered())); ++ this.author = author; ++ } ++ ++ private static void validateTitle(final String title) { ++ Preconditions.checkArgument( ++ title.length() <= net.minecraft.world.item.component.WrittenBookContent.TITLE_MAX_LENGTH, ++ "Title cannot be longer than %s, was %s", ++ net.minecraft.world.item.component.WrittenBookContent.TITLE_MAX_LENGTH, ++ title.length() ++ ); ++ } ++ ++ private static void validatePageLength(final Component page) { ++ final String flagPage = GsonHelper.toStableString(GsonComponentSerializer.gson().serializeToTree(page)); ++ Preconditions.checkArgument( ++ flagPage.length() <= net.minecraft.world.item.component.WrittenBookContent.PAGE_LENGTH, ++ "Cannot have page length more than %s, had %s", ++ net.minecraft.world.item.component.WrittenBookContent.PAGE_LENGTH, ++ flagPage.length() ++ ); ++ } ++ ++ @Override ++ public WrittenBookContent.Builder title(final String title) { ++ validateTitle(title); ++ this.title = Filterable.passThrough(title); ++ return this; ++ } ++ ++ @Override ++ public WrittenBookContent.Builder filteredTitle(final Filtered title) { ++ validateTitle(title.raw()); ++ if (title.filtered() != null) { ++ validateTitle(title.filtered()); ++ } ++ this.title = new Filterable<>(title.raw(), Optional.ofNullable(title.filtered())); ++ return this; ++ } ++ ++ @Override ++ public WrittenBookContent.Builder author(final String author) { ++ this.author = author; ++ return this; ++ } ++ ++ @Override ++ public WrittenBookContent.Builder generation(final int generation) { ++ Preconditions.checkArgument( ++ generation >= 0 && generation <= net.minecraft.world.item.component.WrittenBookContent.MAX_GENERATION, ++ "generation must be between %s and %s, was %s", ++ 0, net.minecraft.world.item.component.WrittenBookContent.MAX_GENERATION, ++ generation ++ ); ++ this.generation = generation; ++ return this; ++ } ++ ++ @Override ++ public WrittenBookContent.Builder resolved(final boolean resolved) { ++ this.resolved = resolved; ++ return this; ++ } ++ ++ @Override ++ public WrittenBookContent.Builder addPage(final ComponentLike page) { ++ final Component component = page.asComponent(); ++ validatePageLength(component); ++ this.pages.add(Filterable.passThrough(asVanilla(component))); ++ return this; ++ } ++ ++ @Override ++ public WrittenBookContent.Builder addPages(final List pages) { ++ for (final ComponentLike page : pages) { ++ final Component component = page.asComponent(); ++ validatePageLength(component); ++ this.pages.add(Filterable.passThrough(asVanilla(component))); ++ } ++ return this; ++ } ++ ++ @Override ++ public WrittenBookContent.Builder addFilteredPage(final Filtered page) { ++ final Component raw = page.raw().asComponent(); ++ validatePageLength(raw); ++ Component filtered = null; ++ if (page.filtered() != null) { ++ filtered = page.filtered().asComponent(); ++ validatePageLength(filtered); ++ } ++ this.pages.add(new Filterable<>(asVanilla(raw), Optional.ofNullable(filtered).map(PaperAdventure::asVanilla))); ++ return this; ++ } ++ ++ @Override ++ public WrittenBookContent.Builder addFilteredPages(final List> pages) { ++ pages.forEach(this::addFilteredPage); ++ return this; ++ } ++ ++ @Override ++ public WrittenBookContent build() { ++ return new PaperWrittenBookContent(new net.minecraft.world.item.component.WrittenBookContent( ++ this.title, ++ this.author, ++ this.generation, ++ new ObjectArrayList<>(this.pages), ++ this.resolved ++ )); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c96cb39cf21ebe33d09733affc3cb031d94213f2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java +@@ -0,0 +1,66 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++import com.google.common.base.Preconditions; ++import com.google.common.collect.Lists; ++import io.papermc.paper.registry.set.PaperRegistrySets; ++import io.papermc.paper.registry.set.RegistryKeySet; ++import java.util.ArrayList; ++import java.util.List; ++import io.papermc.paper.util.MCUtil; ++import net.kyori.adventure.key.Key; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.core.registries.Registries; ++import org.bukkit.craftbukkit.potion.CraftPotionUtil; ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionEffectType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++@ApiStatus.Internal ++@NullMarked ++public class ConsumableTypesBridgeImpl implements ConsumableTypesBridge { ++ ++ @Override ++ public ConsumeEffect.ApplyStatusEffects applyStatusEffects(final List effectList, final float probability) { ++ Preconditions.checkArgument(0 <= probability && probability <= 1, "probability must be between 0-1, was %s", probability); ++ return new PaperApplyStatusEffects( ++ new net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect( ++ new ArrayList<>(Lists.transform(effectList, CraftPotionUtil::fromBukkit)), ++ probability ++ ) ++ ); ++ } ++ ++ @Override ++ public ConsumeEffect.RemoveStatusEffects removeStatusEffects(final RegistryKeySet potionEffectTypeTagKey) { ++ return new PaperRemoveStatusEffects( ++ new net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect( ++ PaperRegistrySets.convertToNms(Registries.MOB_EFFECT, BuiltInRegistries.BUILT_IN_CONVERSIONS.lookup(), potionEffectTypeTagKey) ++ ) ++ ); ++ } ++ ++ @Override ++ public ConsumeEffect.ClearAllStatusEffects clearAllStatusEffects() { ++ return new PaperClearAllStatusEffects( ++ new net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect() ++ ); ++ } ++ ++ @Override ++ public ConsumeEffect.PlaySound playSoundEffect(final Key sound) { ++ return new PaperPlaySound( ++ new net.minecraft.world.item.consume_effects.PlaySoundConsumeEffect( ++ MCUtil.keyToSound(sound) ++ ) ++ ); ++ } ++ ++ @Override ++ public ConsumeEffect.TeleportRandomly teleportRandomlyEffect(final float diameter) { ++ Preconditions.checkArgument(diameter > 0, "diameter must be positive, was %s", diameter); ++ return new PaperTeleportRandomly( ++ new net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect(diameter) ++ ); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffects.java +new file mode 100644 +index 0000000000000000000000000000000000000000..465bec185aad849f283aae39bc23e9ba7a052371 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffects.java +@@ -0,0 +1,28 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++import java.util.List; ++import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; ++import org.bukkit.craftbukkit.potion.CraftPotionUtil; ++import org.bukkit.potion.PotionEffect; ++ ++import static io.papermc.paper.datacomponent.ComponentUtils.transform; ++ ++public record PaperApplyStatusEffects( ++ ApplyStatusEffectsConsumeEffect impl ++) implements ConsumeEffect.ApplyStatusEffects, PaperConsumableEffectImpl { ++ ++ @Override ++ public List effects() { ++ return transform(this.impl().effects(), CraftPotionUtil::toBukkit); ++ } ++ ++ @Override ++ public float probability() { ++ return this.impl.probability(); ++ } ++ ++ @Override ++ public ApplyStatusEffectsConsumeEffect getHandle() { ++ return this.impl; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffects.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2afcbbbeb486783737fd606113b6f938d0a18cb5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffects.java +@@ -0,0 +1,11 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++public record PaperClearAllStatusEffects( ++ net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect impl ++) implements ConsumeEffect.ClearAllStatusEffects, PaperConsumableEffectImpl { ++ ++ @Override ++ public net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect getHandle() { ++ return this.impl; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffectImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffectImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..05ede1d3f5b0b5ea3a5004cb4a7a153ed7714a55 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffectImpl.java +@@ -0,0 +1,7 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++import net.minecraft.world.item.consume_effects.ConsumeEffect; ++import org.bukkit.craftbukkit.util.Handleable; ++ ++public interface PaperConsumableEffectImpl extends Handleable { ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffects.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ff07939ef0730a11c712c09c360da8a21a777618 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffects.java +@@ -0,0 +1,32 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; ++import net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect; ++import net.minecraft.world.item.consume_effects.PlaySoundConsumeEffect; ++import net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect; ++import net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect; ++ ++public final class PaperConsumableEffects { ++ ++ private PaperConsumableEffects() { ++ } ++ ++ public static ConsumeEffect fromNms(net.minecraft.world.item.consume_effects.ConsumeEffect consumable) { ++ return switch (consumable) { ++ case ApplyStatusEffectsConsumeEffect effect -> new PaperApplyStatusEffects(effect); ++ case ClearAllStatusEffectsConsumeEffect effect -> new PaperClearAllStatusEffects(effect); ++ case PlaySoundConsumeEffect effect -> new PaperPlaySound(effect); ++ case RemoveStatusEffectsConsumeEffect effect -> new PaperRemoveStatusEffects(effect); ++ case TeleportRandomlyConsumeEffect effect -> new PaperTeleportRandomly(effect); ++ default -> throw new UnsupportedOperationException("Don't know how to convert " + consumable.getClass()); ++ }; ++ } ++ ++ public static net.minecraft.world.item.consume_effects.ConsumeEffect toNms(ConsumeEffect effect) { ++ if (effect instanceof PaperConsumableEffectImpl consumableEffect) { ++ return consumableEffect.getHandle(); ++ } else { ++ throw new UnsupportedOperationException("Must implement handleable!"); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySound.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySound.java +new file mode 100644 +index 0000000000000000000000000000000000000000..26a8ee292b45e57462e6e6629b328fbf9d6b47e7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySound.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++import io.papermc.paper.adventure.PaperAdventure; ++import net.kyori.adventure.key.Key; ++import net.minecraft.world.item.consume_effects.PlaySoundConsumeEffect; ++ ++public record PaperPlaySound( ++ PlaySoundConsumeEffect impl ++) implements ConsumeEffect.PlaySound, PaperConsumableEffectImpl { ++ ++ @Override ++ public Key sound() { ++ return PaperAdventure.asAdventure(this.impl.sound().value().location()); ++ } ++ ++ @Override ++ public PlaySoundConsumeEffect getHandle() { ++ return this.impl; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffects.java +new file mode 100644 +index 0000000000000000000000000000000000000000..20e09c6ebab91b1ec103aa149d0f57a2a5502644 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffects.java +@@ -0,0 +1,21 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++import io.papermc.paper.registry.RegistryKey; ++import io.papermc.paper.registry.set.PaperRegistrySets; ++import io.papermc.paper.registry.set.RegistryKeySet; ++import org.bukkit.potion.PotionEffectType; ++ ++public record PaperRemoveStatusEffects( ++ net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect impl ++) implements ConsumeEffect.RemoveStatusEffects, PaperConsumableEffectImpl { ++ ++ @Override ++ public RegistryKeySet removeEffects() { ++ return PaperRegistrySets.convertToApi(RegistryKey.MOB_EFFECT, this.impl.effects()); ++ } ++ ++ @Override ++ public net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect getHandle() { ++ return this.impl; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomly.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomly.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c21889e9984f7c36d9f19771c2e23b6efba5197d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomly.java +@@ -0,0 +1,15 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++public record PaperTeleportRandomly( ++ net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect impl ++) implements ConsumeEffect.TeleportRandomly, PaperConsumableEffectImpl { ++ @Override ++ public float diameter() { ++ return this.impl.diameter(); ++ } ++ ++ @Override ++ public net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect getHandle() { ++ return this.impl; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/package-info.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..af6720a49a9d336a345e2bc91d6714f6b2c39886 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/package-info.java +@@ -0,0 +1,7 @@ ++/** ++ * Relating to consumable effects for components. ++ */ ++@NullMarked ++package io.papermc.paper.datacomponent.item.consumable; ++ ++import org.jspecify.annotations.NullMarked; +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/package-info.java b/src/main/java/io/papermc/paper/datacomponent/item/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..02a69025662d6a887f5449fd5eaf7d1083973bf3 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/package-info.java +@@ -0,0 +1,4 @@ ++@NullMarked ++package io.papermc.paper.datacomponent.item; ++ ++import org.jspecify.annotations.NullMarked; +diff --git a/src/main/java/io/papermc/paper/datacomponent/package-info.java b/src/main/java/io/papermc/paper/datacomponent/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..62aa1061c35d5358e6dec16a52574b427cc4b732 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/package-info.java +@@ -0,0 +1,4 @@ ++@NullMarked ++package io.papermc.paper.datacomponent; ++ ++import org.jspecify.annotations.NullMarked; +diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java +index f8c6da955e4bd0e480c7b581d2a4325738f9dd6f..ee1fce58c6e57dd93a30ee66e7488a92f9da2fe3 100644 +--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java ++++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java +@@ -1,6 +1,8 @@ + package io.papermc.paper.registry; + + import io.papermc.paper.adventure.PaperAdventure; ++import io.papermc.paper.datacomponent.DataComponentType; ++import io.papermc.paper.datacomponent.PaperComponentType; + import io.papermc.paper.registry.data.PaperEnchantmentRegistryEntry; + import io.papermc.paper.registry.data.PaperGameEventRegistryEntry; + import io.papermc.paper.registry.entry.RegistryEntry; +@@ -96,6 +98,7 @@ public final class PaperRegistries { + entry(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, Attribute.class, CraftAttribute::new), + entry(Registries.FLUID, RegistryKey.FLUID, Fluid.class, CraftFluid::new), + entry(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, Sound.class, CraftSound::new), ++ entry(Registries.DATA_COMPONENT_TYPE, RegistryKey.DATA_COMPONENT_TYPE, DataComponentType.class, PaperComponentType::of), + + // data-drivens + entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(), +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +index 756c73a401437566258813946fa10c7caa8f2469..bfddaa146c1bcb6a3fdd43773ec06f91a259b200 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +@@ -206,7 +206,7 @@ public final class CraftItemStack extends ItemStack { + this.adjustTagForItemMeta(oldType); // Paper + } + } +- this.setData(null); ++ this.setData((MaterialData) null); // Paper + } + + @Override +@@ -245,7 +245,7 @@ public final class CraftItemStack extends ItemStack { + + @Override + public int getMaxStackSize() { +- return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getMaxStackSize(); ++ return (this.handle == null) ? 64 : this.handle.getMaxStackSize(); // Paper - air stacks to 64 + } + + // Paper start +@@ -267,12 +267,14 @@ public final class CraftItemStack extends ItemStack { + public void addUnsafeEnchantment(Enchantment ench, int level) { + Preconditions.checkArgument(ench != null, "Enchantment cannot be null"); + +- // Paper start - Replace whole method +- final ItemMeta itemMeta = this.getItemMeta(); +- if (itemMeta != null) { +- itemMeta.addEnchant(ench, level, true); +- this.setItemMeta(itemMeta); ++ // Paper start ++ if (this.handle == null) { ++ return; + } ++ ++ EnchantmentHelper.updateEnchantments(this.handle, mutable -> { // data component api doesn't really support mutable things once already set yet ++ mutable.set(CraftEnchantment.bukkitToMinecraftHolder(ench), level); ++ }); + // Paper end + } + +@@ -302,17 +304,28 @@ public final class CraftItemStack extends ItemStack { + public int removeEnchantment(Enchantment ench) { + Preconditions.checkArgument(ench != null, "Enchantment cannot be null"); + +- // Paper start - replace entire method +- int level = getEnchantmentLevel(ench); +- if (level > 0) { +- final ItemMeta itemMeta = this.getItemMeta(); +- if (itemMeta == null) return 0; +- itemMeta.removeEnchant(ench); +- this.setItemMeta(itemMeta); ++ // Paper start ++ if (this.handle == null) { ++ return 0; ++ } ++ ++ ItemEnchantments itemEnchantments = this.handle.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY); ++ if (itemEnchantments.isEmpty()) { ++ return 0; + } +- // Paper end + +- return level; ++ Holder removedEnchantment = CraftEnchantment.bukkitToMinecraftHolder(ench); ++ if (itemEnchantments.keySet().contains(removedEnchantment)) { ++ int previousLevel = itemEnchantments.getLevel(removedEnchantment); ++ ++ ItemEnchantments.Mutable mutable = new ItemEnchantments.Mutable(itemEnchantments); // data component api doesn't really support mutable things once already set yet ++ mutable.removeIf(enchantment -> enchantment.equals(removedEnchantment)); ++ this.handle.set(DataComponents.ENCHANTMENTS, mutable.toImmutable()); ++ return previousLevel; ++ } ++ ++ return 0; ++ // Paper end + } + + @Override +@@ -324,7 +337,13 @@ public final class CraftItemStack extends ItemStack { + + @Override + public Map getEnchantments() { +- return this.hasItemMeta() ? this.getItemMeta().getEnchants() : ImmutableMap.of(); // Paper - use Item Meta ++ // Paper start ++ io.papermc.paper.datacomponent.item.ItemEnchantments itemEnchantments = this.getData(io.papermc.paper.datacomponent.DataComponentTypes.ENCHANTMENTS); // empty constant might be useful here ++ if (itemEnchantments == null) { ++ return java.util.Collections.emptyMap(); ++ } ++ return itemEnchantments.enchantments(); ++ // Paper end + } + + static Map getEnchantments(net.minecraft.world.item.ItemStack item) { +@@ -526,4 +545,119 @@ public final class CraftItemStack extends ItemStack { + return this.pdcView; + } + // Paper end - pdc ++ // Paper start - data component API ++ @Override ++ public T getData(final io.papermc.paper.datacomponent.DataComponentType.Valued type) { ++ if (this.isEmpty()) { ++ return null; ++ } ++ return io.papermc.paper.datacomponent.PaperComponentType.convertDataComponentValue(this.handle.getComponents(), (io.papermc.paper.datacomponent.PaperComponentType.ValuedImpl) type); ++ } ++ ++ @Override ++ public boolean hasData(final io.papermc.paper.datacomponent.DataComponentType type) { ++ if (this.isEmpty()) { ++ return false; ++ } ++ return this.handle.has(io.papermc.paper.datacomponent.PaperComponentType.bukkitToMinecraft(type)); ++ } ++ ++ @Override ++ public java.util.Set getDataTypes() { ++ if (this.isEmpty()) { ++ return java.util.Collections.emptySet(); ++ } ++ return io.papermc.paper.datacomponent.PaperComponentType.minecraftToBukkit(this.handle.getComponents().keySet()); ++ } ++ ++ @Override ++ public void setData(final io.papermc.paper.datacomponent.DataComponentType.Valued type, final T value) { ++ Preconditions.checkArgument(value != null, "value cannot be null"); ++ if (this.isEmpty()) { ++ return; ++ } ++ this.setDataInternal((io.papermc.paper.datacomponent.PaperComponentType.ValuedImpl) type, value); ++ } ++ ++ @Override ++ public void setData(final io.papermc.paper.datacomponent.DataComponentType.NonValued type) { ++ if (this.isEmpty()) { ++ return; ++ } ++ this.setDataInternal((io.papermc.paper.datacomponent.PaperComponentType.NonValuedImpl) type, null); ++ } ++ ++ private void setDataInternal(final io.papermc.paper.datacomponent.PaperComponentType type, final A value) { ++ this.handle.set(type.getHandle(), type.getAdapter().toVanilla(value)); ++ } ++ ++ @Override ++ public void unsetData(final io.papermc.paper.datacomponent.DataComponentType type) { ++ if (this.isEmpty()) { ++ return; ++ } ++ this.handle.remove(io.papermc.paper.datacomponent.PaperComponentType.bukkitToMinecraft(type)); ++ } ++ ++ @Override ++ public void resetData(final io.papermc.paper.datacomponent.DataComponentType type) { ++ if (this.isEmpty()) { ++ return; ++ } ++ this.resetData((io.papermc.paper.datacomponent.PaperComponentType) type); ++ } ++ ++ private void resetData(final io.papermc.paper.datacomponent.PaperComponentType type) { ++ final net.minecraft.core.component.DataComponentType nms = io.papermc.paper.datacomponent.PaperComponentType.bukkitToMinecraft(type); ++ final M nmsValue = this.handle.getItem().components().get(nms); ++ // if nmsValue is null, it will clear any set patch ++ // if nmsValue is not null, it will still clear any set patch because it will equal the default value ++ this.handle.set(nms, nmsValue); ++ } ++ ++ @Override ++ public boolean isDataOverridden(final io.papermc.paper.datacomponent.DataComponentType type) { ++ if (this.isEmpty()) { ++ return false; ++ } ++ final net.minecraft.core.component.DataComponentType nms = io.papermc.paper.datacomponent.PaperComponentType.bukkitToMinecraft(type); ++ // maybe a more efficient way is to expose the "patch" map in PatchedDataComponentMap and just check if the type exists as a key ++ return !java.util.Objects.equals(this.handle.get(nms), this.handle.getPrototype().get(nms)); ++ } ++ ++ @Override ++ public boolean matchesWithoutData(final ItemStack item, final java.util.Set exclude, final boolean ignoreCount) { ++ // Extracted from base equals ++ final CraftItemStack craftStack = getCraftStack(item); ++ if (this.handle == craftStack.handle) return true; ++ if (this.handle == null || craftStack.handle == null) return false; ++ if (this.handle.isEmpty() && craftStack.handle.isEmpty()) return true; ++ ++ net.minecraft.world.item.ItemStack left = this.handle; ++ net.minecraft.world.item.ItemStack right = craftStack.handle; ++ if (!ignoreCount && left.getCount() != right.getCount()) { ++ return false; ++ } ++ if (!left.is(right.getItem())) { ++ return false; ++ } ++ ++ // It can be assumed that the prototype is equal since the type is the same. This way all we need to check is the patch ++ ++ // Fast path when excluded types is empty ++ if (exclude.isEmpty()) { ++ return left.getComponentsPatch().equals(right.getComponentsPatch()); ++ } ++ ++ // Collect all the NMS types into a set ++ java.util.Set> skippingTypes = new java.util.HashSet<>(exclude.size()); ++ for (io.papermc.paper.datacomponent.DataComponentType api : exclude) { ++ skippingTypes.add(io.papermc.paper.datacomponent.PaperComponentType.bukkitToMinecraft(api)); ++ } ++ ++ // Check the patch by first stripping excluded types and then compare the trimmed patches ++ return left.getComponentsPatch().forget(skippingTypes::contains).equals(right.getComponentsPatch().forget(skippingTypes::contains)); ++ } ++ ++ // Paper end - data component API + } +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java +index 1b57649d0d3db24ed32c78cf3d5ce1d9fb1353e0..ce1287edd7db00279ec8569d767ab6272c8ae3fb 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java +@@ -270,4 +270,20 @@ public class CraftItemType implements ItemType.Typed, Han + return rarity == null ? null : org.bukkit.inventory.ItemRarity.valueOf(rarity.name()); + } + // Paper end - expand ItemRarity API ++ // Paper start - data component API ++ @Override ++ public T getDefaultData(final io.papermc.paper.datacomponent.DataComponentType.Valued type) { ++ return io.papermc.paper.datacomponent.PaperComponentType.convertDataComponentValue(this.item.components(), ((io.papermc.paper.datacomponent.PaperComponentType.ValuedImpl) type)); ++ } ++ ++ @Override ++ public boolean hasDefaultData(final io.papermc.paper.datacomponent.DataComponentType type) { ++ return this.item.components().has(io.papermc.paper.datacomponent.PaperComponentType.bukkitToMinecraft(type)); ++ } ++ ++ @Override ++ public java.util.Set getDefaultDataTypes() { ++ return io.papermc.paper.datacomponent.PaperComponentType.minecraftToBukkit(this.item.components().keySet()); ++ } ++ // Paper end - data component API + } +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java +index a944803771d514572f94b4e98a6d4435a009c078..82cb8cd1635c279326cec8454f1906ce35021dec 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java +@@ -91,7 +91,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { + this.safelyAddEffects(effects, false); // Paper - limit firework effects + } + +- static FireworkEffect getEffect(FireworkExplosion explosion) { ++ public static FireworkEffect getEffect(FireworkExplosion explosion) { // Paper + FireworkEffect.Builder effect = FireworkEffect.builder() + .flicker(explosion.hasTwinkle()) + .trail(explosion.hasTrail()) +@@ -111,7 +111,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { + return effect.build(); + } + +- static FireworkExplosion getExplosion(FireworkEffect effect) { ++ public static FireworkExplosion getExplosion(FireworkEffect effect) { // Paper + IntList colors = CraftMetaFirework.addColors(effect.getColors()); + IntList fadeColors = CraftMetaFirework.addColors(effect.getFadeColors()); + +diff --git a/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.ItemComponentTypesBridge b/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.ItemComponentTypesBridge +new file mode 100644 +index 0000000000000000000000000000000000000000..0fd276c2fdbba784c1cd95105553996b4ba2460e +--- /dev/null ++++ b/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.ItemComponentTypesBridge +@@ -0,0 +1 @@ ++io.papermc.paper.datacomponent.item.ItemComponentTypesBridgesImpl +diff --git a/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.consumable.ConsumableTypesBridge b/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.consumable.ConsumableTypesBridge +new file mode 100644 +index 0000000000000000000000000000000000000000..852ab097181491735fb9ee5ee4f70e4ceeb32e6d +--- /dev/null ++++ b/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.consumable.ConsumableTypesBridge +@@ -0,0 +1 @@ ++io.papermc.paper.datacomponent.item.consumable.ConsumableTypesBridgeImpl +diff --git a/src/test/java/io/papermc/paper/datacomponent/DataComponentTypesTest.java b/src/test/java/io/papermc/paper/datacomponent/DataComponentTypesTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1d707114f53e80bf278dc640c55b515d85f03120 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/datacomponent/DataComponentTypesTest.java +@@ -0,0 +1,58 @@ ++package io.papermc.paper.datacomponent; ++ ++import com.google.common.collect.Collections2; ++import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; ++import net.minecraft.core.registries.Registries; ++import net.minecraft.resources.ResourceLocation; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.bukkit.support.RegistryHelper; ++import org.bukkit.support.environment.AllFeatures; ++import org.junit.jupiter.api.Assertions; ++import org.junit.jupiter.api.Test; ++import java.lang.reflect.Field; ++import java.util.Set; ++import java.util.function.Predicate; ++import java.util.stream.Collectors; ++ ++@AllFeatures ++public class DataComponentTypesTest { ++ ++ private static final Set NOT_IN_API = Set.of( ++ ResourceLocation.parse("custom_data"), ++ ResourceLocation.parse("entity_data"), ++ ResourceLocation.parse("bees"), ++ ResourceLocation.parse("debug_stick_state"), ++ ResourceLocation.parse("block_entity_data"), ++ ResourceLocation.parse("bucket_entity_data"), ++ ResourceLocation.parse("lock"), ++ ResourceLocation.parse("creative_slot_lock") ++ ); ++ ++ @Test ++ public void testAllDataComponentsAreMapped() throws IllegalAccessException { ++ final Set vanillaDataComponentTypes = new ObjectOpenHashSet<>( ++ RegistryHelper.getRegistry() ++ .lookupOrThrow(Registries.DATA_COMPONENT_TYPE) ++ .keySet() ++ ); ++ ++ for (final Field declaredField : DataComponentTypes.class.getDeclaredFields()) { ++ if (!DataComponentType.class.isAssignableFrom(declaredField.getType())) continue; ++ ++ final DataComponentType dataComponentType = (DataComponentType) declaredField.get(null); ++ if (!vanillaDataComponentTypes.remove(CraftNamespacedKey.toMinecraft(dataComponentType.getKey()))) { ++ Assertions.fail("API defined component type " + dataComponentType.key().asMinimalString() + " is unknown to vanilla registry"); ++ } ++ } ++ ++ if (!vanillaDataComponentTypes.containsAll(NOT_IN_API)) { ++ Assertions.fail("API defined data components that were marked as not-yet-implemented: " + NOT_IN_API.stream().filter(Predicate.not(vanillaDataComponentTypes::contains)).map(ResourceLocation::toString).collect(Collectors.joining(", "))); ++ } ++ ++ vanillaDataComponentTypes.removeAll(NOT_IN_API); ++ if (!vanillaDataComponentTypes.isEmpty()) { ++ Assertions.fail("API did not define following vanilla data component types: " + String.join(", ", Collections2.transform(vanillaDataComponentTypes, ResourceLocation::toString))); ++ } ++ } ++ ++} +diff --git a/src/test/java/io/papermc/paper/item/ItemStackDataComponentEqualsTest.java b/src/test/java/io/papermc/paper/item/ItemStackDataComponentEqualsTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4ee0491763341232844a99aa528310a3b3dca1d5 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/item/ItemStackDataComponentEqualsTest.java +@@ -0,0 +1,92 @@ ++package io.papermc.paper.item; ++ ++import io.papermc.paper.datacomponent.DataComponentTypes; ++import java.util.Set; ++import net.kyori.adventure.text.Component; ++import org.bukkit.Material; ++import org.bukkit.inventory.ItemStack; ++import org.bukkit.support.environment.AllFeatures; ++import org.junit.jupiter.api.Assertions; ++import org.junit.jupiter.api.Test; ++ ++@AllFeatures ++class ItemStackDataComponentEqualsTest { ++ ++ @Test ++ public void testEqual() { ++ ItemStack item1 = ItemStack.of(Material.STONE, 1); ++ item1.setData(DataComponentTypes.MAX_STACK_SIZE, 32); ++ item1.setData(DataComponentTypes.ITEM_NAME, Component.text("HI")); ++ ++ ItemStack item2 = ItemStack.of(Material.STONE, 1); ++ item2.setData(DataComponentTypes.MAX_STACK_SIZE, 32); ++ item2.setData(DataComponentTypes.ITEM_NAME, Component.text("HI")); ++ ++ Assertions.assertTrue(item1.matchesWithoutData(item2, Set.of())); ++ } ++ ++ @Test ++ public void testEqualIgnoreComponent() { ++ ItemStack item1 = ItemStack.of(Material.STONE, 2); ++ item1.setData(DataComponentTypes.MAX_STACK_SIZE, 1); ++ ++ ItemStack item2 = ItemStack.of(Material.STONE, 1); ++ item2.setData(DataComponentTypes.MAX_STACK_SIZE, 2); ++ ++ Assertions.assertFalse(item1.matchesWithoutData(item2, Set.of(DataComponentTypes.MAX_STACK_SIZE))); ++ } ++ ++ @Test ++ public void testEqualIgnoreComponentAndSize() { ++ ItemStack item1 = ItemStack.of(Material.STONE, 2); ++ item1.setData(DataComponentTypes.MAX_STACK_SIZE, 1); ++ ++ ItemStack item2 = ItemStack.of(Material.STONE, 1); ++ item2.setData(DataComponentTypes.MAX_STACK_SIZE, 2); ++ ++ Assertions.assertTrue(item1.matchesWithoutData(item2, Set.of(DataComponentTypes.MAX_STACK_SIZE), true)); ++ } ++ ++ @Test ++ public void testEqualWithoutComponent() { ++ ItemStack item1 = ItemStack.of(Material.STONE, 1); ++ ++ ItemStack item2 = ItemStack.of(Material.STONE, 1); ++ item2.setData(DataComponentTypes.MAX_STACK_SIZE, 2); ++ ++ Assertions.assertFalse(item1.matchesWithoutData(item2, Set.of(DataComponentTypes.WRITTEN_BOOK_CONTENT))); ++ } ++ ++ @Test ++ public void testEqualRemoveComponent() { ++ ItemStack item1 = ItemStack.of(Material.STONE, 1); ++ item1.unsetData(DataComponentTypes.MAX_STACK_SIZE); ++ ++ ItemStack item2 = ItemStack.of(Material.STONE, 1); ++ item2.unsetData(DataComponentTypes.MAX_STACK_SIZE); ++ ++ Assertions.assertTrue(item1.matchesWithoutData(item2, Set.of())); ++ } ++ ++ @Test ++ public void testEqualIncludeComponentIgnoreSize() { ++ ItemStack item1 = ItemStack.of(Material.STONE, 2); ++ item1.setData(DataComponentTypes.MAX_STACK_SIZE, 1); ++ ++ ItemStack item2 = ItemStack.of(Material.STONE, 1); ++ item2.setData(DataComponentTypes.MAX_STACK_SIZE, 1); ++ ++ Assertions.assertTrue(item1.matchesWithoutData(item2, Set.of(), true)); ++ } ++ ++ @Test ++ public void testAdvancedExample() { ++ ItemStack oakLeaves = ItemStack.of(Material.OAK_LEAVES, 1); ++ oakLeaves.setData(DataComponentTypes.HIDE_TOOLTIP); ++ oakLeaves.setData(DataComponentTypes.MAX_STACK_SIZE, 1); ++ ++ ItemStack otherOakLeavesItem = ItemStack.of(Material.OAK_LEAVES, 2); ++ ++ Assertions.assertTrue(oakLeaves.matchesWithoutData(otherOakLeavesItem, Set.of(DataComponentTypes.HIDE_TOOLTIP, DataComponentTypes.MAX_STACK_SIZE), true)); ++ } ++} +diff --git a/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java b/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5825be69af0b949ce28d6bde28bef68935db0d45 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java +@@ -0,0 +1,371 @@ ++package io.papermc.paper.item; ++ ++import io.papermc.paper.datacomponent.DataComponentType; ++import io.papermc.paper.datacomponent.DataComponentTypes; ++import io.papermc.paper.datacomponent.item.ChargedProjectiles; ++import io.papermc.paper.datacomponent.item.CustomModelData; ++import io.papermc.paper.datacomponent.item.DyedItemColor; ++import io.papermc.paper.datacomponent.item.Fireworks; ++import io.papermc.paper.datacomponent.item.FoodProperties; ++import io.papermc.paper.datacomponent.item.ItemArmorTrim; ++import io.papermc.paper.datacomponent.item.ItemAttributeModifiers; ++import io.papermc.paper.datacomponent.item.ItemEnchantments; ++import io.papermc.paper.datacomponent.item.ItemLore; ++import io.papermc.paper.datacomponent.item.JukeboxPlayable; ++import io.papermc.paper.datacomponent.item.MapId; ++import io.papermc.paper.datacomponent.item.MapItemColor; ++import io.papermc.paper.datacomponent.item.PotDecorations; ++import io.papermc.paper.datacomponent.item.Tool; ++import io.papermc.paper.datacomponent.item.Unbreakable; ++import io.papermc.paper.registry.RegistryAccess; ++import io.papermc.paper.registry.RegistryKey; ++import io.papermc.paper.registry.set.RegistrySet; ++import io.papermc.paper.registry.tag.TagKey; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.util.TriState; ++import org.bukkit.Color; ++import org.bukkit.FireworkEffect; ++import org.bukkit.JukeboxSong; ++import org.bukkit.Material; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.bukkit.attribute.Attribute; ++import org.bukkit.attribute.AttributeModifier; ++import org.bukkit.block.BlockState; ++import org.bukkit.block.BlockType; ++import org.bukkit.block.DecoratedPot; ++import org.bukkit.enchantments.Enchantment; ++import org.bukkit.inventory.EquipmentSlotGroup; ++import org.bukkit.inventory.ItemFlag; ++import org.bukkit.inventory.ItemRarity; ++import org.bukkit.inventory.ItemStack; ++import org.bukkit.inventory.ItemType; ++import org.bukkit.inventory.meta.ArmorMeta; ++import org.bukkit.inventory.meta.BlockStateMeta; ++import org.bukkit.inventory.meta.CrossbowMeta; ++import org.bukkit.inventory.meta.Damageable; ++import org.bukkit.inventory.meta.FireworkMeta; ++import org.bukkit.inventory.meta.ItemMeta; ++import org.bukkit.inventory.meta.LeatherArmorMeta; ++import org.bukkit.inventory.meta.MapMeta; ++import org.bukkit.inventory.meta.Repairable; ++import org.bukkit.inventory.meta.components.FoodComponent; ++import org.bukkit.inventory.meta.components.JukeboxPlayableComponent; ++import org.bukkit.inventory.meta.components.ToolComponent; ++import org.bukkit.inventory.meta.trim.ArmorTrim; ++import org.bukkit.inventory.meta.trim.TrimMaterial; ++import org.bukkit.inventory.meta.trim.TrimPattern; ++import org.bukkit.support.environment.AllFeatures; ++import org.junit.jupiter.api.Assertions; ++import org.junit.jupiter.api.Test; ++import java.util.List; ++import java.util.Map; ++import java.util.function.BiConsumer; ++import java.util.function.Function; ++ ++@AllFeatures ++class ItemStackDataComponentTest { ++ ++ @Test ++ void testMaxStackSize() { ++ testWithMeta(new ItemStack(Material.STONE), DataComponentTypes.MAX_STACK_SIZE, 32, ItemMeta.class, ItemMeta::getMaxStackSize, ItemMeta::setMaxStackSize); ++ } ++ ++ @Test ++ void testMaxDamage() { ++ testWithMeta(new ItemStack(Material.STONE), DataComponentTypes.MAX_DAMAGE, 120, Damageable.class, Damageable::getMaxDamage, Damageable::setMaxDamage); ++ } ++ ++ @Test ++ void testDamage() { ++ testWithMeta(new ItemStack(Material.STONE), DataComponentTypes.DAMAGE, 120, Damageable.class, Damageable::getDamage, Damageable::setDamage); ++ } ++ ++ @Test ++ void testUnbreakable() { ++ final ItemStack stack = new ItemStack(Material.STONE); ++ stack.setData(DataComponentTypes.UNBREAKABLE, Unbreakable.unbreakable().showInTooltip(false).build()); ++ ++ Assertions.assertTrue(stack.getItemMeta().isUnbreakable()); ++ Assertions.assertTrue(stack.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_UNBREAKABLE)); ++ stack.unsetData(DataComponentTypes.UNBREAKABLE); ++ Assertions.assertFalse(stack.getItemMeta().isUnbreakable()); ++ } ++ ++ @Test ++ void testHideAdditionalTooltip() { ++ final ItemStack stack = new ItemStack(Material.STONE); ++ stack.setData(DataComponentTypes.HIDE_ADDITIONAL_TOOLTIP); ++ ++ Assertions.assertTrue(stack.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_ADDITIONAL_TOOLTIP)); ++ stack.unsetData(DataComponentTypes.HIDE_ADDITIONAL_TOOLTIP); ++ Assertions.assertFalse(stack.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_ADDITIONAL_TOOLTIP)); ++ } ++ ++ @Test ++ void testHideTooltip() { ++ ItemStack stack = new ItemStack(Material.STONE); ++ stack.setData(DataComponentTypes.HIDE_TOOLTIP); ++ ++ Assertions.assertEquals(stack.getItemMeta().isHideTooltip(), stack.hasData(DataComponentTypes.HIDE_TOOLTIP)); ++ Assertions.assertTrue(stack.getItemMeta().isHideTooltip()); ++ stack.unsetData(DataComponentTypes.HIDE_TOOLTIP); ++ Assertions.assertFalse(stack.getItemMeta().isHideTooltip()); ++ stack = new ItemStack(Material.STONE); ++ ++ stack.unsetData(DataComponentTypes.HIDE_TOOLTIP); ++ Assertions.assertFalse(stack.getItemMeta().isHideTooltip()); ++ Assertions.assertEquals(stack.getItemMeta().isHideTooltip(), stack.hasData(DataComponentTypes.HIDE_TOOLTIP)); ++ } ++ ++ @Test ++ void testRepairCost() { ++ final ItemStack stack = new ItemStack(Material.STONE); ++ testWithMeta(stack, DataComponentTypes.REPAIR_COST, 120, Repairable.class, Repairable::getRepairCost, Repairable::setRepairCost); ++ } ++ ++ @Test ++ void testCustomName() { ++ testWithMeta(new ItemStack(Material.STONE), DataComponentTypes.CUSTOM_NAME, Component.text("HELLO!!!!!!"), ItemMeta.class, ItemMeta::displayName, ItemMeta::displayName); ++ } ++ ++ @Test ++ void testItemName() { ++ testWithMeta(new ItemStack(Material.STONE), DataComponentTypes.ITEM_NAME, Component.text("HELLO!!!!!! ITEM NAME"), ItemMeta.class, ItemMeta::itemName, ItemMeta::itemName); ++ } ++ ++ @Test ++ void testItemLore() { ++ List list = List.of(Component.text("1"), Component.text("2")); ++ testWithMeta(new ItemStack(Material.STONE), DataComponentTypes.LORE, ItemLore.lore().lines(list).build(), ItemLore::lines, ItemMeta.class, ItemMeta::lore, ItemMeta::lore); ++ } ++ ++ @Test ++ void testItemRarity() { ++ testWithMeta(new ItemStack(Material.STONE), DataComponentTypes.RARITY, ItemRarity.RARE, ItemMeta.class, ItemMeta::getRarity, ItemMeta::setRarity); ++ } ++ ++ @Test ++ void testItemEnchantments() { ++ final ItemStack stack = new ItemStack(Material.STONE); ++ Map enchantmentIntegerMap = Map.of(Enchantment.SOUL_SPEED, 1); ++ stack.setData(DataComponentTypes.ENCHANTMENTS, ItemEnchantments.itemEnchantments(enchantmentIntegerMap, false)); ++ ++ Assertions.assertTrue(stack.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)); ++ Assertions.assertEquals(1, stack.getItemMeta().getEnchantLevel(Enchantment.SOUL_SPEED)); ++ Assertions.assertEquals(stack.getItemMeta().getEnchants(), enchantmentIntegerMap); ++ stack.unsetData(DataComponentTypes.ENCHANTMENTS); ++ Assertions.assertTrue(stack.getItemMeta().getEnchants().isEmpty()); ++ } ++ ++ @Test ++ void testItemAttributes() { ++ final ItemStack stack = new ItemStack(Material.STONE); ++ AttributeModifier modifier = new AttributeModifier(NamespacedKey.minecraft("test"), 5, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.ANY); ++ stack.setData(DataComponentTypes.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.itemAttributes().showInTooltip(false).addModifier(Attribute.ATTACK_DAMAGE, modifier).build()); ++ ++ Assertions.assertTrue(stack.getItemMeta().hasItemFlag(ItemFlag.HIDE_ATTRIBUTES)); ++ Assertions.assertEquals(modifier, ((List) stack.getItemMeta().getAttributeModifiers(Attribute.ATTACK_DAMAGE)).getFirst()); ++ stack.unsetData(DataComponentTypes.ATTRIBUTE_MODIFIERS); ++ Assertions.assertNull(stack.getItemMeta().getAttributeModifiers()); ++ } ++ ++ @Test ++ void testCustomModelData() { ++ testWithMeta(new ItemStack(Material.STONE), DataComponentTypes.CUSTOM_MODEL_DATA, CustomModelData.customModelData(1), CustomModelData::id, ItemMeta.class, ItemMeta::getCustomModelData, ItemMeta::setCustomModelData); ++ } ++ ++ @Test ++ void testEnchantmentGlintOverride() { ++ testWithMeta(new ItemStack(Material.STONE), DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE, true, ItemMeta.class, ItemMeta::getEnchantmentGlintOverride, ItemMeta::setEnchantmentGlintOverride); ++ } ++ ++ @Test ++ void testFood() { ++ FoodProperties properties = FoodProperties.food() ++ .canAlwaysEat(true) ++ .saturation(1.3F) ++ .nutrition(1) ++ .build(); ++ ++ final ItemStack stack = new ItemStack(Material.CROSSBOW); ++ stack.setData(DataComponentTypes.FOOD, properties); ++ ++ ItemMeta meta = stack.getItemMeta(); ++ FoodComponent component = meta.getFood(); ++ Assertions.assertEquals(properties.canAlwaysEat(), component.canAlwaysEat()); ++ Assertions.assertEquals(properties.saturation(), component.getSaturation()); ++ Assertions.assertEquals(properties.nutrition(), component.getNutrition()); ++ ++ stack.unsetData(DataComponentTypes.FOOD); ++ meta = stack.getItemMeta(); ++ Assertions.assertFalse(meta.hasFood()); ++ } ++ ++ @Test ++ void testTool() { ++ Tool properties = Tool.tool() ++ .damagePerBlock(1) ++ .defaultMiningSpeed(2F) ++ .addRules(List.of( ++ Tool.rule( ++ RegistrySet.keySetFromValues(RegistryKey.BLOCK, List.of(BlockType.STONE, BlockType.GRAVEL)), ++ 2F, ++ TriState.TRUE ++ ), ++ Tool.rule( ++ RegistryAccess.registryAccess().getRegistry(RegistryKey.BLOCK).getTag(TagKey.create(RegistryKey.BLOCK, NamespacedKey.minecraft("bamboo_blocks"))), ++ 2F, ++ TriState.TRUE ++ ) ++ )) ++ .build(); ++ ++ final ItemStack stack = new ItemStack(Material.CROSSBOW); ++ stack.setData(DataComponentTypes.TOOL, properties); ++ ++ ItemMeta meta = stack.getItemMeta(); ++ ToolComponent component = meta.getTool(); ++ Assertions.assertEquals(properties.damagePerBlock(), component.getDamagePerBlock()); ++ Assertions.assertEquals(properties.defaultMiningSpeed(), component.getDefaultMiningSpeed()); ++ ++ int idx = 0; ++ for (ToolComponent.ToolRule effect : component.getRules()) { ++ Assertions.assertEquals(properties.rules().get(idx).speed(), effect.getSpeed()); ++ Assertions.assertEquals(properties.rules().get(idx).correctForDrops().toBoolean(), effect.isCorrectForDrops()); ++ Assertions.assertEquals(properties.rules().get(idx).blocks().resolve(Registry.BLOCK), effect.getBlocks().stream().map(Material::asBlockType).toList()); ++ idx++; ++ } ++ ++ stack.unsetData(DataComponentTypes.TOOL); ++ meta = stack.getItemMeta(); ++ Assertions.assertFalse(meta.hasTool()); ++ } ++ ++ @Test ++ void testJukeboxPlayable() { ++ JukeboxPlayable properties = JukeboxPlayable.jukeboxPlayable(JukeboxSong.MALL).build(); ++ ++ final ItemStack stack = new ItemStack(Material.BEEF); ++ stack.setData(DataComponentTypes.JUKEBOX_PLAYABLE, properties); ++ ++ ItemMeta meta = stack.getItemMeta(); ++ JukeboxPlayableComponent component = meta.getJukeboxPlayable(); ++ Assertions.assertEquals(properties.jukeboxSong(), component.getSong()); ++ ++ stack.unsetData(DataComponentTypes.JUKEBOX_PLAYABLE); ++ meta = stack.getItemMeta(); ++ Assertions.assertFalse(meta.hasJukeboxPlayable()); ++ } ++ ++ @Test ++ void testDyedColor() { ++ final ItemStack stack = new ItemStack(Material.LEATHER_CHESTPLATE); ++ Color color = Color.BLUE; ++ stack.setData(DataComponentTypes.DYED_COLOR, DyedItemColor.dyedItemColor(color, false)); ++ ++ Assertions.assertTrue(stack.getItemMeta().hasItemFlag(ItemFlag.HIDE_DYE)); ++ Assertions.assertEquals(color, ((LeatherArmorMeta) stack.getItemMeta()).getColor()); ++ stack.unsetData(DataComponentTypes.DYED_COLOR); ++ Assertions.assertFalse(((LeatherArmorMeta) stack.getItemMeta()).isDyed()); ++ } ++ ++ @Test ++ void testMapColor() { ++ testWithMeta(new ItemStack(Material.FILLED_MAP), DataComponentTypes.MAP_COLOR, MapItemColor.mapItemColor().color(Color.BLUE).build(), MapItemColor::color, MapMeta.class, MapMeta::getColor, MapMeta::setColor); ++ } ++ ++ @Test ++ void testMapId() { ++ testWithMeta(new ItemStack(Material.FILLED_MAP), DataComponentTypes.MAP_ID, MapId.mapId(1), MapId::id, MapMeta.class, MapMeta::getMapId, MapMeta::setMapId); ++ } ++ ++ @Test ++ void testFireworks() { ++ testWithMeta(new ItemStack(Material.FIREWORK_ROCKET), DataComponentTypes.FIREWORKS, Fireworks.fireworks(List.of(FireworkEffect.builder().build()), 1), Fireworks::effects, FireworkMeta.class, FireworkMeta::getEffects, (fireworkMeta, effects) -> { ++ fireworkMeta.clearEffects(); ++ fireworkMeta.addEffects(effects); ++ }); ++ ++ testWithMeta(new ItemStack(Material.FIREWORK_ROCKET), DataComponentTypes.FIREWORKS, Fireworks.fireworks(List.of(FireworkEffect.builder().build()), 1), Fireworks::flightDuration, FireworkMeta.class, FireworkMeta::getPower, FireworkMeta::setPower); ++ } ++ ++ @Test ++ void testTrim() { ++ final ItemStack stack = new ItemStack(Material.LEATHER_CHESTPLATE); ++ ItemArmorTrim armorTrim = ItemArmorTrim.itemArmorTrim(new ArmorTrim(TrimMaterial.AMETHYST, TrimPattern.BOLT), false); ++ stack.setData(DataComponentTypes.TRIM, armorTrim); ++ ++ Assertions.assertTrue(stack.getItemMeta().hasItemFlag(ItemFlag.HIDE_ARMOR_TRIM)); ++ Assertions.assertEquals(armorTrim.armorTrim(), ((ArmorMeta) stack.getItemMeta()).getTrim()); ++ stack.unsetData(DataComponentTypes.TRIM); ++ Assertions.assertFalse(stack.getItemMeta().hasItemFlag(ItemFlag.HIDE_ARMOR_TRIM)); ++ Assertions.assertFalse(((ArmorMeta) stack.getItemMeta()).hasTrim()); ++ } ++ ++ @Test ++ void testChargedProjectiles() { ++ final ItemStack stack = new ItemStack(Material.CROSSBOW); ++ ItemStack projectile = new ItemStack(Material.FIREWORK_ROCKET); ++ stack.setData(DataComponentTypes.CHARGED_PROJECTILES, ChargedProjectiles.chargedProjectiles().add(projectile).build()); ++ ++ CrossbowMeta meta = (CrossbowMeta) stack.getItemMeta(); ++ Assertions.assertEquals(meta.getChargedProjectiles().getFirst(), projectile); ++ ++ stack.unsetData(DataComponentTypes.CHARGED_PROJECTILES); ++ meta = (CrossbowMeta) stack.getItemMeta(); ++ Assertions.assertTrue(meta.getChargedProjectiles().isEmpty()); ++ } ++ ++ @Test ++ void testPot() { ++ final ItemStack stack = new ItemStack(Material.DECORATED_POT); ++ stack.setData(DataComponentTypes.POT_DECORATIONS, PotDecorations.potDecorations().back(ItemType.DANGER_POTTERY_SHERD).build()); ++ ++ BlockState state = ((BlockStateMeta) stack.getItemMeta()).getBlockState(); ++ DecoratedPot decoratedPot = (DecoratedPot) state; ++ ++ Assertions.assertEquals(decoratedPot.getSherd(DecoratedPot.Side.BACK), Material.DANGER_POTTERY_SHERD); ++ stack.unsetData(DataComponentTypes.POT_DECORATIONS); ++ decoratedPot = (DecoratedPot) ((BlockStateMeta) stack.getItemMeta()).getBlockState(); ++ Assertions.assertTrue(decoratedPot.getSherds().values().stream().allMatch((m) -> m.asItemType() == ItemType.BRICK)); ++ } ++ ++ private static void testWithMeta(final ItemStack stack, final DataComponentType.Valued type, final T value, final Class metaType, final Function metaGetter, final BiConsumer metaSetter) { ++ testWithMeta(stack, type, value, Function.identity(), metaType, metaGetter, metaSetter); ++ } ++ ++ private static void testWithMeta(final ItemStack stack, final DataComponentType.Valued type, final T value, Function mapper, final Class metaType, final Function metaGetter, final BiConsumer metaSetter) { ++ ItemStack original = stack.clone(); ++ stack.setData(type, value); ++ ++ Assertions.assertEquals(value, stack.getData(type)); ++ ++ final ItemMeta meta = stack.getItemMeta(); ++ final M typedMeta = Assertions.assertInstanceOf(metaType, meta); ++ ++ Assertions.assertEquals(metaGetter.apply(typedMeta), mapper.apply(value)); ++ ++ // SETTING ++ metaSetter.accept(typedMeta, mapper.apply(value)); ++ original.setItemMeta(typedMeta); ++ Assertions.assertEquals(value, original.getData(type)); ++ } ++ ++ private static void testWithMeta(final ItemStack stack, final DataComponentType.NonValued type, final boolean value, final Class metaType, final Function metaGetter, final BiConsumer metaSetter) { ++ ItemStack original = stack.clone(); ++ stack.setData(type); ++ ++ Assertions.assertEquals(value, stack.hasData(type)); ++ ++ final ItemMeta meta = stack.getItemMeta(); ++ final M typedMeta = Assertions.assertInstanceOf(metaType, meta); ++ ++ Assertions.assertEquals(metaGetter.apply(typedMeta), value); ++ ++ // SETTING ++ metaSetter.accept(typedMeta, value); ++ original.setItemMeta(typedMeta); ++ Assertions.assertEquals(value, original.hasData(type)); ++ } ++} +diff --git a/src/test/java/io/papermc/paper/item/MetaComparisonTest.java b/src/test/java/io/papermc/paper/item/MetaComparisonTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1225ad95a204434ef6af5e6e92593cbbafc31b4a +--- /dev/null ++++ b/src/test/java/io/papermc/paper/item/MetaComparisonTest.java +@@ -0,0 +1,284 @@ ++package io.papermc.paper.item; ++ ++import com.destroystokyo.paper.profile.CraftPlayerProfile; ++import com.destroystokyo.paper.profile.PlayerProfile; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.event.HoverEvent; ++import net.kyori.adventure.text.format.NamedTextColor; ++import org.bukkit.Bukkit; ++import org.bukkit.ChatColor; ++import org.bukkit.Color; ++import org.bukkit.Material; ++import org.bukkit.craftbukkit.inventory.CraftItemFactory; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.enchantments.Enchantment; ++import org.bukkit.inventory.ItemFactory; ++import org.bukkit.inventory.ItemStack; ++import org.bukkit.inventory.meta.BookMeta; ++import org.bukkit.inventory.meta.ItemMeta; ++import org.bukkit.inventory.meta.PotionMeta; ++import org.bukkit.inventory.meta.SkullMeta; ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionEffectType; ++import org.bukkit.support.environment.AllFeatures; ++import org.junit.jupiter.api.Assertions; ++import org.junit.jupiter.api.Disabled; ++import org.junit.jupiter.api.Test; ++ ++import java.util.UUID; ++import java.util.function.Consumer; ++ ++// TODO: This should technically be used to compare legacy meta vs the newly implemented ++@AllFeatures ++public class MetaComparisonTest { ++ ++ private static final ItemFactory FACTORY = CraftItemFactory.instance(); ++ ++ @Test ++ public void testMetaApplication() { ++ ItemStack itemStack = new ItemStack(Material.STONE); ++ ++ ItemMeta meta = itemStack.getItemMeta(); ++ meta.setCustomModelData(1); ++ ++ ItemMeta converted = FACTORY.asMetaFor(meta, Material.GOLD_INGOT); ++ Assertions.assertEquals(converted.getCustomModelData(), meta.getCustomModelData()); ++ ++ ItemMeta convertedAdvanced = FACTORY.asMetaFor(meta, Material.PLAYER_HEAD); ++ Assertions.assertEquals(convertedAdvanced.getCustomModelData(), meta.getCustomModelData()); ++ } ++ ++ @Test ++ public void testMetaApplicationDowngrading() { ++ ItemStack itemStack = new ItemStack(Material.PLAYER_HEAD); ++ PlayerProfile profile = Bukkit.createProfile("Owen1212055"); ++ ++ SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); ++ meta.setPlayerProfile(profile); ++ ++ SkullMeta converted = (SkullMeta) FACTORY.asMetaFor(meta, Material.PLAYER_HEAD); ++ Assertions.assertEquals(converted.getPlayerProfile(), meta.getPlayerProfile()); ++ ++ SkullMeta downgraded = (SkullMeta) FACTORY.asMetaFor(FACTORY.asMetaFor(meta, Material.STONE), Material.PLAYER_HEAD); ++ Assertions.assertNull(downgraded.getPlayerProfile()); ++ } ++ ++ @Test ++ public void testMetaApplicationDowngradingPotion() { ++ ItemStack itemStack = new ItemStack(Material.POTION); ++ Color color = Color.BLUE; ++ ++ PotionMeta meta = (PotionMeta) itemStack.getItemMeta(); ++ meta.setColor(color); ++ ++ PotionMeta converted = (PotionMeta) FACTORY.asMetaFor(meta, Material.POTION); ++ Assertions.assertEquals(converted.getColor(), color); ++ ++ PotionMeta downgraded = (PotionMeta) FACTORY.asMetaFor(FACTORY.asMetaFor(meta, Material.STONE), Material.POTION); ++ Assertions.assertNull(downgraded.getColor()); ++ } ++ ++ @Test ++ public void testNullMeta() { ++ ItemStack itemStack = new ItemStack(Material.AIR); ++ ++ Assertions.assertFalse(itemStack.hasItemMeta()); ++ Assertions.assertNull(itemStack.getItemMeta()); ++ } ++ ++ @Test ++ public void testPotionMeta() { ++ PotionEffect potionEffect = new PotionEffect(PotionEffectType.SPEED, 10, 10, false); ++ ItemStack nmsItemStack = new ItemStack(Material.POTION, 1); ++ ++ testSetAndGet(nmsItemStack, ++ (meta) -> ((PotionMeta) meta).addCustomEffect(potionEffect, true), ++ (meta) -> Assertions.assertEquals(potionEffect, ((PotionMeta) meta).getCustomEffects().getFirst()) ++ ); ++ } ++ ++ @Test ++ public void testEnchantment() { ++ ItemStack stack = new ItemStack(Material.STICK, 1); ++ ++ testSetAndGet(stack, ++ (meta) -> Assertions.assertTrue(meta.addEnchant(Enchantment.SHARPNESS, 1, true)), ++ (meta) -> Assertions.assertEquals(1, meta.getEnchantLevel(Enchantment.SHARPNESS)) ++ ); ++ } ++ ++ @Test ++ @Disabled ++ public void testPlayerHead() { ++ PlayerProfile profile = new CraftPlayerProfile(UUID.randomUUID(), "Owen1212055"); ++ ItemStack stack = new ItemStack(Material.PLAYER_HEAD, 1); ++ ++ testSetAndGet(stack, ++ (meta) -> ((SkullMeta) meta).setPlayerProfile(profile), ++ (meta) -> { ++ Assertions.assertTrue(((SkullMeta) meta).hasOwner()); ++ Assertions.assertEquals(profile, ((SkullMeta) meta).getPlayerProfile()); ++ } ++ ); ++ ++ testSetAndGet(stack, ++ (meta) -> ((SkullMeta) meta).setOwner("Owen1212055"), ++ (meta) -> { ++ Assertions.assertTrue(((SkullMeta) meta).hasOwner()); ++ Assertions.assertEquals("Owen1212055", ((SkullMeta) meta).getOwner()); ++ } ++ ); ++ } ++ ++ @Test ++ public void testBookMetaAuthor() { ++ ItemStack stack = new ItemStack(Material.WRITTEN_BOOK, 1); ++ ++ // Legacy string ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).setAuthor("Owen1212055"), ++ (meta) -> Assertions.assertEquals("Owen1212055", ((BookMeta) meta).getAuthor()) ++ ); ++ ++ // Component Colored ++ Component coloredName = Component.text("Owen1212055", NamedTextColor.DARK_GRAY); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).author(coloredName), ++ (meta) -> Assertions.assertEquals(coloredName, ((BookMeta) meta).author()) ++ ); ++ ++ // Simple text ++ Component name = Component.text("Owen1212055"); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).author(name), ++ (meta) -> Assertions.assertEquals(name, ((BookMeta) meta).author()) ++ ); ++ } ++ ++ @Test ++ public void testBookMetaTitle() { ++ ItemStack stack = new ItemStack(Material.WRITTEN_BOOK, 1); ++ ++ // Legacy string ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).setTitle("Owen1212055"), ++ (meta) -> Assertions.assertEquals("Owen1212055", ((BookMeta) meta).getTitle()) ++ ); ++ ++ // Component Colored ++ Component coloredName = Component.text("Owen1212055", NamedTextColor.DARK_GRAY); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).title(coloredName), ++ (meta) -> Assertions.assertEquals(coloredName, ((BookMeta) meta).title()) ++ ); ++ ++ // Simple text ++ Component name = Component.text("Owen1212055"); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).title(name), ++ (meta) -> Assertions.assertEquals(name, ((BookMeta) meta).title()) ++ ); ++ } ++ ++ ++ @Test ++ public void testWriteableBookPages() { ++ ItemStack stack = new ItemStack(Material.WRITABLE_BOOK, 1); ++ ++ // Writeable books are serialized as plain text, but has weird legacy color support. ++ // So, we need to test to make sure that all works here. ++ ++ // Legacy string ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPage("Owen1212055"), ++ (meta) -> Assertions.assertEquals("Owen1212055", ((BookMeta) meta).getPage(1)) ++ ); ++ ++ // Legacy string colored ++ String translatedLegacy = ChatColor.translateAlternateColorCodes('&', "&7Owen1212055"); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPage(translatedLegacy), ++ (meta) -> Assertions.assertEquals(translatedLegacy, ((BookMeta) meta).getPage(1)) ++ ); ++ ++ // Component Colored ++ Component coloredName = Component.text("Owen1212055", NamedTextColor.DARK_GRAY); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPages(coloredName), ++ (meta) -> Assertions.assertEquals(coloredName, ((BookMeta) meta).page(1)) ++ ); ++ ++ // Simple text ++ Component name = Component.text("Owen1212055"); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPages(name), ++ (meta) -> Assertions.assertEquals(name, ((BookMeta) meta).page(1)) ++ ); ++ ++ // Simple text + hover... should NOT be saved ++ // As this is plain text ++ Component nameWithHover = Component.text("Owen1212055") ++ .hoverEvent(HoverEvent.hoverEvent(HoverEvent.Action.SHOW_TEXT, Component.text("Hover"))); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPages(nameWithHover), ++ (meta) -> Assertions.assertEquals(name, ((BookMeta) meta).page(1)) ++ ); ++ } ++ ++ @Test ++ public void testWrittenBookPages() { ++ ItemStack stack = new ItemStack(Material.WRITTEN_BOOK, 1); ++ ++ // Writeable books are serialized as plain text, but has weird legacy color support. ++ // So, we need to test to make sure that all works here. ++ ++ // Legacy string ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPage("Owen1212055"), ++ (meta) -> Assertions.assertEquals("Owen1212055", ((BookMeta) meta).getPage(1)) ++ ); ++ ++ // Legacy string colored ++ String translatedLegacy = ChatColor.translateAlternateColorCodes('&', "&7Owen1212055"); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPage(translatedLegacy), ++ (meta) -> Assertions.assertEquals(translatedLegacy, ((BookMeta) meta).getPage(1)) ++ ); ++ ++ // Component Colored ++ Component coloredName = Component.text("Owen1212055", NamedTextColor.DARK_GRAY); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPages(coloredName), ++ (meta) -> Assertions.assertEquals(coloredName, ((BookMeta) meta).page(1)) ++ ); ++ ++ // Simple text ++ Component name = Component.text("Owen1212055"); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPages(name), ++ (meta) -> Assertions.assertEquals(name, ((BookMeta) meta).page(1)) ++ ); ++ ++ // Simple text + hover... should be saved ++ Component nameWithHover = Component.text("Owen1212055") ++ .hoverEvent(HoverEvent.hoverEvent(HoverEvent.Action.SHOW_TEXT, Component.text("Hover"))); ++ testSetAndGet(stack, ++ (meta) -> ((BookMeta) meta).addPages(nameWithHover), ++ (meta) -> Assertions.assertEquals(nameWithHover, ((BookMeta) meta).page(1)) ++ ); ++ } ++ ++ private void testSetAndGet(org.bukkit.inventory.ItemStack itemStack, ++ Consumer set, ++ Consumer get) { ++ ItemMeta craftMeta = CraftItemStack.getItemMeta(CraftItemStack.asNMSCopy(itemStack)); // TODO: This should be converted to use the old meta when this is added. ++ ItemMeta paperMeta = CraftItemStack.getItemMeta(CraftItemStack.asNMSCopy(itemStack)); ++ // Test craft meta ++ set.accept(craftMeta); ++ get.accept(craftMeta); ++ ++ // Test paper meta ++ set.accept(paperMeta); ++ get.accept(paperMeta); ++ } ++} +diff --git a/src/test/java/org/bukkit/PerMaterialTest.java b/src/test/java/org/bukkit/PerMaterialTest.java +index 629fccec144b5d66addc0e8258cde90e81904e1c..6961730365da9083e8963200ecc5f85dbc654f35 100644 +--- a/src/test/java/org/bukkit/PerMaterialTest.java ++++ b/src/test/java/org/bukkit/PerMaterialTest.java +@@ -101,17 +101,13 @@ public class PerMaterialTest { + + final ItemStack bukkit = new ItemStack(material); + final CraftItemStack craft = CraftItemStack.asCraftCopy(bukkit); +- if (material == Material.AIR) { +- final int MAX_AIR_STACK = 0 /* Why can't I hold all of these AIR? */; +- assertThat(material.getMaxStackSize(), is(MAX_AIR_STACK)); +- assertThat(bukkit.getMaxStackSize(), is(MAX_AIR_STACK)); +- assertThat(craft.getMaxStackSize(), is(MAX_AIR_STACK)); +- } else { ++ ++ // Paper - remove air exception + int max = CraftMagicNumbers.getItem(material).components().getOrDefault(DataComponents.MAX_STACK_SIZE, 64); + assertThat(material.getMaxStackSize(), is(max)); + assertThat(bukkit.getMaxStackSize(), is(max)); + assertThat(craft.getMaxStackSize(), is(max)); +- } ++ // Paper - remove air exception + } + + @ParameterizedTest +diff --git a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java b/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java +index b717a5ffa567781b0687bbe238b62844214db284..2d60c06b70201e4c993498af3c8e52da94b5a63e 100644 +--- a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java ++++ b/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java +@@ -100,6 +100,7 @@ public class RegistriesArgumentProvider implements ArgumentsProvider { + register(RegistryKey.MAP_DECORATION_TYPE, MapCursor.Type.class, Registries.MAP_DECORATION_TYPE, CraftMapCursor.CraftType.class, MapDecorationType.class); + register(RegistryKey.BANNER_PATTERN, PatternType.class, Registries.BANNER_PATTERN, CraftPatternType.class, BannerPattern.class); + register(RegistryKey.MENU, MenuType.class, Registries.MENU, CraftMenuType.class, net.minecraft.world.inventory.MenuType.class); ++ register(RegistryKey.DATA_COMPONENT_TYPE, io.papermc.paper.datacomponent.DataComponentType.class, Registries.DATA_COMPONENT_TYPE, io.papermc.paper.datacomponent.PaperComponentType.class, net.minecraft.core.component.DataComponentType.class); + } + + private static void register(RegistryKey registryKey, Class bukkit, ResourceKey registry, Class craft, Class minecraft) { // Paper diff --git a/patches/server/1037-Rewrite-dataconverter-system.patch b/patches/server/1037-Rewrite-dataconverter-system.patch index e452b9f771..71437e89b2 100644 --- a/patches/server/1037-Rewrite-dataconverter-system.patch +++ b/patches/server/1037-Rewrite-dataconverter-system.patch @@ -9339,7 +9339,7 @@ index 0000000000000000000000000000000000000000..075574f33476882ddc6787e3b8bac864 +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java new file mode 100644 -index 0000000000000000000000000000000000000000..11f5081f0cfb6f0f16689c68836b1f2962a0321c +index 0000000000000000000000000000000000000000..d4d41add3566a0e377fa41eb6d40004b05e2cbbc --- /dev/null +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java @@ -0,0 +1,325 @@ @@ -9352,7 +9352,7 @@ index 0000000000000000000000000000000000000000..11f5081f0cfb6f0f16689c68836b1f29 + +public final class MCTypeRegistry { + -+ private static final Logger LOGGER = LogUtils.getLogger(); ++ private static final Logger LOGGER = LogUtils.getClassLogger(); + + public static final MCDataType LEVEL = new MCDataType("Level"); + public static final MCDataType PLAYER = new MCDataType("Player"); @@ -30384,7 +30384,7 @@ index b54a3741cd3ba615c83c98985cb4b3c4c586ed7a..b148cf247acdd36f856d0495cde4cc5a return nbttagcompound; }); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 08d48cd55cfaf92530cc900f2f119ae3a258eb39..d8d04183fd8bb0bcf2f703ef65b11dbd342473ba 100644 +index 29d5fa49730d2161bb1b024995a533a08c57939b..83020837e29ee627b1081daddb4bdee147b95af3 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -523,7 +523,7 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/1038-Moonrise-optimisation-patches.patch b/patches/server/1038-Moonrise-optimisation-patches.patch index 38803e3d68..cdd0ced2cb 100644 --- a/patches/server/1038-Moonrise-optimisation-patches.patch +++ b/patches/server/1038-Moonrise-optimisation-patches.patch @@ -17,7 +17,7 @@ Currently includes: See https://github.com/Tuinity/Moonrise diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java b/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java -index 94bba2b71918d79f54b3e28c35e76098ba0afd8c..fc029c8fb22a7c8eeb23bfc171812f6da91c60fa 100644 +index 49fe9eed5d5d08abd6e9778fe0d0545f35552435..fc029c8fb22a7c8eeb23bfc171812f6da91c60fa 100644 --- a/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java +++ b/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java @@ -2,11 +2,17 @@ package ca.spottedleaf.moonrise.common.util; @@ -87,7 +87,7 @@ index 94bba2b71918d79f54b3e28c35e76098ba0afd8c..fc029c8fb22a7c8eeb23bfc171812f6d - 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 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); @@ -153,7 +153,7 @@ index 94bba2b71918d79f54b3e28c35e76098ba0afd8c..fc029c8fb22a7c8eeb23bfc171812f6d - 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); @@ -6785,7 +6785,7 @@ index 0000000000000000000000000000000000000000..7eafc5b7cba23d8dec92ecc1050afe3f \ No newline at end of file diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java new file mode 100644 -index 0000000000000000000000000000000000000000..a0e5fc2eff605e17704f0726d20e79cbb3d88d6d +index 0000000000000000000000000000000000000000..91a6f57f35fc1553159cca138a0619e703b2b014 --- /dev/null +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java @@ -0,0 +1,1455 @@ @@ -6811,6 +6811,7 @@ index 0000000000000000000000000000000000000000..a0e5fc2eff605e17704f0726d20e79cb +import ca.spottedleaf.moonrise.patches.chunk_system.util.ChunkSystemSortedArraySet; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; ++import com.mojang.logging.LogUtils; +import it.unimi.dsi.fastutil.longs.Long2ByteLinkedOpenHashMap; +import it.unimi.dsi.fastutil.longs.Long2ByteMap; +import it.unimi.dsi.fastutil.longs.Long2IntMap; @@ -6832,7 +6833,6 @@ index 0000000000000000000000000000000000000000..a0e5fc2eff605e17704f0726d20e79cb +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.chunk.LevelChunk; +import org.slf4j.Logger; -+import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.text.DecimalFormat; +import java.util.ArrayDeque; @@ -6850,7 +6850,7 @@ index 0000000000000000000000000000000000000000..a0e5fc2eff605e17704f0726d20e79cb + +public final class ChunkHolderManager { + -+ private static final Logger LOGGER = LoggerFactory.getLogger(ChunkHolderManager.class); ++ private static final Logger LOGGER = LogUtils.getClassLogger(); + + public static final int FULL_LOADED_TICKET_LEVEL = ChunkLevel.FULL_CHUNK_LEVEL; + public static final int BLOCK_TICKING_TICKET_LEVEL = ChunkLevel.BLOCK_TICKING_LEVEL; @@ -8246,10 +8246,10 @@ index 0000000000000000000000000000000000000000..a0e5fc2eff605e17704f0726d20e79cb +} diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java new file mode 100644 -index 0000000000000000000000000000000000000000..f3c453773e0413276935ca653b60bbe64fa4b169 +index 0000000000000000000000000000000000000000..b0bfe655922877676948d9b6ff3fa5a6ebb7a640 --- /dev/null +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java -@@ -0,0 +1,1036 @@ +@@ -0,0 +1,1038 @@ +package ca.spottedleaf.moonrise.patches.chunk_system.scheduling; + +import ca.spottedleaf.concurrentutil.executor.PrioritisedExecutor; @@ -8277,6 +8277,7 @@ index 0000000000000000000000000000000000000000..f3c453773e0413276935ca653b60bbe6 +import ca.spottedleaf.moonrise.patches.chunk_system.util.ParallelSearchRadiusIteration; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; ++import com.mojang.logging.LogUtils; +import net.minecraft.CrashReport; +import net.minecraft.CrashReportCategory; +import net.minecraft.ReportedException; @@ -8299,7 +8300,6 @@ index 0000000000000000000000000000000000000000..f3c453773e0413276935ca653b60bbe6 +import net.minecraft.world.level.chunk.status.ChunkStep; +import net.minecraft.world.phys.Vec3; +import org.slf4j.Logger; -+import org.slf4j.LoggerFactory; +import java.io.File; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; @@ -8315,7 +8315,7 @@ index 0000000000000000000000000000000000000000..f3c453773e0413276935ca653b60bbe6 + +public final class ChunkTaskScheduler { + -+ private static final Logger LOGGER = LoggerFactory.getLogger(ChunkTaskScheduler.class); ++ private static final Logger LOGGER = LogUtils.getClassLogger(); + + public static void init(final boolean useParallelGen) { + for (final PrioritisedThreadPool.ExecutorGroup.ThreadPoolExecutor executor : MoonriseCommon.RADIUS_AWARE_GROUP.getAllExecutors()) { @@ -8831,7 +8831,7 @@ index 0000000000000000000000000000000000000000..f3c453773e0413276935ca653b60bbe6 + this.chunkHolderManager.processTicketUpdates(); + } + -+ final Consumer loadCallback = (final ChunkAccess chunk) -> { ++ final Consumer loadCallback = onComplete == null && !addTicket ? null : (final ChunkAccess chunk) -> { + try { + if (onComplete != null) { + onComplete.accept(chunk); @@ -8868,7 +8868,9 @@ index 0000000000000000000000000000000000000000..f3c453773e0413276935ca653b60bbe6 + if (!chunkHolder.upgradeGenTarget(toStatus)) { + this.schedule(chunkX, chunkZ, toStatus, chunkHolder, tasks); + } -+ chunkHolder.addStatusConsumer(toStatus, loadCallback); ++ if (loadCallback != null) { ++ chunkHolder.addStatusConsumer(toStatus, loadCallback); ++ } + } + } + } finally { @@ -8882,7 +8884,7 @@ index 0000000000000000000000000000000000000000..f3c453773e0413276935ca653b60bbe6 + tasks.get(i).schedule(); + } + -+ if (!scheduled) { ++ if (loadCallback != null && !scheduled) { + // couldn't schedule + try { + loadCallback.accept(chunk); @@ -26283,7 +26285,7 @@ index 65206fdfa5b94eaca139e433b4865c16b16641f3..bf4463bcb5dc439ac5a3fa08dd60845a } } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 0a895055ec7f61d3cb52d303bbe3f89486a322e7..38ac7fd8e68f535a5e9bdd816997e865b7694af1 100644 +index 0a895055ec7f61d3cb52d303bbe3f89486a322e7..10a9406e96ab0ab2404c0e0a9bef08e86a6a12a2 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -52,7 +52,7 @@ import net.minecraft.world.level.storage.DimensionDataStorage; @@ -26484,13 +26486,13 @@ index 0a895055ec7f61d3cb52d303bbe3f89486a322e7..38ac7fd8e68f535a5e9bdd816997e865 + + if (ret != null || !ca.spottedleaf.moonrise.common.util.TickThread.isTickThread()) { + return ret; -+ } + } + + final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder holder = ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getChunkTaskScheduler() + .chunkHolderManager.getChunkHolder(chunkX, chunkZ); + if (holder == null) { + return ret; - } ++ } + + return ca.spottedleaf.moonrise.common.PlatformHooks.get().getCurrentlyLoadingChunk(holder.vanillaChunkHolder); + // Paper end - rewrite chunk system @@ -26552,15 +26554,15 @@ index 0a895055ec7f61d3cb52d303bbe3f89486a322e7..38ac7fd8e68f535a5e9bdd816997e865 + ret.complete(ChunkResult.of(chunk)); + } + }; -+ + +- private boolean chunkAbsent(@Nullable ChunkHolder holder, int maxLevel) { +- return holder == null || holder.oldTicketLevel > maxLevel; // CraftBukkit using oldTicketLevel for isLoaded checks + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getChunkTaskScheduler().scheduleChunkLoad( + chunkX, chunkZ, leastStatus, true, + ca.spottedleaf.concurrentutil.util.Priority.HIGHER, + complete + ); - -- private boolean chunkAbsent(@Nullable ChunkHolder holder, int maxLevel) { -- return holder == null || holder.oldTicketLevel > maxLevel; // CraftBukkit using oldTicketLevel for isLoaded checks ++ + return ret; + } else { + // can return now @@ -26673,6 +26675,15 @@ index 0a895055ec7f61d3cb52d303bbe3f89486a322e7..38ac7fd8e68f535a5e9bdd816997e865 this.tickChunks(gameprofilerfiller, j, list); gameprofilerfiller.pop(); } finally { +@@ -448,7 +512,7 @@ public class ServerChunkCache extends ChunkSource { + + while (iterator.hasNext()) { + ChunkHolder playerchunk = (ChunkHolder) iterator.next(); +- LevelChunk chunk = playerchunk.getTickingChunk(); ++ LevelChunk chunk = playerchunk.getChunkToSend(); // Paper - rewrite chunk system + + if (chunk != null) { + playerchunk.broadcastChanges(chunk); @@ -460,14 +524,26 @@ public class ServerChunkCache extends ChunkSource { } @@ -26790,7 +26801,7 @@ index b2fd3e936559c8fcb8b02ae3ef63c4f3bd0edb08..5bbc7ceaafc163f12344e5d5d355ad2f if (!list.equals(this.lastPassengers)) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70174468a3 100644 +index c5f3e4dff83a85a3a5f29534afd84d4a332b1d3e..85c58214c13208ed30f0ae4a2722f172184123ab 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -185,7 +185,7 @@ import org.bukkit.event.weather.LightningStrikeEvent; @@ -26811,7 +26822,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 private final GameEventDispatcher gameEventDispatcher; public boolean noSave; private final SleepStatus sleepStatus; -@@ -272,15 +272,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -272,12 +272,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public final void loadChunksForMoveAsync(AABB axisalignedbb, ca.spottedleaf.concurrentutil.util.Priority priority, java.util.function.Consumer> onLoad) { @@ -26821,17 +26832,16 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 - }); - return; - } -- List ret = new java.util.ArrayList<>(); -- it.unimi.dsi.fastutil.ints.IntArrayList ticketLevels = new it.unimi.dsi.fastutil.ints.IntArrayList(); -- + // Paper - rewrite chunk system int minBlockX = Mth.floor(axisalignedbb.minX - 1.0E-7D) - 3; - int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3; - -@@ -293,30 +285,159 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - int minChunkZ = minBlockZ >> 4; - int maxChunkZ = maxBlockZ >> 4; + int minBlockZ = Mth.floor(axisalignedbb.minZ - 1.0E-7D) - 3; +@@ -296,32 +291,159 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + public final void loadChunks(int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ, + ca.spottedleaf.concurrentutil.util.Priority priority, + java.util.function.Consumer> onLoad) { +- List ret = new java.util.ArrayList<>(); +- it.unimi.dsi.fastutil.ints.IntArrayList ticketLevels = new it.unimi.dsi.fastutil.ints.IntArrayList(); - ServerChunkCache chunkProvider = this.getChunkSource(); + this.moonrise$loadChunksAsync(minChunkX, maxChunkX, minChunkZ, maxChunkZ, priority, onLoad); // Paper - rewrite chunk system + } @@ -26874,7 +26884,9 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 + final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder.ChunkCompletion lastCompletion = newChunkHolder.getLastChunkCompletion(); + return lastCompletion == null ? null : lastCompletion.chunk(); + } -+ + +- int requiredChunks = (maxChunkX - minChunkX + 1) * (maxChunkZ - minChunkZ + 1); +- int[] loadedChunks = new int[1]; + @Override + public final ChunkAccess moonrise$getSpecificChunkIfLoaded(final int chunkX, final int chunkZ, final net.minecraft.world.level.chunk.status.ChunkStatus leastStatus) { + final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder newChunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(chunkX, chunkZ); @@ -26883,26 +26895,24 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 + } + return newChunkHolder.getChunkIfPresentUnchecked(leastStatus); + } - -- int requiredChunks = (maxChunkX - minChunkX + 1) * (maxChunkZ - minChunkZ + 1); -- int[] loadedChunks = new int[1]; ++ + @Override + public final void moonrise$midTickTasks() { + ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.server).moonrise$executeMidTickTasks(); + } - -- Long holderIdentifier = Long.valueOf(chunkProvider.chunkFutureAwaitCounter++); ++ + @Override + public final ChunkAccess moonrise$syncLoadNonFull(final int chunkX, final int chunkZ, final net.minecraft.world.level.chunk.status.ChunkStatus status) { + return this.moonrise$getChunkTaskScheduler().syncLoadNonFull(chunkX, chunkZ, status); + } -- java.util.function.Consumer consumer = (net.minecraft.world.level.chunk.ChunkAccess chunk) -> { +- Long holderIdentifier = Long.valueOf(chunkProvider.chunkFutureAwaitCounter++); + @Override + public final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler moonrise$getChunkTaskScheduler() { + return this.chunkTaskScheduler; + } -+ + +- java.util.function.Consumer consumer = (net.minecraft.world.level.chunk.ChunkAccess chunk) -> { + @Override + public final ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController moonrise$getChunkDataController() { + return this.chunkDataController; @@ -27002,7 +27012,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } } } -@@ -324,22 +445,137 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -329,22 +451,137 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe for (int cx = minChunkX; cx <= maxChunkX; ++cx) { for (int cz = minChunkZ; cz <= maxChunkZ; ++cz) { @@ -27150,7 +27160,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 // Add env and gen to constructor, IWorldDataServer -> WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { -@@ -373,14 +609,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -378,14 +615,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe DataFixer datafixer = minecraftserver.getFixerUpper(); EntityPersistentStorage entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver); @@ -27168,7 +27178,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 return minecraftserver.overworld().getDataStorage(); }); this.chunkSource.getGeneratorState().ensureStructuresGenerated(); -@@ -408,6 +643,20 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -413,6 +649,20 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> { return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences"); }); @@ -27189,7 +27199,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit } -@@ -530,7 +779,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -535,7 +785,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe gameprofilerfiller.push("checkDespawn"); entity.checkDespawn(); gameprofilerfiller.pop(); @@ -27198,7 +27208,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 Entity entity1 = entity.getVehicle(); if (entity1 != null) { -@@ -553,13 +802,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -558,13 +808,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } gameprofilerfiller.push("entityManagement"); @@ -27217,7 +27227,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } protected void tickTime() { -@@ -599,7 +851,60 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -604,7 +857,60 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe }); } @@ -27278,7 +27288,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 ChunkPos chunkcoordintpair = chunk.getPos(); boolean flag = this.isRaining(); int j = chunkcoordintpair.getMinBlockX(); -@@ -607,7 +912,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -612,7 +918,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ProfilerFiller gameprofilerfiller = Profiler.get(); gameprofilerfiller.push("thunder"); @@ -27287,7 +27297,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); if (this.isRainingAt(blockposition)) { -@@ -639,7 +944,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -644,7 +950,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow for (int l = 0; l < randomTickSpeed; ++l) { @@ -27296,7 +27306,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 this.tickPrecipitation(this.getBlockRandomPos(j, 0, k, 15)); } } -@@ -647,35 +952,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -652,35 +958,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe gameprofilerfiller.popPush("tickBlocks"); if (randomTickSpeed > 0) { @@ -27333,7 +27343,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } gameprofilerfiller.pop(); -@@ -948,6 +1225,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -953,6 +1231,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (fluid1.is(fluid)) { fluid1.tick(this, pos, iblockdata); } @@ -27345,7 +27355,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } -@@ -957,6 +1239,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -962,6 +1245,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (iblockdata.is(block)) { iblockdata.tick(this, pos, this.random); } @@ -27357,7 +27367,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } -@@ -1035,6 +1322,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1040,6 +1328,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) { @@ -27369,7 +27379,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 ServerChunkCache chunkproviderserver = this.getChunkSource(); if (!savingDisabled) { -@@ -1048,14 +1340,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1053,14 +1346,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe progressListener.progressStage(Component.translatable("menu.savingChunks")); } @@ -27395,7 +27405,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 // CraftBukkit start - moved from MinecraftServer.saveChunks ServerLevel worldserver1 = this; -@@ -1195,7 +1492,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1200,7 +1498,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED); } @@ -27404,7 +27414,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } // CraftBukkit start -@@ -1226,7 +1523,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1231,7 +1529,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // CraftBukkit end @@ -27413,7 +27423,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } } -@@ -1237,11 +1534,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1242,11 +1540,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { // CraftBukkit end @@ -27426,7 +27436,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 return false; } else { this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit -@@ -1901,7 +2194,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1906,7 +2200,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } @@ -27435,7 +27445,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size())); bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count())); -@@ -1950,7 +2243,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1955,7 +2249,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1); try { @@ -27444,7 +27454,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } catch (Throwable throwable4) { if (bufferedwriter2 != null) { try { -@@ -1971,7 +2264,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1976,7 +2270,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2); try { @@ -27453,7 +27463,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } catch (Throwable throwable6) { if (bufferedwriter3 != null) { try { -@@ -2113,7 +2406,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2118,7 +2412,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @VisibleForTesting public String getWatchdogStats() { @@ -27462,7 +27472,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); }), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats()); } -@@ -2143,15 +2436,25 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2148,15 +2442,25 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public LevelEntityGetter getEntities() { org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot @@ -27491,7 +27501,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } public void startTickingChunk(LevelChunk chunk) { -@@ -2171,34 +2474,47 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2176,34 +2480,47 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public void close() throws IOException { super.close(); @@ -27546,7 +27556,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 } @Override -@@ -2254,7 +2570,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2259,7 +2576,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report); crashreportsystemdetails.setDetail("Loaded entity count", () -> { @@ -27556,7 +27566,7 @@ index 32f8186b1502b481c1100f7fdba0339ae3dd34fa..70efc63102b3d3727be376d42f1bef70 return crashreportsystemdetails; } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e2527f3e2b96df539c765ae23c83a09d3298d430..8ceeebb561046933cba0725e15732fa074226884 100644 +index 08a82b7a3456f58b3d0fdbb8e8dbce6972ad1672..dda53c52fab7c02f39451335fe0bfe36852ac994 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -218,7 +218,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -36017,7 +36027,7 @@ index f65cc95ab28e8a3b21eac2b16bd9ebe97e56e571..0074bc0e7147dc3a8c538e796f14ac9b @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a3c6ad1a53bdfd9bd928951983a503afba9eedc3..34eb7ede1d9f8cbd94660144fc5ef77669ea8afa 100644 +index 758d86865136e5ef58f401f00c5e62fbb8cf25a3..6323738fe96c8e815a0835e6d8b03125c36ecf90 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1432,7 +1432,7 @@ public final class CraftServer implements Server { @@ -36048,10 +36058,10 @@ index a3c6ad1a53bdfd9bd928951983a503afba9eedc3..34eb7ede1d9f8cbd94660144fc5ef776 // Paper start - Adventure diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 30dc6ac6c7da7397a113da2994b16ef375b067fa..18e6c9fb355614de40999310f47502e2847e626b 100644 +index 4a5a0e33af16369f665bf39e70238e4e5a5486da..696152286a4d16fa51a23ff6e15fb297f3476007 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -500,10 +500,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -488,10 +488,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); if (playerChunk == null) return false; @@ -36069,7 +36079,7 @@ index 30dc6ac6c7da7397a113da2994b16ef375b067fa..18e6c9fb355614de40999310f47502e2 // Paper start - Anti-Xray bypass final Map refreshPackets = new HashMap<>(); -@@ -516,8 +520,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -504,8 +508,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { })); // Paper end - Anti-Xray bypass } @@ -36079,16 +36089,16 @@ index 30dc6ac6c7da7397a113da2994b16ef375b067fa..18e6c9fb355614de40999310f47502e2 return true; } -@@ -621,20 +624,8 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -609,20 +612,8 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public Collection getPluginChunkTickets(int x, int z) { DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; - SortedArraySet> tickets = chunkDistanceManager.tickets.get(ChunkPos.asLong(x, z)); - +- - if (tickets == null) { - return Collections.emptyList(); - } -- + - ImmutableList.Builder ret = ImmutableList.builder(); - for (Ticket ticket : tickets) { - if (ticket.getType() == TicketType.PLUGIN_TICKET) { @@ -36101,7 +36111,7 @@ index 30dc6ac6c7da7397a113da2994b16ef375b067fa..18e6c9fb355614de40999310f47502e2 } @Override -@@ -642,7 +633,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -630,7 +621,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { Map> ret = new HashMap<>(); DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; @@ -36110,7 +36120,7 @@ index 30dc6ac6c7da7397a113da2994b16ef375b067fa..18e6c9fb355614de40999310f47502e2 long chunkKey = chunkTickets.getLongKey(); SortedArraySet> tickets = chunkTickets.getValue(); -@@ -1345,12 +1336,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1333,12 +1324,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public int getViewDistance() { @@ -36125,7 +36135,7 @@ index 30dc6ac6c7da7397a113da2994b16ef375b067fa..18e6c9fb355614de40999310f47502e2 } public BlockMetadataStore getBlockMetadata() { -@@ -2488,17 +2479,20 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2473,17 +2464,20 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void setSimulationDistance(final int simulationDistance) { diff --git a/patches/server/1039-API-for-checking-sent-chunks.patch b/patches/server/1039-API-for-checking-sent-chunks.patch index 822754301b..33cbf04ef5 100644 --- a/patches/server/1039-API-for-checking-sent-chunks.patch +++ b/patches/server/1039-API-for-checking-sent-chunks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] API for checking sent chunks diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 73ee1ba0b70859cc9c012ab32ad04e8ae2a73e30..92fb2f976ae1c36b152733c28f223337e7f8632e 100644 +index 4f1b3b38d1eec331ab67307eb0e9e62621ce3cd5..d0010dfd22463986bf3be9b3ee015ce92735753e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -3498,6 +3498,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/1040-Fix-CraftWorld-isChunkGenerated.patch b/patches/server/1040-Fix-CraftWorld-isChunkGenerated.patch index bf009e18a3..2aa2a06b03 100644 --- a/patches/server/1040-Fix-CraftWorld-isChunkGenerated.patch +++ b/patches/server/1040-Fix-CraftWorld-isChunkGenerated.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix CraftWorld#isChunkGenerated The upstream implementation is returning true for non-full chunks. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 18e6c9fb355614de40999310f47502e2847e626b..3134fab97260897601d7c8e2810f11b8be86dbec 100644 +index 696152286a4d16fa51a23ff6e15fb297f3476007..8f234b46c24a0ae08aa5f8190c5b27e1f62dfbab 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -409,11 +409,28 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -397,11 +397,28 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean isChunkGenerated(int x, int z) { diff --git a/patches/server/1041-Add-startup-flag-to-disable-gamerule-limits.patch b/patches/server/1041-Add-startup-flag-to-disable-gamerule-limits.patch index 426dd76265..452a3c6ba7 100644 --- a/patches/server/1041-Add-startup-flag-to-disable-gamerule-limits.patch +++ b/patches/server/1041-Add-startup-flag-to-disable-gamerule-limits.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add startup flag to disable gamerule limits -DPaper.DisableGameRuleLimits=true will disable gamerule limits diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java -index 4ae47c2c5a6bcfbf932d000a80974463e2d3818d..467696a78791d65a66eb380e97d33123a5a12e61 100644 +index 4ae47c2c5a6bcfbf932d000a80974463e2d3818d..7c363d59c6567cae8e6caf213be51804efa5a96d 100644 --- a/src/main/java/net/minecraft/world/level/GameRules.java +++ b/src/main/java/net/minecraft/world/level/GameRules.java @@ -36,6 +36,14 @@ import org.slf4j.Logger; @@ -14,7 +14,7 @@ index 4ae47c2c5a6bcfbf932d000a80974463e2d3818d..467696a78791d65a66eb380e97d33123 public class GameRules { + // Paper start - allow disabling gamerule limits -+ private static final boolean DISABLE_LIMITS = Boolean.getBoolean("Paper.DisableGameRuleLimits"); ++ private static final boolean DISABLE_LIMITS = Boolean.getBoolean("paper.disableGameRuleLimits"); + + private static int limit(final int limit, final int unlimited) { + return DISABLE_LIMITS ? unlimited : limit; diff --git a/patches/server/1043-Detail-more-information-in-watchdog-dumps.patch b/patches/server/1043-Detail-more-information-in-watchdog-dumps.patch index 2d5148854d..ded78aa33e 100644 --- a/patches/server/1043-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/1043-Detail-more-information-in-watchdog-dumps.patch @@ -78,10 +78,10 @@ index f7197f1347251a37dd0f6d9ffa2f09bc3a4e1233..1f7f68aad97ee73763c042837f239bdc }); throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 70efc63102b3d3727be376d42f1bef70174468a3..7b936a01888d71fe305863054471b6b4a3aa95b8 100644 +index 85c58214c13208ed30f0ae4a2722f172184123ab..ff79925649ac1ceb6121c4b74fdb65f5f138f689 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1247,7 +1247,26 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1253,7 +1253,26 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } @@ -108,7 +108,7 @@ index 70efc63102b3d3727be376d42f1bef70174468a3..7b936a01888d71fe305863054471b6b4 // Spigot start /*if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - comment out EAR 2 entity.tickCount++; -@@ -1277,6 +1296,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1283,6 +1302,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2 } diff --git a/patches/server/1046-Bundle-spark.patch b/patches/server/1046-Bundle-spark.patch index 49bec1f832..503d8c374f 100644 --- a/patches/server/1046-Bundle-spark.patch +++ b/patches/server/1046-Bundle-spark.patch @@ -5,16 +5,16 @@ Subject: [PATCH] Bundle spark diff --git a/build.gradle.kts b/build.gradle.kts -index a6ae4494ab5970447625d332ef15a76baac9666e..c209eb393670fd8d6c97ca65a801c8032b582a35 100644 +index 9e6c2a4630ce75e4115f76b5e7a1e0b50e8b3197..faf3e3fd72e8c915e7a4803dacbe1bb576c6663e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -75,6 +75,10 @@ dependencies { +@@ -76,6 +76,10 @@ dependencies { implementation("io.papermc:reflection-rewriter-runtime:$reflectionRewriterVersion") implementation("io.papermc:reflection-rewriter-proxy-generator:$reflectionRewriterVersion") // Paper end - Remap reflection + // Paper start - spark + implementation("me.lucko:spark-api:0.1-20240720.200737-2") -+ implementation("me.lucko:spark-paper:1.10.105-SNAPSHOT") ++ implementation("me.lucko:spark-paper:1.10.119-SNAPSHOT") + // Paper end - spark } @@ -364,7 +364,7 @@ index c06863578c5d654706d93e73059d89c12ae502a5..17a158ff6ce6520b69a5a0032ba4c054 com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c814b68933155fe7391b325260052d9affb6841c..e80439a0d17adaab7b782626fd2ee9ce1669058c 100644 +index 6323738fe96c8e815a0835e6d8b03125c36ecf90..806e56cb60235a99f468d36a059fdbd54c2d46e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -312,6 +312,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/1048-Incremental-chunk-and-player-saving.patch b/patches/server/1048-Incremental-chunk-and-player-saving.patch index 30f35bb821..d545517720 100644 --- a/patches/server/1048-Incremental-chunk-and-player-saving.patch +++ b/patches/server/1048-Incremental-chunk-and-player-saving.patch @@ -51,10 +51,10 @@ index 38b5eef0b5ff38f9a8dfa59822d7b41336108f49..b33b68649e67de08719b30e98650c84f ProfilerFiller gameprofilerfiller = Profiler.get(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 7b936a01888d71fe305863054471b6b4a3aa95b8..c09c718c1b1c9f27fdf1e4160b2df6887cf1d1a2 100644 +index ff79925649ac1ceb6121c4b74fdb65f5f138f689..5f244cafe6c3cfb4a3bd08f9ae0f1a5aeec9b359 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1347,6 +1347,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1353,6 +1353,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos); } @@ -86,7 +86,7 @@ index 7b936a01888d71fe305863054471b6b4a3aa95b8..c09c718c1b1c9f27fdf1e4160b2df688 // Paper start - add close param this.save(progressListener, flush, savingDisabled, false); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8ceeebb561046933cba0725e15732fa074226884..8c9148426f23cbbdfaf7ae66657d1a620f8bd853 100644 +index dda53c52fab7c02f39451335fe0bfe36852ac994..167ab6346edb8f29c29a7327f031c0f5df71acf1 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -221,6 +221,7 @@ import org.bukkit.inventory.MainHand; diff --git a/patches/server/1051-Lag-compensation-ticks.patch b/patches/server/1051-Lag-compensation-ticks.patch index 49158b5c6c..9e44007563 100644 --- a/patches/server/1051-Lag-compensation-ticks.patch +++ b/patches/server/1051-Lag-compensation-ticks.patch @@ -30,10 +30,10 @@ index b33b68649e67de08719b30e98650c84f4c3c18d6..e636a96ea6220fda671a31d3d9cdea46 gameprofilerfiller.push(() -> { String s = String.valueOf(worldserver); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c09c718c1b1c9f27fdf1e4160b2df6887cf1d1a2..21c78bc96c39f6261adaad2e7c225948b6f1606f 100644 +index 5f244cafe6c3cfb4a3bd08f9ae0f1a5aeec9b359..91c99cf68bf07eb81dcb63690365559df41b912e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -576,6 +576,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -582,6 +582,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ); } // Paper end - chunk tick iteration @@ -65,7 +65,7 @@ index 504c996220b278c194c93e001a3b326d549868ec..a96f859a5d0c6ec692d4627a69f3c9ee if (this.hasDelayedDestroy) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4836b01323abb125289982ef3ceca09d6a9cfc3b..e86314de8d908a0c3e9f17d3e163c11180cf3f59 100644 +index 59c992173fda6153c58722caae061b0e6bee86a1..6a3a8f0466998409a01223bc0c16d92b96e50118 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4051,6 +4051,10 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1053-Optional-per-player-mob-spawns.patch b/patches/server/1053-Optional-per-player-mob-spawns.patch index 48c89f8839..90f5fa951b 100644 --- a/patches/server/1053-Optional-per-player-mob-spawns.patch +++ b/patches/server/1053-Optional-per-player-mob-spawns.patch @@ -72,7 +72,7 @@ index 38ac7fd8e68f535a5e9bdd816997e865b7694af1..b1ecc218034944533967375d11297705 this.lastSpawnState = spawnercreature_d; profiler.popPush("spawnAndTick"); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8c9148426f23cbbdfaf7ae66657d1a620f8bd853..8cc02ee9b1a710e35eb65a5a095681cc7dc542bb 100644 +index 167ab6346edb8f29c29a7327f031c0f5df71acf1..f28babf8c778ef570d35e1aaa88467160cf3f1b1 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -303,6 +303,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple @@ -87,7 +87,7 @@ index 8c9148426f23cbbdfaf7ae66657d1a620f8bd853..8cc02ee9b1a710e35eb65a5a095681cc // CraftBukkit start public CraftPlayer.TransferCookieConnection transferCookieConnection; diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index bf943feca387b77a3154773a59da7190d38d8621..0beb5ab48c5405d9bc2ad8d0c430312f456d38c2 100644 +index bf943feca387b77a3154773a59da7190d38d8621..12ebd7829c7f6814ccd79ae96aa9023afcc64696 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -71,6 +71,12 @@ public final class NaturalSpawner { @@ -126,7 +126,7 @@ index bf943feca387b77a3154773a59da7190d38d8621..0beb5ab48c5405d9bc2ad8d0c430312f } - if ((flag || !enumcreaturetype.isFriendly()) && (flag1 || enumcreaturetype.isFriendly()) && (flag2 || !enumcreaturetype.isPersistent()) && spawnercreature_d.canSpawnForCategoryGlobal(enumcreaturetype, limit)) { -+ if ((flag || !enumcreaturetype.isFriendly()) && (flag1 || enumcreaturetype.isFriendly()) && (flag2 || !enumcreaturetype.isPersistent()) && (!worldserver.paperConfig().entities.spawning.perPlayerMobSpawns || spawnercreature_d.canSpawnForCategoryGlobal(enumcreaturetype, limit))) { // Paper - Optional per player mob spawns; remove global check, check later during the local one ++ if ((flag || !enumcreaturetype.isFriendly()) && (flag1 || enumcreaturetype.isFriendly()) && (flag2 || !enumcreaturetype.isPersistent()) && (worldserver.paperConfig().entities.spawning.perPlayerMobSpawns || spawnercreature_d.canSpawnForCategoryGlobal(enumcreaturetype, limit))) { // Paper - Optional per player mob spawns; remove global check, check later during the local one // CraftBukkit end list.add(enumcreaturetype); } diff --git a/patches/server/1054-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/patches/server/1054-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch index e2a568cb21..a4379980b1 100644 --- a/patches/server/1054-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch +++ b/patches/server/1054-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch @@ -60,7 +60,7 @@ index b1ecc218034944533967375d11297705c3fc01a3..aaaadb7be8abf867624a1ca83371595b spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true); } else { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8cc02ee9b1a710e35eb65a5a095681cc7dc542bb..4e4e5b7e8c387cf13cf5bc5e39d334c3222c9103 100644 +index f28babf8c778ef570d35e1aaa88467160cf3f1b1..b525369fb6f3bb80c1553ae41b1e3bddeda29936 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -307,6 +307,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple @@ -72,7 +72,7 @@ index 8cc02ee9b1a710e35eb65a5a095681cc7dc542bb..4e4e5b7e8c387cf13cf5bc5e39d334c3 // CraftBukkit start public CraftPlayer.TransferCookieConnection transferCookieConnection; diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 0beb5ab48c5405d9bc2ad8d0c430312f456d38c2..5297798c2be1ba85569c2b92ed221956bf75477a 100644 +index 12ebd7829c7f6814ccd79ae96aa9023afcc64696..c1b76a1ebc1eea7ab70cf61d8175a31794dd122a 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -299,6 +299,11 @@ public final class NaturalSpawner { diff --git a/patches/server/1055-Avoid-issues-with-certain-tasks-not-processing-durin.patch b/patches/server/1055-Avoid-issues-with-certain-tasks-not-processing-durin.patch index 180648d806..4bb32dd1da 100644 --- a/patches/server/1055-Avoid-issues-with-certain-tasks-not-processing-durin.patch +++ b/patches/server/1055-Avoid-issues-with-certain-tasks-not-processing-durin.patch @@ -11,7 +11,7 @@ sleep by default, which avoids the problem and makes it more obvious to check if enabled. We also unload chunks during sleep to prevent memory leaks caused by plugin chunk loads. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9dfa6bb83469620a446509656ea1ad140b2e683f..af8dbfcc9df105896c8574d2d9dd647ac30ae04d 100644 +index e636a96ea6220fda671a31d3d9cdea468a558768..64b56abf8900d0424100da460fc68ac964394793 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1638,6 +1638,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop +From: Bjarne Koll Date: Fri, 1 Nov 2024 14:58:57 +0100 Subject: [PATCH] Correct update cursor diff --git a/patches/server/1060-Call-CraftPlayer-onEntityRemove-for-all-online-playe.patch b/patches/server/1060-Call-CraftPlayer-onEntityRemove-for-all-online-playe.patch index fd0f3377d3..4af4caf52d 100644 --- a/patches/server/1060-Call-CraftPlayer-onEntityRemove-for-all-online-playe.patch +++ b/patches/server/1060-Call-CraftPlayer-onEntityRemove-for-all-online-playe.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Call CraftPlayer#onEntityRemove for all online players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5964d601c05176f48167cc92057a59e52a4da92b..3b6b6483bf855493948417f44f06427b625bc910 100644 +index 6bf37e37e179e7f962ca6a256b8476b99855aac5..9638bb0393257a917bdaa95d33561b37ab1878bc 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2780,7 +2780,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2786,7 +2786,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // CraftBukkit start entity.valid = false; if (!(entity instanceof ServerPlayer)) { diff --git a/patches/server/1061-Improve-exact-choice-recipe-ingredients.patch b/patches/server/1061-Improve-exact-choice-recipe-ingredients.patch index 24495c4ce6..a7270cced5 100644 --- a/patches/server/1061-Improve-exact-choice-recipe-ingredients.patch +++ b/patches/server/1061-Improve-exact-choice-recipe-ingredients.patch @@ -6,6 +6,8 @@ Subject: [PATCH] Improve exact choice recipe ingredients Fixes exact choices not working with recipe book clicks and shapeless recipes. +Feature patch + == AT == public net.minecraft.world.item.ItemStackLinkedSet TYPE_AND_TAG diff --git a/patches/server/1062-Eigencraft-redstone-implementation.patch b/patches/server/1062-Eigencraft-redstone-implementation.patch index 8ea799e5f8..85700695b3 100644 --- a/patches/server/1062-Eigencraft-redstone-implementation.patch +++ b/patches/server/1062-Eigencraft-redstone-implementation.patch @@ -17,6 +17,8 @@ A lot of this code is self-contained in a helper class. Aside from making the obvious class/function renames and obfhelpers I didn't need to modify much. Just added Bukkit's event system and took a few liberties with dead code and comment misspellings. +Feature patch + == AT == public net.minecraft.world.level.block.RedStoneWireBlock shouldSignal public net.minecraft.world.level.block.RedStoneWireBlock canSurvive(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/LevelReader;Lnet/minecraft/core/BlockPos;)Z diff --git a/patches/unapplied/server/0994-Add-Alternate-Current-redstone-implementation.patch b/patches/server/1065-Add-Alternate-Current-redstone-implementation.patch similarity index 91% rename from patches/unapplied/server/0994-Add-Alternate-Current-redstone-implementation.patch rename to patches/server/1065-Add-Alternate-Current-redstone-implementation.patch index dc479927b8..631fddfa22 100644 --- a/patches/unapplied/server/0994-Add-Alternate-Current-redstone-implementation.patch +++ b/patches/server/1065-Add-Alternate-Current-redstone-implementation.patch @@ -20,9 +20,11 @@ Alternate Current needs the following modifications: * RedStoneWireBlock: Replace calls to vanilla's or Eigencraft's methods for handling power changes with calls to Alternate Current's wire handler. +Feature patch + diff --git a/src/main/java/alternate/current/wire/LevelHelper.java b/src/main/java/alternate/current/wire/LevelHelper.java new file mode 100644 -index 0000000000000000000000000000000000000000..8196460fe91bc4d1b03ca214d4323276d1d19464 +index 0000000000000000000000000000000000000000..eda108e2df9bf7d1ddd89287b8d2c2d7f1637c96 --- /dev/null +++ b/src/main/java/alternate/current/wire/LevelHelper.java @@ -0,0 +1,66 @@ @@ -57,7 +59,7 @@ index 0000000000000000000000000000000000000000..8196460fe91bc4d1b03ca214d4323276 + static boolean setWireState(ServerLevel level, BlockPos pos, BlockState state, boolean updateNeighborShapes) { + int y = pos.getY(); + -+ if (y < level.getMinBuildHeight() || y >= level.getMaxBuildHeight()) { ++ if (y < level.getMinY() || y >= level.getMaxY()) { + return false; + } + @@ -81,7 +83,7 @@ index 0000000000000000000000000000000000000000..8196460fe91bc4d1b03ca214d4323276 + // notify clients of the BlockState change + level.getChunkSource().blockChanged(pos); + // mark the chunk for saving -+ chunk.setUnsaved(true); ++ chunk.markUnsaved(); + + if (updateNeighborShapes) { + prevState.updateIndirectNeighbourShapes(level, pos, Block.UPDATE_CLIENTS); @@ -980,7 +982,7 @@ index 0000000000000000000000000000000000000000..4fd8cb29024330397cfe4cbc1f237d28 +} diff --git a/src/main/java/alternate/current/wire/WireConnectionManager.java b/src/main/java/alternate/current/wire/WireConnectionManager.java new file mode 100644 -index 0000000000000000000000000000000000000000..c69dcf2b418a0a2f373425ea0dd7144fd2f33c87 +index 0000000000000000000000000000000000000000..f03b313e58385d626490a9e64c9616fd08aa951e --- /dev/null +++ b/src/main/java/alternate/current/wire/WireConnectionManager.java @@ -0,0 +1,134 @@ @@ -1111,7 +1113,7 @@ index 0000000000000000000000000000000000000000..c69dcf2b418a0a2f373425ea0dd7144f + * important. + */ + void forEach(Consumer consumer, UpdateOrder updateOrder, int iFlowDir) { -+ for (int iDir : updateOrder.cardinalNeighbors(iFlowDir)) { ++ for (int iDir : updateOrder.cardinalNeighbors(iFlowDir)) { + for (WireConnection c = heads[iDir]; c != null && c.iDir == iDir; c = c.next) { + consumer.accept(c); + } @@ -1120,15 +1122,14 @@ index 0000000000000000000000000000000000000000..c69dcf2b418a0a2f373425ea0dd7144f +} diff --git a/src/main/java/alternate/current/wire/WireHandler.java b/src/main/java/alternate/current/wire/WireHandler.java new file mode 100644 -index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b7922fccd573 +index 0000000000000000000000000000000000000000..259b301b2c8b64cb7974a235afb260e0e991af54 --- /dev/null +++ b/src/main/java/alternate/current/wire/WireHandler.java -@@ -0,0 +1,1053 @@ +@@ -0,0 +1,1073 @@ +package alternate.current.wire; + +import java.util.Iterator; +import java.util.Queue; -+import java.util.function.Consumer; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry; @@ -1143,6 +1144,7 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.redstone.InstantNeighborUpdater; +import net.minecraft.world.level.redstone.NeighborUpdater; ++import net.minecraft.world.level.redstone.Orientation; +import net.minecraft.world.level.redstone.Redstone; + +/** @@ -1284,24 +1286,15 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + return iDir ^ (0b10 >>> (iDir >>> 2)); + } + -+ // Each array is placed at the index that encodes the direction that is missing -+ // from the array. -+ private static final int[][] I_EXCEPT = { -+ { NORTH, EAST, SOUTH, DOWN, UP }, -+ { WEST, EAST, SOUTH, DOWN, UP }, -+ { WEST, NORTH, SOUTH, DOWN, UP }, -+ { WEST, NORTH, EAST, DOWN, UP }, -+ { WEST, NORTH, EAST, SOUTH, UP }, -+ { WEST, NORTH, EAST, SOUTH, DOWN } -+ }; -+ private static final int[][] I_EXCEPT_CARDINAL = { -+ { NORTH, EAST, SOUTH }, -+ { WEST, EAST, SOUTH }, -+ { WEST, NORTH, SOUTH }, -+ { WEST, NORTH, EAST, }, -+ { WEST, NORTH, EAST, SOUTH }, -+ { WEST, NORTH, EAST, SOUTH } -+ }; ++ public static int index(Direction dir) { ++ for (int i = 0; i < ALL.length; i++) { ++ if (dir == ALL[i]) { ++ return i; ++ } ++ } ++ ++ return -1; ++ } + } + + /** @@ -1402,16 +1395,22 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + this.fillNodeCache(0, 16); + } + ++ private Node getOrAddNode(BlockPos pos) { ++ // just pass in null, then the state will only be retrieved ++ // if there is no node as this position yet ++ return getOrAddNode(pos, null); ++ } ++ + /** -+ * Retrieve the {@link Node Node} that represents the ++ * Retrieve the {@link alternate.current.wire.Node Node} that represents the + * block at the given position in the level. + */ -+ private Node getOrAddNode(BlockPos pos) { ++ private Node getOrAddNode(BlockPos pos, BlockState state) { + return nodes.compute(pos.asLong(), (key, node) -> { + if (node == null) { + // If there is not yet a node at this position, retrieve and + // update one from the cache. -+ return getNextNode(pos); ++ return getNextNode(pos, state != null ? state : level.getBlockState(pos)); + } + if (node.invalid) { + return revalidateNode(node); @@ -1422,7 +1421,7 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + } + + /** -+ * Remove and return the {@link Node Node} at the given ++ * Remove and return the {@link alternate.current.wire.Node Node} at the given + * position. + */ + private Node removeNode(BlockPos pos) { @@ -1430,17 +1429,9 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + } + + /** -+ * Return a {@link Node Node} that represents the block -+ * at the given position. -+ */ -+ private Node getNextNode(BlockPos pos) { -+ return getNextNode(pos, level.getBlockState(pos)); -+ } -+ -+ /** + * Return a node that represents the given position and block state. If it is a -+ * wire, then create a new {@link WireNode WireNode}. -+ * Otherwise, grab the next {@link Node Node} from the ++ * wire, then create a new {@link alternate.current.wire.WireNode WireNode}. ++ * Otherwise, grab the next {@link alternate.current.wire.Node Node} from the + * cache and update it. + */ + private Node getNextNode(BlockPos pos, BlockState state) { @@ -1483,6 +1474,10 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + * Otherwise, the node can be quickly revalidated with the new block state. + */ + private Node revalidateNode(Node node) { ++ if (!node.invalid) { ++ return node; ++ } ++ + BlockPos pos = node.pos; + BlockState state = level.getBlockState(pos); + @@ -1539,17 +1534,28 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + /** + * This method should be called whenever a wire receives a block update. + */ -+ public void onWireUpdated(BlockPos pos) { ++ public boolean onWireUpdated(BlockPos pos, BlockState state, Orientation orientation) { ++ Node node = getOrAddNode(pos, state); ++ ++ if (!node.isWire()) { ++ return false; // we should never get here ++ } ++ ++ WireNode wire = node.asWire(); ++ + invalidate(); -+ findRoots(pos); ++ revalidateNode(wire); ++ findRoots(wire, orientation); + tryUpdate(); ++ ++ return true; + } + + /** + * This method should be called whenever a wire is placed. + */ -+ public void onWireAdded(BlockPos pos) { -+ Node node = getOrAddNode(pos); ++ public void onWireAdded(BlockPos pos, BlockState state) { ++ Node node = getOrAddNode(pos, state); + + if (!node.isWire()) { + return; // we should never get here @@ -1641,15 +1647,19 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + * from multiple points at once, checking for common cases like the one + * described above is relatively straight-forward. + */ -+ private void findRoots(BlockPos pos) { -+ Node node = getOrAddNode(pos); ++ private void findRoots(WireNode wire, Orientation orientation) { ++ // horizontal direction bias for update order purposes ++ int iDirBias = -1; + -+ if (!node.isWire()) { -+ return; // we should never get here ++ if (orientation != null) { ++ Direction dir = orientation.getFront().getAxis().isHorizontal() ++ ? orientation.getFront() ++ : orientation.getUp(); ++ ++ iDirBias = Directions.index(dir); + } + -+ WireNode wire = node.asWire(); -+ findRoot(wire); ++ findRoot(wire, iDirBias); + + // If the wire at the given position is not in an invalid state + // we can exit early. @@ -1657,33 +1667,43 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + return; + } + -+ for (int iDir : updateOrder.directNeighbors(wire.iFlowDir)) { -+ Node neighbor = getNeighbor(wire, iDir); -+ -+ if (neighbor.isConductor() || neighbor.isSignalSource()) { -+ findRootsAround(neighbor, Directions.iOpposite(iDir)); ++ if (orientation == null) { ++ // no neighborChanged orientation present, look around in all sides ++ for (int iDir : updateOrder.directNeighbors(wire.iFlowDir)) { ++ findRootsAround(wire, iDir); + } ++ } else { ++ // use the orientation from the neighborChanged update to look for roots only behind ++ findRootsAround(wire, Directions.index(orientation.getFront().getOpposite())); + } + } + + /** -+ * Look for wires around the given node that require power changes. ++ * Look for wires around a neighbor of the given wire that require power changes. + */ -+ private void findRootsAround(Node node, int except) { -+ for (int iDir : Directions.I_EXCEPT_CARDINAL[except]) { -+ Node neighbor = getNeighbor(node, iDir); ++ private void findRootsAround(WireNode wire, int iDir) { ++ Node node = getNeighbor(wire, iDir); + -+ if (neighbor.isWire()) { -+ findRoot(neighbor.asWire()); ++ if (node.isConductor() || node.isSignalSource()) { ++ for (int iSide : updateOrder.cardinalNeighbors(wire.iFlowDir)) { ++ Node neighbor = getNeighbor(node, iSide); ++ ++ if (neighbor.isWire()) { ++ findRoot(neighbor.asWire(), iSide); ++ } + } + } + } + ++ private void findRoot(WireNode wire) { ++ findRoot(wire, -1); ++ } ++ + /** + * Check if the given wire requires power changes. If it does, queue it for the + * breadth-first search as a root. + */ -+ private void findRoot(WireNode wire) { ++ private void findRoot(WireNode wire, int iDiscoveryDir) { + // Each wire only needs to be checked once. + if (wire.discovered) { + return; @@ -1694,7 +1714,7 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + findPower(wire, false); + + if (needsUpdate(wire)) { -+ searchRoot(wire); ++ searchRoot(wire, iDiscoveryDir); + } + } + @@ -1810,7 +1830,7 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + // Since 1.16 there is a block that is both a conductor and a signal + // source: the target block! + if (neighbor.isConductor()) { -+ power = Math.max(power, getDirectSignalTo(wire, neighbor, Directions.iOpposite(iDir))); ++ power = Math.max(power, getDirectSignalTo(wire, neighbor)); + } + if (neighbor.isSignalSource()) { + power = Math.max(power, neighbor.state.getSignal(level, neighbor.pos, Directions.ALL[iDir])); @@ -1828,10 +1848,10 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + * Determine the direct signal the given wire receives from neighboring blocks + * through the given conductor node. + */ -+ private int getDirectSignalTo(WireNode wire, Node node, int except) { ++ private int getDirectSignalTo(WireNode wire, Node node) { + int power = POWER_MIN; + -+ for (int iDir : Directions.I_EXCEPT[except]) { ++ for (int iDir = 0; iDir < Directions.ALL.length; iDir++) { + Node neighbor = getNeighbor(node, iDir); + + if (neighbor.isSignalSource()) { @@ -1856,13 +1876,13 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + /** + * Queue the given wire for the breadth-first search as a root. + */ -+ private void searchRoot(WireNode wire) { -+ int iBackupFlowDir; -+ -+ if (wire.connections.iFlowDir < 0) { -+ iBackupFlowDir = 0; -+ } else { ++ private void searchRoot(WireNode wire, int iBackupFlowDir) { ++ if (wire.connections.iFlowDir >= 0) { ++ // power flow direction takes precedent + iBackupFlowDir = wire.connections.iFlowDir; ++ } else if (iBackupFlowDir < 0) { ++ // use default value if none is given ++ iBackupFlowDir = 0; + } + + search(wire, true, iBackupFlowDir); @@ -2167,7 +2187,9 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 + * Emit a block update to the given node. + */ + private void updateBlock(Node node, BlockPos neighborPos, Block neighborBlock) { -+ neighborUpdater.neighborChanged(node.pos, neighborBlock, neighborPos); ++ // redstone wire is the only block that uses the neighborChanged orientation ++ // so leaving it as null should not be an issue ++ neighborUpdater.neighborChanged(node.pos, neighborBlock, null); + } + + @FunctionalInterface @@ -2179,7 +2201,7 @@ index 0000000000000000000000000000000000000000..8b7e33ce050ba75139df1c56c007b792 +} diff --git a/src/main/java/alternate/current/wire/WireNode.java b/src/main/java/alternate/current/wire/WireNode.java new file mode 100644 -index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf7864546b33 +index 0000000000000000000000000000000000000000..298076a0db4e6ee6e4775ac43bf749d9f5689bdb --- /dev/null +++ b/src/main/java/alternate/current/wire/WireNode.java @@ -0,0 +1,122 @@ @@ -2299,17 +2321,17 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78 + return true; + } + -+ currentPower = LevelHelper.doRedstoneEvent(level, pos, currentPower, Mth.clamp(virtualPower, Redstone.SIGNAL_MIN, Redstone.SIGNAL_MAX)); ++ currentPower = LevelHelper.doRedstoneEvent(level, pos, currentPower, Mth.clamp(virtualPower, Redstone.SIGNAL_MIN, Redstone.SIGNAL_MAX));; + state = state.setValue(RedStoneWireBlock.POWER, currentPower); + + return LevelHelper.setWireState(level, pos, state, added); + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index acc11fc7f30b6d4a3a4445b7db25bf99c93b39f2..6f3eedade396405d67ff56c66755929acda5cff0 100644 +index 9638bb0393257a917bdaa95d33561b37ab1878bc..957cae6ddeba9efe3b55588567ae51e8b86b6a42 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -230,6 +230,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public final UUID uuid; public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent @@ -2317,8 +2339,8 @@ index acc11fc7f30b6d4a3a4445b7db25bf99c93b39f2..6f3eedade396405d67ff56c66755929a public LevelChunk getChunkIfLoaded(int x, int z) { return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately -@@ -2427,6 +2428,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. - return crashreportsystemdetails; +@@ -2647,6 +2648,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + return this.chunkSource.getGenerator().getSeaLevel(); } + // Paper start - optimize redstone (Alternate Current) @@ -2332,13 +2354,13 @@ index acc11fc7f30b6d4a3a4445b7db25bf99c93b39f2..6f3eedade396405d67ff56c66755929a EntityCallbacks() {} diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c4ec80bbab850fe767a345d96f02103ca43eb3cb..ca1dab96b40511d53aedd4f64e6cd0fb03583710 100644 +index 022de445bbbb869c38be4972c98dcf1c665539ec..2cc264f577fdd81d02783e0d6146bea9728789c7 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -2030,4 +2030,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - } - } - // Paper end - notify observers even if grow failed +@@ -2015,6 +2015,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + public abstract FuelValues fuelValues(); + + // Paper start - optimize redstone (Alternate Current) + public alternate.current.wire.WireHandler getWireHandler() { + // This method is overridden in ServerLevel. @@ -2349,12 +2371,15 @@ index c4ec80bbab850fe767a345d96f02103ca43eb3cb..ca1dab96b40511d53aedd4f64e6cd0fb + return null; + } + // Paper end - optimize redstone (Alternate Current) - } ++ + public static enum ExplosionInteraction implements StringRepresentable { + + NONE("none"), BLOCK("block"), MOB("mob"), TNT("tnt"), TRIGGER("trigger"), STANDARD("standard"); // CraftBukkit - Add STANDARD which will always use Explosion.Effect.DESTROY diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java -index 18ed178223cca85dbba65b1e07741622e266d318..c131734cad123a35456d18f8a161f77a4ac9ac99 100644 +index 09b8f5335cb7651d90f4d1ca61b2ec5aa324e443..21f2c61023fadcce30452a02f067cd5d87e5d8dc 100644 --- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -258,7 +258,7 @@ public class RedStoneWireBlock extends Block { +@@ -290,7 +290,7 @@ public class RedStoneWireBlock extends Block { return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER); } @@ -2363,49 +2388,65 @@ index 18ed178223cca85dbba65b1e07741622e266d318..c131734cad123a35456d18f8a161f77a // The bulk of the new functionality is found in RedstoneWireTurbo.java com.destroystokyo.paper.util.RedstoneWireTurbo turbo = new com.destroystokyo.paper.util.RedstoneWireTurbo(this); -@@ -460,7 +460,13 @@ public class RedStoneWireBlock extends Block { +@@ -372,7 +372,13 @@ public class RedStoneWireBlock extends Block { @Override protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { if (!oldState.is(state.getBlock()) && !world.isClientSide) { -- this.updateSurroundingRedstone(world, pos, state, null); // Paper - Optimize redstone +- this.updateSurroundingRedstone(world, pos, state, null, true); // Paper - Optimize redstone + // Paper start - optimize redstone - replace call to updatePowerStrength + if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { -+ world.getWireHandler().onWireAdded(pos); // Alternate Current ++ world.getWireHandler().onWireAdded(pos, state); // Alternate Current + } else { -+ this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft ++ this.updateSurroundingRedstone(world, pos, state, null, true); // Vanilla/Eigencraft + } -+ // Paper end - optimize redstone - Iterator iterator = Direction.Plane.VERTICAL.iterator(); ++ // Paper end - while (iterator.hasNext()) { -@@ -487,7 +493,13 @@ public class RedStoneWireBlock extends Block { - world.updateNeighborsAt(pos.relative(enumdirection), this); + for (Direction direction : Direction.Plane.VERTICAL) { + world.updateNeighborsAt(pos.relative(direction), this); +@@ -391,7 +397,12 @@ public class RedStoneWireBlock extends Block { + world.updateNeighborsAt(pos.relative(direction), this); } -- this.updateSurroundingRedstone(world, pos, state, null); // Paper - Optimize redstone +- this.updateSurroundingRedstone(world, pos, state, null, false); // Paper - Optimize redstone + // Paper start - optimize redstone - replace call to updatePowerStrength + if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { + world.getWireHandler().onWireRemoved(pos, state); // Alternate Current + } else { -+ this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft ++ this.updateSurroundingRedstone(world, pos, state, null, false); // Vanilla/Eigencraft + } -+ // Paper end - optimize redstone this.updateNeighborsOfNeighboringWires(world, pos); } } -@@ -521,8 +533,14 @@ public class RedStoneWireBlock extends Block { +@@ -415,9 +426,15 @@ public class RedStoneWireBlock extends Block { @Override - protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { + protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { if (!world.isClientSide) { + // Paper start - optimize redstone (Alternate Current) + // Alternate Current handles breaking of redstone wires in the WireHandler. + if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { -+ world.getWireHandler().onWireUpdated(pos); ++ world.getWireHandler().onWireUpdated(pos, state, wireOrientation); + } else + // Paper end - optimize redstone (Alternate Current) - if (state.canSurvive(world, pos)) { -- this.updateSurroundingRedstone(world, pos, state, sourcePos); // Paper - Optimize redstone -+ this.updateSurroundingRedstone(world, pos, state, sourcePos); // Paper - Optimize redstone (Eigencraft) - } else { - dropResources(state, world, pos); - world.removeBlock(pos, false); + if (sourceBlock != this || !useExperimentalEvaluator(world)) { + if (state.canSurvive(world, pos)) { +- this.updateSurroundingRedstone(world, pos, state, wireOrientation, false); // Paper - Optimize redstone ++ this.updateSurroundingRedstone(world, pos, state, wireOrientation, false); // Paper - Optimize redstone (Eigencraft) + } else { + dropResources(state, world, pos); + world.removeBlock(pos, false); +diff --git a/src/main/java/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java b/src/main/java/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java +index 4a9dc307106687bec084244c0a76e3e30f244fe2..8342dd636531729a187aff1bd69878d7aef9d3eb 100644 +--- a/src/main/java/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java ++++ b/src/main/java/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java +@@ -17,6 +17,11 @@ public class ExperimentalRedstoneUtils { + if (up != null) { + orientation = orientation.withFront(up); + } ++ // Paper start - Optimize redstone (Alternate Current) - use default front instead of random ++ else if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { ++ orientation = orientation.withFront(Direction.WEST); ++ } ++ // Paper end - Optimize redstone (Alternate Current) + + return orientation; + } else { diff --git a/patches/server/1066-Fix-incorrect-invulnerability-damage-reduction.patch b/patches/server/1066-Fix-incorrect-invulnerability-damage-reduction.patch new file mode 100644 index 0000000000..3b3dd3d144 --- /dev/null +++ b/patches/server/1066-Fix-incorrect-invulnerability-damage-reduction.patch @@ -0,0 +1,115 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Bjarne Koll +Date: Mon, 11 Nov 2024 21:35:27 +0100 +Subject: [PATCH] Fix incorrect invulnerability damage reduction + +Fixes incorrect spigot handling of the invulnerability damage +reduction applied when an already invulnerable entity is damaged with a +larger damage amount than the initial damage. +Vanilla still damages entities even if invulnerable if the damage to be +applied is larger than the previous damage taken. In that case, vanilla +applies the difference between the previous damage taken and the +proposed damage. + +Spigot's damage modifier API takes over the computation of damage +reducing effects, however spigot invokes this handling with the initial +damage before computing the difference to the previous damage amount. +This leads to the reduction values to generally be larger than expected, +as they are computed on the not-yet-reduced value. +Spigot applies these reductions after calling the EntityDamageEvent and +*then* subtracts the previous damage point, leading to the final damage +amount being smaller than expected. + +This patch cannot simply call the EntityDamageEvent with the reduced +damage, as that would lead to EntityDamageEvent#getDamage() returning +the already reduced damage, which breaks its method contract. +Instead, this patch makes use of the DamageModifier API, implementing +the last-damage-reduction as a DamageModifier. + +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 6a3a8f0466998409a01223bc0c16d92b96e50118..51f913a495e7fda7e0e72439c6d7cc9607bd4af8 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -1505,12 +1505,12 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + // Paper start - only call damage event when actuallyHurt will be called - move call logic down +- event = this.handleEntityDamage(source, amount); ++ event = this.handleEntityDamage(source, amount, this.lastHurt); // Paper - fix invulnerability reduction in EntityDamageEvent - pass lastDamage reduction + amount = computeAmountFromEntityDamageEvent(event); + // Paper end - only call damage event when actuallyHurt will be called - move call logic down + + // CraftBukkit start +- if (!this.actuallyHurt(world, source, (float) event.getFinalDamage() - this.lastHurt, event)) { ++ if (!this.actuallyHurt(world, source, (float) event.getFinalDamage(), event)) { // Paper - fix invulnerability reduction in EntityDamageEvent - no longer subtract lastHurt, that is part of the damage event calc now + return false; + } + if (this instanceof ServerPlayer && event.getDamage() == 0 && originalAmount == 0) return false; // Paper - revert to vanilla damage - players are not affected by damage that is 0 - skip damage if the vanilla damage is 0 and was not modified by plugins in the event. +@@ -1519,7 +1519,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + flag1 = false; + } else { + // Paper start - only call damage event when actuallyHurt will be called - move call logic down +- event = this.handleEntityDamage(source, amount); ++ event = this.handleEntityDamage(source, amount, 0); // Paper - fix invulnerability reduction in EntityDamageEvent - pass lastDamage reduction (none in this branch) + amount = computeAmountFromEntityDamageEvent(event); + // Paper end - only call damage event when actuallyHurt will be called - move call logic down + // CraftBukkit start +@@ -2322,8 +2322,19 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + // CraftBukkit start +- private EntityDamageEvent handleEntityDamage(final DamageSource damagesource, float f) { ++ private EntityDamageEvent handleEntityDamage(final DamageSource damagesource, float f, final float invulnerabilityRelatedLastDamage) { // Paper - fix invulnerability reduction in EntityDamageEvent + float originalDamage = f; ++ // Paper start - fix invulnerability reduction in EntityDamageEvent ++ final com.google.common.base.Function invulnerabilityReductionEquation = d -> { ++ if (invulnerabilityRelatedLastDamage == 0) return 0D; // no last damage, no reduction ++ // last damage existed, this means the reduction *technically* is (new damage - last damage). ++ // If the event damage was changed to something less than invul damage, hard lock it at 0. ++ if (d < invulnerabilityRelatedLastDamage) return 0D; ++ return (double) -invulnerabilityRelatedLastDamage; ++ }; ++ final float originalInvulnerabilityReduction = invulnerabilityReductionEquation.apply((double) f).floatValue(); ++ f += originalInvulnerabilityReduction; ++ // Paper end - fix invulnerability reduction in EntityDamageEvent + + com.google.common.base.Function freezing = new com.google.common.base.Function() { + @Override +@@ -2400,7 +2411,12 @@ public abstract class LivingEntity extends Entity implements Attackable { + }; + float absorptionModifier = absorption.apply((double) f).floatValue(); + +- return CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, freezingModifier, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, freezing, hardHat, blocking, armor, resistance, magic, absorption); ++ // Paper start - fix invulnerability reduction in EntityDamageEvent ++ return CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, freezingModifier, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, freezing, hardHat, blocking, armor, resistance, magic, absorption, (damageModifierDoubleMap, damageModifierFunctionMap) -> { ++ damageModifierFunctionMap.put(DamageModifier.INVULNERABILITY_REDUCTION, invulnerabilityReductionEquation); ++ damageModifierDoubleMap.put(DamageModifier.INVULNERABILITY_REDUCTION, (double) originalInvulnerabilityReduction); ++ }); ++ // Paper end - fix invulnerability reduction in EntityDamageEvent + } + + protected boolean actuallyHurt(ServerLevel worldserver, final DamageSource damagesource, float f, final EntityDamageEvent event) { // void -> boolean, add final +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index deba03eb37012c638e08e20cd1c98e9db190c790..e37aaf77f94b97b736cc20ef070cefdff0400188 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -1218,6 +1218,11 @@ public class CraftEventFactory { + private static final Function ZERO = Functions.constant(-0.0); + + public static EntityDamageEvent handleLivingEntityDamageEvent(Entity damagee, DamageSource source, double rawDamage, double freezingModifier, double hardHatModifier, double blockingModifier, double armorModifier, double resistanceModifier, double magicModifier, double absorptionModifier, Function freezing, Function hardHat, Function blocking, Function armor, Function resistance, Function magic, Function absorption) { ++ // Paper start - fix invulnerability reduction in EntityDamageEvent ++ return handleLivingEntityDamageEvent(damagee, source, rawDamage, freezingModifier, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, freezing, hardHat, blocking, armor, resistance, magic, absorption, null); ++ } ++ public static EntityDamageEvent handleLivingEntityDamageEvent(Entity damagee, DamageSource source, double rawDamage, double freezingModifier, double hardHatModifier, double blockingModifier, double armorModifier, double resistanceModifier, double magicModifier, double absorptionModifier, Function freezing, Function hardHat, Function blocking, Function armor, Function resistance, Function magic, Function absorption, java.util.function.BiConsumer, Map>> callback) { ++ // Paper end - fix invulnerability reduction in EntityDamageEvent + Map modifiers = new EnumMap<>(DamageModifier.class); + Map> modifierFunctions = new EnumMap<>(DamageModifier.class); + modifiers.put(DamageModifier.BASE, rawDamage); +@@ -1242,6 +1247,7 @@ public class CraftEventFactory { + modifierFunctions.put(DamageModifier.MAGIC, magic); + modifiers.put(DamageModifier.ABSORPTION, absorptionModifier); + modifierFunctions.put(DamageModifier.ABSORPTION, absorption); ++ if (callback != null) callback.accept(modifiers, modifierFunctions); // Paper - fix invulnerability reduction in EntityDamageEvent + return CraftEventFactory.handleEntityDamageEvent(damagee, source, modifiers, modifierFunctions); + } + diff --git a/patches/server/1067-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch b/patches/server/1067-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch new file mode 100644 index 0000000000..511cccc084 --- /dev/null +++ b/patches/server/1067-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> +Date: Mon, 18 Nov 2024 20:27:58 +0100 +Subject: [PATCH] Fix NPE when EntityResurrectEvent is uncancelled + + +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 51f913a495e7fda7e0e72439c6d7cc9607bd4af8..f36a075dbee2b96d01899e02460b1d8443e91749 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -1711,6 +1711,12 @@ public abstract class LivingEntity extends Entity implements Attackable { + if (!itemstack1.isEmpty() && itemstack != null) { // Paper - only reduce item if actual totem was found + itemstack1.shrink(1); + } ++ // Paper start - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled ++ // restore the previous behavior in that case by defaulting to vanillas totem of undying efect ++ if (deathprotection == null) { ++ deathprotection = DeathProtection.TOTEM_OF_UNDYING; ++ } ++ // Paper end - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled + if (itemstack != null && this instanceof ServerPlayer) { + // CraftBukkit end + ServerPlayer entityplayer = (ServerPlayer) this; diff --git a/patches/unapplied/server/9999-Optimise-nearby-player-retrieval.patch b/patches/unapplied/server/9999-Optimise-nearby-player-retrieval.patch index eae5d781cc..d3e18e7c39 100644 --- a/patches/unapplied/server/9999-Optimise-nearby-player-retrieval.patch +++ b/patches/unapplied/server/9999-Optimise-nearby-player-retrieval.patch @@ -7,6 +7,8 @@ Instead of searching/testing every player online on the server, we can instead use the nearby player tracking system to reduce the number of tests per search. +Feature patch + diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index d4376ed215d97066a21e462fae2a0e25ad8a16a1..aab652174a8175765cad548f7c61ce353ca74803 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java