Fix entity motion tag from mob spawners (#5718)

This commit is contained in:
Nassim 2021-05-24 11:18:26 +02:00 committed by GitHub
parent 2d34898b55
commit 615df3d8a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,14 +31,14 @@ index 1d154ef60fd979340cf925748251669e860d4094..68f8a7f227c4d683d4c13d634ccfbabe
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait));
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 743d4725c0a26a8abd0a98eed2ec45ffba6211ad..344862c3f479ae7b6d4f929c9ef7882aba983ffb 100644
index 743d4725c0a26a8abd0a98eed2ec45ffba6211ad..58d9dce288ab9cc1989cfcb66703b76fdabf1319 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -145,6 +145,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
+ boolean preserveMotion = true; // Paper - keep initial motion on first setPositionRotation
+ public 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;
}
@ -56,6 +56,18 @@ index 743d4725c0a26a8abd0a98eed2ec45ffba6211ad..344862c3f479ae7b6d4f929c9ef7882a
this.g(d0, d1, d2);
this.yaw = f;
this.pitch = f1;
diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
index 5538404456dfee42257fad9040fcc0fefdfc5fab..33a5dbcc11455f81088d9fd685a8c4b1b8f4b1f2 100644
--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
@@ -165,6 +165,7 @@ public abstract class MobSpawnerAbstract {
return;
}
+ entity.preserveMotion = true; // Paper - preserve entity motion from tag
entity.setPositionRotation(entity.locX(), entity.locY(), entity.locZ(), world.random.nextFloat() * 360.0F, 0.0F);
if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 387f6f6fa9bbb1cce544cfb907f68c7993752dd7..fb52a60437d48282f3e99e7eccb0e76b446155f9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java