mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Remove incorrect logic for Fireball#setVelocity (#10764)
This commit is contained in:
parent
bbe01377d5
commit
3636a1dcf5
2 changed files with 36 additions and 4 deletions
|
@ -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.
|
||||
* <br>
|
||||
- * To also change the speed of the fireball, use {@link #setVelocity(Vector)}.
|
||||
+ * To also change the acceleration of the fireball, use {@link #setPower(Vector)}.
|
||||
* <b>Note:</b> that the client may not respect non-default speeds and will therefore
|
||||
* mispredict the location of the fireball, causing visual stutter.
|
||||
* <br>
|
||||
- * <b>Also Note:</b> that this method and {@link #setVelocity(Vector)} will override each other.
|
||||
+ * <b>Also Note:</b> 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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue