Archiviert
13
0

Preserve initial velocity of spawned entities - Fixes #4292

Dieser Commit ist enthalten in:
Aikar 2020-09-19 13:19:34 -04:00
Ursprung bd648dfb47
Commit e3e1191ac9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE

Datei anzeigen

@ -9,14 +9,28 @@ as this is how Vanilla teleports entities.
Cancel any pending motion when teleported.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3e6ccdd5b54dbe51d4ee9ec979cbc2d0f335be70..abdc68fce1ebb70ab6a25188ec1773ccbb8f37a6 100644
index 3e6ccdd5b54dbe51d4ee9ec979cbc2d0f335be70..5e1978d1c96dede07ead967c1e85a352348e7777 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1316,6 +1316,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -54,6 +54,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
+ boolean preserveMotion = true; // Paper - keep initial motion on first setPositionRotation
static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@@ -1316,6 +1317,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
+ this.mot = new Vec3D(0, 0, 0); // Paper - cancel entity velocity if teleported
+ // Paper - cancel entity velocity if teleported
+ if (!preserveMotion) {
+ this.mot = Vec3D.ORIGIN;
+ } else {
+ this.preserveMotion = false;
+ }
+ // Paper end
this.g(d0, d1, d2);
this.yaw = f;
this.pitch = f1;