BuilderBodyMotionMoveAway class

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

Файл: com/hypixel/hytale/server/npc/corecomponents/movement/builders/BuilderBodyMotionMoveAway.java

extends: BuilderBodyMotionFindWithTarget

Поля (1)

МодификаторыТипИмя
final double[] DEFAULT_HOLD_DIRECTION_DURATION_RANGE

Методы (10)

МодификаторыВозвратСигнатура
abstract return new BodyMotionMoveAwayreturn new BodyMotionMoveAway(this, var1)
public float getChangeDirectionViewSectorRadiansfloat getChangeDirectionViewSectorRadians(@Nonnull BuilderSupport var1)
public float getDirectionJitterRadiansfloat getDirectionJitterRadians(@Nonnull BuilderSupport var1)
public double getErraticChangeDurationMultiplierdouble getErraticChangeDurationMultiplier(@Nonnull BuilderSupport var1)
public double getErraticDistancedouble getErraticDistance(@Nonnull BuilderSupport var1)
public float getErraticExtraJitterRadiansfloat getErraticExtraJitterRadians(@Nonnull BuilderSupport var1)
public double getFalloffdouble getFalloff(@Nonnull BuilderSupport var1)
public double[] getHoldDirectionDurationRangedouble[] getHoldDirectionDurationRange(@Nonnull BuilderSupport var1)
public double getSlowdownDistancedouble getSlowdownDistance(@Nonnull BuilderSupport var1)
public double getStopDistancedouble getStopDistance(@Nonnull BuilderSupport var1)

Исходный код

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

class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderDescriptorState;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.DoubleHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.NumberArrayHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleRangeValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleSequenceValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleSingleValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.RelationalOperator;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.movement.BodyMotionMoveAway;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BuilderBodyMotionMoveAway class="kw">extends BuilderBodyMotionFindWithTarget {
   class="kw">private class="kw">static class="kw">final double[] DEFAULT_HOLD_DIRECTION_DURATION_RANGE = new double[]{2.0, 5.0};
   class="kw">protected class="kw">final DoubleHolder slowdownDistance = new DoubleHolder();
   class="kw">protected class="kw">final DoubleHolder stopDistance = new DoubleHolder();
   class="kw">protected class="kw">final DoubleHolder falloff = new DoubleHolder();
   class="kw">protected class="kw">final NumberArrayHolder holdDirectionDurationRange = new NumberArrayHolder();
   class="kw">protected class="kw">final DoubleHolder changeDirectionViewSector = new DoubleHolder();
   class="kw">protected class="kw">final DoubleHolder directionJitter = new DoubleHolder();
   class="kw">protected class="kw">final DoubleHolder erraticDistance = new DoubleHolder();
   class="kw">protected class="kw">final DoubleHolder erraticExtraJitter = new DoubleHolder();
   class="kw">protected class="kw">final DoubleHolder erraticChangeDurationMultiplier = new DoubleHolder();

   class="kw">public BuilderBodyMotionMoveAway() {
   }

   @Nonnull
   class="kw">public BodyMotionMoveAway build(@Nonnull BuilderSupport var1) {
      class="kw">return new BodyMotionMoveAway(this, var1);
   }

   @Nonnull
   @Override
   class="kw">public String getShortDescription() {
      class="kw">return "Move away from target";
   }

   @Nonnull
   @Override
   class="kw">public String getLongDescription() {
      class="kw">return "Move away from a target using path finding or steering";
   }

   @Nonnull
   @Override
   class="kw">public BuilderDescriptorState getBuilderDescriptorState() {
      class="kw">return BuilderDescriptorState.Experimental;
   }

