Preserve velocity for fireball (#10934)

This commit is contained in:
Lulu13022002 2024-06-21 20:06:31 +02:00 committed by GitHub
parent 0409a68f50
commit 9cd0201535
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 49 additions and 25 deletions

View file

@ -56,6 +56,18 @@ index f2855de7320dc9532d0b568b84b0b7e5a2064045..1e65bfa3d2f3a178803c530e1610c940
this.setPosRaw(x, y, z);
this.setYRot(yaw);
this.setXRot(pitch);
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
index a28e6b6a50cfd9191732ad2e4aca5f639a1fae75..244e328c6f67cfa543ee283715bb3b89dbaa0f0c 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
@@ -78,6 +78,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
}
DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, vec34.normalize());
+ dragonFireball.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported
dragonFireball.moveTo(o, p, q, 0.0F, 0.0F);
if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events
this.dragon.level().addFreshEntity(dragonFireball);
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index b90127f9f805fdb5bb43a4b8ad2b10499b0b6b78..8efc06d29c62fa2be8515ed3359d52a6d4b807d2 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
@ -81,3 +93,15 @@ index 34321f095e12ea0cca34ff1ec00819c6350205a8..5f5788a502642463091fb76e98703aae
// SPIGOT-619: Force sync head rotation also
this.entity.setYHeadRot(location.getYaw());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 344ef786330d1247fdfb56ef04be130c9ffb7d8f..af5aab1755f80222a249b1cc7da595af78dccbbd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -590,6 +590,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
((AbstractHurtingProjectile) launch).projectileSource = this;
+ launch.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported
launch.moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
} else if (LlamaSpit.class.isAssignableFrom(projectile)) {
Location location = this.getEyeLocation();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#clearActiveItem
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 344ef786330d1247fdfb56ef04be130c9ffb7d8f..69917c67228ccf51ebee8965e4fb8e58c9b7e8ec 100644
index af5aab1755f80222a249b1cc7da595af78dccbbd..02160f138128cbb1f7391061128f8b6e74549f50 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -936,6 +936,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -937,6 +937,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return this.getHandle().getUseItem().asBukkitMirror();
}

View file

@ -36,10 +36,10 @@ index 9393e9d21fcc41cb0f20b98d9f28c95b0e523f62..796945fb1a8b43987ed9f01375113b2c
public int getSleepTicks() {
return this.getHandle().sleepCounter;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 69917c67228ccf51ebee8965e4fb8e58c9b7e8ec..d29de162033aaa59b8f9861e0657ee8717291a71 100644
index 02160f138128cbb1f7391061128f8b6e74549f50..498d5097597a35827f4293b303a956fcf63bb52d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -993,4 +993,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -994,4 +994,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().take(((CraftItem) item).getHandle(), quantity);
}
// Paper end - pickup animation API

View file

@ -38,10 +38,10 @@ index 5678d2007d5adf45dec0638c5dd848b601801814..0a7ed5a4f1644a70d8f98ad7a6962b81
+ // Paper end - living entity allow attribute registration
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index d29de162033aaa59b8f9861e0657ee8717291a71..fe827bd8c847e6a4dccf6af5f5e7e73ed40e0beb 100644
index 498d5097597a35827f4293b303a956fcf63bb52d..e03a8bbd13da81644d9f302724c27705d812a10f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -756,6 +756,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -757,6 +757,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return this.getHandle().craftAttributes.getAttribute(attribute);
}

View file

@ -45,10 +45,10 @@ index 04a39cb6c13c26e2cb1d73a9da98df5d04df69bc..5d137f8c42356359701e1bea7525f82c
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index fe827bd8c847e6a4dccf6af5f5e7e73ed40e0beb..f68754e2ca352583f09e1d80cebf6eb11eb71eeb 100644
index e03a8bbd13da81644d9f302724c27705d812a10f..64a6ceeccc1464c83a837bdedbe729273cad5343 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -629,6 +629,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -630,6 +630,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return this.getHandle().hasLineOfSight(((CraftEntity) other).getHandle());
}

View file

