diff options
Diffstat (limited to 'patches/server/1027-Add-enchantWithLevels-with-enchantment-registry-set.patch')
-rw-r--r-- | patches/server/1027-Add-enchantWithLevels-with-enchantment-registry-set.patch | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/patches/server/1027-Add-enchantWithLevels-with-enchantment-registry-set.patch b/patches/server/1027-Add-enchantWithLevels-with-enchantment-registry-set.patch new file mode 100644 index 0000000000..61f5aced36 --- /dev/null +++ b/patches/server/1027-Add-enchantWithLevels-with-enchantment-registry-set.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: masmc05 <[email protected]> +Date: Wed, 25 Sep 2024 16:26:04 +0300 +Subject: [PATCH] Add enchantWithLevels with enchantment registry set + + +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +index d9eec6cff3c7c6515f4d61bf1063e7d609d4bcb3..2f11d324ee5e8df66b65c1426e7d1a6d82990ea7 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +@@ -322,6 +322,22 @@ public final class CraftItemFactory implements ItemFactory { + ); + } + ++ @Override ++ public ItemStack enchantWithLevels(ItemStack itemStack, int levels, io.papermc.paper.registry.set.RegistryKeySet<org.bukkit.enchantments.Enchantment> keySet, java.util.Random random) { ++ return enchantWithLevels( ++ itemStack, ++ levels, ++ Optional.of( ++ io.papermc.paper.registry.set.PaperRegistrySets.convertToNms( ++ Registries.ENCHANTMENT, ++ net.minecraft.server.MinecraftServer.getServer().registryAccess().createSerializationContext(net.minecraft.nbt.NbtOps.INSTANCE).lookupProvider, ++ keySet ++ ) ++ ), ++ random ++ ); ++ } ++ + @SuppressWarnings("OptionalUsedAsFieldOrParameterType") + private ItemStack enchantWithLevels( + ItemStack itemStack, |