当前位置: 首页>>代码示例>>Java>>正文


Java CraftSound类代码示例

本文整理汇总了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));
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:27,代码来源:CraftPlayer.java

示例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);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:8,代码来源:CraftPlayer.java

示例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);
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:8,代码来源:CraftPlayer.java

示例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);
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:11,代码来源:CraftPlayer.java

示例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);
}
 
开发者ID:agaricusb,项目名称:MCPBukkit,代码行数:11,代码来源:CraftPlayer.java

示例6: getKey

import org.bukkit.craftbukkit.CraftSound; //导入依赖的package包/类
public static String getKey(Sound bukkitSound) {
    return CraftSound.getSound(bukkitSound);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:NMSHacks.java

示例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())));
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:7,代码来源:SoundTest.java

示例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);
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:7,代码来源:CraftPlayer.java


注:本文中的org.bukkit.craftbukkit.CraftSound类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。