aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0685-Implement-enchantWithLevels-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0685-Implement-enchantWithLevels-API.patch')
-rw-r--r--patches/server/0685-Implement-enchantWithLevels-API.patch15
1 files changed, 10 insertions, 5 deletions
diff --git a/patches/server/0685-Implement-enchantWithLevels-API.patch b/patches/server/0685-Implement-enchantWithLevels-API.patch
index e228c3dfc4..7bf61f04ba 100644
--- a/patches/server/0685-Implement-enchantWithLevels-API.patch
+++ b/patches/server/0685-Implement-enchantWithLevels-API.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Implement enchantWithLevels API
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
-index 803a19063c03627dbea79cb1c395ae35aaef2834..aeb72f7c1bef0407eb00f1116948a0d96ff2ea7b 100644
+index 803a19063c03627dbea79cb1c395ae35aaef2834..317af98f8bd166a5a534f74e6ba177be9afb6a8f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
-@@ -302,4 +302,29 @@ public final class CraftItemFactory implements ItemFactory {
+@@ -302,4 +302,34 @@ public final class CraftItemFactory implements ItemFactory {
return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
}
// Paper end - old getSpawnEgg API
@@ -30,9 +30,14 @@ index 803a19063c03627dbea79cb1c395ae35aaef2834..aeb72f7c1bef0407eb00f1116948a0d9
+ new org.bukkit.craftbukkit.util.RandomSourceWrapper(random),
+ internalStack,
+ levels,
-+ enchantments.holders()
-+ .<net.minecraft.core.Holder<Enchantment>>map(r -> r)
-+ .filter(r -> allowTreasure || !r.is(EnchantmentTags.TREASURE))
++ registryAccess,
++ allowTreasure
++ ? Optional.empty()
++ // While IN_ENCHANTING_TABLE is not logically the same as all but TREASURE, the tag is defined as
++ // NON_TREASURE, which does contain all enchantments not in the treasure tag.
++ // Additionally, the allowTreasure boolean is more intended to configure this method to behave like
++ // an enchanting table.
++ : registryAccess.registryOrThrow(Registries.ENCHANTMENT).getTag(EnchantmentTags.IN_ENCHANTING_TABLE)
+ );
+ return CraftItemStack.asCraftMirror(enchanted);
+ }