當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。