Fix Player#applyMending NPE (#2917)

This commit is contained in:
Gergely Sarkozi 2020-01-28 19:20:53 +01:00 committed by Shane Freeder
parent d16a5d8813
commit c9eebbb802
1 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
From d38b801d38490495780f41c3ded0a0cc9420de1c Mon Sep 17 00:00:00 2001
From 946f1ed01e757565fd7814a4f49b89d63962c69f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Dec 2017 17:36:49 -0500
Subject: [PATCH] Ability to apply mending to XP API
@ -10,7 +10,7 @@ of giving the player experience points.
Both an API To standalone mend, and apply mending logic to .giveExp has been added.
diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java
index 1822178e8..fabc7a8dd 100644
index 1822178e8..d96c03a1a 100644
--- a/src/main/java/net/minecraft/server/EnchantmentManager.java
+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java
@@ -246,6 +246,11 @@ public class EnchantmentManager {
@ -18,9 +18,9 @@ index 1822178e8..fabc7a8dd 100644
}
+ // Paper - OBFHELPER
+ public static @Nullable ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) {
+ public static @javax.annotation.Nonnull ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) {
+ Entry<EnumItemSlot, ItemStack> entry = b(enchantment, entityliving);
+ return entry != null ? entry.getValue() : null;
+ return entry != null ? entry.getValue() : ItemStack.NULL_ITEM;
+ }
@Nullable
public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) {
@ -86,5 +86,5 @@ index 5b5f2418e..6f47768c9 100644
}
--
2.25.0.windows.1
2.16.1.windows.4