3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00
Paper/patches/server/1037-Make-setVelocity-method-of-Fireballs-change-the-trav.patch

31 Zeilen
1.3 KiB
Diff

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 e04500dcdc5b72cca7ac81b5d12e76822db9c8c5..22d59ca52229dc566b8dfb460b92ecd6318e6db0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
@@ -46,6 +46,18 @@ 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;