VerticalRange class

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

Файл: com/hypixel/hytale/server/npc/movement/controllers/MotionController.java

Поля (3)

МодификаторыТипИмя
public double current
public double max
public double min

Методы (2)

МодификаторыВозвратСигнатура
public boolean isWithinRangepublic boolean isWithinRange()
public void setpublic void set(double var1, double var3, double var5)

Исходный код

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

class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.math.shape.Box;
class="kw">import com.hypixel.hytale.math.vector.Vector3dUtil;
class="kw">import com.hypixel.hytale.protocol.MovementStates;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.Model;
class="kw">import com.hypixel.hytale.server.core.entity.movement.MovementStatesComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.physics.component.PhysicsValues;
class="kw">import com.hypixel.hytale.server.core.modules.physics.component.Velocity;
class="kw">import com.hypixel.hytale.server.core.modules.splitvelocity.VelocityConfig;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.movement.MovementMode;
class="kw">import com.hypixel.hytale.server.npc.movement.MovementState;
class="kw">import com.hypixel.hytale.server.npc.movement.NavState;
class="kw">import com.hypixel.hytale.server.npc.movement.Steering;
class="kw">import com.hypixel.hytale.server.npc.movement.constraints.RelaxedConstraint;
class="kw">import com.hypixel.hytale.server.npc.role.Role;
class="kw">import com.hypixel.hytale.server.npc.role.RoleDebugFlags;
class="kw">import com.hypixel.hytale.server.npc.role.support.DebugSupport;
class="kw">import java.util.EnumSet;
class="kw">import java.util.Set;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector3dc;

class="kw">public class="kw">interface MotionController class="kw">extends DebugSupport.DebugFlagsChangeListener {
   @Nonnull
   String getType();

   @Nonnull
   Set<MovementMode> getSupportedMovementModes();

   @Nonnull
   Set<MovementMode> getDefaultSpawnMovementModes();

   @Nonnull
   Role getRole();

   void setRole(Role var1);

   class="kw">default void setDebugEntityId(int var1) {
   }

   void setInertia(double var1);

   void setKnockbackScale(double var1);

   double getGravity();

   void setHeadPitchAngleRange(@Nullable float[] var1);

   void spawned();

   void activate();

   void deactivate();

   void updateModelParameters(@Nullable Ref<EntityStore> var1, Model var2, Box var3, @Nullable ComponentAccessor<EntityStore> var4);

   double steer(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull Role var2,
      @Nonnull Steering var3,
      @Nonnull Steering var4,
      double var5,
      @Nonnull ComponentAccessor<EntityStore> var7
   );

   double probeMove(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull Vector3dc var2,
      @Nonnull Vector3dc var3,
      @Nonnull ProbeMoveData var4,
      @Nonnull ComponentAccessor<EntityStore> var5
   );

   double probeMove(@Nonnull Ref<EntityStore> var1, @Nonnull ProbeMoveData var2, @Nonnull ComponentAccessor<EntityStore> var3);

   class="kw">default void applyRailStep(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull Role var2,
      @Nonnull Vector3dc var3,
      @Nonnull RailStepConfig var4,
      @Nonnull RailStepResult var5,
      @Nonnull ComponentAccessor<EntityStore> var6
   ) {
      throw new UnsupportedOperationException("applyRailStep is not supported by " + this.getType());
   }

   void constrainRotations(Role var1, TransformComponent var2);

   double getCurrentMaxBodyRotationSpeed();

   void updateMovementState(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull MovementStates var2,
      @Nonnull Steering var3,
      @Nonnull Vector3d var4,
      @Nonnull ComponentAccessor<EntityStore> var5
   );

   boolean isValidPosition(@Nonnull Vector3dc var1, ComponentAccessor<EntityStore> var2);

   boolean canSteer(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2);

   boolean isForcePushed();

   @Nullable
   String canSteerFailReason(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2);

   boolean isInProgress();

   boolean isObstructed();

   boolean inAir();

   boolean inWater();

   boolean onGround();

   boolean standingOnBlockOfType(int var1);

   double getMaximumSpeed();

   double getCurrentSpeed();

   boolean estimateVelocity(Steering var1, Vector3d var2);

   double getCurrentTurnRadius();

   double waypointDistance(Vector3dc var1, Vector3dc var2);

   double waypointDistanceSquared(Vector3dc var1, Vector3dc var2);

