-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add Bee#set/getTimeSinceSting() methods (#12719) #12792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
public void setTimeSinceSting(final int time) { | ||
this.getHandle().setTimeSinceSting(time); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't have source in front of me, are there any range restrictions on this number? Like should it never be negative? That sort of thing.
@Machine-Maker Done. Made the |
As it was said before, please use an AT ( |
Now I used Access Transformer |
@Override | ||
public void setTimeSinceSting(int time) { | ||
if (time < 0) { | ||
throw new IllegalArgumentException("Time since sting cannot be negative"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use a precondition, can you also rebuild patches to sort the AT file if you don't mind.
Can also put the @ NonNegative annotation for the api.
@Lulu13022002 Done. Used |
Description
Adds API methods to get and set the time since a bee last stung, allowing better control over bee behavior after stinging.
Problem
Currently there's no way to access or modify the
timeSinceSting
field through the API. This prevents plugins from properly managing bee behavior when usingsetHasStung(false)
to make bees attack repeatedly, as thetimeSinceSting
value keeps increasing and can eventually cause the bee to die.Solution
Added two new methods to the Bee API:
getTimeSinceSting()
- Returns the number of ticks since the bee last stungsetTimeSinceSting(int time)
- Sets the number of ticks since the bee last stungCloses #12719