Remove incorrect logic for Fireball#setVelocity (#10764)
Dieser Commit ist enthalten in:
Ursprung
6de7a1f052
Commit
2a90732677
@ -462,9 +462,23 @@ index c7d6a328def83619dca9b6122aeb5870e4585e70..795e799fec7cfd65a0e08bb3f941148d
|
||||
* Mark the entity's removal.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/entity/Fireball.java b/src/main/java/org/bukkit/entity/Fireball.java
|
||||
index ceaf263bc554a92a232bd3ed18ea67ce4e0b487a..dc8ed9164f22eb140e16b9b25a82f85b873ada42 100644
|
||||
index ceaf263bc554a92a232bd3ed18ea67ce4e0b487a..fcb8a7c3e885a89191556bf4ee5edab2e926d4b1 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Fireball.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Fireball.java
|
||||
@@ -12,11 +12,11 @@ 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)
|
||||
@@ -32,4 +32,32 @@ public interface Fireball extends Projectile, Explosive {
|
||||
@NotNull
|
||||
public Vector getDirection();
|
||||
|
@ -705,30 +705,48 @@ index d30e1dd1b4525674c8a52da9b677c09a251b2467..9edcdc71b28cf08e42fbe44723ba540e
|
||||
+ // Paper end - missing entity api
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
||||
index 114e84b485a6f05eac66083d8fd71028018d57ea..3c22799d36f07e349df207ce8a39236bbf6c17bf 100644
|
||||
index 114e84b485a6f05eac66083d8fd71028018d57ea..e4e23a7b6d308ee476b5b8c2ad80efe4608b8346 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
||||
@@ -74,6 +74,20 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
|
||||
@@ -56,23 +56,29 @@ 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 17164811bbcf983bef62c47bc99330074762267b..c455deb4fd2a7684bcc01a8212c362a2375c190b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren