Pathfinding improvements (#1180)

* Pathfinding improvements

* n.m.block.BlockPlacementEnvironment -> n.m.entity.ai.pathing.NavigationType
This commit is contained in:
Joseph Burton 2020-03-17 20:21:08 +00:00 committed by GitHub
parent 9e3e56c893
commit 4b2f6a5aa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 115 additions and 9 deletions

View File

@ -113,7 +113,7 @@ CLASS net/minecraft/class_2248 net/minecraft/block/Block
ARG 4 random
METHOD method_9515 appendProperties (Lnet/minecraft/class_2689$class_2690;)V
ARG 1 builder
METHOD method_9516 canPlaceAtSide (Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_10;)Z
METHOD method_9516 canPathfindThrough (Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_10;)Z
ARG 1 state
ARG 2 world
ARG 3 pos

View File

@ -1 +0,0 @@
CLASS net/minecraft/class_10 net/minecraft/block/BlockPlacementEnvironment

View File

@ -90,7 +90,7 @@ CLASS net/minecraft/class_2680 net/minecraft/block/BlockState
METHOD method_11607 getRayTraceShape (Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Lnet/minecraft/class_265;
ARG 1 world
ARG 2 pos
METHOD method_11609 canPlaceAtSide (Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_10;)Z
METHOD method_11609 canPathfindThrough (Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_10;)Z
ARG 1 world
ARG 2 pos
ARG 3 env

View File

@ -20,3 +20,8 @@ CLASS net/minecraft/class_2323 net/minecraft/block/DoorBlock
ARG 1 world
ARG 2 pos
ARG 3 open
METHOD method_24795 isWoodenDoor (Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)Z
ARG 0 world
ARG 1 pos
METHOD method_24796 isWoodenDoor (Lnet/minecraft/class_2680;)Z
ARG 0 state

View File

@ -217,6 +217,9 @@ CLASS net/minecraft/class_1297 net/minecraft/entity/Entity
METHOD method_24516 isInRange (Lnet/minecraft/class_1297;D)Z
ARG 1 other
ARG 2 radius
METHOD method_24828 isOnGround ()Z
METHOD method_24830 setOnGround (Z)V
ARG 1 onGround
METHOD method_5621 getMountedHeightOffset ()D
METHOD method_5622 onBlockCollision (Lnet/minecraft/class_2680;)V
ARG 1 state

View File

@ -1 +1,11 @@
CLASS net/minecraft/class_15 net/minecraft/entity/ai/pathing/AmphibiousPathNodeMaker
FIELD field_64 oldWaterBorderPenalty F
FIELD field_65 oldWalkablePenalty F
METHOD method_65 getPathNode (IIIID)Lnet/minecraft/class_9;
ARG 1 x
ARG 2 y
ARG 3 z
ARG 4 maxYStep
ARG 5 prevFeetY
METHOD method_66 getFeetY (Lnet/minecraft/class_2338;)D
ARG 1 pos

View File

@ -1 +1,13 @@
CLASS net/minecraft/class_6 net/minecraft/entity/ai/pathing/BirdPathNodeMaker
METHOD method_10 getNodeType (Lnet/minecraft/class_1308;Lnet/minecraft/class_2338;)Lnet/minecraft/class_7;
ARG 1 entity
ARG 2 pos
METHOD method_22877 isPassable (Lnet/minecraft/class_9;)Z
ARG 1 node
METHOD method_22878 unvisited (Lnet/minecraft/class_9;)Z
ARG 1 node
METHOD method_9 getNodeType (Lnet/minecraft/class_1308;III)Lnet/minecraft/class_7;
ARG 1 entity
ARG 2 x
ARG 3 y
ARG 4 z

View File

@ -3,18 +3,29 @@ CLASS net/minecraft/class_1408 net/minecraft/entity/ai/pathing/EntityNavigation
FIELD field_20294 currentDistance I
FIELD field_21642 rangeMultiplier F
FIELD field_6668 speed D
FIELD field_6669 lastActiveTickMs J
FIELD field_6670 currentNodeMs J
FIELD field_6671 followRange Lnet/minecraft/class_1324;
FIELD field_6672 pathStartPos Lnet/minecraft/class_243;
FIELD field_6673 pathNodeNavigator Lnet/minecraft/class_13;
FIELD field_6674 pathStartTime I
FIELD field_6675 tickCount I
FIELD field_6677 world Lnet/minecraft/class_1937;
FIELD field_6678 nodeMaker Lnet/minecraft/class_8;
FIELD field_6679 shouldRecalculate Z
FIELD field_6680 lastNodePosition Lnet/minecraft/class_243;
FIELD field_6681 currentPath Lnet/minecraft/class_11;
FIELD field_6682 currentNodeTimeout D
FIELD field_6683 nodeReachProximity F
COMMENT If the Chebyshev distance from the entity to the next node is less than
COMMENT or equal to this value, the entity is considered "reached" the node.
FIELD field_6684 entity Lnet/minecraft/class_1308;
FIELD field_6685 lastRecalculateTime J
METHOD <init> (Lnet/minecraft/class_1308;Lnet/minecraft/class_1937;)V
ARG 1 mob
ARG 2 world
METHOD method_18053 onBlockChanged (Lnet/minecraft/class_2338;)V
ARG 1 pos
METHOD method_18416 findPathToAny (Ljava/util/Set;IZI)Lnet/minecraft/class_11;
ARG 1 positions
ARG 2 range
@ -25,6 +36,7 @@ CLASS net/minecraft/class_1408 net/minecraft/entity/ai/pathing/EntityNavigation
METHOD method_23964 setRangeMultiplier (F)V
ARG 1 rangeMultiplier
METHOD method_23965 resetRangeMultiplier ()V
METHOD method_23966 isFollowingPath ()Z
METHOD method_6333 isValidPosition (Lnet/minecraft/class_2338;)Z
ARG 1 pos
METHOD method_6334 startMovingAlong (Lnet/minecraft/class_11;D)Z
@ -34,11 +46,13 @@ CLASS net/minecraft/class_1408 net/minecraft/entity/ai/pathing/EntityNavigation
ARG 1 entity
ARG 2 speed
METHOD method_6336 createPathNodeNavigator (I)Lnet/minecraft/class_13;
ARG 1 range
METHOD method_6337 startMovingTo (DDDD)Z
ARG 1 x
ARG 3 y
ARG 5 z
ARG 7 speed
METHOD method_6339 continueFollowingPath ()V
METHOD method_6340 stop ()V
METHOD method_6341 canPathDirectlyThrough (Lnet/minecraft/class_243;Lnet/minecraft/class_243;III)Z
ARG 1 origin
@ -51,7 +65,10 @@ CLASS net/minecraft/class_1408 net/minecraft/entity/ai/pathing/EntityNavigation
METHOD method_6344 setSpeed (D)V
ARG 1 speed
METHOD method_6345 getCurrentPath ()Lnet/minecraft/class_11;
METHOD method_6346 checkTimeouts (Lnet/minecraft/class_243;)V
ARG 1 currentPos
METHOD method_6347 getPos ()Lnet/minecraft/class_243;
COMMENT The position to act as if the entity is at for pathfinding purposes
METHOD method_6348 findPathTo (Lnet/minecraft/class_2338;I)Lnet/minecraft/class_11;
ARG 1 target
ARG 2 distance
@ -71,4 +88,6 @@ CLASS net/minecraft/class_1408 net/minecraft/entity/ai/pathing/EntityNavigation
METHOD method_6356 recalculatePath ()V
METHOD method_6357 isIdle ()Z
METHOD method_6358 isAtValidPosition ()Z
METHOD method_6359 adjustPath ()V
COMMENT Adjusts the current path according to various special obstacles that may be in the way, for example sunlight
METHOD method_6360 tick ()V

View File

@ -5,7 +5,7 @@ CLASS net/minecraft/class_14 net/minecraft/entity/ai/pathing/LandPathNodeMaker
ARG 2 successor1
ARG 3 successor2
ARG 4 diagonalSuccessor
METHOD method_23476 getPathNodeType (Lnet/minecraft/class_1922;III)Lnet/minecraft/class_7;
METHOD method_23476 getLandNodeType (Lnet/minecraft/class_1922;III)Lnet/minecraft/class_7;
ARG 0 world
ARG 1 x
ARG 2 y
@ -14,8 +14,19 @@ CLASS net/minecraft/class_14 net/minecraft/entity/ai/pathing/LandPathNodeMaker
ARG 1 entity
ARG 2 x
ARG 3 y
METHOD method_58 getBasicPathNodeType (Lnet/minecraft/class_1922;III)Lnet/minecraft/class_7;
METHOD method_60 getHeight (Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)D
ARG 4 z
METHOD method_58 getCommonNodeType (Lnet/minecraft/class_1922;III)Lnet/minecraft/class_7;
ARG 0 world
ARG 1 x
ARG 2 y
ARG 3 z
METHOD method_59 getNodeTypeFromNeighbors (Lnet/minecraft/class_1922;IIILnet/minecraft/class_7;)Lnet/minecraft/class_7;
ARG 0 world
ARG 1 x
ARG 2 y
ARG 3 z
ARG 4 type
METHOD method_60 getFeetY (Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)D
ARG 0 world
ARG 1 pos
METHOD method_61 adjustNodeType (Lnet/minecraft/class_1922;ZZLnet/minecraft/class_2338;Lnet/minecraft/class_7;)Lnet/minecraft/class_7;
@ -29,11 +40,14 @@ CLASS net/minecraft/class_14 net/minecraft/entity/ai/pathing/LandPathNodeMaker
ARG 2 y
ARG 3 z
ARG 4 maxYStep
ARG 5 height
ARG 5 prevFeetY
ARG 7 direction
METHOD method_63 getNodeType (Lnet/minecraft/class_1308;Lnet/minecraft/class_2338;)Lnet/minecraft/class_7;
ARG 1 entity
METHOD method_64 getNodeType (Lnet/minecraft/class_1922;IIIIIIZZLjava/util/EnumSet;Lnet/minecraft/class_7;Lnet/minecraft/class_2338;)Lnet/minecraft/class_7;
ARG 2 pos
METHOD method_64 findNearbyNodeTypes (Lnet/minecraft/class_1922;IIIIIIZZLjava/util/EnumSet;Lnet/minecraft/class_7;Lnet/minecraft/class_2338;)Lnet/minecraft/class_7;
COMMENT Adds the node types in the box with the given size to the input EnumSet.
COMMENT @return The node type at the least coordinates of the input box.
ARG 1 world
ARG 2 x
ARG 3 y

View File

@ -2,5 +2,29 @@ CLASS net/minecraft/class_1409 net/minecraft/entity/ai/pathing/MobNavigation
FIELD field_6686 avoidSunlight Z
METHOD method_6361 setAvoidSunlight (Z)V
ARG 1 avoidSunlight
METHOD method_6362 getPathfindingY ()I
COMMENT The y-position to act as if the entity is at for pathfinding purposes
METHOD method_6363 setCanPathThroughDoors (Z)V
ARG 1 canPathThroughDoors
METHOD method_6364 allVisibleAreSafe (IIIIIILnet/minecraft/class_243;DD)Z
ARG 1 centerX
ARG 2 centerY
ARG 3 centerZ
ARG 4 xSize
ARG 5 ySize
ARG 6 zSize
ARG 7 entityPos
ARG 8 lookVecX
ARG 10 lookVecZ
METHOD method_6366 canEnterOpenDoors ()Z
METHOD method_6367 allVisibleArePassable (IIIIIILnet/minecraft/class_243;DD)Z
COMMENT Checks whether all blocks in the box which are visible (in front of) the mob can be pathed through
ARG 1 x
ARG 2 y
ARG 3 z
ARG 4 xSize
ARG 5 ySize
ARG 6 zSize
ARG 7 entityPos
ARG 8 lookVecX
ARG 10 lookVecZ

View File

@ -0,0 +1 @@
CLASS net/minecraft/class_10 net/minecraft/entity/ai/pathing/NavigationType

View File

@ -5,8 +5,11 @@ CLASS net/minecraft/class_5 net/minecraft/entity/ai/pathing/PathMinHeap
ARG 1 node
METHOD method_3 setNodeWeight (Lnet/minecraft/class_9;F)V
ARG 1 node
ARG 2 weight
METHOD method_4 shiftUp (I)V
ARG 1 index
METHOD method_5 clear ()V
METHOD method_6 pop ()Lnet/minecraft/class_9;
METHOD method_7 shiftDown (I)V
ARG 1 index
METHOD method_8 isEmpty ()Z

View File

@ -1,10 +1,16 @@
CLASS net/minecraft/class_8 net/minecraft/entity/ai/pathing/PathNodeMaker
FIELD field_20622 cachedWorld Lnet/minecraft/class_1950;
FIELD field_25 canSwim Z
FIELD field_27 canOpenDoors Z
FIELD field_28 entityBlockZSize I
FIELD field_29 canEnterOpenDoors Z
FIELD field_30 entityBlockYSize I
FIELD field_31 entityBlockXSize I
FIELD field_32 pathNodeCache Lit/unimi/dsi/fastutil/ints/Int2ObjectMap;
FIELD field_33 entity Lnet/minecraft/class_1308;
METHOD method_12 init (Lnet/minecraft/class_1950;Lnet/minecraft/class_1308;)V
ARG 1 cachedWorld
ARG 2 entity
METHOD method_13 getNode (III)Lnet/minecraft/class_9;
ARG 1 x
ARG 2 y
@ -38,7 +44,8 @@ CLASS net/minecraft/class_8 net/minecraft/entity/ai/pathing/PathNodeMaker
METHOD method_22 canSwim ()Z
METHOD method_23 canEnterOpenDoors ()Z
METHOD method_24 canOpenDoors ()Z
METHOD method_25 getNodeType (Lnet/minecraft/class_1922;III)Lnet/minecraft/class_7;
METHOD method_25 getDefaultNodeType (Lnet/minecraft/class_1922;III)Lnet/minecraft/class_7;
COMMENT Gets the path node type at the given position without adjusting the node type according to whether the entity can enter or open doors
ARG 1 world
ARG 2 x
ARG 3 y

View File

@ -1,3 +1,5 @@
CLASS net/minecraft/class_7 net/minecraft/entity/ai/pathing/PathNodeType
FIELD field_13 defaultPenalty F
METHOD <init> (Ljava/lang/String;IF)V
ARG 3 defaultPenalty
METHOD method_11 getDefaultPenalty ()F

View File

@ -1 +1,2 @@
CLASS net/minecraft/class_1410 net/minecraft/entity/ai/pathing/SpiderNavigation
FIELD field_6687 targetPos Lnet/minecraft/class_2338;

View File

@ -1 +1,2 @@
CLASS net/minecraft/class_1412 net/minecraft/entity/ai/pathing/SwimNavigation
FIELD field_6689 canJumpOutOfWater Z

View File

@ -1,7 +1,12 @@
CLASS net/minecraft/class_12 net/minecraft/entity/ai/pathing/WaterPathNodeMaker
FIELD field_58 canJumpOutOfWater Z
METHOD <init> (Z)V
ARG 1 canJumpOutOfWater
METHOD method_50 getNodeType (III)Lnet/minecraft/class_7;
ARG 1 x
ARG 2 y
ARG 3 z
METHOD method_51 getPathNodeInWater (III)Lnet/minecraft/class_9;
ARG 1 x
ARG 2 y
ARG 3 z