mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 14:19:13 +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
@@ -34,7 +34,7 @@ public class MusicController {
|
||||
|
||||
ScriptClientSound clientSound = new ScriptClientSound(music);
|
||||
clientSound.setPos((float)entity.posX, (float)entity.posY, (float)entity.posZ);
|
||||
clientSound.setVolume(4.0F);
|
||||
clientSound.setVolume(Math.max(1, offRange/16.0F));
|
||||
clientSound.setAttenuationType(ISound.AttenuationType.LINEAR);
|
||||
clientSound.setRepeat(true);
|
||||
this.sound = clientSound;
|
||||
@@ -86,6 +86,14 @@ public class MusicController {
|
||||
return this.offRange;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
Entity player = Minecraft.getMinecraft().thePlayer;
|
||||
if (this.entity != null && this.entity.dimension == player.dimension) {
|
||||
return player.getDistanceToEntity(this.entity);
|
||||
}
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
public void playSound(String music, float x, float y, float z) {
|
||||
Minecraft.getMinecraft().theWorld.playSound(x, y, z, music, 1, 1, false);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user