diff --git a/patches/api/Missing-Entity-API.patch b/patches/api/Missing-Entity-API.patch index e326a52d24..c8f2ab9991 100644 --- a/patches/api/Missing-Entity-API.patch +++ b/patches/api/Missing-Entity-API.patch @@ -465,6 +465,20 @@ diff --git a/src/main/java/org/bukkit/entity/Fireball.java b/src/main/java/org/b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Fireball.java +++ b/src/main/java/org/bukkit/entity/Fireball.java +@@ -0,0 +0,0 @@ public interface Fireball extends Projectile, Explosive { + * Sets the direction the fireball should be flying towards. + * The direction vector will be normalized and the default speed will be applied. + *
+- * To also change the speed of the fireball, use {@link #setVelocity(Vector)}. ++ * To also change the acceleration of the fireball, use {@link #setPower(Vector)}. + * Note: that the client may not respect non-default speeds and will therefore + * mispredict the location of the fireball, causing visual stutter. + *
+- * Also Note: that this method and {@link #setVelocity(Vector)} will override each other. ++ * Also Note: that this method and {@link #setPower(Vector)} will override each other. + * + * @param direction the direction this fireball should be flying towards + * @see #setVelocity(Vector) @@ -0,0 +0,0 @@ public interface Fireball extends Projectile, Explosive { @NotNull public Vector getDirection(); diff --git a/patches/server/Missing-Entity-API.patch b/patches/server/Missing-Entity-API.patch index a229b75ebd..b188c97f81 100644 --- a/patches/server/Missing-Entity-API.patch +++ b/patches/server/Missing-Entity-API.patch @@ -709,26 +709,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java @@ -0,0 +0,0 @@ public class CraftFireball extends AbstractProjectile implements Fireball { + public void setDirection(Vector direction) { + Preconditions.checkArgument(direction != null, "Vector direction cannot be null"); + if (direction.isZero()) { +- this.setVelocity(direction); ++ this.setPower(direction); // Paper + return; + } + this.getHandle().assignPower(direction.getX(), direction.getY(), direction.getZ()); this.update(); // SPIGOT-6579 } ++ // Paper - fix upstream bug where they thought x/y/zPower was velocity ++ + // Paper start - Expose power on fireball projectiles -+ @Override + @Override +- public void setVelocity(Vector velocity) { +- Preconditions.checkArgument(velocity != null, "Vector velocity cannot be null"); +- // SPIGOT-6993: Allow power to be higher / lower than the normalized direction enforced by #setDirection(Vector) +- // Note: Because of MC-80142 the fireball will stutter on the client when setting the velocity to something other than 0 or the normalized vector * 0.1 +- this.getHandle().xPower = velocity.getX(); +- this.getHandle().yPower = velocity.getY(); +- this.getHandle().zPower = velocity.getZ(); +- this.update(); // SPIGOT-6579 + public void setPower(final Vector power) { + this.getHandle().xPower = power.getX(); + this.getHandle().yPower = power.getY(); + this.getHandle().zPower = power.getZ(); ++ this.update(); + } + + @Override + public Vector getPower() { + return new Vector(this.getHandle().xPower, this.getHandle().yPower, this.getHandle().zPower); -+ } + } + // Paper end - Expose power on fireball projectiles -+ + @Override public AbstractHurtingProjectile getHandle() { - return (AbstractHurtingProjectile) this.entity; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java