@Override public void playNote(Location loc, byte instrument, byte note) { if (getHandle().playerConnection == null) return; String instrumentName = null; switch (instrument) { case 0: instrumentName = "harp"; break; case 1: instrumentName = "basedrum"; break; case 2: instrumentName = "snare"; break; case 3: instrumentName = "hat"; break; case 4: instrumentName = "bass"; break; } float f = (float) Math.pow(2.0D, (note - 12.0D) / 12.0D); getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect("block.note." + instrumentName), SoundCategory.MUSIC, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f)); }
@Override public void playNote(Location loc, Instrument instrument, Note note) { if (getHandle().playerConnection == null) return; String instrumentName = null; switch (instrument.ordinal()) { case 0: instrumentName = "harp"; break; case 1: instrumentName = "basedrum"; break; case 2: instrumentName = "snare"; break; case 3: instrumentName = "hat"; break; case 4: instrumentName = "bass"; break; } float f = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D); getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect("block.note." + instrumentName), SoundCategory.MUSIC, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f)); }
@Override public void playSound(Location loc, Sound sound, float volume, float pitch) { if (sound == null) { return; } playSound(loc, CraftSound.getSound(sound), volume, pitch); }
@Override public void playSound(Location loc, Sound sound, float volume, float pitch) { if (loc == null || sound == null || getHandle().playerConnection == null) return; PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect(CraftSound.getSound(sound)), SoundCategory.MASTER, loc.getX(), loc.getY(), loc.getZ(), volume, pitch); getHandle().playerConnection.sendPacket(packet); }
public void playSound(Location loc, Sound sound, float volume, float pitch) { if (loc == null || sound == null || getHandle().playerConnection == null) return; double x = loc.getBlockX() + 0.5; double y = loc.getBlockY() + 0.5; double z = loc.getBlockZ() + 0.5; Packet62NamedSoundEffect packet = new Packet62NamedSoundEffect(CraftSound.getSound(sound), x, y, z, volume, pitch); getHandle().playerConnection.sendPacket(packet); }
public void playSound(Location loc, Sound sound, float volume, float pitch) { if (loc == null || sound == null || getHandle().field_71135_a == null) return; double x = loc.getBlockX() + 0.5; double y = loc.getBlockY() + 0.5; double z = loc.getBlockZ() + 0.5; net.minecraft.network.packet.Packet62LevelSound packet = new net.minecraft.network.packet.Packet62LevelSound(CraftSound.getSound(sound), x, y, z, volume, pitch); getHandle().field_71135_a.func_72567_b(packet); }
public static String getKey(Sound bukkitSound) { return CraftSound.getSound(bukkitSound); }
@Test public void testGetSound() { for (Sound sound : Sound.values()) { assertThat(sound.name(), CraftSound.getSound(sound), is(not(nullValue()))); } }
public void playSound(Location loc, Sound sound, float volume, float pitch) { if (sound == null) { return; } playSound(loc, CraftSound.getSound(sound), volume, pitch); }