From f51ddcde2112fe73241df87bac7d4d77e964ce0f Mon Sep 17 00:00:00 2001 From: enbrain <69905075+enbrain@users.noreply.github.com> Date: Sat, 2 Oct 2021 03:00:45 +0900 Subject: [PATCH] Improve ProjectileEntity (#2715) * Improve ProjectileEntity * setProperties -> setVelocity * Update speed javadoc * Update divergence javadoc Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../projectile/ProjectileEntity.mapping | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/mappings/net/minecraft/entity/projectile/ProjectileEntity.mapping b/mappings/net/minecraft/entity/projectile/ProjectileEntity.mapping index 7bc9b8b3a1..85499c6e1e 100644 --- a/mappings/net/minecraft/entity/projectile/ProjectileEntity.mapping +++ b/mappings/net/minecraft/entity/projectile/ProjectileEntity.mapping @@ -3,13 +3,23 @@ CLASS net/minecraft/class_1676 net/minecraft/entity/projectile/ProjectileEntity FIELD field_23740 leftOwner Z FIELD field_28646 shot Z FIELD field_33399 owner Lnet/minecraft/class_1297; - METHOD method_24919 setProperties (Lnet/minecraft/class_1297;FFFFF)V - ARG 1 user + METHOD method_24919 setVelocity (Lnet/minecraft/class_1297;FFFFF)V + COMMENT Sets velocity and updates rotation accordingly. + ARG 1 shooter + COMMENT the entity who shot this projectile; used to add the shooter's velocity + COMMENT to this projectile ARG 2 pitch + COMMENT the pitch ARG 3 yaw + COMMENT the yaw ARG 4 roll - ARG 5 modifierZ - ARG 6 modifierXYZ + COMMENT the roll + ARG 5 speed + COMMENT the speed + ARG 6 divergence + COMMENT the fuzziness added to the direction; player usages have 1.0 and other + COMMENT mobs/tools have higher values; some mobs have difficulty-adjusted + COMMENT values METHOD method_24920 onBlockHit (Lnet/minecraft/class_3965;)V ARG 1 blockHitResult METHOD method_24921 getOwner ()Lnet/minecraft/class_1297; @@ -31,10 +41,24 @@ CLASS net/minecraft/class_1676 net/minecraft/entity/projectile/ProjectileEntity METHOD method_7454 onEntityHit (Lnet/minecraft/class_3966;)V ARG 1 entityHitResult METHOD method_7485 setVelocity (DDDFF)V + COMMENT Sets velocity and updates rotation accordingly. + COMMENT + COMMENT

The velocity and rotation will be set to the same direction. + COMMENT + COMMENT

The direction is calculated as follows: Based on the direction vector + COMMENT {@code (x, y, z)}, a random vector is added, then multiplied by the + COMMENT {@code speed}. ARG 1 x + COMMENT the X component of the direction vector ARG 3 y + COMMENT the Y component of the direction vector ARG 5 z + COMMENT the Z component of the direction vector ARG 7 speed + COMMENT the speed ARG 8 divergence + COMMENT the fuzziness added to the direction; player usages have 1.0 and other + COMMENT mobs/tools have higher values; some mobs have difficulty-adjusted + COMMENT values METHOD method_7488 onCollision (Lnet/minecraft/class_239;)V ARG 1 hitResult