mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 12:11:35 +01:00
Remove incorrect logic for Fireball#setVelocity (#10764)
This commit is contained in:
parent
bbe01377d5
commit
3636a1dcf5
@ -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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Fireball.java
|
--- a/src/main/java/org/bukkit/entity/Fireball.java
|
||||||
+++ b/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 {
|
@@ -0,0 +0,0 @@ public interface Fireball extends Projectile, Explosive {
|
||||||
@NotNull
|
@NotNull
|
||||||
public Vector getDirection();
|
public Vector getDirection();
|
||||||
|
@ -709,26 +709,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
||||||
+++ b/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 {
|
@@ -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
|
this.update(); // SPIGOT-6579
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ // Paper - fix upstream bug where they thought x/y/zPower was velocity
|
||||||
|
+
|
||||||
+ // Paper start - Expose power on fireball projectiles
|
+ // 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) {
|
+ public void setPower(final Vector power) {
|
||||||
+ this.getHandle().xPower = power.getX();
|
+ this.getHandle().xPower = power.getX();
|
||||||
+ this.getHandle().yPower = power.getY();
|
+ this.getHandle().yPower = power.getY();
|
||||||
+ this.getHandle().zPower = power.getZ();
|
+ this.getHandle().zPower = power.getZ();
|
||||||
|
+ this.update();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public Vector getPower() {
|
+ public Vector getPower() {
|
||||||
+ return new Vector(this.getHandle().xPower, this.getHandle().yPower, this.getHandle().zPower);
|
+ return new Vector(this.getHandle().xPower, this.getHandle().yPower, this.getHandle().zPower);
|
||||||
+ }
|
}
|
||||||
+ // Paper end - Expose power on fireball projectiles
|
+ // Paper end - Expose power on fireball projectiles
|
||||||
+
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractHurtingProjectile getHandle() {
|
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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
||||||
|
Loading…
Reference in New Issue
Block a user