本文整理汇总了Java中cn.nukkit.level.sound.NoteBoxSound类的典型用法代码示例。如果您正苦于以下问题:Java NoteBoxSound类的具体用法?Java NoteBoxSound怎么用?Java NoteBoxSound使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoteBoxSound类属于cn.nukkit.level.sound包,在下文中一共展示了NoteBoxSound类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstrument
import cn.nukkit.level.sound.NoteBoxSound; //导入依赖的package包/类
public int getInstrument() {
Block below = this.down();
switch (below.getId()) {
case WOODEN_PLANK:
case NOTEBLOCK:
case CRAFTING_TABLE:
return NoteBoxSound.INSTRUMENT_BASS;
case SAND:
case SANDSTONE:
case SOUL_SAND:
return NoteBoxSound.INSTRUMENT_TABOUR;
case GLASS:
case GLASS_PANEL:
case GLOWSTONE_BLOCK:
return NoteBoxSound.INSTRUMENT_CLICK;
case COAL_ORE:
case DIAMOND_ORE:
case EMERALD_ORE:
case GLOWING_REDSTONE_ORE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case REDSTONE_ORE:
return NoteBoxSound.INSTRUMENT_BASS_DRUM;
default:
return NoteBoxSound.INSTRUMENT_PIANO;
}
}
示例2: emitSound
import cn.nukkit.level.sound.NoteBoxSound; //导入依赖的package包/类
public void emitSound() {
BlockEventPacket pk = new BlockEventPacket();
pk.x = (int) this.x;
pk.y = (int) this.y;
pk.z = (int) this.z;
pk.case1 = this.getInstrument();
pk.case2 = this.getStrength();
this.getLevel().addChunkPacket((int) this.x >> 4, (int) this.z >> 4, pk);
this.getLevel().addSound(new NoteBoxSound(this, this.getInstrument(), this.getStrength()));
}
示例3: sendTo
import cn.nukkit.level.sound.NoteBoxSound; //导入依赖的package包/类
@Override
public void sendTo(Player player, Vector3 vec){
Block block = player.level.getBlock(vec);
if(block.getId() == Block.NOTEBLOCK){
player.level.addSound(new NoteBoxSound(block, this.instrument, this.pitch), player);
}else{
player.level.sendBlocks(new Player[]{player}, new Vector3[]{Block.get(Block.NOTEBLOCK, 0, block)});
player.level.addSound(new NoteBoxSound(block, this.instrument, this.pitch), player);
player.level.sendBlocks(new Player[]{player}, new Vector3[]{block});
}
}
示例4: getInstrument
import cn.nukkit.level.sound.NoteBoxSound; //导入依赖的package包/类
public int getInstrument() {
Block below = this.getSide(Vector3.SIDE_DOWN);
switch (below.getId()) {
case WOODEN_PLANK:
case NOTEBLOCK:
case CRAFTING_TABLE:
return NoteBoxSound.INSTRUMENT_BASS;
case SAND:
case SANDSTONE:
case SOUL_SAND:
return NoteBoxSound.INSTRUMENT_TABOUR;
case GLASS:
case GLASS_PANEL:
case GLOWSTONE_BLOCK:
return NoteBoxSound.INSTRUMENT_CLICK;
case COAL_ORE:
case DIAMOND_ORE:
case EMERALD_ORE:
case GLOWING_REDSTONE_ORE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case REDSTONE_ORE:
return NoteBoxSound.INSTRUMENT_BASS_DRUM;
default:
return NoteBoxSound.INSTRUMENT_PIANO;
}
}
示例5: onActivate
import cn.nukkit.level.sound.NoteBoxSound; //导入依赖的package包/类
public boolean onActivate(Item item, Player player) {
Block up = this.getSide(Vector3.SIDE_UP);
if (up.getId() == Block.AIR) {
this.getLevel().addSound(new NoteBoxSound(this, this.getInstrument(), this.getStrength()));
return true;
} else {
return false;
}
}