BodyMotionLand class

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

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

extends: BodyMotionFind

Поля (8)

МодификаторыТипИмя
final double goalLenience
Role var10
NPCEntity var11
MotionController var5
double var6
boolean var8
double var8
TransformComponent var9

Методы (1)

МодификаторыВозвратСигнатура
abstract super super(var1, var2)

Исходный код

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

class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
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.movement.builders.BuilderBodyMotionLand;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.instructions.ExecutionSupport;
class="kw">import com.hypixel.hytale.server.npc.movement.Steering;
class="kw">import com.hypixel.hytale.server.npc.movement.controllers.MotionController;
class="kw">import com.hypixel.hytale.server.npc.movement.controllers.MotionControllerFly;
class="kw">import com.hypixel.hytale.server.npc.role.Role;
class="kw">import com.hypixel.hytale.server.npc.sensorinfo.InfoProvider;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;

class="kw">public class BodyMotionLand class="kw">extends BodyMotionFind {
   class="kw">protected class="kw">final double goalLenience;
   class="kw">protected class="kw">final double goalLenienceSquared;

   class="kw">public BodyMotionLand(@Nonnull BuilderBodyMotionLand var1, @Nonnull BuilderSupport var2) {
      super(var1, var2);
      this.goalLenience = var1.getGoalLenience(var2);
      this.goalLenienceSquared = this.goalLenience * this.goalLenience;
   }

   @Override
   class="kw">public boolean computeSteering(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull ExecutionSupport var2,
      @Nullable InfoProvider var3,
      double var4,
      @Nonnull Steering var6,
      @Nonnull ComponentAccessor<EntityStore> var7
   ) {
      boolean var8 = super.computeSteering(var1, var2, var3, var4, var6, var7);
      TransformComponent var9 = var7.getComponent(var1, TransformComponent.getComponentType());
      assert var9 != null;
      Role var10 = var2.getRole();
      assert var10 != null;
      if (!var10.hasMotionController("Walk")) {
         class="kw">return false;
      } else if (this.isGoalReached(var1, var2.getMotionContextSupport().getActiveMotionController(), var9.getPosition(), var7)) {
         NPCEntity var11 = var7.getComponent(var1, NPCEntity.getComponentType());
         assert var11 != null;
         var10.setActiveMotionController(var1, var11, "Walk", var7);
         class="kw">return false;
      } else {
         class="kw">return var8;
      }
   }

   @Override
   class="kw">public boolean canComputeMotion(
      @Nonnull Ref<EntityStore> var1, @Nonnull ExecutionSupport var2, @Nullable InfoProvider var3, @Nonnull ComponentAccessor<EntityStore> var4
   ) {
      MotionController var5 = var2.getMotionContextSupport().getActiveMotionController();
      class="kw">return var5.matchesType(MotionControllerFly.class) && !var5.isObstructed() && super.canComputeMotion(var1, var2, var3, var4);
   }

   @Override
   class="kw">protected boolean isGoalReached(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull MotionController var2,
      @Nonnull Vector3d var3,
      @Nonnull Vector3d var4,
      @Nonnull ComponentAccessor<EntityStore> var5
   ) {
      double var6 = var4.y - var3.y;
      if (!(var6 < this.heightDifferenceMin) && !(var6 > this.heightDifferenceMax)) {
         double var8 = var2.waypointDistanceSquared(var3, var4);
         class="kw">return var8 > this.effectiveDistanceSquared && var8 > this.goalLenienceSquared
            ? false
            : !this.reachable || this.canReachTarget(var1, var2, var3, var4, var5);
      } else {
         class="kw">return false;
      }
   }
}