diff --git a/src/main/java/noppes/npcs/client/controllers/MusicController.java b/src/main/java/noppes/npcs/client/controllers/MusicController.java index d80745d90..256602682 100644 --- a/src/main/java/noppes/npcs/client/controllers/MusicController.java +++ b/src/main/java/noppes/npcs/client/controllers/MusicController.java @@ -9,6 +9,7 @@ import net.minecraft.util.ResourceLocation; public class MusicController { public static MusicController Instance; public ScriptClientSound sound; + private Entity entity; public MusicController(){ Instance = this; @@ -33,6 +34,7 @@ public class MusicController { clientSound.setVolume(4.0F); clientSound.setAttenuationType(ISound.AttenuationType.LINEAR); this.sound = clientSound; + this.entity = entity; SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler(); soundHandler.playSound(clientSound); @@ -45,9 +47,11 @@ public class MusicController { ScriptClientSound clientSound = new ScriptClientSound(music); clientSound.setEntity(entity); + this.sound = clientSound; + this.entity = entity; + SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler(); soundHandler.playSound(clientSound); - this.sound = clientSound; } public boolean isPlaying(String music) { @@ -66,6 +70,10 @@ public class MusicController { return this.sound != null; } + public Entity getEntity() { + return this.entity; + } + public void playSound(String music, float x, float y, float z) { Minecraft.getMinecraft().theWorld.playSound(x, y, z, music, 1, 1, false); } diff --git a/src/main/java/noppes/npcs/roles/JobBard.java b/src/main/java/noppes/npcs/roles/JobBard.java index 816cc32ea..87e229c4d 100644 --- a/src/main/java/noppes/npcs/roles/JobBard.java +++ b/src/main/java/noppes/npcs/roles/JobBard.java @@ -95,7 +95,7 @@ public class JobBard extends JobInterface{ if(!MusicController.Instance.isPlaying()){ this.play(); } - else if(MusicController.Instance.sound.getEntity() != npc){ + else if(MusicController.Instance.getEntity() != npc){ EntityPlayer player = CustomNpcs.proxy.getPlayer(); if(npc.getDistanceToEntity(player) < MusicController.Instance.sound.getDistance()){ MusicController.Instance.stopMusic();