mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-28 19:03:51 -07:00
Remove incorrect logic for Fireball#setVelocity (#10764)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user