mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Preserve initial velocity of spawned entities - Fixes #4292
This commit is contained in:
parent
0aa0eba111
commit
97b9071852
@ -12,11 +12,25 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
|
Loading…
Reference in New Issue
Block a user