ActionPlaySound class

Пакет: com.hypixel.hytale.server.npc.corecomponents.audiovisual

Файл: com/hypixel/hytale/server/npc/corecomponents/audiovisual/ActionPlaySound.java

extends: DeferrableAction

Поля (3)

МодификаторыТипИмя
final int soundEventIndex
IPositionProvider var7
TransformComponent var8

Методы (3)

МодификаторыВозвратСигнатура
if if(this.positionSource == PositionSource.Sensor)
if if(var8 == null)
abstract super super(var1, var2)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.audiovisual;

class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.universe.world.SoundUtil;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.DeferrableAction;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.PositionSource;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.audiovisual.builders.BuilderActionPlaySound;
class="kw">import com.hypixel.hytale.server.npc.instructions.ExecutionSupport;
class="kw">import com.hypixel.hytale.server.npc.sensorinfo.IPositionProvider;
class="kw">import com.hypixel.hytale.server.npc.sensorinfo.InfoProvider;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class ActionPlaySound class="kw">extends DeferrableAction {
   class="kw">protected class="kw">final int soundEventIndex;
   class="kw">protected class="kw">final PositionSource positionSource;

   class="kw">public ActionPlaySound(@Nonnull BuilderActionPlaySound var1, @Nonnull BuilderSupport var2) {
      super(var1, var2);
      this.soundEventIndex = var1.getSoundEventIndex(var2);
      this.positionSource = var1.getPositionSource();
   }

   @Override
   class="kw">public boolean execute(
      @Nonnull Ref<EntityStore> var1, @Nonnull ExecutionSupport var2, @Nullable InfoProvider var3, double var4, @Nonnull Store<EntityStore> var6
   ) {
      super.execute(var1, var2, var3, var4, var6);
      if (this.positionSource == PositionSource.Sensor) {
         IPositionProvider var7 = var3 != null ? var3.getPositionProvider() : null;
         if (var7 == null || !var7.providePosition(this.scratch)) {
            class="kw">return true;
         }
      } else {
         TransformComponent var8 = var6.getComponent(var1, TransformComponent.getComponentType());
         if (var8 == null) {
            class="kw">return true;
         }

         this.scratch.set(var8.getPosition());
      }

      this.scheduleOrFire(var2, var1, this.scratch.x, this.scratch.y, this.scratch.z, var6);
      class="kw">return true;
   }

   @Override
   class="kw">protected void fire(@Nonnull Ref<EntityStore> var1, double var2, double var4, double var6, @Nullable Rotation3f var8, @Nonnull Store<EntityStore> var9) {
      SoundUtil.playSoundEvent3d(var1, this.soundEventIndex, var2, var4, var6, false, var9);
   }
}