mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Make setVelocity method of Fireballs change the travel direction to an arbitrary vector (#9815)
This commit is contained in:
parent
ec584ef1c3
commit
62d89ef9e4
2 changed files with 34 additions and 5 deletions
|
@ -0,0 +1,30 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: TrollyLoki <trollyloki@gmail.com>
|
||||||
|
Date: Tue, 10 Oct 2023 00:45:01 -0400
|
||||||
|
Subject: [PATCH] Make setVelocity method of Fireballs change the travel
|
||||||
|
direction to an arbitrary vector
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- 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 {
|
||||||
|
update(); // SPIGOT-6579
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Paper start - set direction without normalizing
|
||||||
|
+ @Override
|
||||||
|
+ public void setVelocity(Vector velocity) {
|
||||||
|
+ Preconditions.checkArgument(velocity != null, "Vector velocity cannot be null");
|
||||||
|
+ velocity.checkFinite();
|
||||||
|
+ this.getHandle().xPower = velocity.getX();
|
||||||
|
+ this.getHandle().yPower = velocity.getY();
|
||||||
|
+ this.getHandle().zPower = velocity.getZ();
|
||||||
|
+ update();
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public AbstractHurtingProjectile getHandle() {
|
||||||
|
return (AbstractHurtingProjectile) entity;
|
|
@ -121,7 +121,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
return Optional.of(InteractionResult.FAIL);
|
return Optional.of(InteractionResult.FAIL);
|
||||||
}
|
}
|
||||||
entity.playSound(((Bucketable) entity).getPickupSound(), 1.0F, 1.0F);
|
entity.playSound(((Bucketable) entity).getPickupSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
|
Loading…
Reference in a new issue