Skip to content

Commit

Permalink
Use player as point of reference for min volume. Fixes BUKKIT-4640
Browse files Browse the repository at this point in the history
When the minimum volume is being used because the distance is over a
threshold, the unit vector delta should be added to the player's
location, instead of where the command specified location.

This change makes the player's location the point of reference for
playing sounds when distance to volume scale is lower than minimum
specified volume.
  • Loading branch information
Wolvereness committed Aug 3, 2013
1 parent bf832ee commit 2ccd671
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ public boolean execute(CommandSender sender, String currentAlias, String[] args)
final double delta = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) / 2.0D;

if (delta > 0.0D) {
soundLocation.add(deltaX / delta, deltaY / delta, deltaZ / delta);
location.add(deltaX / delta, deltaY / delta, deltaZ / delta);
}

player.playSound(soundLocation, soundArg, (float) minimumVolume, (float) pitch);
player.playSound(location, soundArg, (float) minimumVolume, (float) pitch);
} else {
player.playSound(soundLocation, soundArg, (float) volume, (float) pitch);
}
Expand Down

0 comments on commit 2ccd671

Please sign in to comment.