本文整理匯總了Java中org.bukkit.Material.NOTE_BLOCK屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.NOTE_BLOCK屬性的具體用法?Java Material.NOTE_BLOCK怎麽用?Java Material.NOTE_BLOCK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.bukkit.Material
的用法示例。
在下文中一共展示了Material.NOTE_BLOCK屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: playTick
@Override
public void playTick(Player p, int tick) {
if (noteBlock.getType() != Material.NOTE_BLOCK) {
return;
}
if (!p.getWorld().getName().equals(noteBlock.getWorld().getName())) {
// not in same world
return;
}
byte playerVolume = NoteBlockPlayerMain.getPlayerVolume(p);
for (Layer l : song.getLayerHashMap().values()) {
Note note = l.getNote(tick);
if (note == null) {
continue;
}
p.playNote(noteBlock.getLocation(), Instrument.getBukkitInstrument(note.getInstrument()),
new org.bukkit.Note(note.getKey() - 33));
p.playSound(noteBlock.getLocation(),
Instrument.getInstrument(note.getInstrument()),
(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
NotePitch.getPitch(note.getKey() - 33));
}
}
示例2: playTick
@Override
public void playTick(Player p, int tick) {
if (noteBlock.getType() != Material.NOTE_BLOCK) {
return;
}
if (!p.getWorld().getName().equals(noteBlock.getWorld().getName())) {
// not in same world
return;
}
byte playerVolume = MusicManager.getPlayerVolume(p);
for (Layer l : song.getLayerHashMap().values()) {
Note note = l.getNote(tick);
if (note == null) {
continue;
}
p.playNote(noteBlock.getLocation(), Instrument.getBukkitInstrument(note.getInstrument()),
new org.bukkit.Note(note.getKey() - 33));
p.playSound(noteBlock.getLocation(),
Instrument.getInstrument(note.getInstrument()),
(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
NotePitch.getPitch(note.getKey() - 33));
}
}
示例3: play
public boolean play() {
Block block = getBlock();
if (block.getType() == Material.NOTE_BLOCK) {
note.triggerNote(world.getHandle(), getX(), getY(), getZ());
return true;
} else {
return false;
}
}