From f9e1ad2c2d3138308e940657d2bdca66d856bfb2 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Wed, 15 Feb 2023 14:10:14 -0800 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) (#8832) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 37262de8 PR-812: Add Registry#match(String) d6b40162 SPIGOT-4569: Add more BlockData API f9691891 PR-809: Throw a more clear error for BlockIterators with zero direction, add Vector#isZero() 91e79e19 PR-804: Added methods to get translation keys for materials, itemstacks and more 426b00d3 PR-795: Add new BiomeParameterPoint passed to BiomeProvider#getBiome 0e91ea52 SPIGOT-7224: Add events for brewing stands and campfires starting their actions CraftBukkit Changes: a50301aa5 Fix issues with fluid tag conversion and fluid #isTagged 6aeb5e4c3 SPIGOT-4569: Implement more BlockData API 7dbf862c2 PR-1131: Added methods to get translation keys for materials, itemstacks and more 7167588b1 PR-1117: Add new BiomeParameterPoint passed to BiomeProvider#getBiome 7c44152eb SPIGOT-7224: Add events for brewing stands and campfires starting their actions --- ...-get-a-BlockState-without-a-snapshot.patch | 2 +- patches/api/Add-Block-isValidTool.patch | 2 +- .../api/Add-BlockSoundGroup-interface.patch | 2 +- patches/api/Add-Destroy-Speed-API.patch | 4 +- .../Add-Raw-Byte-Entity-Serialization.patch | 4 +- ...Add-Raw-Byte-ItemStack-Serialization.patch | 2 +- patches/api/Add-enchantWithLevels-API.patch | 2 +- patches/api/Add-getComputedBiome-API.patch | 2 +- ...patch => Add-getDrops-to-BlockState.patch} | 25 +-- patches/api/Add-getI18NDisplayName-API.patch | 2 +- ...Collidable-methods-to-various-places.patch | 4 +- .../Add-methods-to-get-translation-keys.patch | 159 +++++++----------- .../Add-missing-isFuel-Material-entries.patch | 18 +- .../api/Additional-Block-Material-API-s.patch | 2 +- patches/api/Adventure.patch | 10 +- ...Blocks-to-be-accessed-via-a-long-key.patch | 2 +- .../Attributes-API-for-item-defaults.patch | 2 +- patches/api/Block-Ticking-API.patch | 2 +- ...Cache-the-result-of-Material-isBlock.patch | 6 +- ...y-Counter-to-allow-plugins-to-use-va.patch | 6 +- ...for-InventoryBlockStartEvent-subclas.patch | 93 ++++++++++ .../api/Fix-Spigot-annotation-mistakes.patch | 32 +++- .../api/Get-entity-default-attributes.patch | 2 +- ...nt-furnace-cook-speed-multiplier-API.patch | 9 +- .../Improve-Block-breakNaturally-API.patch | 2 +- patches/api/Item-Rarity-API.patch | 8 +- ...PI-additions-for-quantity-flags-lore.patch | 2 +- patches/api/ItemStack-damage-API.patch | 2 +- patches/api/ItemStack-editMeta.patch | 2 +- .../api/ItemStack-getMaxItemUseDuration.patch | 2 +- patches/api/ItemStack-repair-check-API.patch | 2 +- .../api/Mark-experimental-api-as-such.patch | 42 ++--- patches/api/Material-API-additions.patch | 4 +- patches/api/Timings-v2.patch | 4 +- patches/api/ensureServerConversions-API.patch | 4 +- patches/server/Add-Destroy-Speed-API.patch | 2 +- ...patch => Add-getDrops-to-BlockState.patch} | 21 +-- .../Add-methods-to-get-translation-keys.patch | 42 +---- ...y-Counter-to-allow-plugins-to-use-va.patch | 5 +- .../Fix-Fluid-tags-isTagged-method.patch | 32 ---- .../Implement-CraftBlockSoundGroup.patch | 4 +- patches/server/MC-Utils.patch | 2 +- patches/server/Timings-v2.patch | 2 +- patches/server/cache-resource-keys.patch | 16 -- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 46 files changed, 278 insertions(+), 320 deletions(-) rename patches/api/{Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch => Add-getDrops-to-BlockState.patch} (66%) create mode 100644 patches/api/Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch rename patches/server/{Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch => Add-getDrops-to-BlockState.patch} (66%) delete mode 100644 patches/server/Fix-Fluid-tags-isTagged-method.patch diff --git a/patches/api/API-to-get-a-BlockState-without-a-snapshot.patch b/patches/api/API-to-get-a-BlockState-without-a-snapshot.patch index 1df53fbe18..158eaae091 100644 --- a/patches/api/API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/api/API-to-get-a-BlockState-without-a-snapshot.patch @@ -12,7 +12,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable { +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable { @NotNull BlockState getState(); diff --git a/patches/api/Add-Block-isValidTool.patch b/patches/api/Add-Block-isValidTool.patch index d115b7cfde..348e05b224 100644 --- a/patches/api/Add-Block-isValidTool.patch +++ b/patches/api/Add-Block-isValidTool.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr public static int getBlockKeyZ(long packed) { return (int) ((packed << 10) >> 37); } diff --git a/patches/api/Add-BlockSoundGroup-interface.patch b/patches/api/Add-BlockSoundGroup-interface.patch index 5005389b7a..b3f68520dc 100644 --- a/patches/api/Add-BlockSoundGroup-interface.patch +++ b/patches/api/Add-BlockSoundGroup-interface.patch @@ -79,7 +79,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable { +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable { * @return <code>true</code> if the block data can be placed here */ boolean canPlace(@NotNull BlockData data); diff --git a/patches/api/Add-Destroy-Speed-API.patch b/patches/api/Add-Destroy-Speed-API.patch index 4aaeed43e4..45a4c573b7 100644 --- a/patches/api/Add-Destroy-Speed-API.patch +++ b/patches/api/Add-Destroy-Speed-API.patch @@ -9,9 +9,9 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr @NotNull - @Deprecated + @Deprecated(forRemoval = true) String getTranslationKey(); + + /** diff --git a/patches/api/Add-Raw-Byte-Entity-Serialization.patch b/patches/api/Add-Raw-Byte-Entity-Serialization.patch index 0e3f99ebdf..15cd50a215 100644 --- a/patches/api/Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/api/Add-Raw-Byte-Entity-Serialization.patch @@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.bukkit.entity.Entity deserializeEntity(byte[] data, World world, boolean preserveUUID); + /** - * Return the translation key for the Material, so the client can translate it into the active - * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}. + * Creates and returns the next EntityId available. + * <p> diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Entity.java diff --git a/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch b/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch index ff1945465e..bb89536915 100644 --- a/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch @@ -23,7 +23,7 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return Bukkit.getServer().getItemFactory().ensureServerConversions(this); } diff --git a/patches/api/Add-enchantWithLevels-API.patch b/patches/api/Add-enchantWithLevels-API.patch index 98b6db8588..636b1b8021 100644 --- a/patches/api/Add-enchantWithLevels-API.patch +++ b/patches/api/Add-enchantWithLevels-API.patch @@ -35,7 +35,7 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat } // Paper start diff --git a/patches/api/Add-getComputedBiome-API.patch b/patches/api/Add-getComputedBiome-API.patch index f7389965b5..c7d04fc9e5 100644 --- a/patches/api/Add-getComputedBiome-API.patch +++ b/patches/api/Add-getComputedBiome-API.patch @@ -54,7 +54,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr * Returns the biome that this block resides in * * @return Biome type containing this block diff --git a/patches/api/Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch b/patches/api/Add-getDrops-to-BlockState.patch similarity index 66% rename from patches/api/Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch rename to patches/api/Add-getDrops-to-BlockState.patch index 89d7359bb5..7e08b816a9 100644 --- a/patches/api/Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch +++ b/patches/api/Add-getDrops-to-BlockState.patch @@ -1,8 +1,10 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MelnCat <melncatuwu@gmail.com> Date: Fri, 12 Aug 2022 23:24:53 -0700 -Subject: [PATCH] Add getDrops to BlockState and isPreferredTool to BlockData +Subject: [PATCH] Add getDrops to BlockState +Originally added isPreferredTool to BlockData but +upstream added that. diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -43,24 +45,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + java.util.@org.jetbrains.annotations.Unmodifiable Collection<org.bukkit.inventory.ItemStack> getDrops(@NotNull org.bukkit.inventory.ItemStack tool, @Nullable org.bukkit.entity.Entity entity); // Paper end } -diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/data/BlockData.java -+++ b/src/main/java/org/bukkit/block/data/BlockData.java -@@ -0,0 +0,0 @@ public interface BlockData extends Cloneable { - * @return is ticked randomly - */ - boolean isRandomlyTicked(); -+ -+ /** -+ * Returns if the given item is a preferred choice to break this block. -+ * -+ * In some cases this determines if a block will drop anything or extra -+ * loot. -+ * -+ * @param tool The tool or item used for breaking this block -+ * @return true if the tool is preferred for breaking this block -+ */ -+ boolean isPreferredTool(@NotNull org.bukkit.inventory.ItemStack tool); - // Paper end - } diff --git a/patches/api/Add-getI18NDisplayName-API.patch b/patches/api/Add-getI18NDisplayName-API.patch index 4690b6073d..e63e7aefec 100644 --- a/patches/api/Add-getI18NDisplayName-API.patch +++ b/patches/api/Add-getI18NDisplayName-API.patch @@ -35,7 +35,7 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public @NotNull net.kyori.adventure.text.Component displayName() { return Bukkit.getServer().getItemFactory().displayName(this); } diff --git a/patches/api/Add-isCollidable-methods-to-various-places.patch b/patches/api/Add-isCollidable-methods-to-various-places.patch index 084ef23bd0..370f7137f6 100644 --- a/patches/api/Add-isCollidable-methods-to-various-places.patch +++ b/patches/api/Add-isCollidable-methods-to-various-places.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/M index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) { return Bukkit.getUnsafe().getItemAttributes(this, equipmentSlot); } @@ -48,7 +48,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr * @return true if block is solid */ boolean isSolid(); diff --git a/patches/api/Add-methods-to-get-translation-keys.patch b/patches/api/Add-methods-to-get-translation-keys.patch index f3833b3b4c..0461e0fb1d 100644 --- a/patches/api/Add-methods-to-get-translation-keys.patch +++ b/patches/api/Add-methods-to-get-translation-keys.patch @@ -151,73 +151,61 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * An enum of all material IDs accepted by the official server and client */ @SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper --public enum Material implements Keyed { -+public enum Material implements Keyed, net.kyori.adventure.translation.Translatable { // Paper +-public enum Material implements Keyed, Translatable { ++public enum Material implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper //<editor-fold desc="Materials" defaultstate="collapsed"> AIR(9648, 0), STONE(22948), -@@ -0,0 +0,0 @@ public enum Material implements Keyed { +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable { } return false; } + -+ /** -+ * Return the translation key for the Material, so the client can translate it into the active -+ * locale when using a TranslatableComponent. -+ * @return the translation key -+ * @deprecated use {@link #translationKey()} -+ */ -+ @NotNull -+ @Deprecated -+ public String getTranslationKey() { -+ return this.translationKey(); -+ } -+ + @Override + public @NotNull String translationKey() { -+ return Bukkit.getUnsafe().getTranslationKey(this); ++ if (this.isItem()) { ++ return Bukkit.getUnsafe().getItemTranslationKey(this); ++ } else { ++ return Bukkit.getUnsafe().getBlockTranslationKey(this); ++ } + } // Paper end /** -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable { + * material + * @see #getBlockTranslationKey() + * @see #getItemTranslationKey() ++ * @deprecated use {@link #translationKey()} + */ + @Override + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public String getTranslationKey() { + if (this.isItem()) { + return Bukkit.getUnsafe().getItemTranslationKey(this); +diff --git a/src/main/java/org/bukkit/Translatable.java b/src/main/java/org/bukkit/Translatable.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -0,0 +0,0 @@ public interface UnsafeValues { - byte[] serializeItem(ItemStack item); +--- a/src/main/java/org/bukkit/Translatable.java ++++ b/src/main/java/org/bukkit/Translatable.java +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents an object with a text representation that can be translated by the + * Minecraft client. ++ * @deprecated use {@link net.kyori.adventure.translation.Translatable} + */ ++@Deprecated(forRemoval = true) // Paper + public interface Translatable { - ItemStack deserializeItem(byte[] data); -+ -+ /** -+ * Return the translation key for the Material, so the client can translate it into the active -+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}. -+ * @return the translation key -+ */ -+ String getTranslationKey(Material mat); -+ -+ /** -+ * Return the translation key for the Block, so the client can translate it into the active -+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}. -+ * @return the translation key -+ */ -+ String getTranslationKey(org.bukkit.block.Block block); -+ -+ /** -+ * Return the translation key for the EntityType, so the client can translate it into the active -+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.<br> -+ * This is <code>null</code>, when the EntityType isn't known to NMS (custom entities) -+ * @return the translation key -+ */ -+ String getTranslationKey(org.bukkit.entity.EntityType type); -+ -+ /** -+ * Return the translation key for the ItemStack, so the client can translate it into the active -+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.<br> -+ * @return the translation key -+ */ -+ String getTranslationKey(ItemStack itemStack); - // Paper end + /** + * Get the translation key, suitable for use in a translation component. + * + * @return the translation key ++ * @deprecated look for a {@code translationKey()} method instead + */ + @NotNull ++ @Deprecated(forRemoval = true) // Paper + String getTranslationKey(); } diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -276,24 +264,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * (i.e. lighting and power) may not be able to be safely accessed during world * generation when used in cases like BlockPhysicsEvent!!!! */ --public interface Block extends Metadatable { -+public interface Block extends Metadatable, net.kyori.adventure.translation.Translatable { // Paper - translatable +-public interface Block extends Metadatable, Translatable { ++public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable /** * Gets the metadata for this block -@@ -0,0 +0,0 @@ public interface Block extends Metadatable { +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable { * @return the sound group for this block */ @NotNull org.bukkit.SoundGroup getBlockSoundGroup(); + + /** -+ * Return the translation key for the Block, so the client can translate it into the active -+ * locale when using a TranslatableComponent. -+ * @return the translation key + * @deprecated use {@link #translationKey()} + */ + @NotNull -+ @Deprecated ++ @Deprecated(forRemoval = true) + String getTranslationKey(); // Paper end } @@ -333,29 +318,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; --public enum EntityType implements Keyed { -+public enum EntityType implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translatable +-public enum EntityType implements Keyed, Translatable { ++public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable // These strings MUST match the strings in nms.EntityTypes and are case sensitive. /** -@@ -0,0 +0,0 @@ public enum EntityType implements Keyed { - public boolean isAlive() { - return living; +@@ -0,0 +0,0 @@ public enum EntityType implements Keyed, Translatable { + + @Override + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); } -+ // Paper start -+ /** -+ * Return the translation key for the EntityType, so the client can translate it into the active -+ * locale when using a TranslatableComponent.<br> -+ * This is <code>null</code>, when the EntityType isn't known to NMS (custom entities) -+ * @return the translation key -+ * @deprecated use {@link #translationKey()} -+ */ -+ @Deprecated -+ @Nullable -+ public String getTranslationKey() { -+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); -+ } + ++ // Paper start + /** + * @throws IllegalArgumentException if the entity does not have a translation key (is probably a custom entity) + */ @@ -480,31 +457,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * use this class to encapsulate Materials for which {@link Material#isItem()} * returns false.</b> */ --public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper -+public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem>, net.kyori.adventure.translation.Translatable { // Paper +-public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper ++public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem>, net.kyori.adventure.translation.Translatable { // Paper private Material type = Material.AIR; private int amount = 0; private MaterialData data = null; -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + + @Override + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); + } +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat ItemMeta itemMeta = getItemMeta(); return itemMeta != null && itemMeta.hasItemFlag(flag); } + + /** -+ * Gets the translation key for this itemstack. -+ * This is not the same as getting the translation key -+ * for the material of this itemstack. -+ * -+ * @return the translation key -+ * @deprecated use {@link #translationKey()} -+ */ -+ @NotNull -+ @Deprecated -+ public String getTranslationKey() { -+ return this.translationKey(); -+ } -+ -+ /** + * {@inheritDoc} + * <p> + * This is not the same as getting the translation key diff --git a/patches/api/Add-missing-isFuel-Material-entries.patch b/patches/api/Add-missing-isFuel-Material-entries.patch index 985823f126..360810b640 100644 --- a/patches/api/Add-missing-isFuel-Material-entries.patch +++ b/patches/api/Add-missing-isFuel-Material-entries.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/M index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla case ACACIA_DOOR: case ACACIA_FENCE: case ACACIA_FENCE_GATE: @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case ACACIA_LOG: case ACACIA_PLANKS: case ACACIA_PRESSURE_PLATE: -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla case ACACIA_WOOD: case AZALEA: case BAMBOO: @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case BARREL: case BIRCH_BOAT: case BIRCH_BUTTON: -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla case BIRCH_DOOR: case BIRCH_FENCE: case BIRCH_FENCE_GATE: @@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case BIRCH_LOG: case BIRCH_PLANKS: case BIRCH_PRESSURE_PLATE: -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla case DARK_OAK_DOOR: case DARK_OAK_FENCE: case DARK_OAK_FENCE_GATE: @@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case DARK_OAK_LOG: case DARK_OAK_PLANKS: case DARK_OAK_PRESSURE_PLATE: -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla case JUNGLE_DOOR: case JUNGLE_FENCE: case JUNGLE_FENCE_GATE: @@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case JUNGLE_LOG: case JUNGLE_PLANKS: case JUNGLE_PRESSURE_PLATE: -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla case MANGROVE_DOOR: case MANGROVE_FENCE: case MANGROVE_FENCE_GATE: @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case MANGROVE_LOG: case MANGROVE_PLANKS: case MANGROVE_PRESSURE_PLATE: -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla case OAK_DOOR: case OAK_FENCE: case OAK_FENCE_GATE: @@ -84,7 +84,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case OAK_LOG: case OAK_PLANKS: case OAK_PRESSURE_PLATE: -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla case SPRUCE_DOOR: case SPRUCE_FENCE: case SPRUCE_FENCE_GATE: @@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case SPRUCE_LOG: case SPRUCE_PLANKS: case SPRUCE_PRESSURE_PLATE: -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla case STICK: case STRIPPED_ACACIA_LOG: case STRIPPED_ACACIA_WOOD: diff --git a/patches/api/Additional-Block-Material-API-s.patch b/patches/api/Additional-Block-Material-API-s.patch index 994c0f52b8..2439118514 100644 --- a/patches/api/Additional-Block-Material-API-s.patch +++ b/patches/api/Additional-Block-Material-API-s.patch @@ -12,7 +12,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr */ boolean isLiquid(); diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 9e1fe92d39..175246c58c 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -3712,14 +3712,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * use this class to encapsulate Materials for which {@link Material#isItem()} * returns false.</b> */ --public class ItemStack implements Cloneable, ConfigurationSerializable { -+public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper +-public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable { ++public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper private Material type = Material.AIR; private int amount = 0; private MaterialData data = null; -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { - - return true; +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); } + + // Paper start diff --git a/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch index 6b3a1ce13a..8f930a52e7 100644 --- a/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ b/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -98,7 +98,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable { +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable { */ int getZ(); diff --git a/patches/api/Attributes-API-for-item-defaults.patch b/patches/api/Attributes-API-for-item-defaults.patch index ac9b8f689b..8465c006a3 100644 --- a/patches/api/Attributes-API-for-item-defaults.patch +++ b/patches/api/Attributes-API-for-item-defaults.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/M index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla public io.papermc.paper.inventory.ItemRarity getItemRarity() { return Bukkit.getUnsafe().getItemRarity(this); } diff --git a/patches/api/Block-Ticking-API.patch b/patches/api/Block-Ticking-API.patch index 16a3dfd263..160c0230b6 100644 --- a/patches/api/Block-Ticking-API.patch +++ b/patches/api/Block-Ticking-API.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr * @return true if the block was destroyed */ boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience); diff --git a/patches/api/Cache-the-result-of-Material-isBlock.patch b/patches/api/Cache-the-result-of-Material-isBlock.patch index 85161b8783..bf400a5790 100644 --- a/patches/api/Cache-the-result-of-Material-isBlock.patch +++ b/patches/api/Cache-the-result-of-Material-isBlock.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/M index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla public final Class<?> data; private final boolean legacy; private final NamespacedKey key; @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private Material(final int id) { this(id, 64); -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla * @return true if this material is a block */ public boolean isBlock() { @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 switch (this) { //<editor-fold defaultstate="collapsed" desc="isBlock"> case ACACIA_BUTTON: -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla static { for (Material material : values()) { BY_NAME.put(material.name(), material); diff --git a/patches/api/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/api/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index de5800f633..e175ddef6d 100644 --- a/patches/api/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/api/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -0,0 +0,0 @@ public interface UnsafeValues { - * @return the translation key - */ - String getTranslationKey(ItemStack itemStack); + byte[] serializeItem(ItemStack item); + + ItemStack deserializeItem(byte[] data); + + /** + * Creates and returns the next EntityId available. diff --git a/patches/api/Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch b/patches/api/Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch new file mode 100644 index 0000000000..42480ac263 --- /dev/null +++ b/patches/api/Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <jake.m.potrebic@gmail.com> +Date: Tue, 7 Feb 2023 08:20:27 -0800 +Subject: [PATCH] Fix HandlerList for InventoryBlockStartEvent subclasses + + +diff --git a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; + */ + public class BrewingStartEvent extends InventoryBlockStartEvent { + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - remove HandlerList + private int brewingTime; + + public BrewingStartEvent(@NotNull final Block furnace, @NotNull ItemStack source, int brewingTime) { +@@ -0,0 +0,0 @@ public class BrewingStartEvent extends InventoryBlockStartEvent { + this.brewingTime = brewTime; + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - remove HandlerList + } +diff --git a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; + */ + public class CampfireStartEvent extends InventoryBlockStartEvent { + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - remove HandlerList + private int cookingTime; + private CampfireRecipe campfireRecipe; + +@@ -0,0 +0,0 @@ public class CampfireStartEvent extends InventoryBlockStartEvent { + this.cookingTime = cookTime; + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - remove HandlerList + } +diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; + * Called when a Furnace starts smelting. + */ + public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - remove HandlerList + private final CookingRecipe<?> recipe; + private int totalCookTime; + +@@ -0,0 +0,0 @@ public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { + this.totalCookTime = cookTime; + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - remove HandlerList + } diff --git a/patches/api/Fix-Spigot-annotation-mistakes.patch b/patches/api/Fix-Spigot-annotation-mistakes.patch index 0c4ad19f14..bd4fedd28d 100644 --- a/patches/api/Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/Fix-Spigot-annotation-mistakes.patch @@ -82,7 +82,7 @@ diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/M index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ public enum Material implements Keyed { +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable { } /** @@ -96,7 +96,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean isLegacy() { return legacy; } -@@ -0,0 +0,0 @@ public enum Material implements Keyed { +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable { * Gets the MaterialData class associated with this Material * * @return MaterialData associated with this Material @@ -144,6 +144,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public enum NetherWartsState { /** +diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> { + * + * @param input non-null input + * @return registered object or null if does not exist ++ * @deprecated this method's behavior is broken and not useful. If you want to get an object ++ * based on its vanilla name, or a key, wrap it in a {@link NamespacedKey} object and use {@link #get(NamespacedKey)} + */ + @Nullable ++ @Deprecated(forRemoval = true) // Paper + default T match(@NotNull String input) { + Preconditions.checkArgument(input != null, "input must not be null"); + diff --git a/src/main/java/org/bukkit/SandstoneType.java b/src/main/java/org/bukkit/SandstoneType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/SandstoneType.java @@ -674,15 +690,15 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ import java.util.List; // Paper - import java.util.Map; +@@ -0,0 +0,0 @@ import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.Material; + import org.bukkit.Translatable; +import org.bukkit.UndefinedNullability; import org.bukkit.Utility; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.enchantments.Enchantment; -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat * @param damage durability / damage * @deprecated see {@link #setDurability(short)} */ @@ -690,7 +706,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public ItemStack(@NotNull final Material type, final int amount, final short damage) { this(type, amount, damage, null); } -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat * Gets the MaterialData for this stack of items * * @return MaterialData for this item @@ -701,7 +717,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public MaterialData getData() { Material mat = Bukkit.getUnsafe().toLegacy(getType()); if (data == null && mat != null && mat.getData() != null) { -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat * Sets the MaterialData for this stack of items * * @param data New MaterialData for this item @@ -711,7 +727,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void setData(@Nullable MaterialData data) { if (data == null) { this.data = data; -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat * * @return a copy of the current ItemStack's ItemData */ diff --git a/patches/api/Get-entity-default-attributes.patch b/patches/api/Get-entity-default-attributes.patch index a3875ab580..c963c456b3 100644 --- a/patches/api/Get-entity-default-attributes.patch +++ b/patches/api/Get-entity-default-attributes.patch @@ -35,7 +35,7 @@ diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/EntityType.java +++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -0,0 +0,0 @@ public enum EntityType implements Keyed, net.kyori.adventure.translation.Transla +@@ -0,0 +0,0 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys"); return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); } diff --git a/patches/api/Implement-furnace-cook-speed-multiplier-API.patch b/patches/api/Implement-furnace-cook-speed-multiplier-API.patch index 7504ded4b0..2fdab13daa 100644 --- a/patches/api/Implement-furnace-cook-speed-multiplier-API.patch +++ b/patches/api/Implement-furnace-cook-speed-multiplier-API.patch @@ -40,20 +40,19 @@ diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +++ b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java -@@ -0,0 +0,0 @@ public class FurnaceStartSmeltEvent extends BlockEvent { +@@ -0,0 +0,0 @@ public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { private final CookingRecipe<?> recipe; private int totalCookTime; + @Deprecated // Paper - furnace cook speed multiplier public FurnaceStartSmeltEvent(@NotNull final Block furnace, @NotNull ItemStack source, @NotNull final CookingRecipe<?> recipe) { -+ // Paper start - furnace cook speed multiplier ++ // Paper start + this(furnace, source, recipe, recipe.getCookingTime()); + } + -+ public FurnaceStartSmeltEvent(@NotNull final Block furnace, @NotNull ItemStack source, @NotNull CookingRecipe<?> recipe, int cookingTime) { ++ public FurnaceStartSmeltEvent(final @NotNull Block furnace, final @NotNull ItemStack source, final @NotNull CookingRecipe<?> recipe, final int cookingTime) { + // Paper end - super(furnace); - this.source = source; + super(furnace, source); this.recipe = recipe; - this.totalCookTime = recipe.getCookingTime(); + this.totalCookTime = cookingTime; // Paper - furnace cook speed multiplier diff --git a/patches/api/Improve-Block-breakNaturally-API.patch b/patches/api/Improve-Block-breakNaturally-API.patch index 0890fbef19..02e283945e 100644 --- a/patches/api/Improve-Block-breakNaturally-API.patch +++ b/patches/api/Improve-Block-breakNaturally-API.patch @@ -13,7 +13,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable { +@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable { */ boolean breakNaturally(@Nullable ItemStack tool); diff --git a/patches/api/Item-Rarity-API.patch b/patches/api/Item-Rarity-API.patch index 808d3aa2c0..98d37aa6b4 100644 --- a/patches/api/Item-Rarity-API.patch +++ b/patches/api/Item-Rarity-API.patch @@ -42,9 +42,9 @@ diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/M index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata - public @NotNull String translationKey() { - return Bukkit.getUnsafe().getTranslationKey(this); +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + return Bukkit.getUnsafe().getBlockTranslationKey(this); + } } + + /** @@ -91,7 +91,7 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public @NotNull String translationKey() { return Bukkit.getUnsafe().getTranslationKey(this); } diff --git a/patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch b/patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch index be753a01bf..0d3bfd4277 100644 --- a/patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch +++ b/patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.Material; -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat // Requires access to NMS return ensureServerConversions().getMaxItemUseDuration(); } diff --git a/patches/api/ItemStack-damage-API.patch b/patches/api/ItemStack-damage-API.patch index 5c5643c265..c69417f0ca 100644 --- a/patches/api/ItemStack-damage-API.patch +++ b/patches/api/ItemStack-damage-API.patch @@ -64,7 +64,7 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public boolean canRepair(@NotNull ItemStack toBeRepaired) { return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this); } diff --git a/patches/api/ItemStack-editMeta.patch b/patches/api/ItemStack-editMeta.patch index 392bcab303..03534bc53e 100644 --- a/patches/api/ItemStack-editMeta.patch +++ b/patches/api/ItemStack-editMeta.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return result.ensureServerConversions(); // Paper } diff --git a/patches/api/ItemStack-getMaxItemUseDuration.patch b/patches/api/ItemStack-getMaxItemUseDuration.patch index 361192d6cd..49d8c076a3 100644 --- a/patches/api/ItemStack-getMaxItemUseDuration.patch +++ b/patches/api/ItemStack-getMaxItemUseDuration.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public String getI18NDisplayName() { return Bukkit.getServer().getItemFactory().getI18NDisplayName(this); } diff --git a/patches/api/ItemStack-repair-check-API.patch b/patches/api/ItemStack-repair-check-API.patch index 3251a10bcb..476c675975 100644 --- a/patches/api/ItemStack-repair-check-API.patch +++ b/patches/api/ItemStack-repair-check-API.patch @@ -29,7 +29,7 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public io.papermc.paper.inventory.ItemRarity getRarity() { return Bukkit.getUnsafe().getItemStackRarity(this); } diff --git a/patches/api/Mark-experimental-api-as-such.patch b/patches/api/Mark-experimental-api-as-such.patch index 95ef207798..f9f5871cac 100644 --- a/patches/api/Mark-experimental-api-as-such.patch +++ b/patches/api/Mark-experimental-api-as-such.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/M index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla ACACIA_PLANKS(31312), DARK_OAK_PLANKS(20869), MANGROVE_PLANKS(7078), @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_MOSAIC(10715), /** * BlockData: {@link Sapling} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Orientable} */ @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_BLOCK(20770, Orientable.class), /** * BlockData: {@link Orientable} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Orientable} */ @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 STRIPPED_BAMBOO_BLOCK(14799, Orientable.class), /** * BlockData: {@link Orientable} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Slab} */ @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_MOSAIC_SLAB(22118, Slab.class), /** * BlockData: {@link Slab} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link ChiseledBookshelf} */ @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 CHISELED_BOOKSHELF(8099, ChiseledBookshelf.class), MOSSY_COBBLESTONE(21900), OBSIDIAN(32723), -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Fence} */ @@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_FENCE(17207, Fence.class), /** * BlockData: {@link Fence} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Stairs} */ @@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_MOSAIC_STAIRS(20977, Stairs.class), /** * BlockData: {@link Stairs} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Switch} */ @@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_BUTTON(21810, Switch.class), /** * BlockData: {@link Switch} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Powerable} */ @@ -94,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_PRESSURE_PLATE(26740, Powerable.class), /** * BlockData: {@link Powerable} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Door} */ @@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_DOOR(19971, Door.class), /** * BlockData: {@link Door} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link TrapDoor} */ @@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_TRAPDOOR(9174, TrapDoor.class), /** * BlockData: {@link TrapDoor} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Gate} */ @@ -118,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_FENCE_GATE(14290, Gate.class), /** * BlockData: {@link Gate} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla DARK_OAK_CHEST_BOAT(8733, 1), MANGROVE_BOAT(20792, 1), MANGROVE_CHEST_BOAT(18572, 1), @@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_CHEST_RAFT(20056, 1), /** * BlockData: {@link StructureBlock} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Sign} */ @@ -136,7 +136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_SIGN(26139, 16, Sign.class), /** * BlockData: {@link Sign} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link HangingSign} */ @@ -189,7 +189,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 WARPED_HANGING_SIGN(8195, 16, HangingSign.class), BUCKET(15215, 16), WATER_BUCKET(8802, 1), -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla EGG(21603, 16), COMPASS(24139), RECOVERY_COMPASS(12710), @@ -197,7 +197,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BUNDLE(16835, 1), FISHING_ROD(4167, 1, 64), CLOCK(14980), -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla BEE_SPAWN_EGG(22924), BLAZE_SPAWN_EGG(4759), CAT_SPAWN_EGG(29583), @@ -205,7 +205,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 CAMEL_SPAWN_EGG(14760), CAVE_SPIDER_SPAWN_EGG(23341), CHICKEN_SPAWN_EGG(5462), -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Rotatable} */ @@ -213,7 +213,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 PIGLIN_HEAD(5512, Rotatable.class), NETHER_STAR(12469), PUMPKIN_PIE(28725), -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link WallSign} */ @@ -271,7 +271,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BAMBOO_WALL_HANGING_SIGN(6669, WallHangingSign.class), /** * BlockData: {@link RedstoneWallTorch} -@@ -0,0 +0,0 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla /** * BlockData: {@link Directional} */ @@ -430,7 +430,7 @@ diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/EntityType.java +++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -0,0 +0,0 @@ public enum EntityType implements Keyed, net.kyori.adventure.translation.Transla +@@ -0,0 +0,0 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans FROG("frog", Frog.class, -1), TADPOLE("tadpole", Tadpole.class, -1), WARDEN("warden", Warden.class, -1), diff --git a/patches/api/Material-API-additions.patch b/patches/api/Material-API-additions.patch index 30f9e1562e..6e56683c2f 100644 --- a/patches/api/Material-API-additions.patch +++ b/patches/api/Material-API-additions.patch @@ -13,10 +13,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * An enum of all material IDs accepted by the official server and client */ +@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper - public enum Material implements Keyed { + public enum Material implements Keyed, Translatable { //<editor-fold desc="Materials" defaultstate="collapsed"> AIR(9648, 0), -@@ -0,0 +0,0 @@ public enum Material implements Keyed { +@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable { } } diff --git a/patches/api/Timings-v2.patch b/patches/api/Timings-v2.patch index 957431f78d..ae392c11ef 100644 --- a/patches/api/Timings-v2.patch +++ b/patches/api/Timings-v2.patch @@ -2846,9 +2846,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Material fromLegacy(Material material); @@ -0,0 +0,0 @@ public interface UnsafeValues { - Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot); + String getTranslationKey(EntityType entityType); - CreativeCategory getCreativeCategory(Material material); + String getTranslationKey(ItemStack itemStack); + + // Paper start + /** diff --git a/patches/api/ensureServerConversions-API.patch b/patches/api/ensureServerConversions-API.patch index 6a9cb2dae9..43440407a7 100644 --- a/patches/api/ensureServerConversions-API.patch +++ b/patches/api/ensureServerConversions-API.patch @@ -32,7 +32,7 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat } } @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } /** -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return Bukkit.getServer().getItemFactory().displayName(this); } diff --git a/patches/server/Add-Destroy-Speed-API.patch b/patches/server/Add-Destroy-Speed-API.patch index 4c604c09f5..5fbd0c3048 100644 --- a/patches/server/Add-Destroy-Speed-API.patch +++ b/patches/server/Add-Destroy-Speed-API.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -0,0 +0,0 @@ public class CraftBlock implements Block { public String translationKey() { - return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); + return this.getNMS().getBlock().getDescriptionId(); } + + @Override diff --git a/patches/server/Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch b/patches/server/Add-getDrops-to-BlockState.patch similarity index 66% rename from patches/server/Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch rename to patches/server/Add-getDrops-to-BlockState.patch index ff0603f575..a7d8c4fba6 100644 --- a/patches/server/Add-getDrops-to-BlockState-and-isPreferredTool-to-Bl.patch +++ b/patches/server/Add-getDrops-to-BlockState.patch @@ -1,8 +1,10 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MelnCat <melncatuwu@gmail.com> Date: Fri, 12 Aug 2022 23:24:37 -0700 -Subject: [PATCH] Add getDrops to BlockState and isPreferredTool to BlockData +Subject: [PATCH] Add getDrops to BlockState +Originally added isPreferredTool to BlockData but +upstream added that. diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -42,20 +44,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } // Paper end } -diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -0,0 +0,0 @@ public class CraftBlockData implements BlockData { - return this.state.isRandomlyTicking(); - } - // Paper end -+ -+ // Paper start - Preferred tool API -+ @Override -+ public boolean isPreferredTool(org.bukkit.inventory.ItemStack item) { -+ net.minecraft.world.item.ItemStack nms = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item); -+ return !state.requiresCorrectToolForDrops() || nms.isCorrectToolForDrops(state); -+ } -+ // Paper end - } diff --git a/patches/server/Add-methods-to-get-translation-keys.patch b/patches/server/Add-methods-to-get-translation-keys.patch index 0f08d052bf..af5ce07fe4 100644 --- a/patches/server/Add-methods-to-get-translation-keys.patch +++ b/patches/server/Add-methods-to-get-translation-keys.patch @@ -19,13 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + + @Override -+ public String getTranslationKey() { -+ return this.translationKey(); -+ } -+ -+ @Override + public String translationKey() { -+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); ++ return this.getNMS().getBlock().getDescriptionId(); + } // Paper end } @@ -45,41 +40,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end public net.minecraft.world.item.enchantment.Enchantment getHandle() { -diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues { - Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); - return compound; - } -+ -+ @Override -+ public String getTranslationKey(Material mat) { -+ if (mat.isBlock()) { -+ return getBlock(mat).getDescriptionId(); -+ } -+ return getItem(mat).getDescriptionId(); -+ } -+ -+ @Override -+ public String getTranslationKey(org.bukkit.block.Block block) { -+ return ((org.bukkit.craftbukkit.block.CraftBlock)block).getNMS().getBlock().getDescriptionId(); -+ } -+ -+ @Override -+ public String getTranslationKey(org.bukkit.entity.EntityType type) { -+ return net.minecraft.world.entity.EntityType.byString(type.getName()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElse(null); -+ } -+ -+ @Override -+ public String getTranslationKey(org.bukkit.inventory.ItemStack itemStack) { -+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); -+ return nmsItemStack.getItem().getDescriptionId(nmsItemStack); -+ } - // Paper end - - /** diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java diff --git a/patches/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index d88dd58a85..6af5bde1f6 100644 --- a/patches/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -25,10 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues { - net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); - return nmsItemStack.getItem().getDescriptionId(nmsItemStack); + Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); + return compound; } + ++ @Override + public int nextEntityId() { + return net.minecraft.world.entity.Entity.nextEntityId(); + } diff --git a/patches/server/Fix-Fluid-tags-isTagged-method.patch b/patches/server/Fix-Fluid-tags-isTagged-method.patch deleted file mode 100644 index 00ef77f8b6..0000000000 --- a/patches/server/Fix-Fluid-tags-isTagged-method.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <jake.m.potrebic@gmail.com> -Date: Tue, 1 Mar 2022 12:45:50 -0800 -Subject: [PATCH] Fix Fluid tags isTagged method - - -diff --git a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -+++ b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -@@ -0,0 +0,0 @@ public class CraftFluidTag extends CraftTag<net.minecraft.world.level.material.F - - @Override - public boolean isTagged(Fluid fluid) { -- return CraftMagicNumbers.getFluid(fluid).is(tag); -+ return registry.getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.Registry.FLUID_REGISTRY, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(fluid.getKey()))).is(tag); // Paper - } - - @Override -diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues { - return CraftMagicNumbers.MATERIAL_BLOCK.get(material); - } - -- public static net.minecraft.world.level.material.Fluid getFluid(Fluid fluid) { -+ public static net.minecraft.world.level.material.Fluid getFluid(Material fluid) { // Paper - wrong type - return CraftMagicNumbers.MATERIAL_FLUID.get(fluid); - } - diff --git a/patches/server/Implement-CraftBlockSoundGroup.patch b/patches/server/Implement-CraftBlockSoundGroup.patch index b85eb56ebf..4a48e1c37a 100644 --- a/patches/server/Implement-CraftBlockSoundGroup.patch +++ b/patches/server/Implement-CraftBlockSoundGroup.patch @@ -54,8 +54,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -0,0 +0,0 @@ public class CraftBlock implements Block { - - return iblockdata.canSurvive(world, this.position); + public String getTranslationKey() { + return this.getNMS().getBlock().getDescriptionId(); } + + // Paper start diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index e79b1d370b..960ab1be08 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -7622,9 +7622,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues { + private static final BiMap<net.minecraft.world.level.material.Fluid, Fluid> FLUIDTYPE_FLUID = HashBiMap.create(); private static final Map<Material, Item> MATERIAL_ITEM = new HashMap<>(); private static final Map<Material, Block> MATERIAL_BLOCK = new HashMap<>(); - private static final Map<Material, net.minecraft.world.level.material.Fluid> MATERIAL_FLUID = new HashMap<>(); + // Paper start + private static final Map<org.bukkit.entity.EntityType, net.minecraft.world.entity.EntityType<?>> ENTITY_TYPE_ENTITY_TYPES = new HashMap<>(); + private static final Map<net.minecraft.world.entity.EntityType<?>, org.bukkit.entity.EntityType> ENTITY_TYPES_ENTITY_TYPE = new HashMap<>(); diff --git a/patches/server/Timings-v2.patch b/patches/server/Timings-v2.patch index be1ca002de..f1aa454792 100644 --- a/patches/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -2038,7 +2038,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static byte toLegacyData(BlockState data) { return CraftLegacy.toLegacyData(data); @@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues { - return CreativeCategory.BUILDING_BLOCKS; // TODO: Figure out what to do with this + return nmsItemStack.getItem().getDescriptionId(nmsItemStack); } + // Paper start diff --git a/patches/server/cache-resource-keys.patch b/patches/server/cache-resource-keys.patch index 21d3326d95..fa1667d845 100644 --- a/patches/server/cache-resource-keys.patch +++ b/patches/server/cache-resource-keys.patch @@ -38,20 +38,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return registry.getHolderOrThrow(KEY_CACHE.computeIfAbsent(entity, type -> ResourceKey.create(Registries.ENTITY_TYPE, CraftNamespacedKey.toMinecraft(type.getKey())))).is(tag); // Paper - cache key } - @Override -diff --git a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -+++ b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java -@@ -0,0 +0,0 @@ public class CraftFluidTag extends CraftTag<net.minecraft.world.level.material.F - super(registry, tag); - } - -+ private static final java.util.Map<Fluid, net.minecraft.resources.ResourceKey<net.minecraft.world.level.material.Fluid>> KEY_CACHE = Collections.synchronizedMap(new java.util.EnumMap<>(Fluid.class)); // Paper - @Override - public boolean isTagged(Fluid fluid) { -- return registry.getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.Registry.FLUID_REGISTRY, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(fluid.getKey()))).is(tag); // Paper -+ return registry.getHolderOrThrow(KEY_CACHE.computeIfAbsent(fluid, f -> net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.FLUID, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(f.getKey())))).is(tag); // Paper - cache key - } - @Override diff --git a/work/Bukkit b/work/Bukkit index 22f8c20898..37262de84b 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 22f8c20898698bdd5fe348404a49d0cad36fef0b +Subproject commit 37262de84b9613e61809f31691e6f9db48dce0a8 diff --git a/work/CraftBukkit b/work/CraftBukkit index 39462a8985..a50301aa51 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 39462a898595280d1a1c6197c2ad66082434ba80 +Subproject commit a50301aa51aab7aa25869d921fa0c6a65eeda547