Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/Enchantment.patch
2018-07-15 10:00:00 +10:00

33 Zeilen
1.4 KiB
Diff

--- a/net/minecraft/server/Enchantment.java
+++ b/net/minecraft/server/Enchantment.java
@@ -15,6 +15,17 @@
@Nullable
protected String d;
+ // CraftBukkit start - add back
+ @Nullable
+ public static Enchantment fromId(MinecraftKey key) {
+ return Enchantment.enchantments.get(key);
+ }
+
+ public static MinecraftKey getId(Enchantment enchantment) {
+ return Enchantment.enchantments.b(enchantment);
+ }
+ // CraftBukkit end
+
protected Enchantment(Enchantment.Rarity enchantment_rarity, EnchantmentSlotType enchantmentslottype, EnumItemSlot[] aenumitemslot) {
this.e = enchantment_rarity;
this.itemTarget = enchantmentslottype;
@@ -153,6 +164,11 @@
a("channeling", new EnchantmentTridentChanneling(Enchantment.Rarity.VERY_RARE, new EnumItemSlot[] { EnumItemSlot.MAINHAND}));
a("mending", new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values()));
a("vanishing_curse", new EnchantmentVanishing(Enchantment.Rarity.VERY_RARE, EnumItemSlot.values()));
+ // CraftBukkit start
+ for (Object enchantment : Enchantment.enchantments) {
+ org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment((Enchantment) enchantment));
+ }
+ // CraftBukkit end
}
private static void a(String s, Enchantment enchantment) {