mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 01:04:30 +00:00
Fixed background music not cancelling when moving within another bard NPC's range
This commit is contained in:
1 parent
56bb6751b1
commit
f6244434f7
2 files changed
+18
-6
No files matched your search
@@ -93,13 +93,15 @@ public class JobBard extends JobInterface{
|
||||
return;
|
||||
|
||||
if(!MusicController.Instance.isPlaying()){
|
||||
this.play();
|
||||
if (!this.play()) return;
|
||||
}
|
||||
else if(MusicController.Instance.getEntity() != npc){
|
||||
EntityPlayer player = CustomNpcs.proxy.getPlayer();
|
||||
if(npc.getDistanceToEntity(player) < MusicController.Instance.sound.getDistance()){
|
||||
double distanceToPlayer = npc.getDistanceToEntity(player);
|
||||
double distanceToMusic = MusicController.Instance.getDistance();
|
||||
if(distanceToPlayer < distanceToMusic){
|
||||
MusicController.Instance.stopMusic();
|
||||
this.play();
|
||||
if (!this.play()) return;
|
||||
}
|
||||
}
|
||||
else if(hasOffRange){
|
||||
@@ -113,14 +115,16 @@ public class JobBard extends JobInterface{
|
||||
}
|
||||
}
|
||||
|
||||
private void play() {
|
||||
private boolean play() {
|
||||
List<EntityPlayer> list = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(minRange, minRange/2, minRange));
|
||||
if(!list.contains(CustomNpcs.proxy.getPlayer()))
|
||||
return;
|
||||
return false;
|
||||
|
||||
if(isStreamer)
|
||||
MusicController.Instance.playMusicJukebox(song, npc, hasOffRange ? maxRange : 0);
|
||||
else
|
||||
MusicController.Instance.playMusicBackground(song, npc, hasOffRange ? maxRange : 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user