From 6fab8fe51ef2cc4e503f68a00cd38874c262c86b Mon Sep 17 00:00:00 2001 From: FearThe1337 Date: Wed, 17 Dec 2014 17:00:10 +0100 Subject: SPIGOT-236 - fix notes playing wrongly. Formula is from BlockNote (NMS), slightly formatted different to be smaller. --- src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 3b9bfecc..6361b44c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -266,7 +266,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { instrumentName = "bassattack"; break; } - getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect("note."+instrumentName, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, note)); + + float f = (float) Math.pow(2.0D, (note - 12.0D) / 12.0D); + getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect("note."+instrumentName, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f)); } @Override @@ -291,7 +293,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { instrumentName = "bassattack"; break; } - getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect("note."+instrumentName, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, note.getId())); + float f = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D); + getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect("note."+instrumentName, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f)); } @Override -- cgit v1.2.3