   double waypointDistance(@Nonnull Ref<EntityStore> var1, Vector3d var2, @Nonnull ComponentAccessor<EntityStore> var3);

   double waypointDistanceSquared(@Nonnull Ref<EntityStore> var1, Vector3d var2, @Nonnull ComponentAccessor<EntityStore> var3);

   float getMaxClimbAngle();

   float getMaxSinkAngle();

   class="kw">default double getMaxClimbHeight() {
      class="kw">return 0.0;
   }

   class="kw">default double getMaxDropHeight() {
      class="kw">return 0.0;
   }

   boolean translateToAccessiblePosition(Vector3d var1, Box var2, double var3, double var5, ComponentAccessor<EntityStore> var7);

   @Nonnull
   Box getCollisionBoundingBox();

   Vector3d getComponentSelector();

   Vector3d getPlanarComponentSelector();

   void setComponentSelector(Vector3d var1);

   boolean is2D();

   Vector3dc getWorldNormal();

   Vector3dc getWorldAntiNormal();

   void addVelocity(@Nonnull Vector3d var1, @Nullable VelocityConfig var2);

   Vector3d getExternalVelocity();

   double getCombinedExternalVelocityLength();

   void clearExternalForces();

   void setVelocity(@Nonnull Vector3dc var1, @Nullable VelocityConfig var2, boolean var3);

   MotionController.VerticalRange getDesiredVerticalRange(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2);

   double getWanderVerticalMovementRatio();

   boolean isAvoidingBlockDamage();

   boolean willReceiveBlockDamage();

   void requirePreciseMovement(Vector3d var1);

   void enableHeadingBlending(double var1, Vector3d var3, double var4);

   void enableHeadingBlending();

   void setRelaxedMoveConstraints(@Nonnull EnumSet<RelaxedConstraint> var1);

   @Nonnull
   EnumSet<RelaxedConstraint> getRelaxedConstraints();

   NavState getNavState();

   double getThrottleDuration();

   double getTargetDeltaSquared();

   void setNavState(NavState var1, double var2, double var4);

   void setForceRecomputePath(boolean var1);

   boolean isForceRecomputePath();

   boolean canRestAtPlace();

   void beforeInstructionSensorsAndActions(double var1);

   void beforeInstructionMotion(double var1);

   class="kw">default boolean matchesType(@Nonnull Class<? class="kw">extends MotionController> var1) {
      class="kw">return var1.isInstance(this);
   }

   double getDesiredAltitudeWeight();

   double getHeightOverGround();

   class="kw">default void clearOverrides() {
   }

   class="kw">default double getSquaredDistance(@Nonnull Vector3d var1, @Nonnull Vector3d var2, boolean var3) {
      class="kw">return var3 ? this.waypointDistanceSquared(var1, var2) : var1.distanceSquared(var2);
   }

   void updatePhysicsValues(PhysicsValues var1);

   class="kw">static boolean isInMovementState(@Nonnull Ref<EntityStore> var0, @Nonnull MovementState var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      MovementStatesComponent var3 = var2.getComponent(var0, MovementStatesComponent.getComponentType());
      assert var3 != null;
      MovementStates var4 = var3.getMovementStates();

      class="kw">return class="kw">switch (var1) {
         case CLIMBING -> var4.climbing;
         case FALLING -> var4.falling;
         case CROUCHING -> var4.crouching;
         case FLYING -> var4.flying;
         case JUMPING -> var4.jumping;
         case SPRINTING -> var4.sprinting;
         case RUNNING -> var4.running;
         case IDLE, WALKING -> {
            Velocity var5 = var2.getComponent(var0, Velocity.getComponentType());
            assert var5 != null;
            boolean var6 = Vector3dUtil.closeToZero(var5.getVelocity(), 0.001);
            yield var1 == MovementState.IDLE
               ? var6
               : !var6 && !var4.falling && !var4.climbing && !var4.flying && !var4.running && !var4.sprinting && !var4.jumping && !var4.crouching;
         }
         case ANY -> true;
      };
   }

   @Override
   class="kw">default void onDebugFlagsChanged(EnumSet<RoleDebugFlags> var1) {
   }

   class VerticalRange {
      class="kw">public double current;
      class="kw">public double min;
      class="kw">public double max;

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

      class="kw">public void set(double var1, double var3, double var5) {
         this.current = var1;
         this.min = var3;
         this.max = var5;
      }

      class="kw">public boolean isWithinRange() {
         class="kw">return this.current >= this.min && this.current <= this.max;
      }
   }
}