Class FuzzyTargeting

java.lang.Object
net.minecraft.entity.ai.FuzzyTargeting

public class FuzzyTargeting extends Object
Path targeting utilities using fuzzy, or approximated, positions from FuzzyPositions.

Methods in this class can be used to do pathing for an entity to a random position. Positions are chosen to stay within range of the entity's chosen position target if applicable, and will be suitably randomized within that constraint.

Mappings:
Namespace Name
official bqn
intermediary net/minecraft/class_5534
named net/minecraft/entity/ai/FuzzyTargeting
  • Constructor Details

    • FuzzyTargeting

      public FuzzyTargeting()
  • Method Details

    • find

      @Nullable public static @Nullable Vec3d find(PathAwareEntity entity, int horizontalRange, int verticalRange)
      Paths to a random reachable position with positive path-finding favorability.
      Parameters:
      entity - the entity doing the pathing
      horizontalRange - the horizontal pathing range (how far the point can be from the entity's starting position on the X or Z range)
      verticalRange - the vertical pathing range (how far the point can be from the entity's starting position on the Y range)
      Returns:
      chosen position or null if none could be found
      Mappings:
      Namespace Name Mixin selector
      official a Lbqn;a(Lbgc;II)Ledu;
      intermediary method_31527 Lnet/minecraft/class_5534;method_31527(Lnet/minecraft/class_1314;II)Lnet/minecraft/class_243;
      named find Lnet/minecraft/entity/ai/FuzzyTargeting;find(Lnet/minecraft/entity/mob/PathAwareEntity;II)Lnet/minecraft/util/math/Vec3d;
    • find

      @Nullable public static @Nullable Vec3d find(PathAwareEntity entity, int horizontalRange, int verticalRange, ToDoubleFunction<BlockPos> scorer)
      Paths to a random reachable position with positive path-finding favorability computed by a given function.
      Parameters:
      entity - the entity doing the pathing
      horizontalRange - the horizontal pathing range (how far the point can be from the entity's starting position on the X or Z range)
      verticalRange - the vertical pathing range (how far the point can be from the entity's starting position on the Y range)
      scorer - function to compute the path-finding favorability of a candidate position
      Returns:
      the chosen position or null if none could be found
      Mappings:
      Namespace Name Mixin selector
      official a Lbqn;a(Lbgc;IILjava/util/function/ToDoubleFunction;)Ledu;
      intermediary method_31530 Lnet/minecraft/class_5534;method_31530(Lnet/minecraft/class_1314;IILjava/util/function/ToDoubleFunction;)Lnet/minecraft/class_243;
      named find Lnet/minecraft/entity/ai/FuzzyTargeting;find(Lnet/minecraft/entity/mob/PathAwareEntity;IILjava/util/function/ToDoubleFunction;)Lnet/minecraft/util/math/Vec3d;
    • findTo

      @Nullable public static @Nullable Vec3d findTo(PathAwareEntity entity, int horizontalRange, int verticalRange, Vec3d end)
      Paths to a random reachable position leading towards a given end-point.
      Parameters:
      horizontalRange - the horizontal pathing range (how far the point can be from the entity's starting position on the X or Z range)
      verticalRange - the vertical pathing range (how far the point can be from the entity's starting position on the Y range)
      end - the position to path towards
      Returns:
      the chosen position or null if none could be found
      Mappings:
      Namespace Name Mixin selector
      official a Lbqn;a(Lbgc;IILedu;)Ledu;
      intermediary method_31528 Lnet/minecraft/class_5534;method_31528(Lnet/minecraft/class_1314;IILnet/minecraft/class_243;)Lnet/minecraft/class_243;
      named findTo Lnet/minecraft/entity/ai/FuzzyTargeting;findTo(Lnet/minecraft/entity/mob/PathAwareEntity;IILnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;
    • findFrom

      @Nullable public static @Nullable Vec3d findFrom(PathAwareEntity entity, int horizontalRange, int verticalRange, Vec3d start)
      Paths to a random reachable position leading away from a given starting point.
      Parameters:
      entity - the entity doing the pathing
      horizontalRange - the horizontal pathing range (how far the point can be from the entity's starting position on the X or Z range)
      verticalRange - the vertical pathing range (how far the point can be from the entity's starting position on the Y range)
      start - the position to path away from
      Returns:
      the chosen position or null if none could be found
      Mappings:
      Namespace Name Mixin selector
      official b Lbqn;b(Lbgc;IILedu;)Ledu;
      intermediary method_31534 Lnet/minecraft/class_5534;method_31534(Lnet/minecraft/class_1314;IILnet/minecraft/class_243;)Lnet/minecraft/class_243;
      named findFrom Lnet/minecraft/entity/ai/FuzzyTargeting;findFrom(Lnet/minecraft/entity/mob/PathAwareEntity;IILnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;
    • findValid

      @Nullable private static @Nullable Vec3d findValid(PathAwareEntity entity, int horizontalRange, int verticalRange, Vec3d direction, boolean posTargetInRange)
      Mappings:
      Namespace Name Mixin selector
      official a Lbqn;a(Lbgc;IILedu;Z)Ledu;
      intermediary method_31529 Lnet/minecraft/class_5534;method_31529(Lnet/minecraft/class_1314;IILnet/minecraft/class_243;Z)Lnet/minecraft/class_243;
      named findValid Lnet/minecraft/entity/ai/FuzzyTargeting;findValid(Lnet/minecraft/entity/mob/PathAwareEntity;IILnet/minecraft/util/math/Vec3d;Z)Lnet/minecraft/util/math/Vec3d;
    • validate

      @Nullable public static @Nullable BlockPos validate(PathAwareEntity entity, BlockPos pos)
      Checks whether a given position is a valid pathable target.
      Parameters:
      entity - the entity doing the pathing
      pos - the candidate position
      Returns:
      the input position, or null if validation failed
      Mappings:
      Namespace Name Mixin selector
      official a Lbqn;a(Lbgc;Lgu;)Lgu;
      intermediary method_31533 Lnet/minecraft/class_5534;method_31533(Lnet/minecraft/class_1314;Lnet/minecraft/class_2338;)Lnet/minecraft/class_2338;
      named validate Lnet/minecraft/entity/ai/FuzzyTargeting;validate(Lnet/minecraft/entity/mob/PathAwareEntity;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/BlockPos;
    • towardTarget

      @Nullable public static @Nullable BlockPos towardTarget(PathAwareEntity entity, int horizontalRange, boolean posTargetInRange, BlockPos relativeInRangePos)
      Paths to a random reachable position approaching an entity's chosen position target.
      Parameters:
      entity - the entity doing the pathing
      horizontalRange - the horizontal pathing range (how far the point can be from the entity's starting position on the X or Z range)
      Returns:
      the chosen position or null if none could be found
      Mappings:
      Namespace Name Mixin selector
      official a Lbqn;a(Lbgc;IZLgu;)Lgu;
      intermediary method_31532 Lnet/minecraft/class_5534;method_31532(Lnet/minecraft/class_1314;IZLnet/minecraft/class_2338;)Lnet/minecraft/class_2338;
      named towardTarget Lnet/minecraft/entity/ai/FuzzyTargeting;towardTarget(Lnet/minecraft/entity/mob/PathAwareEntity;IZLnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/BlockPos;