本文整理汇总了Java中org.bukkit.craftbukkit.CraftSound类的典型用法代码示例。如果您正苦于以下问题:Java CraftSound类的具体用法?Java CraftSound怎么用?Java CraftSound使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CraftSound类属于org.bukkit.craftbukkit包,在下文中一共展示了CraftSound类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playNote
import org.bukkit.craftbukkit.CraftSound; //导入依赖的package包/类
@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));
}
示例2: playSound
import org.bukkit.craftbukkit.CraftSound; //导入依赖的package包/类
@Override
public void playSound(Location loc, Sound sound, float volume, float pitch) {
if (sound == null) {
return;
}
playSound(loc, CraftSound.getSound(sound), volume, pitch);
}
示例3: playSound
import org.bukkit.craftbukkit.CraftSound; //导入依赖的package包/类
@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);
}
示例4: playSound
import org.bukkit.craftbukkit.CraftSound; //导入依赖的package包/类
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);
}
示例5: playSound
import org.bukkit.craftbukkit.CraftSound; //导入依赖的package包/类
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);
}
示例6: getKey
import org.bukkit.craftbukkit.CraftSound; //导入依赖的package包/类
public static String getKey(Sound bukkitSound) {
return CraftSound.getSound(bukkitSound);
}
示例7: testGetSound
import org.bukkit.craftbukkit.CraftSound; //导入依赖的package包/类
@Test
public void testGetSound() {
for (Sound sound : Sound.values()) {
assertThat(sound.name(), CraftSound.getSound(sound), is(not(nullValue())));
}
}
示例8: playSound
import org.bukkit.craftbukkit.CraftSound; //导入依赖的package包/类
public void playSound(Location loc, Sound sound, float volume, float pitch) {
if (sound == null) {
return;
}
playSound(loc, CraftSound.getSound(sound), volume, pitch);
}