Skip to content

Expose power on fireballs#10302

Merged
lynxplay merged 3 commits into
PaperMC:masterfrom
TonytheMacaroni:fireball-velocity
Mar 20, 2024
Merged

Expose power on fireballs#10302
lynxplay merged 3 commits into
PaperMC:masterfrom
TonytheMacaroni:fireball-velocity

Conversation

@TonytheMacaroni
Copy link
Copy Markdown
Contributor

@TonytheMacaroni TonytheMacaroni commented Mar 6, 2024

Fixes #10186.

Patch previously modified the power of the projectile, which actually controls how fast it accelerates. It now uses AbstractHurtingProjectile#setDirection, which also sets the power, but uses the default magnitude of 0.1.

Considered also directly exposing the power, but was unsure exactly on the best approach of implementing it. AbstractHurtingProjectile#setDirection assumes a magnitude of 0.1, which would need changing if power could be changed. Could either calculate the magnitude from the current power on setting direction, which would need some consideration for when the projectile is created, or including a field for it that's set when the power is modified.

Now entirely reverts the original patch, and adds a javadoc comment to Fireball#setVelocity to note that fireballs accelerate in the direction of their power. Also added Fireball#setPower and Fireball#getPower to control the power of the projectile. Currently Fireball#getDirection and Fireball#getPower do the same thing - should I remove Fireball#getPower or deprecate Fireball#getDirection for its misleading name?

@TonytheMacaroni TonytheMacaroni requested a review from a team as a code owner March 6, 2024 00:08
@TonytheMacaroni
Copy link
Copy Markdown
Contributor Author

TonytheMacaroni commented Mar 6, 2024

On second thought, is setting the direction when you set the velocity even a sensible thing to do? Perhaps just a javadoc note on Fireball#setVelocity is necessary to clarify that setting the velocity does not change the direction the fireball accelerates? Ended up doing this.

@TonytheMacaroni TonytheMacaroni changed the title Change the direction, rather than the power of fireballs Expose power on fireballs Mar 6, 2024
Comment thread patches/api/0466-Expose-power-for-fireball-projectiles.patch Outdated
Comment thread patches/server/0948-Expose-power-on-fireball-projectiles.patch Outdated
@lynxplay lynxplay force-pushed the fireball-velocity branch from f06521f to 895a1ef Compare March 20, 2024 21:02
@lynxplay lynxplay merged commit 41ffa0c into PaperMC:master Mar 20, 2024
@TonytheMacaroni TonytheMacaroni deleted the fireball-velocity branch July 25, 2024 18:57
LeonTG pushed a commit to LeonTG/Paper that referenced this pull request May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fireball setVelocity incorrectly sets power

4 participants