Search in sources :

Example 1 with Jukebox

use of org.spongepowered.api.block.entity.Jukebox in project SpongeCommon by SpongePowered.

the class SpongeCommonEventFactory method callPlaySoundRecordEvent.

public static PlaySoundEvent.Record callPlaySoundRecordEvent(final Cause cause, final JukeboxBlockEntity jukebox, final MusicDisc recordType, final int data) {
    final Jukebox apiJuke = (Jukebox) jukebox;
    final ServerLocation location = (ServerLocation) apiJuke.location();
    final PlaySoundEvent.Record event = data == 0 ? SpongeEventFactory.createPlaySoundEventRecordStart(cause, apiJuke, location, recordType, Sound.Source.RECORD, recordType.sound(), 1.0F, 4.0F) : SpongeEventFactory.createPlaySoundEventRecordStop(cause, apiJuke, location, recordType, Sound.Source.RECORD, recordType.sound(), 1.0F, 4.0F);
    SpongeCommon.post(event);
    return event;
}
Also used : Jukebox(org.spongepowered.api.block.entity.Jukebox) ServerLocation(org.spongepowered.api.world.server.ServerLocation) PlaySoundEvent(org.spongepowered.api.event.sound.PlaySoundEvent)

Aggregations

Jukebox (org.spongepowered.api.block.entity.Jukebox)1 PlaySoundEvent (org.spongepowered.api.event.sound.PlaySoundEvent)1 ServerLocation (org.spongepowered.api.world.server.ServerLocation)1