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


Java NotePitch类代码示例

本文整理汇总了Java中org.spongepowered.api.data.type.NotePitch的典型用法代码示例。如果您正苦于以下问题:Java NotePitch类的具体用法?Java NotePitch怎么用?Java NotePitch使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NotePitch类属于org.spongepowered.api.data.type包,在下文中一共展示了NotePitch类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerDefaults

import org.spongepowered.api.data.type.NotePitch; //导入依赖的package包/类
@Override
public void registerDefaults() {
    registerOption("block_state", BlockState.class);
    registerOption("color", Color.class);
    registerOption("direction", Direction.class);
    registerOption("firework_effects", List.class,
            value -> value.isEmpty() ? new IllegalArgumentException("The firework effects list may not be empty") : null);
    registerOption("quantity", Integer.class,
            value -> value < 1 ? new IllegalArgumentException("Quantity must be at least 1") : null);
    registerOption("item_stack_snapshot", ItemStackSnapshot.class);
    registerOption("note", NotePitch.class);
    registerOption("offset", Vector3d.class);
    registerOption("potion_effect_type", PotionEffectType.class);
    registerOption("scale", Double.class,
            value -> value < 0 ? new IllegalArgumentException("Scale may not be negative") : null);
    registerOption("velocity", Vector3d.class);
    registerOption("slow_horizontal_velocity", Boolean.class);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:19,代码来源:ParticleOptionRegistryModule.java

示例2: playNote

import org.spongepowered.api.data.type.NotePitch; //导入依赖的package包/类
@Override
public void playNote() {
    final Location<World> location = getLocation();
    final Location<World> downLocation = location.add(0, -1, 0);
    // Get the instrument type based on the underlying block
    final InstrumentType instrumentType = downLocation.getProperty(InstrumentProperty.class)
            .map(InstrumentProperty::getValue).orElse(InstrumentTypes.HARP);
    final NotePitch notePitch = get(Keys.NOTE_PITCH).get();
    // Trigger the note play effect
    ((LanternWorld) location.getExtent()).addBlockAction(location.getBlockPosition(),
            getBlock().getType(), new NoteAction(instrumentType, notePitch));
    // Calculate the pitch value based on the note pitch
    double pitch = (double) ((LanternNotePitch) notePitch).getInternalId();
    pitch = Math.pow(2.0, (pitch - 12.0) / 12.0);
    location.getExtent().playSound(instrumentType.getSound(), SoundCategories.BLOCK,
            location.getPosition().add(0.5, 0.5, 0.5), 3.0, pitch);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:18,代码来源:LanternNote.java

示例3: of

import org.spongepowered.api.data.type.NotePitch; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static NotePitch of(Note note) {
    if (note == null) {
        return null;
    }
    return NOTES.get(note.getId());
}
 
开发者ID:LapisBlue,项目名称:Pore,代码行数:8,代码来源:NoteConverter.java

示例4: cycleNext

import org.spongepowered.api.data.type.NotePitch; //导入依赖的package包/类
@Override
public NotePitch cycleNext() {
    return this.next;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternNotePitch.java

示例5: setNext

import org.spongepowered.api.data.type.NotePitch; //导入依赖的package包/类
public void setNext(NotePitch next) {
    if (this.next != null) {
        throw new IllegalStateException("The next pitch value can only be set once!");
    }
    this.next = next;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:7,代码来源:LanternNotePitch.java

示例6: nextNote

import org.spongepowered.api.data.type.NotePitch; //导入依赖的package包/类
/**
 * Cycles the current {@link NotePitch} to the next one.
 */
public void nextNote() {
    final NotePitch notePitch = get(Keys.NOTE_PITCH).get();
    offer(Keys.NOTE_PITCH, notePitch.cycleNext());
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:LanternNote.java

示例7: NoteAction

import org.spongepowered.api.data.type.NotePitch; //导入依赖的package包/类
public NoteAction(InstrumentType instrumentType, NotePitch notePitch) {
    this.instrumentType = instrumentType;
    this.notePitch = notePitch;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:NoteAction.java


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