diff options
author | Newwind <[email protected]> | 2024-08-31 19:29:50 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-31 20:29:50 +0200 |
commit | 509ea2fd17fa03ce04f86046098607733b8767ba (patch) | |
tree | 3f7c9a29481fafbb6ad9f846839ec8f4863d2363 /patches/server/1047-Add-even-more-Enchantment-API.patch | |
parent | e01ddf46279fbb68d157749a906b7a2ecc60da1a (diff) | |
download | Paper-509ea2fd17fa03ce04f86046098607733b8767ba.tar.gz Paper-509ea2fd17fa03ce04f86046098607733b8767ba.zip |
Fix horse armor desync (#11341)
Diffstat (limited to 'patches/server/1047-Add-even-more-Enchantment-API.patch')
-rw-r--r-- | patches/server/1047-Add-even-more-Enchantment-API.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/patches/server/1047-Add-even-more-Enchantment-API.patch b/patches/server/1047-Add-even-more-Enchantment-API.patch new file mode 100644 index 0000000000..dfc79b5b19 --- /dev/null +++ b/patches/server/1047-Add-even-more-Enchantment-API.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Fri, 19 Jul 2024 08:42:45 -0700 +Subject: [PATCH] Add even more Enchantment API + +In a separate patch because RegistryKeySet is used +and the previous "more enchant api" patch is before that. + +diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +index 4221a1e9cba35c8dc58e51e162e7fcbd0e8b31af..34934f0dbe66ee200cd99c002c53645660041548 100644 +--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java ++++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +@@ -216,6 +216,34 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine + } + // Paper end - more Enchantment API + ++ // Paper start - even more Enchantment API ++ @Override ++ public net.kyori.adventure.text.Component description() { ++ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.handle.value().description()); ++ } ++ ++ @Override ++ public io.papermc.paper.registry.set.RegistryKeySet<org.bukkit.inventory.ItemType> getSupportedItems() { ++ return io.papermc.paper.registry.set.PaperRegistrySets.convertToApi(io.papermc.paper.registry.RegistryKey.ITEM, this.handle.value().getSupportedItems()); ++ } ++ ++ @Override ++ public io.papermc.paper.registry.set.RegistryKeySet<org.bukkit.inventory.ItemType> getPrimaryItems() { ++ final java.util.Optional<net.minecraft.core.HolderSet<net.minecraft.world.item.Item>> primaryItems = this.handle.value().definition().primaryItems(); ++ return primaryItems.map(holders -> io.papermc.paper.registry.set.PaperRegistrySets.convertToApi(io.papermc.paper.registry.RegistryKey.ITEM, holders)).orElse(null); ++ } ++ ++ @Override ++ public int getWeight() { ++ return this.handle.value().getWeight(); ++ } ++ ++ @Override ++ public io.papermc.paper.registry.set.RegistryKeySet<org.bukkit.enchantments.Enchantment> getExclusiveWith() { ++ return io.papermc.paper.registry.set.PaperRegistrySets.convertToApi(io.papermc.paper.registry.RegistryKey.ENCHANTMENT, this.handle.value().exclusiveSet()); ++ } ++ // Paper end - even more Enchantment API ++ + @Override + public String getTranslationKey() { + return Util.makeDescriptionId("enchantment", this.handle.unwrapKey().get().location()); |