BuilderBodyMotionPath class

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

Файл: com/hypixel/hytale/server/npc/corecomponents/world/builders/BuilderBodyMotionPath.java

extends: BuilderBodyMotionBase

Поля (1)

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

Методы (17)

МодификаторыВозвратСигнатура
abstract return new BodyMotionPathreturn new BodyMotionPath(this, var1)
public double[] getDelayScaleRangedouble[] getDelayScaleRange(@Nonnull BuilderSupport var1)
public BodyMotionPath.Direction getDirectionBodyMotionPath.Direction getDirection()
public double getMaxNodeDelaydouble getMaxNodeDelay()
public double getMaxRelativeSpeeddouble getMaxRelativeSpeed()
public double getMaxWalkDistancedouble getMaxWalkDistance()
public double getMinNodeDelaydouble getMinNodeDelay()
public double getMinRelativeSpeeddouble getMinRelativeSpeed()
public double getMinWalkDistancedouble getMinWalkDistance()
public double getNodeWidthdouble getNodeWidth()
public double getPathWidthdouble getPathWidth()
public double[] getPercentDelayRangedouble[] getPercentDelayRange(@Nonnull BuilderSupport var1)
public BodyMotionPath.Shape getShapeBodyMotionPath.Shape getShape(@Nonnull BuilderSupport var1)
public int getViewSegmentsint getViewSegments(@Nonnull BuilderSupport var1)
public boolean isPickRandomAngleboolean isPickRandomAngle()
public boolean isStartAtNearestNodeboolean isStartAtNearestNode()
public boolean isUseNodeViewDirectionboolean isUseNodeViewDirection()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.world.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.Feature;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.EnumHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.IntHolder;
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.IntSingleValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.RelationalOperator;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderBodyMotionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.world.BodyMotionPath;
class="kw">import java.util.EnumSet;
class="kw">import java.util.Set;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BuilderBodyMotionPath class="kw">extends BuilderBodyMotionBase {
   class="kw">public class="kw">static class="kw">final double[] DEFAULT_DELAY_SCALE_RANGE = new double[]{0.2, 0.4};
   class="kw">public class="kw">static class="kw">final double[] DEFAULT_PERCENT_DELAY_RANGE = new double[]{0.0, 0.2};
   class="kw">protected class="kw">final EnumHolder<BodyMotionPath.Shape> shape = new EnumHolder<>();
   class="kw">protected class="kw">final NumberArrayHolder delayScaleRange = new NumberArrayHolder();
   class="kw">protected class="kw">final NumberArrayHolder percentDelayRange = new NumberArrayHolder();
   class="kw">protected class="kw">final IntHolder viewSegments = new IntHolder();
   class="kw">protected double pathWidth;
   class="kw">protected double nodeWidth;
   class="kw">protected double minRelativeSpeed;
   class="kw">protected double maxRelativeSpeed;
   class="kw">protected double minWalkDistance;
   class="kw">protected double maxWalkDistance;
   class="kw">protected boolean startAtNearestNode;
   class="kw">protected BodyMotionPath.Direction direction;
   class="kw">protected double minNodeDelay;
   class="kw">protected double maxNodeDelay;
   class="kw">protected boolean useNodeViewDirection;
   class="kw">protected boolean pickRandomAngle;

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

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

   @Nonnull
   @Override
   class="kw">public String getShortDescription() {
      class="kw">return "Walk along a path";
   }

   @Nonnull
   @Override
   class="kw">public String getLongDescription() {
      class="kw">return "Walk along a path.";
   }

   @Override
   class="kw">public void registerTags(@Nonnull Set<String> var1) {
      super.registerTags(var1);
      var1.add("path");
   }

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

