Add Entity Movement Direction API (#7085)
This allows you to get player movement when riding vehicles, etc.
This commit is contained in:
parent
d8847bc1f3
commit
dd47ec6fe2
10 changed files with 107 additions and 18 deletions
|
@ -512,6 +512,68 @@ index 6b3c9bef9a8a34ddc6ff42cf358541a2665bf5e3..9c618a27d590f186f29c5d9094fc565e
|
|||
+ void setExplosionPower(int explosionPower);
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index b665b99ca6de3a35c3296a500db1527a8513a711..56a59bfee3138bfb93cbb85c5d8b86e3aa977b05 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -971,6 +971,57 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
void clearActiveItem();
|
||||
// Paper end
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Retrieves the sideways movement direction of the entity.
|
||||
+ * <p>
|
||||
+ * The returned value ranges from -1 to 1, where:
|
||||
+ * - Positive 1 represents movement to the left.
|
||||
+ * - Negative 1 represents movement to the right.
|
||||
+ * <p>
|
||||
+ * Please note that for entities of type {@link Player}, this value is updated only when riding another entity.
|
||||
+ * <p>
|
||||
+ * This method specifically provides information about the entity's sideways movement, whereas {@link #getVelocity()} returns
|
||||
+ * a vector representing the entity's overall current momentum.
|
||||
+ *
|
||||
+ * @return Sideways movement direction, ranging from -1 (right) to 1 (left).
|
||||
+ */
|
||||
+ float getSidewaysMovement();
|
||||
+
|
||||
+ /**
|
||||
+ * Retrieves the upwards movement direction of the entity.
|
||||
+ * <p>
|
||||
+ * The returned value ranges from -1 to 1, where:
|
||||
+ * - Positive 1 represents upward movement.
|
||||
+ * - Negative 1 represents downward movement.
|
||||
+ * <p>
|
||||
+ * Please note that for entities of type {@link Player}, this value is never updated.
|
||||
+ * <p>
|
||||
+ * This method specifically provides information about the entity's vertical movement,
|
||||
+ * whereas {@link #getVelocity()} returns a vector representing the entity's overall
|
||||
+ * current momentum.
|
||||
+ *
|
||||
+ * @return Upwards movement direction, ranging from -1 (downward) to 1 (upward).
|
||||
+ */
|
||||
+ float getUpwardsMovement();
|
||||
+
|
||||
+ /**
|
||||
+ * Retrieves the forwards movement direction of the entity.
|
||||
+ * <p>
|
||||
+ * The returned value ranges from -1 to 1, where:
|
||||
+ * - Positive 1 represents movement forwards.
|
||||
+ * - Negative 1 represents movement backwards.
|
||||
+ * <p>
|
||||
+ * Please note that for entities of type {@link Player}, this value is updated only when riding another entity.
|
||||
+ * <p>
|
||||
+ * This method specifically provides information about the entity's forward and backward movement,
|
||||
+ * whereas {@link #getVelocity()} returns a vector representing the entity's overall current momentum.
|
||||
+ *
|
||||
+ * @return Forwards movement direction, ranging from -1 (backward) to 1 (forward).
|
||||
+ */
|
||||
+ float getForwardsMovement();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get's remaining time a player needs to keep hands raised with an item to finish using it.
|
||||
* @return Remaining ticks to use the item
|
||||
diff --git a/src/main/java/org/bukkit/entity/Llama.java b/src/main/java/org/bukkit/entity/Llama.java
|
||||
index d23226ccb0f6c25028f000ce31346cd0a8898e6a..bc84b892cae5fe7019a3ad481e9da79956efa1fe 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Llama.java
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#swingHand(EquipmentSlot) convenience method
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 26f12a6e4b2aff8ec052342939435f1ae4c02e2d..930c328880708cea182ccb031d31305e7d1c529b 100644
|
||||
index 4c1c87c07735eecc2a1eaef2da77d3fe636adefb..ac87b7a28553425dc45af11ac6f5089f5197ce20 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1089,5 +1089,23 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
@@ -1140,5 +1140,23 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
@Deprecated
|
||||
void setHurtDirection(float hurtDirection);
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add entity knockback API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 930c328880708cea182ccb031d31305e7d1c529b..14854e1325d61d0112cc928c8a5a92a8a45249d3 100644
|
||||
index ac87b7a28553425dc45af11ac6f5089f5197ce20..eced9bfd35aa822b1ba141ea60e603bca5a137f8 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1107,5 +1107,17 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
@@ -1158,5 +1158,17 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
this.swingOffHand();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ to simulate damage done to an itemstack and all
|
|||
the logic associated with damaging them
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 14854e1325d61d0112cc928c8a5a92a8a45249d3..7889ec8e0954c98e9611a20811b1ddc5bcd93b7f 100644
|
||||
index eced9bfd35aa822b1ba141ea60e603bca5a137f8..088f42f294784e14f4478255193f4fd40cba4e53 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1119,5 +1119,52 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
@@ -1170,5 +1170,52 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
* @param directionZ The relative z position of the knockback source direction
|
||||
*/
|
||||
void knockback(double strength, double directionX, double directionZ);
|
||||
|
|
|
@ -53,10 +53,10 @@ index 9c7eba228dc1c244d49cb5139e1710804b887d6a..db4231b6e77a7cf9fe430e5207c1fc9c
|
|||
|
||||
// Paper Start - Collision API
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index f4c5ec3f7e5c29b1799eef6c4f76617e9f23c0d7..03490d35a24c056ed148e45eea27d1786a58c8fc 100644
|
||||
index 4682df5d422c24c2d145bd28bc3d0fa8b1cd6ce8..bd5e53372ce860924f5403dca6b0c45878a9e4d2 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1166,5 +1166,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
@@ -1217,5 +1217,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
* @param amount the amount of damage to do
|
||||
*/
|
||||
void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue