From 6921ee54f539ae8a00ab66b1c997fcf572b4d676 Mon Sep 17 00:00:00 2001 From: Ben Staddon Date: Sat, 3 Dec 2016 18:47:57 +0000 Subject: [PATCH] [1.11] Fix null checks in shouldCauseReequipAnimation (#3482) --- .../net/minecraftforge/client/ForgeHooksClient.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 4ed9f91354..04ef10cb84 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -669,12 +669,15 @@ public class ForgeHooksClient } private static int slotMainHand = 0; - // FIXME - public static boolean shouldCauseReequipAnimation(ItemStack from, ItemStack to, int slot) + + public static boolean shouldCauseReequipAnimation(@Nonnull ItemStack from, @Nonnull ItemStack to, int slot) { - if (from == null && to != null) return true; - if (from == null && to == null) return false; - if (from != null && to == null) return true; + boolean fromInvalid = from.func_190926_b(); + boolean toInvalid = to.func_190926_b(); + + if (fromInvalid && toInvalid) return false; + if (fromInvalid || toInvalid) return true; + boolean changed = false; if (slot != -1) {