   @Nonnull
   class="kw">public BuilderBodyMotionPath readConfig(@Nonnull JsonElement var1) {
      this.getBoolean(
         var1, "StartAtNearestNode", var1x -> this.startAtNearestNode = var1x, true, BuilderDescriptorState.Stable, "Start at closest warp point", null
      );
      this.getDouble(
         var1,
         "PathWidth",
         var1x -> this.pathWidth = var1x,
         0.0,
         DoubleSingleValidator.greaterEqual0(),
         BuilderDescriptorState.Experimental,
         "Walking corridor width",
         null
      );
      this.getDouble(
         var1,
         "NodeWidth",
         var1x -> this.nodeWidth = var1x,
         0.2,
         DoubleSingleValidator.greater0(),
         BuilderDescriptorState.Experimental,
         "Radius of warp point node",
         null
      );
      this.getDouble(
         var1,
         "MinRelSpeed",
         var1x -> this.minRelativeSpeed = var1x,
         0.5,
         DoubleRangeValidator.fromExclToIncl(0.0, 1.0),
         BuilderDescriptorState.Stable,
         "Minimum relative walk speed",
         null
      );
      this.getDouble(
         var1,
         "MaxRelSpeed",
         var1x -> this.maxRelativeSpeed = var1x,
         0.5,
         DoubleRangeValidator.fromExclToIncl(0.0, 1.0),
         BuilderDescriptorState.Stable,
         "Maximum relative walk speed",
         null
      );
      this.getDouble(
         var1,
         "MinWalkDistance",
         var1x -> this.minWalkDistance = var1x,
         0.0,
         DoubleSingleValidator.greaterEqual0(),
         BuilderDescriptorState.Experimental,
         "Minimum walk distance when PathWidth greater 0",
         null
      );
      this.getDouble(
         var1,
         "MaxWalkDistance",
         var1x -> this.maxWalkDistance = var1x,
         0.0,
         DoubleSingleValidator.greaterEqual0(),
         BuilderDescriptorState.Experimental,
         "Maximum walk distance when PathWidth greater 0",
         null
      );
      this.getEnum(
         var1,
         "Direction",
         var1x -> this.direction = var1x,
         BodyMotionPath.Direction.class,
         BodyMotionPath.Direction.FORWARD,
         BuilderDescriptorState.Stable,
         "Walking direction relative to order of nodes",
         null
      );
      this.getEnum(var1, "Shape", this.shape, BodyMotionPath.Shape.class, BodyMotionPath.Shape.LOOP, BuilderDescriptorState.Stable, "Shape of Path", null);
      this.getDouble(
         var1,
         "MinNodeDelay",
         var1x -> this.minNodeDelay = var1x,
         0.0,
         DoubleSingleValidator.greaterEqual0(),
         BuilderDescriptorState.Stable,
         "Minimum resting time at a node",
         null
      );
      this.getDouble(
         var1,
         "MaxNodeDelay",
         var1x -> this.maxNodeDelay = var1x,
         0.0,
         DoubleSingleValidator.greaterEqual0(),
         BuilderDescriptorState.Stable,
         "Maximum resting time at a node",
         null
      );
      this.getBoolean(
         var1,
         "UseNodeViewDirection",
         var1x -> this.useNodeViewDirection = var1x,
         false,
         BuilderDescriptorState.Stable,
         "Look into next node direction at node",
         null
      );
      this.getDoubleRange(
         var1,
         "NodePauseScaleRange",
         this.delayScaleRange,
         DEFAULT_DELAY_SCALE_RANGE,
         DoubleSequenceValidator.fromExclToInclWeaklyMonotonic(0.0, Double.MAX_VALUE),
         BuilderDescriptorState.Stable,
         "The range from which to pick a value that defines the portion of the total node pause time that should be spent facing a direction before turning",
         null
      );
      this.getDoubleRange(
         var1,
         "NodePauseExtraPercentRange",
         this.percentDelayRange,
         DEFAULT_PERCENT_DELAY_RANGE,
         DoubleSequenceValidator.between01WeaklyMonotonic(),
         BuilderDescriptorState.Stable,
         "A range from which to pick the additional percentage of the directional pause time to add to it",
         null
      );
      this.getBoolean(
         var1,
         "PickRandomAngle",
         var1x -> this.pickRandomAngle = var1x,
         false,
         BuilderDescriptorState.Stable,
         "Whether to sweep left and right using the observation angle, or pick a random angle within the sector each time",
         null
      );
      this.getInt(
         var1,
         "ViewSegments",
         this.viewSegments,
         1,
         IntSingleValidator.greater0(),
         BuilderDescriptorState.Stable,
         "The number of distinct segments to stop at when sweeping from left to right using the observation angle",
         null
      );
      this.validateDoubleRelation("MinRelativeSpeed", this.minRelativeSpeed, RelationalOperator.LessEqual, "MaxRelativeSpeed", this.maxRelativeSpeed);
      this.validateDoubleRelation("MinWalkDistance", this.minWalkDistance, RelationalOperator.LessEqual, "MaxWalkDistance", this.maxWalkDistance);
      this.validateDoubleRelation("MinNodeDelay", this.minNodeDelay, RelationalOperator.LessEqual, "MaxNodeDelay", this.maxNodeDelay);
      this.requireFeature(EnumSet.of(Feature.Path));
      class="kw">return this;
   }

   class="kw">public double getPathWidth() {
      class="kw">return this.pathWidth;
   }

   class="kw">public double getNodeWidth() {
      class="kw">return this.nodeWidth;
   }

   class="kw">public double getMinRelativeSpeed() {
      class="kw">return this.minRelativeSpeed;
   }

   class="kw">public double getMaxRelativeSpeed() {
      class="kw">return this.maxRelativeSpeed;
   }

   class="kw">public double getMinWalkDistance() {
      class="kw">return this.minWalkDistance;
   }

   class="kw">public double getMaxWalkDistance() {
      class="kw">return this.maxWalkDistance;
   }

   class="kw">public boolean isStartAtNearestNode() {
      class="kw">return this.startAtNearestNode;
   }

   class="kw">public BodyMotionPath.Direction getDirection() {
      class="kw">return this.direction;
   }

   class="kw">public BodyMotionPath.Shape getShape(@Nonnull BuilderSupport var1) {
      class="kw">return this.shape.get(var1.getExecutionContext());
   }

   class="kw">public double getMinNodeDelay() {
      class="kw">return this.minNodeDelay;
   }

   class="kw">public double getMaxNodeDelay() {
      class="kw">return this.maxNodeDelay;
   }

   class="kw">public boolean isUseNodeViewDirection() {
      class="kw">return this.useNodeViewDirection;
   }

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

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

   class="kw">public boolean isPickRandomAngle() {
      class="kw">return this.pickRandomAngle;
   }

   class="kw">public int getViewSegments(@Nonnull BuilderSupport var1) {
      class="kw">return this.viewSegments.get(var1.getExecutionContext());
   }
}