   @Nonnull
   class="kw">public BuilderBodyMotionMoveAway readConfig(@Nonnull JsonElement var1) {
      super.readConfig(var1);
      this.getDouble(
         var1,
         "SlowDownDistance",
         this.slowdownDistance,
         8.0,
         DoubleSingleValidator.greater0(),
         BuilderDescriptorState.Stable,
         "Distance from target when NPC should start to slowdown",
         null
      );
      this.getDouble(
         var1,
         "StopDistance",
         this.stopDistance,
         10.0,
         DoubleSingleValidator.greater0(),
         BuilderDescriptorState.Stable,
         "Distance from target when NPC should halt",
         null
      );
      this.getDouble(
         var1,
         "Falloff",
         this.falloff,
         3.0,
         DoubleSingleValidator.greater0(),
         BuilderDescriptorState.Stable,
         "Rate how fast the slowdown should happen relative to distance",
         null
      );
      this.getDoubleRange(
         var1,
         "HoldDirectionTimeRange",
         this.holdDirectionDurationRange,
         DEFAULT_HOLD_DIRECTION_DURATION_RANGE,
         DoubleSequenceValidator.betweenWeaklyMonotonic(0.0, Double.MAX_VALUE),
         BuilderDescriptorState.Stable,
         "How often to change heading",
         null
      );
      this.getDouble(
         var1,
         "ChangeDirectionViewSector",
         this.changeDirectionViewSector,
         230.0,
         DoubleRangeValidator.between(0.0, 360.0),
         BuilderDescriptorState.Stable,
         "The view sector the NPC uses to decide if it should class="kw">switch direction",
         null
      );
      this.getDouble(
         var1,
         "DirectionJitter",
         this.directionJitter,
         45.0,
         DoubleRangeValidator.between(0.0, 180.0),
         BuilderDescriptorState.Stable,
         "How much jitter in degrees to add to the heading the NPC uses",
         null
      );
      this.getDouble(
         var1,
         "ErraticDistance",
         this.erraticDistance,
         4.0,
         DoubleSingleValidator.greater0(),
         BuilderDescriptorState.Stable,
         "If the player is closer than this distance, the NPC will behave more erratically using the additional jitter parameter",
         null
      );
      this.getDouble(
         var1,
         "ErraticExtraJitter",
         this.erraticExtraJitter,
         45.0,
         DoubleRangeValidator.between(0.0, 180.0),
         BuilderDescriptorState.Stable,
         "Extra jitter to add to the NPC heading on top of the standard when the target is too close",
         null
      );
      this.getDouble(
         var1,
         "ErraticChangeDurationMultiplier",
         this.erraticChangeDurationMultiplier,
         0.5,
         DoubleRangeValidator.fromExclToIncl(0.0, 1.0),
         BuilderDescriptorState.Stable,
         "A multiplier to decrease the duration between direction changes when the target is too close",
         null
      );
      this.validateDoubleRelation(this.slowdownDistance, RelationalOperator.LessEqual, this.stopDistance);
      class="kw">return this;
   }

   class="kw">public double getSlowdownDistance(@Nonnull BuilderSupport var1) {
      class="kw">return this.slowdownDistance.get(var1.getExecutionContext());
   }

   class="kw">public double getStopDistance(@Nonnull BuilderSupport var1) {
      class="kw">return this.stopDistance.get(var1.getExecutionContext());
   }

   class="kw">public double getFalloff(@Nonnull BuilderSupport var1) {
      class="kw">return this.falloff.get(var1.getExecutionContext());
   }

   class="kw">public double[] getHoldDirectionDurationRange(@Nonnull BuilderSupport var1) {
      class="kw">return this.holdDirectionDurationRange.get(var1.getExecutionContext());
   }

   class="kw">public float getChangeDirectionViewSectorRadians(@Nonnull BuilderSupport var1) {
      class="kw">return (float)(this.changeDirectionViewSector.get(var1.getExecutionContext()) * (float) (Math.PI / 180.0));
   }

   class="kw">public float getDirectionJitterRadians(@Nonnull BuilderSupport var1) {
      class="kw">return (float)(this.directionJitter.get(var1.getExecutionContext()) * (float) (Math.PI / 180.0));
   }

   class="kw">public double getErraticDistance(@Nonnull BuilderSupport var1) {
      class="kw">return this.erraticDistance.get(var1.getExecutionContext());
   }

   class="kw">public float getErraticExtraJitterRadians(@Nonnull BuilderSupport var1) {
      class="kw">return (float)(this.erraticExtraJitter.get(var1.getExecutionContext()) * (float) (Math.PI / 180.0));
   }

   class="kw">public double getErraticChangeDurationMultiplier(@Nonnull BuilderSupport var1) {
      class="kw">return this.erraticChangeDurationMultiplier.get(var1.getExecutionContext());
   }
}