blob: bdca715a0db99792652d79c90650da4f4ada2ee4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: masmc05 <masmc05@gmail.com>
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 fef91dbede067f1ab99a9c7d463a2c55cc6cae3a..4abd939223a9d5a0c52a64e22c29fe1de85500e9 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -319,6 +319,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,
|