From 06e8b4905b1ca704aab6d23010d1fcbf7c739a90 Mon Sep 17 00:00:00 2001 From: liach <7806504+liach@users.noreply.github.com> Date: Tue, 23 Feb 2021 14:33:28 -0600 Subject: [PATCH] Some path targeting stuff (#2030) * Some path targeting stuff I think they are very open to improvements, but I will share what I have for now Signed-off-by: liach * Update mappings/net/minecraft/entity/ai/FuzzyPositions.mapping This apparently kills mappingpoet. fun enough * Update mappings/net/minecraft/entity/ai/AboveGroundTargeting.mapping Co-authored-by: YanisBft * Apply suggestions from code review Co-authored-by: YanisBft * Update mappings/net/minecraft/entity/ai/NoPenaltySolidTargeting.mapping Co-authored-by: liach Co-authored-by: YanisBft --- .../entity/ai/AboveGroundTargeting.mapping | 14 +++++ .../entity/ai/FuzzyPositions.mapping | 51 +++++++++++++++++++ .../entity/ai/FuzzyTargeting.mapping | 38 ++++++++++++++ .../entity/ai/NavigationConditions.mapping | 25 +++++++++ .../entity/ai/NoPenaltySolidTargeting.mapping | 22 ++++++++ .../entity/ai/NoPenaltyTargeting.mapping | 23 +++++++++ .../entity/ai/NoWaterTargeting.mapping | 10 ++++ 7 files changed, 183 insertions(+) create mode 100644 mappings/net/minecraft/entity/ai/AboveGroundTargeting.mapping create mode 100644 mappings/net/minecraft/entity/ai/FuzzyPositions.mapping create mode 100644 mappings/net/minecraft/entity/ai/FuzzyTargeting.mapping create mode 100644 mappings/net/minecraft/entity/ai/NavigationConditions.mapping create mode 100644 mappings/net/minecraft/entity/ai/NoPenaltySolidTargeting.mapping create mode 100644 mappings/net/minecraft/entity/ai/NoPenaltyTargeting.mapping create mode 100644 mappings/net/minecraft/entity/ai/NoWaterTargeting.mapping diff --git a/mappings/net/minecraft/entity/ai/AboveGroundTargeting.mapping b/mappings/net/minecraft/entity/ai/AboveGroundTargeting.mapping new file mode 100644 index 0000000000..160f9a2c9d --- /dev/null +++ b/mappings/net/minecraft/entity/ai/AboveGroundTargeting.mapping @@ -0,0 +1,14 @@ +CLASS net/minecraft/class_5533 net/minecraft/entity/ai/AboveGroundTargeting + COMMENT Similar to {@link FuzzyTargeting}, but the positions this class' utility methods + COMMENT find never have pathfinding penalties and are always above ground or water. + METHOD method_31524 find (Lnet/minecraft/class_1314;IIDDFII)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 x + ARG 5 z + ARG 7 angle + ARG 8 maxAboveSolid + ARG 9 minAboveSolid + METHOD method_31526 (Lnet/minecraft/class_1314;Lnet/minecraft/class_2338;)Z + ARG 1 pos diff --git a/mappings/net/minecraft/entity/ai/FuzzyPositions.mapping b/mappings/net/minecraft/entity/ai/FuzzyPositions.mapping new file mode 100644 index 0000000000..1e4cbb7ec4 --- /dev/null +++ b/mappings/net/minecraft/entity/ai/FuzzyPositions.mapping @@ -0,0 +1,51 @@ +CLASS net/minecraft/class_5535 net/minecraft/entity/ai/FuzzyPositions + METHOD method_31537 towardTarget (Lnet/minecraft/class_1314;ILjava/util/Random;Lnet/minecraft/class_2338;)Lnet/minecraft/class_2338; + COMMENT Adjusts the input {@code fuzz} slightly toward the given {@code entity}'s + COMMENT {@link net.minecraft.entity.mob.MobEntity#getPositionTarget() position target} + COMMENT if it exists. + ARG 0 entity + ARG 1 horizontalRange + ARG 2 random + ARG 3 fuzz + METHOD method_31538 guessBestPathTarget (Lnet/minecraft/class_1314;Ljava/util/function/Supplier;)Lnet/minecraft/class_243; + COMMENT Calls {@link #guessBest(Supplier, ToDoubleFunction)} with the {@code entity}'s + COMMENT path finding favor as the {@code scorer}. + ARG 0 entity + ARG 1 factory + METHOD method_31539 upWhile (Lnet/minecraft/class_2338;IILjava/util/function/Predicate;)Lnet/minecraft/class_2338; + COMMENT Returns the {@code extraAbove + 1}th closest position higher than the + COMMENT input {@code pos} that does not fulfill {@code condition}, or a + COMMENT position with y set to {@code maxY}. + ARG 0 pos + ARG 1 extraAbove + ARG 2 max + ARG 3 condition + METHOD method_31540 upWhile (Lnet/minecraft/class_2338;ILjava/util/function/Predicate;)Lnet/minecraft/class_2338; + COMMENT Returns the closest position higher than the input {@code pos} that does + COMMENT not fulfill {@code condition}, or a position with y set to {@code maxY}. + ARG 0 pos + ARG 1 maxY + ARG 2 condition + METHOD method_31541 localFuzz (Ljava/util/Random;II)Lnet/minecraft/class_2338; + COMMENT Creates a fuzzy offset position within the given horizontal and vertical + COMMENT ranges. + ARG 0 random + ARG 1 horizontalRange + ARG 2 verticalRange + METHOD method_31542 localFuzz (Ljava/util/Random;IIIDDD)Lnet/minecraft/class_2338; + COMMENT Tries to create a fuzzy offset position from the direction and the angle + COMMENT range given. It fulfills the constraints given by {@code horizontalRange} + COMMENT and {@code verticalRange} and returns {@code null} if it cannot do so. + ARG 0 random + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 startHeight + ARG 4 xDirection + ARG 6 zDirection + ARG 8 angleRange + METHOD method_31543 guessBest (Ljava/util/function/Supplier;Ljava/util/function/ToDoubleFunction;)Lnet/minecraft/class_243; + COMMENT Returns the {@link Vec3d#ofBottomCenter(BlockPos) bottom center} of a highest scoring + COMMENT position, as determined by {@code scorer}, out of 10 tries on positions obtained from + COMMENT {@code factory}. + ARG 0 factory + ARG 1 scorer diff --git a/mappings/net/minecraft/entity/ai/FuzzyTargeting.mapping b/mappings/net/minecraft/entity/ai/FuzzyTargeting.mapping new file mode 100644 index 0000000000..2e4cab04c5 --- /dev/null +++ b/mappings/net/minecraft/entity/ai/FuzzyTargeting.mapping @@ -0,0 +1,38 @@ +CLASS net/minecraft/class_5534 net/minecraft/entity/ai/FuzzyTargeting + COMMENT Path targeting utilities using fuzzy, or approximated, positions from + COMMENT {@link FuzzyPositions}. + METHOD method_31527 find (Lnet/minecraft/class_1314;II)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + METHOD method_31528 findTo (Lnet/minecraft/class_1314;IILnet/minecraft/class_243;)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 end + METHOD method_31529 findValid (Lnet/minecraft/class_1314;IILnet/minecraft/class_243;Z)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 direction + ARG 4 posTargetInRange + METHOD method_31530 find (Lnet/minecraft/class_1314;IILjava/util/function/ToDoubleFunction;)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 scorer + METHOD method_31532 tryMake (Lnet/minecraft/class_1314;IZLnet/minecraft/class_2338;)Lnet/minecraft/class_2338; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 posTargetInRange + ARG 3 relativeInRangePos + METHOD method_31533 validate (Lnet/minecraft/class_1314;Lnet/minecraft/class_2338;)Lnet/minecraft/class_2338; + ARG 0 entity + ARG 1 pos + METHOD method_31534 findFrom (Lnet/minecraft/class_1314;IILnet/minecraft/class_243;)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 start + METHOD method_31536 (Lnet/minecraft/class_1314;Lnet/minecraft/class_2338;)Z + ARG 1 currentPos diff --git a/mappings/net/minecraft/entity/ai/NavigationConditions.mapping b/mappings/net/minecraft/entity/ai/NavigationConditions.mapping new file mode 100644 index 0000000000..6c923ea0a1 --- /dev/null +++ b/mappings/net/minecraft/entity/ai/NavigationConditions.mapping @@ -0,0 +1,25 @@ +CLASS net/minecraft/class_5493 net/minecraft/entity/ai/NavigationConditions + METHOD method_30955 hasMobNavigation (Lnet/minecraft/class_1308;)Z + ARG 0 entity + METHOD method_31517 isPositionTargetInRange (Lnet/minecraft/class_1314;I)Z + ARG 0 entity + ARG 1 extraDistance + METHOD method_31518 isWaterAt (Lnet/minecraft/class_1314;Lnet/minecraft/class_2338;)Z + ARG 0 entity + ARG 1 pos + METHOD method_31519 isInvalidPosition (Lnet/minecraft/class_1408;Lnet/minecraft/class_2338;)Z + ARG 0 navigation + ARG 1 pos + METHOD method_31520 isHeightInvalid (Lnet/minecraft/class_2338;Lnet/minecraft/class_1314;)Z + ARG 0 pos + ARG 1 entity + METHOD method_31521 isPositionTargetOutOfWalkRange (ZLnet/minecraft/class_1314;Lnet/minecraft/class_2338;)Z + ARG 0 posTargetInRange + ARG 1 entity + ARG 2 pos + METHOD method_31522 hasPathfindingPenalty (Lnet/minecraft/class_1314;Lnet/minecraft/class_2338;)Z + ARG 0 entity + ARG 1 pos + METHOD method_31523 isSolidAt (Lnet/minecraft/class_1314;Lnet/minecraft/class_2338;)Z + ARG 0 entity + ARG 1 pos diff --git a/mappings/net/minecraft/entity/ai/NoPenaltySolidTargeting.mapping b/mappings/net/minecraft/entity/ai/NoPenaltySolidTargeting.mapping new file mode 100644 index 0000000000..8905ac991d --- /dev/null +++ b/mappings/net/minecraft/entity/ai/NoPenaltySolidTargeting.mapping @@ -0,0 +1,22 @@ +CLASS net/minecraft/class_5530 net/minecraft/entity/ai/NoPenaltySolidTargeting + COMMENT Similar to {@link FuzzyTargeting}, but the positions this class' utility methods + COMMENT find never have pathfinding penalties and are always on solid blocks. + METHOD method_31504 find (Lnet/minecraft/class_1314;IIIDDD)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 startHeight + ARG 4 xDirection + ARG 6 zDirection + ARG 8 rangeAngle + METHOD method_31505 tryMake (Lnet/minecraft/class_1314;IIIDDDZ)Lnet/minecraft/class_2338; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 startHeight + ARG 4 xDirection + ARG 6 zDirection + ARG 8 rangeAngle + ARG 10 posTargetInRange + METHOD method_31506 (Lnet/minecraft/class_1314;Lnet/minecraft/class_2338;)Z + ARG 1 pos diff --git a/mappings/net/minecraft/entity/ai/NoPenaltyTargeting.mapping b/mappings/net/minecraft/entity/ai/NoPenaltyTargeting.mapping new file mode 100644 index 0000000000..db1299b62d --- /dev/null +++ b/mappings/net/minecraft/entity/ai/NoPenaltyTargeting.mapping @@ -0,0 +1,23 @@ +CLASS net/minecraft/class_5532 net/minecraft/entity/ai/NoPenaltyTargeting + COMMENT Similar to {@link FuzzyTargeting}, but the positions this class' utility methods + COMMENT find never have pathfinding penalties. + METHOD method_31510 find (Lnet/minecraft/class_1314;II)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + METHOD method_31511 find (Lnet/minecraft/class_1314;IILnet/minecraft/class_243;)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 direction + METHOD method_31512 find (Lnet/minecraft/class_1314;IILnet/minecraft/class_243;D)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 end + ARG 4 angleRange + METHOD method_31516 tryMake (Lnet/minecraft/class_1314;IZLnet/minecraft/class_2338;)Lnet/minecraft/class_2338; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 posTargetInRange + ARG 3 fuzz diff --git a/mappings/net/minecraft/entity/ai/NoWaterTargeting.mapping b/mappings/net/minecraft/entity/ai/NoWaterTargeting.mapping new file mode 100644 index 0000000000..031cba4053 --- /dev/null +++ b/mappings/net/minecraft/entity/ai/NoWaterTargeting.mapping @@ -0,0 +1,10 @@ +CLASS net/minecraft/class_5531 net/minecraft/entity/ai/NoWaterTargeting + COMMENT Similar to {@link FuzzyTargeting}, but the positions this class' utility methods + COMMENT find are never water. + METHOD method_31508 find (Lnet/minecraft/class_1314;IIILnet/minecraft/class_243;D)Lnet/minecraft/class_243; + ARG 0 entity + ARG 1 horizontalRange + ARG 2 verticalRange + ARG 3 startHeight + ARG 4 direction + ARG 5 angleRange