From b69ce7f3b2dc459c63949cafde3386c0950003f8 Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Wed, 17 Mar 2021 23:00:06 +0300 Subject: [PATCH] Music tracker null pointer check --- .../ru/betterend/mixin/client/MusicTrackerMixin.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/ru/betterend/mixin/client/MusicTrackerMixin.java b/src/main/java/ru/betterend/mixin/client/MusicTrackerMixin.java index afae2d88..fdd8b5ec 100644 --- a/src/main/java/ru/betterend/mixin/client/MusicTrackerMixin.java +++ b/src/main/java/ru/betterend/mixin/client/MusicTrackerMixin.java @@ -42,7 +42,7 @@ public class MusicTrackerMixin { public void be_onTick(CallbackInfo info) { if (ClientOptions.blendBiomeMusic()) { MusicSound musicSound = client.getMusicType(); - if (volume > 0 && beIsInEnd() && beShouldChangeSound(musicSound)) { + if (be_checkNullSound(musicSound) && volume > 0 && be_isInEnd() && be_shouldChangeSound(musicSound)) { if (volume > 0) { if (srcVolume < 0) { srcVolume = current.getVolume(); @@ -81,14 +81,18 @@ public class MusicTrackerMixin { } } - private boolean beIsInEnd() { + private boolean be_isInEnd() { return client.world != null && client.world.getRegistryKey().equals(World.END); } - private boolean beShouldChangeSound(MusicSound musicSound) { + private boolean be_shouldChangeSound(MusicSound musicSound) { return current != null && !musicSound.getSound().getId().equals(this.current.getId()) && musicSound.shouldReplaceCurrentMusic(); } + private boolean be_checkNullSound(MusicSound musicSound) { + return musicSound != null && musicSound.getSound() != null; + } + @Shadow public void play(MusicSound type) {} }