From c1e711d270693e198781f3b6591f95c14eb5a6d1 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Thu, 13 Oct 2022 22:21:01 +0200 Subject: NPE Fix (#364) prevent an npe Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../notenoughupdates/miscfeatures/CustomItemEffects.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index c77a4b39..452f8a9b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -213,12 +213,14 @@ public class CustomItemEffects { @SubscribeEvent public void onGameTick(TickEvent.ClientTickEvent event) { if (event.phase != TickEvent.Phase.END) return; + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + if (player == null) return; if (!usingEtherwarp && wasUsingEtherwarp) { - if (Minecraft.getMinecraft().thePlayer.rotationYaw > 0) { - Minecraft.getMinecraft().thePlayer.rotationYaw -= 0.000001; + if (player.rotationYaw > 0) { + player.rotationYaw -= 0.000001; } else { - Minecraft.getMinecraft().thePlayer.rotationYaw += 0.000001; + player.rotationYaw += 0.000001; } } wasUsingEtherwarp = usingEtherwarp; -- cgit