-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
FishHook - add method to retrieve #12310
base: main
Are you sure you want to change the base?
Conversation
paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
Outdated
Show resolved
Hide resolved
paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
Outdated
Show resolved
Hide resolved
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.
We shouldn't allow plugins to pass in an itemstack at all. instead we should get the itemstack thats in the provided hand and ensure its a fishing rod. i am not sure whether calling this method with a stack other than a rod will cause any internal problems however i think it might cause some issues for plugins expecting the PlayerFishEvent to always be called with a rod
I can definitely change it, since it seems to be consensus. for the record:
The passed ItemStack appears to be only used for criteria triggers and for the loot table. (Although not sure what it does exactly in the loot table)
The event doesn't use this itemstack, it appears to grab straight from the slot of the player. I guess at the end of the day its pretty useless to allow passing in another itemstack, ill change it. |
Update, I have removed the ItemStack from the method, and now retrieving it from the player based on the provided slot. |
This PR aims to add a method to retrieve the current fish hook casted by a player.
I've seen this asked for many times, so I think its my time to add this.
Looking for some feedback on a few things:
CraftItemStack.asNMSCopy()
= I chose this method to prevent actually damaging the original ItemStack, allowing the dev to do the damage themselves, they may or may not want this.Opinions here would be appreciated. Should it be a copy? Should it be the original?
Another option could be nixing the ItemStack all together, and internally handle it (grab based on slot chosen), maybe a boolean like
shouldDamage
, where could then decide to use copy/original.Actually nevermind nixing the itemstack, maybe the dev wants to pass thru some super powerful fishing rod. Ohhh the possibilities.
This could go so many different ways, so feedback would be nice :)