SPIGOT-3432: Add playNote support for new sounds

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2017-07-24 17:41:08 +10:00
parent cdcb11b8ae
commit f4e233550c
3 changed files with 62 additions and 17 deletions

View File

@@ -265,6 +265,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
case 4:
instrumentName = "bass";
break;
case 5:
instrumentName = "flute";
break;
case 6:
instrumentName = "bell";
break;
case 7:
instrumentName = "guitar";
break;
case 8:
instrumentName = "chime";
break;
case 9:
instrumentName = "xylophone";
break;
}
float f = (float) Math.pow(2.0D, (note - 12.0D) / 12.0D);
@@ -292,6 +307,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
case 4:
instrumentName = "bass";
break;
case 5:
instrumentName = "flute";
break;
case 6:
instrumentName = "bell";
break;
case 7:
instrumentName = "guitar";
break;
case 8:
instrumentName = "chime";
break;
case 9:
instrumentName = "xylophone";
break;
}
float f = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D);
getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect("block.note." + instrumentName), net.minecraft.server.SoundCategory.MUSIC, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f));