[SPIGOT-6993] Force option for Fireball#setDirection(Vector) Created: 11/Apr/22  Updated: 25/Dec/24  Resolved: 04/May/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: TrollyLoki Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: API
Environment:

N/A


Version: CraftBukkit version 3475-Spigot-ffceeae-b5559f8 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

The setDirection method in the Fireball class does not allow you to change the magnitude of the vector (i.e. the fireball's speed) because of the underlying vanilla normalization.

I would like an additional option to force set the power values on the fireball to arbitrary values, especially as this is already possible with the vanilla /data command. This could be also be used to freeze fireballs in place.



 Comments   
Comment by Marvin Rieple [ 04/May/24 ]

Made a PR for this, with the limitations mentioned in my previous comment: craftbukkit#1396

You can test it with BuildTools:

java -jar BuildTools.jar --rev 4148 --compile spigot --pr craftbukkit:1396 --pr bukkit:1006 
Comment by Marvin Rieple [ 04/May/24 ]

The client will always normalize the power value, if it is not 0, so even if we allow setting the power via #setVelocity to random values, it will cause client stutter, since the client will wrongly predict the location of the fireball.

Also see MC-80142

Comment by Arti_Creep [ 07/Jun/23 ]

The feature should be implemented regardless in my opinion.

Comment by TrollyLoki [ 17/Apr/22 ]

That seems reasonable to me.

Comment by md_5 [ 17/Apr/22 ]

Wouldn't changing setVelocity to be an unnormalized setDirection ok?

Comment by TrollyLoki [ 13/Apr/22 ]

The JavaDocs explicitly state that fireballs "do not take setVelocity(...) well."

Comment by FreeSoccerHDX [ 13/Apr/22 ]

But is the speed not set with the setVelocity method ? 
You should try that

Comment by TrollyLoki [ 13/Apr/22 ]

There is vanilla code that normalizes the vector passed to that method, which currently cannot be bypassed without nms.

Comment by FreeSoccerHDX [ 12/Apr/22 ]

Not rly sure what you want.... but did you try #setVelocity(Vector) ?

Generated at Tue Apr 08 01:20:53 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.