diff --git a/patches/api/0040-Add-component-support-to-resource-pack-api.patch b/patches/api/0040-Add-component-support-to-resource-pack-api.patch new file mode 100644 index 000000000..ea50f0a49 --- /dev/null +++ b/patches/api/0040-Add-component-support-to-resource-pack-api.patch @@ -0,0 +1,114 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Tue, 17 Aug 2021 17:39:14 -0500 +Subject: [PATCH] Add component support to resource pack api + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index d093d43380e09426f9430460a8626f8dcd675f22..a1d0302deb4e002d18264883f5ce1c1a17a6089d 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -1570,6 +1570,50 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + */ + public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt); + ++ /** ++ * Request that the player's client download and switch resource packs. ++ *

++ * The player's client will download the new resource pack asynchronously ++ * in the background, and will automatically switch to it once the ++ * download is complete. If the client has downloaded and cached a ++ * resource pack with the same hash in the past it will not download but ++ * directly apply the cached pack. If the hash is null and the client has ++ * downloaded and cached the same resource pack in the past, it will ++ * perform a file size check against the response content to determine if ++ * the resource pack has changed and needs to be downloaded again. When ++ * this request is sent for the very first time from a given server, the ++ * client will first display a confirmation GUI to the player before ++ * proceeding with the download. ++ *

++ * Notes: ++ *

++ * ++ * @param url The URL from which the client will download the resource ++ * pack. The string must contain only US-ASCII characters and should ++ * be encoded as per RFC 1738. ++ * @param hash The sha1 hash sum of the resource pack file which is used ++ * to apply a cached version of the pack directly without downloading ++ * if it is available. Hast to be 20 bytes long! ++ * @param prompt The optional custom prompt message to be shown to client. ++ * @throws IllegalArgumentException Thrown if the URL is null. ++ * @throws IllegalArgumentException Thrown if the URL is too long. The ++ * length restriction is an implementation specific arbitrary value. ++ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes ++ * long. ++ */ ++ public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable net.kyori.adventure.text.Component prompt); ++ + /** + * Request that the player's client download and switch resource packs. + *

+@@ -1661,6 +1705,52 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + */ + public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force); + ++ /** ++ * Request that the player's client download and switch resource packs. ++ *

++ * The player's client will download the new resource pack asynchronously ++ * in the background, and will automatically switch to it once the ++ * download is complete. If the client has downloaded and cached a ++ * resource pack with the same hash in the past it will not download but ++ * directly apply the cached pack. If the hash is null and the client has ++ * downloaded and cached the same resource pack in the past, it will ++ * perform a file size check against the response content to determine if ++ * the resource pack has changed and needs to be downloaded again. When ++ * this request is sent for the very first time from a given server, the ++ * client will first display a confirmation GUI to the player before ++ * proceeding with the download. ++ *

++ * Notes: ++ *

++ * ++ * @param url The URL from which the client will download the resource ++ * pack. The string must contain only US-ASCII characters and should ++ * be encoded as per RFC 1738. ++ * @param hash The sha1 hash sum of the resource pack file which is used ++ * to apply a cached version of the pack directly without downloading ++ * if it is available. Hast to be 20 bytes long! ++ * @param prompt The optional custom prompt message to be shown to client. ++ * @param force If true, the client will be disconnected from the server ++ * when it declines to use the resource pack. ++ * @throws IllegalArgumentException Thrown if the URL is null. ++ * @throws IllegalArgumentException Thrown if the URL is too long. The ++ * length restriction is an implementation specific arbitrary value. ++ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes ++ * long. ++ */ ++ public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable net.kyori.adventure.text.Component prompt, boolean force); ++ + /** + * Gets the Scoreboard displayed to this player + * diff --git a/patches/api/0040-Extended-OfflinePlayer-API.patch b/patches/api/0041-Extended-OfflinePlayer-API.patch similarity index 100% rename from patches/api/0040-Extended-OfflinePlayer-API.patch rename to patches/api/0041-Extended-OfflinePlayer-API.patch diff --git a/patches/api/0041-Added-the-ability-to-add-combustible-items.patch b/patches/api/0042-Added-the-ability-to-add-combustible-items.patch similarity index 100% rename from patches/api/0041-Added-the-ability-to-add-combustible-items.patch rename to patches/api/0042-Added-the-ability-to-add-combustible-items.patch diff --git a/patches/server/0227-Add-component-support-to-resource-pack-api.patch b/patches/server/0227-Add-component-support-to-resource-pack-api.patch new file mode 100644 index 000000000..98ca6f494 --- /dev/null +++ b/patches/server/0227-Add-component-support-to-resource-pack-api.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Tue, 17 Aug 2021 17:39:21 -0500 +Subject: [PATCH] Add component support to resource pack api + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 2622cf83dd501b982fdd20b31d174bb0d63d1218..d6618a4ba0e830449f2cf6e60b1d6ff8747bc373 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -1733,24 +1733,36 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + + @Override + public void setResourcePack(String url, byte[] hash, String prompt) { ++ // Purpur start ++ this.setResourcePack(url, hash, io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(prompt), false); ++ } ++ ++ @Override ++ public void setResourcePack(String url, byte[] hash, net.kyori.adventure.text.Component prompt) { + this.setResourcePack(url, hash, prompt, false); + } + + @Override + public void setResourcePack(String url, byte[] hash, boolean force) { +- this.setResourcePack(url, hash, null, force); ++ this.setResourcePack(url, hash, (net.kyori.adventure.text.Component) null, force); + } + + @Override + public void setResourcePack(String url, byte[] hash, String prompt, boolean force) { ++ this.setResourcePack(url, hash, prompt == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(prompt), force); ++ } ++ ++ @Override ++ public void setResourcePack(String url, byte[] hash, net.kyori.adventure.text.Component prompt, boolean force) { ++ // Purpur end + Validate.notNull(url, "Resource pack URL cannot be null"); + + if (hash != null) { + Validate.isTrue(hash.length == 20, "Resource pack hash should be 20 bytes long but was " + hash.length); + +- this.getHandle().sendTexturePack(url, BaseEncoding.base16().lowerCase().encode(hash), force, CraftChatMessage.fromStringOrNull(prompt, true)); ++ this.getHandle().sendTexturePack(url, BaseEncoding.base16().lowerCase().encode(hash), force, io.papermc.paper.adventure.PaperAdventure.asVanilla(prompt)); // Purpur + } else { +- this.getHandle().sendTexturePack(url, "", force, CraftChatMessage.fromStringOrNull(prompt, true)); ++ this.getHandle().sendTexturePack(url, "", force, io.papermc.paper.adventure.PaperAdventure.asVanilla(prompt)); // Purpur + } + } + diff --git a/patches/server/0227-Shulker-change-color-with-dye.patch b/patches/server/0228-Shulker-change-color-with-dye.patch similarity index 100% rename from patches/server/0227-Shulker-change-color-with-dye.patch rename to patches/server/0228-Shulker-change-color-with-dye.patch diff --git a/patches/server/0228-Extended-OfflinePlayer-API.patch b/patches/server/0229-Extended-OfflinePlayer-API.patch similarity index 98% rename from patches/server/0228-Extended-OfflinePlayer-API.patch rename to patches/server/0229-Extended-OfflinePlayer-API.patch index 04467d181..6204391de 100644 --- a/patches/server/0228-Extended-OfflinePlayer-API.patch +++ b/patches/server/0229-Extended-OfflinePlayer-API.patch @@ -223,10 +223,10 @@ index 88bc0807e8bf66a65422f85f1112336334eb3de2..d0e822b329085b9d0a42276c3cacd6cb + // Purpur end - OfflinePlayer API } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2622cf83dd501b982fdd20b31d174bb0d63d1218..928b249faed2d79a5f74c612e5ab38ab82b0a26f 100644 +index d6618a4ba0e830449f2cf6e60b1d6ff8747bc373..eb3324f9f6ec3c90afe8cec2861feebcf0c27ee7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1908,6 +1908,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1920,6 +1920,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.getHandle().getAbilities().walkingSpeed * 2f; } diff --git a/patches/server/0229-Added-the-ability-to-add-combustible-items.patch b/patches/server/0230-Added-the-ability-to-add-combustible-items.patch similarity index 100% rename from patches/server/0229-Added-the-ability-to-add-combustible-items.patch rename to patches/server/0230-Added-the-ability-to-add-combustible-items.patch diff --git a/patches/server/0230-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch b/patches/server/0231-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch similarity index 100% rename from patches/server/0230-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch rename to patches/server/0231-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch diff --git a/patches/server/0231-Chance-for-azalea-blocks-to-grow-into-trees-naturall.patch b/patches/server/0232-Chance-for-azalea-blocks-to-grow-into-trees-naturall.patch similarity index 100% rename from patches/server/0231-Chance-for-azalea-blocks-to-grow-into-trees-naturall.patch rename to patches/server/0232-Chance-for-azalea-blocks-to-grow-into-trees-naturall.patch diff --git a/patches/server/0232-Shift-right-click-to-use-exp-for-mending.patch b/patches/server/0233-Shift-right-click-to-use-exp-for-mending.patch similarity index 100% rename from patches/server/0232-Shift-right-click-to-use-exp-for-mending.patch rename to patches/server/0233-Shift-right-click-to-use-exp-for-mending.patch diff --git a/patches/server/0233-Dolphins-naturally-aggressive-to-players-chance.patch b/patches/server/0234-Dolphins-naturally-aggressive-to-players-chance.patch similarity index 100% rename from patches/server/0233-Dolphins-naturally-aggressive-to-players-chance.patch rename to patches/server/0234-Dolphins-naturally-aggressive-to-players-chance.patch diff --git a/patches/server/0234-Cows-naturally-aggressive-to-players-chance.patch b/patches/server/0235-Cows-naturally-aggressive-to-players-chance.patch similarity index 100% rename from patches/server/0234-Cows-naturally-aggressive-to-players-chance.patch rename to patches/server/0235-Cows-naturally-aggressive-to-players-chance.patch diff --git a/patches/server/0235-Option-for-beds-to-explode-on-villager-sleep.patch b/patches/server/0236-Option-for-beds-to-explode-on-villager-sleep.patch similarity index 100% rename from patches/server/0235-Option-for-beds-to-explode-on-villager-sleep.patch rename to patches/server/0236-Option-for-beds-to-explode-on-villager-sleep.patch diff --git a/patches/server/0236-Halloween-options-and-optimizations.patch b/patches/server/0237-Halloween-options-and-optimizations.patch similarity index 100% rename from patches/server/0236-Halloween-options-and-optimizations.patch rename to patches/server/0237-Halloween-options-and-optimizations.patch diff --git a/patches/server/0237-Config-for-Grindstones-ignoring-curses.patch b/patches/server/0238-Config-for-Grindstones-ignoring-curses.patch similarity index 100% rename from patches/server/0237-Config-for-Grindstones-ignoring-curses.patch rename to patches/server/0238-Config-for-Grindstones-ignoring-curses.patch diff --git a/patches/server/0238-UPnP-Port-Forwarding.patch b/patches/server/0239-UPnP-Port-Forwarding.patch similarity index 100% rename from patches/server/0238-UPnP-Port-Forwarding.patch rename to patches/server/0239-UPnP-Port-Forwarding.patch diff --git a/patches/server/0239-Campfire-option-for-lit-when-placed.patch b/patches/server/0240-Campfire-option-for-lit-when-placed.patch similarity index 100% rename from patches/server/0239-Campfire-option-for-lit-when-placed.patch rename to patches/server/0240-Campfire-option-for-lit-when-placed.patch diff --git a/patches/server/0240-options-to-extinguish-fire-blocks-with-snowballs.patch b/patches/server/0241-options-to-extinguish-fire-blocks-with-snowballs.patch similarity index 100% rename from patches/server/0240-options-to-extinguish-fire-blocks-with-snowballs.patch rename to patches/server/0241-options-to-extinguish-fire-blocks-with-snowballs.patch diff --git a/patches/server/0241-Add-option-to-disable-zombie-villagers-cure.patch b/patches/server/0242-Add-option-to-disable-zombie-villagers-cure.patch similarity index 100% rename from patches/server/0241-Add-option-to-disable-zombie-villagers-cure.patch rename to patches/server/0242-Add-option-to-disable-zombie-villagers-cure.patch diff --git a/patches/server/0242-Persistent-BlockEntity-Lore-and-DisplayName.patch b/patches/server/0243-Persistent-BlockEntity-Lore-and-DisplayName.patch similarity index 100% rename from patches/server/0242-Persistent-BlockEntity-Lore-and-DisplayName.patch rename to patches/server/0243-Persistent-BlockEntity-Lore-and-DisplayName.patch diff --git a/patches/server/0243-Signs-allow-color-codes.patch b/patches/server/0244-Signs-allow-color-codes.patch similarity index 100% rename from patches/server/0243-Signs-allow-color-codes.patch rename to patches/server/0244-Signs-allow-color-codes.patch diff --git a/patches/server/0244-Kelp-weeping-and-twisting-vines-configurable-max-gro.patch b/patches/server/0245-Kelp-weeping-and-twisting-vines-configurable-max-gro.patch similarity index 100% rename from patches/server/0244-Kelp-weeping-and-twisting-vines-configurable-max-gro.patch rename to patches/server/0245-Kelp-weeping-and-twisting-vines-configurable-max-gro.patch