@ -828,7 +828,7 @@ index 2cec61a1bb050c1ef81c5fc3d0afafe9ff29d459..97fa4e1e70203194bd939618b2fad926
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index f68754e2ca352583f09e1d80cebf6eb11eb71eeb..ba1a9726ca269d9eda29aa3c3661c380fc099041 100644
index 64a6ceeccc1464c83a837bdedbe729273cad5343..543c5b53b0bf32ad8f9a87437fa8b3a472de178b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -123,6 +123,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@ -845,7 +845,7 @@ index f68754e2ca352583f09e1d80cebf6eb11eb71eeb..ba1a9726ca269d9eda29aa3c3661c380
@Override
public double getAbsorptionAmount() {
return this.getHandle().getAbsorptionAmount();
@@ -908,14 +915,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -909,14 +916,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean isInvisible() {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Stinger API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index ba1a9726ca269d9eda29aa3c3661c380fc099041..d1e578ef86f730a3294fdc6330e3ad25572cd6b1 100644
index 543c5b53b0bf32ad8f9a87437fa8b3a472de178b..e3487e8429b285519a0a12d6d283266225b75a80 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -361,6 +361,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View file

@ -202,7 +202,7 @@ index 7fbf4fba8df8f47b730a46068e68b33502ed63f8..c5265e9731f32b08916a60067ee5ae3f
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(ResourceLocation.parse(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index d1e578ef86f730a3294fdc6330e3ad25572cd6b1..77330142a8c771befd473784ca90608ccd8d4c0d 100644
index e3487e8429b285519a0a12d6d283266225b75a80..464d67075e052f13e86b51f3e71d05a6536ef540 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -524,6 +524,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View file

@ -515,10 +515,10 @@ index 6e2f91423371ead9890095cf4b1e2299c4dcba28..9d8f4b7176e60180565e3134a14ecf19
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 77330142a8c771befd473784ca90608ccd8d4c0d..7a673ed23eb4aec1dd3d558ad1fd81ceb899ca92 100644
index 464d67075e052f13e86b51f3e71d05a6536ef540..cc33f39dc31692e9309e62c09463e1cc621e2534 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -649,7 +649,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -650,7 +650,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} else if (Firework.class.isAssignableFrom(projectile)) {
Location location = this.getEyeLocation();

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 7a673ed23eb4aec1dd3d558ad1fd81ceb899ca92..790f274948d5a9563ab222cffa6e6df1410d1cf0 100644
index cc33f39dc31692e9309e62c09463e1cc621e2534..d0601fa54f804059b86cf8d5d459b756308e360b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -569,8 +569,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@ -25,7 +25,7 @@ index 7a673ed23eb4aec1dd3d558ad1fd81ceb899ca92..790f274948d5a9563ab222cffa6e6df1
Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation");
net.minecraft.world.level.Level world = ((CraftWorld) this.getWorld()).getHandle();
@@ -658,6 +665,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -659,6 +666,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add entity knockback API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 790f274948d5a9563ab222cffa6e6df1410d1cf0..af1aa0a488fba542954b5d86b19e96e74e458e31 100644
index d0601fa54f804059b86cf8d5d459b756308e360b..766052686d2b7ba479c503b675e7a8cc49590bbe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1097,4 +1097,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -1098,4 +1098,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
throw new UnsupportedOperationException("Cannot set the hurt direction on a non player");
}
// Paper end - hurt direction API

View file

@ -51,10 +51,10 @@ index d825c2e3808e44db9935dab4e7b528146c6d83c2..96a7e80e3efab1bf626fb7aff61e095c
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index af1aa0a488fba542954b5d86b19e96e74e458e31..557628f9a2868788e7b265445b01a38f6fd99a31 100644
index 766052686d2b7ba479c503b675e7a8cc49590bbe..30c3abfdc9280a1ec21a28bd9aef25dd7f509916 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1105,4 +1105,48 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -1106,4 +1106,48 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().knockback(strength, directionX, directionZ);
};
// Paper end - knockback API

View file

@ -133,10 +133,10 @@ index 1a291dd8a287db30e71dcb315599fc4b038764c4..30d62ee4d5cd2ddacb8783b5bbbf475d
public int getHealth() {
return this.getHandle().health;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 557628f9a2868788e7b265445b01a38f6fd99a31..195cbff1253ed864fb18984ff6db928aac2bf8aa 100644
index 30c3abfdc9280a1ec21a28bd9aef25dd7f509916..66611d26cbb7b70003e1a3fec375da0782e113bb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1149,4 +1149,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -1150,4 +1150,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
nmsStack.hurtAndBreak(amount, this.getHandle(), slot, true);
}
// Paper end - ItemStack damage API

View file

@ -43,10 +43,10 @@ index 3c1e199316ae283210529d4d27b4f9d70b4d9404..d8b1cdc78eb234023a42d74059900973
@Override
public boolean isInvisible() { // Paper - moved up from LivingEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 195cbff1253ed864fb18984ff6db928aac2bf8aa..292e1701694b0cb0cb9103244e6e59e07b5838b2 100644
index 66611d26cbb7b70003e1a3fec375da0782e113bb..c64a2efd3c66ac9f4d4fcfb684b8406be22c8f81 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1162,4 +1162,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -1163,4 +1163,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().frictionState = state;
}
// Paper end - friction API

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add method to remove all active potion effects
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 292e1701694b0cb0cb9103244e6e59e07b5838b2..a1e715629313346f670bce92483996122b0f1d7b 100644
index c64a2efd3c66ac9f4d4fcfb684b8406be22c8f81..b3970222ed979dda5296ce472739c112b70d0e89 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -563,6 +563,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {