Esempio n. 1
0
 /**
  * @param event An instance of the ActivateEvent event
  * @param entity An instance of EntityRef Deal with the real activation event (No predicted) and
  *     play a sound.
  */
 @ReceiveEvent(components = {PlaySoundActionComponent.class})
 public void onActivate(ActivateEvent event, EntityRef entity) {
   if (event.getInstigator().equals(localPlayer.getCharacterEntity())) {
     return; // owner has heard sound from prediction
   }
   PlaySoundActionComponent playSound = entity.getComponent(PlaySoundActionComponent.class);
   StaticSound sound = random.nextItem(playSound.sounds);
   verifyAndPlaySound(event, playSound, sound);
 }