BuilderBodyMotionFindBase class
Пакет: com.hypixel.hytale.server.npc.corecomponents.movement.builders
Файл: com/hypixel/hytale/server/npc/corecomponents/movement/builders/BuilderBodyMotionFindBase.java
extends: BuilderBodyMotionBase
implements: Builder<BodyMotion>
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
double[] |
THROTTLE_DELAY |
Методы (24)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
double |
getBlendHeadingdouble getBlendHeading(@Nonnull BuilderSupport var1) |
public |
double |
getDesiredAltitudeWeightdouble getDesiredAltitudeWeight(@Nonnull BuilderSupport var1) |
public |
int |
getMaxOpenNodesint getMaxOpenNodes(@Nonnull BuilderSupport var1) |
public |
int |
getMaxPathLengthint getMaxPathLength(@Nonnull BuilderSupport var1) |
public |
int |
getMaxTotalNodesint getMaxTotalNodes(@Nonnull BuilderSupport var1) |
public |
double |
getMinPathLengthdouble getMinPathLength(@Nonnull BuilderSupport var1) |
public |
int |
getNodesPerTickint getNodesPerTick(@Nonnull BuilderSupport var1) |
public |
int |
getPathSmoothingint getPathSmoothing(@Nonnull BuilderSupport var1) |
public |
double |
getRejectionWeightdouble getRejectionWeight(@Nonnull BuilderSupport var1) |
public |
double |
getRelativeSpeeddouble getRelativeSpeed(@Nonnull BuilderSupport var1) |
public |
double |
getRelativeSpeedWaypointdouble getRelativeSpeedWaypoint(@Nonnull BuilderSupport var1) |
public |
double[] |
getThrottleDelayRangedouble[] getThrottleDelayRange(@Nonnull BuilderSupport var1) |
public |
int |
getThrottleIgnoreCountint getThrottleIgnoreCount(@Nonnull BuilderSupport var1) |
public |
boolean |
getUseBestPathboolean getUseBestPath(@Nonnull BuilderSupport var1) |
public |
double |
getWaypointRadiusdouble getWaypointRadius(@Nonnull BuilderSupport var1) |
|
|
if if(this.enableSteering) |
public |
boolean |
isAvoidingBlockDamageboolean isAvoidingBlockDamage(@Nonnull BuilderSupport var1) |
public |
boolean |
isBuildOptimisedPathboolean isBuildOptimisedPath(@Nonnull BuilderSupport var1) |
public |
boolean |
isDiagonalMovesboolean isDiagonalMoves(@Nonnull BuilderSupport var1) |
public |
boolean |
isLegacyRelaxedMoveConstraintsboolean isLegacyRelaxedMoveConstraints(@Nonnull BuilderSupport var1) |
public |
boolean |
isRelaxedConstraintsPresentboolean isRelaxedConstraintsPresent() |
public |
boolean |
isSkipSteeringboolean isSkipSteering(@Nonnull BuilderSupport var1) |
public |
boolean |
isUsePathfinderboolean isUsePathfinder(@Nonnull BuilderSupport var1) |
public |
boolean |
isUseSteeringboolean isUseSteering(@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.Builder;
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.BooleanHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.DoubleHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.EnumSetHolder;
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.corecomponents.builders.BuilderBodyMotionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.movement.BodyMotionFindBase;
class="kw">import com.hypixel.hytale.server.npc.instructions.BodyMotion;
class="kw">import com.hypixel.hytale.server.npc.movement.constraints.RelaxedConstraint;
class="kw">import java.util.EnumSet;
class="kw">import javax.annotation.Nonnull;
class="kw">public class="kw">abstract class BuilderBodyMotionFindBase class="kw">extends BuilderBodyMotionBase class="kw">implements Builder<BodyMotion> {
class="kw">protected class="kw">static class="kw">final double[] THROTTLE_DELAY = new double[]{3.0, 5.0};
class="kw">private class="kw">static class="kw">final String[] AVOID_OR_RELAXED_ATTRIBUTES = new String[]{"AvoidBlockDamage", "RelaxedConstraints"};
class="kw">private class="kw">static class="kw">final String[] LEGACY_OR_RELAXED_ATTRIBUTES = new String[]{"RelaxedMoveConstraints", "RelaxedConstraints"};
@Nonnull
class="kw">protected EnumSet<BodyMotionFindBase.DebugFlags> parsedDebugFlags = EnumSet.noneOf(BodyMotionFindBase.DebugFlags.class);
class="kw">protected String debugFlags;
class="kw">protected class="kw">final IntHolder nodesPerTick = new IntHolder();
class="kw">protected class="kw">final IntHolder maxPathLength = new IntHolder();
class="kw">protected class="kw">final IntHolder maxOpenNodes = new IntHolder();
class="kw">protected class="kw">final IntHolder maxTotalNodes = new IntHolder();
class="kw">protected class="kw">final BooleanHolder diagonalMoves = new BooleanHolder();
class="kw">protected class="kw">final BooleanHolder useBestPath = new BooleanHolder();
class="kw">protected class="kw">final BooleanHolder buildOptimisedPath = new BooleanHolder();
class="kw">protected class="kw">final IntHolder pathSmoothing = new IntHolder();
class="kw">protected class="kw">final DoubleHolder relativeSpeed = new DoubleHolder();
class="kw">protected class="kw">final DoubleHolder relativeSpeedWaypoint = new DoubleHolder();
class="kw">protected class="kw">final DoubleHolder waypointRadius = new DoubleHolder();
class="kw">protected class="kw">final DoubleHolder rejectionWeight = new DoubleHolder();
class="kw">protected class="kw">final DoubleHolder blendHeading = new DoubleHolder();
class="kw">protected class="kw">final BooleanHolder isAvoidingBlockDamage = new BooleanHolder();
class="kw">protected class="kw">final BooleanHolder isLegacyRelaxedMoveConstraints = new BooleanHolder();
class="kw">protected class="kw">final EnumSetHolder<RelaxedConstraint> relaxedConstraints = new EnumSetHolder<>();
class="kw">protected class="kw">final NumberArrayHolder throttleDelayRangeHolder = new NumberArrayHolder();
class="kw">protected class="kw">final IntHolder throttleIgnoreCount = new IntHolder();
class="kw">protected class="kw">final BooleanHolder useSteering = new BooleanHolder();
class="kw">protected class="kw">final BooleanHolder usePathfinder = new BooleanHolder();
class="kw">protected class="kw">final BooleanHolder skipSteering = new BooleanHolder();
class="kw">protected class="kw">final DoubleHolder minPathLength = new DoubleHolder();
class="kw">protected class="kw">final DoubleHolder desiredAltitudeWeight = new DoubleHolder();
class="kw">private class="kw">final boolean[] avoidOrRelaxedPresent = new boolean[2];
class="kw">private class="kw">final boolean[] legacyOrRelaxedPresent = new boolean[2];
class="kw">protected class="kw">final boolean enableSteering;
class="kw">public BuilderBodyMotionFindBase() {
this.enableSteering = true;
}
class="kw">public BuilderBodyMotionFindBase(boolean var1) {
this.enableSteering = var1;
}
@Nonnull
class="kw">public BuilderBodyMotionFindBase readConfig(@Nonnull JsonElement var1) {
this.getDouble(
var1,
"RelativeSpeed",
this.relativeSpeed,
1.0,
DoubleRangeValidator.fromExclToIncl(0.0, 2.0),
BuilderDescriptorState.Stable,
"Maximum relative speed the NPC should move",
null
);
this.getDouble(
var1,
"RelativeSpeedWaypoint",
this.relativeSpeedWaypoint,
0.5,
DoubleRangeValidator.fromExclToIncl(0.0, 1.0),
BuilderDescriptorState.Stable,
"Maximum relative speed the NPC should move close to waypoints",
null
);
this.getDouble(
var1,
"WaypointRadius",
this.waypointRadius,
0.5,
DoubleSingleValidator.greater(0.1),
BuilderDescriptorState.Stable,
"Radius to slow down around waypoints",
null
);
this.getBoolean(var1, "UseBestPath", this.useBestPath, true, BuilderDescriptorState.Stable, "Use best partial path if goal can't be reached", null);
this.getDoubleRange(
var1,
"ThrottleDelayRange",
this.throttleDelayRangeHolder,
THROTTLE_DELAY,
DoubleSequenceValidator.betweenWeaklyMonotonic(0.0, Double.MAX_VALUE),
BuilderDescriptorState.Stable,
"Time to delay after no path finding solution found",
null
);
this.getInt(
var1,
"ThrottleIgnoreCount",
this.throttleIgnoreCount,
3,
IntSingleValidator.greaterEqual0(),
BuilderDescriptorState.Stable,
"How often no valid path solution can be found before throttling delay is applied",
null
);
this.getBoolean(
var1, "BuildOptimisedPath", this.buildOptimisedPath, true, BuilderDescriptorState.Stable, "Try to reduce number of nodes of generated path", null
);
this.avoidOrRelaxedPresent[0] = this.getBoolean(
var1, "AvoidBlockDamage", this.isAvoidingBlockDamage, true, BuilderDescriptorState.Deprecated, "Should avoid environmental damage from blocks", null
);
this.legacyOrRelaxedPresent[0] = this.getBoolean(
var1,
"RelaxedMoveConstraints",
this.isLegacyRelaxedMoveConstraints,
true,
BuilderDescriptorState.Deprecated,
"NPC can do movements like wading (depends on motion controller type)",
null
);
this.avoidOrRelaxedPresent[1] = this.getEnumSet(
var1,
"RelaxedConstraints",
this.relaxedConstraints,
RelaxedConstraint.class,
EnumSet.noneOf(RelaxedConstraint.class),
BuilderDescriptorState.Stable,
"List of constraints to relax for this motion (new mode; empty = no relaxed constraints)",
null
);
this.legacyOrRelaxedPresent[1] = this.avoidOrRelaxedPresent[1];
this.validateOneOrNonePresent(AVOID_OR_RELAXED_ATTRIBUTES, this.avoidOrRelaxedPresent);
this.validateOneOrNonePresent(LEGACY_OR_RELAXED_ATTRIBUTES, this.legacyOrRelaxedPresent);
this.getDouble(
var1,
"BlendHeading",
this.blendHeading,
0.5,
DoubleRangeValidator.between01(),
BuilderDescriptorState.Stable,
"Relative rotation angle into next waypoint when arriving at current waypoint",
null
);
this.getInt(
var1,
"PathSmoothing",
this.pathSmoothing,
2,
IntSingleValidator.greaterEqual0(),
BuilderDescriptorState.Stable,
"Try to smooth followed path. Larger values smooth more.",
null
);
this.getDouble(
var1,
"RejectionWeight",
this.rejectionWeight,
3.0,
DoubleSingleValidator.greater0(),
BuilderDescriptorState.Stable,
"Weight of rejection vector pushing entity closer to original path",
null
);
if (this.enableSteering) {
this.getBoolean(var1, "UseSteering", this.useSteering, true, BuilderDescriptorState.Stable, "Use simple/cheap steering if available", null);
this.getBoolean(var1, "SkipSteering", this.skipSteering, true, BuilderDescriptorState.Experimental, "Skip steering if target not reachable", null);
this.getBoolean(var1, "UsePathfinder", this.usePathfinder, true, BuilderDescriptorState.Stable, "Use path finder", null);
}
this.getDouble(
var1,
"MinPathLength",
this.minPathLength,
2.0,
DoubleSingleValidator.greaterEqual0(),
BuilderDescriptorState.Experimental,
"Minimum length of path required when not able to reach target (should be greater equal 2)",
null
);
this.getBoolean(var1, "DiagonalMoves", this.diagonalMoves, true, BuilderDescriptorState.Stable, "Allow diagonal moves", null);
this.getInt(var1, "StepsPerTick", this.nodesPerTick, 50, IntSingleValidator.greater0(), BuilderDescriptorState.Stable, "Steps per iteration", null);
this.getInt(
var1,
"MaxPathLength",
this.maxPathLength,
200,
IntSingleValidator.greater0(),
BuilderDescriptorState.Stable,
"Max path steps before aborting path finding",
null
);
this.getInt(
var1,
"MaxOpenNodes",
this.maxOpenNodes,
200,
IntSingleValidator.greater0(),
BuilderDescriptorState.Stable,
"Max open nodes before aborting path finding",
null
);
this.getInt(
var1,
"MaxTotalNodes",
this.maxTotalNodes,
900,
IntSingleValidator.greater0(),
BuilderDescriptorState.Stable,
"Max total node before aborting path finding",
null
);
this.getString(var1, "Debug", var1x -> this.debugFlags = var1x, "", null, BuilderDescriptorState.Stable, "Debugging flags", null);
this.getDouble(
var1,
"DesiredAltitudeWeight",
this.desiredAltitudeWeight,
-1.0,
DoubleRangeValidator.between(-1.0, 1.0),
BuilderDescriptorState.Stable,
"How much this NPC prefers being within the desired height range",
"How much this NPC prefers being within the desired height range. 0 means it doesn't care much, 1 means it will do its best to get there fast. Values below 0 mean the class="kw">default in the motion controller will be used."
);
if (this.debugFlags != null && !this.debugFlags.isEmpty()) {
this.toSet("Debug", BodyMotionFindBase.DebugFlags.class, this.parsedDebugFlags, this.debugFlags);
}
class="kw">return this;
}
@Nonnull
class="kw">public EnumSet<BodyMotionFindBase.DebugFlags> getParsedDebugFlags() {
class="kw">return this.parsedDebugFlags;
}
class="kw">public int getNodesPerTick(@Nonnull BuilderSupport var1) {
class="kw">return this.nodesPerTick.get(var1.getExecutionContext());
}
class="kw">public int getMaxPathLength(@Nonnull BuilderSupport var1) {
class="kw">return this.maxPathLength.get(var1.getExecutionContext());
}
class="kw">public int getMaxOpenNodes(@Nonnull BuilderSupport var1) {
class="kw">return this.maxOpenNodes.get(var1.getExecutionContext());
}
class="kw">public int getMaxTotalNodes(@Nonnull BuilderSupport var1) {
class="kw">return this.maxTotalNodes.get(var1.getExecutionContext());
}
class="kw">public boolean isDiagonalMoves(@Nonnull BuilderSupport var1) {
class="kw">return this.diagonalMoves.get(var1.getExecutionContext());
}
class="kw">public boolean getUseBestPath(@Nonnull BuilderSupport var1) {
class="kw">return this.useBestPath.get(var1.getExecutionContext());
}
class="kw">public boolean isBuildOptimisedPath(@Nonnull BuilderSupport var1) {
class="kw">return this.buildOptimisedPath.get(var1.getExecutionContext());
}
class="kw">public int getPathSmoothing(@Nonnull BuilderSupport var1) {
class="kw">return this.pathSmoothing.get(var1.getExecutionContext());
}
class="kw">public double getRelativeSpeed(@Nonnull BuilderSupport var1) {
class="kw">return this.relativeSpeed.get(var1.getExecutionContext());
}
class="kw">public double getRelativeSpeedWaypoint(@Nonnull BuilderSupport var1) {
class="kw">return this.relativeSpeedWaypoint.get(var1.getExecutionContext());
}
class="kw">public double getWaypointRadius(@Nonnull BuilderSupport var1) {
class="kw">return this.waypointRadius.get(var1.getExecutionContext());
}
class="kw">public double getRejectionWeight(@Nonnull BuilderSupport var1) {
class="kw">return this.rejectionWeight.get(var1.getExecutionContext());
}
class="kw">public double getBlendHeading(@Nonnull BuilderSupport var1) {
class="kw">return this.blendHeading.get(var1.getExecutionContext());
}
class="kw">public boolean isAvoidingBlockDamage(@Nonnull BuilderSupport var1) {
class="kw">return this.isAvoidingBlockDamage.get(var1.getExecutionContext());
}
class="kw">public boolean isLegacyRelaxedMoveConstraints(@Nonnull BuilderSupport var1) {
class="kw">return this.isLegacyRelaxedMoveConstraints.get(var1.getExecutionContext());
}
@Nonnull
class="kw">public EnumSet<RelaxedConstraint> getRelaxedConstraints(@Nonnull BuilderSupport var1) {
class="kw">return this.relaxedConstraints.get(var1.getExecutionContext());
}
class="kw">public boolean isRelaxedConstraintsPresent() {
class="kw">return this.avoidOrRelaxedPresent[1];
}
class="kw">public double[] getThrottleDelayRange(@Nonnull BuilderSupport var1) {
class="kw">return this.throttleDelayRangeHolder.get(var1.getExecutionContext());
}
class="kw">public int getThrottleIgnoreCount(@Nonnull BuilderSupport var1) {
class="kw">return this.throttleIgnoreCount.get(var1.getExecutionContext());
}
class="kw">public boolean isUseSteering(@Nonnull BuilderSupport var1) {
class="kw">return this.enableSteering && this.useSteering.get(var1.getExecutionContext());
}
class="kw">public boolean isUsePathfinder(@Nonnull BuilderSupport var1) {
class="kw">return !this.enableSteering || this.usePathfinder.get(var1.getExecutionContext());
}
class="kw">public boolean isSkipSteering(@Nonnull BuilderSupport var1) {
class="kw">return this.enableSteering && this.skipSteering.get(var1.getExecutionContext());
}
class="kw">public double getMinPathLength(@Nonnull BuilderSupport var1) {
class="kw">return this.minPathLength.get(var1.getExecutionContext());
}
class="kw">public double getDesiredAltitudeWeight(@Nonnull BuilderSupport var1) {
class="kw">return this.desiredAltitudeWeight.get(var1.getExecutionContext());
}
}