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 <liach@users.noreply.github.com>

* 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 <doublecraft.official@gmail.com>

* Apply suggestions from code review

Co-authored-by: YanisBft <doublecraft.official@gmail.com>

* Update mappings/net/minecraft/entity/ai/NoPenaltySolidTargeting.mapping

Co-authored-by: liach <liach@users.noreply.github.com>
Co-authored-by: YanisBft <doublecraft.official@gmail.com>
This commit is contained in:
liach 2021-02-23 14:33:28 -06:00 committed by GitHub
parent d9f1375826
commit 06e8b4905b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 183 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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