diff options
author | FearThe1337 <admin@fearthe1337.com> | 2014-12-17 17:00:10 +0100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2014-12-18 09:47:10 +1100 |
commit | 6fab8fe51ef2cc4e503f68a00cd38874c262c86b (patch) | |
tree | 4f9110af6050b8ef61ae31c331aae8029825690e /src/main/java | |
parent | 975c9ed4f9f463cd003da6be3b1e9929f13dccd6 (diff) | |
download | craftbukkit-6fab8fe51ef2cc4e503f68a00cd38874c262c86b.tar craftbukkit-6fab8fe51ef2cc4e503f68a00cd38874c262c86b.tar.gz craftbukkit-6fab8fe51ef2cc4e503f68a00cd38874c262c86b.tar.lz craftbukkit-6fab8fe51ef2cc4e503f68a00cd38874c262c86b.tar.xz craftbukkit-6fab8fe51ef2cc4e503f68a00cd38874c262c86b.zip |
SPIGOT-236 - fix notes playing wrongly.
Formula is from BlockNote (NMS), slightly formatted different to be smaller.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 7 |
1 files changed, 5 insertions, 2 deletions
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 |