Paper icon indicating copy to clipboard operation
Paper copied to clipboard

make bookshelf power configurable and refresh enchantment hint of menu after editing bookshelf power

Open I-am-ddang opened this issue 9 months ago • 17 comments

I-am-ddang avatar Mar 27 '25 08:03 I-am-ddang

Welcome to paper :partying_face:

It appears you commit / generate a whole slew of completely unrelated and invalid changes. Please make sure to remove them so we can review your PR change.

lynxplay avatar Mar 27 '25 14:03 lynxplay

I would suggest rebasing this PR or creating a new one

electronicboy avatar Mar 27 '25 16:03 electronicboy

I would suggest rebasing this PR or creating a new one

I don't want to create a new one because this is my first PR and its number is 12345. I will look into rebasing the codes

I-am-ddang avatar Mar 27 '25 16:03 I-am-ddang

wait. it is not done. I will inform it is ready for review when I end all of rebase procedure

I-am-ddang avatar Mar 30 '25 09:03 I-am-ddang

I did it. I am now the master of rebase. I am ready for review.

I-am-ddang avatar Mar 30 '25 09:03 I-am-ddang

@lynxplay @electronicboy I'd glad for you to take a look whenever you are not busy guys. thanks for your patient.

I-am-ddang avatar Mar 31 '25 22:03 I-am-ddang

wait I will reopen PR right now. it was accident

I-am-ddang avatar Apr 06 '25 10:04 I-am-ddang

I am not sure if I do it right. waiting for review.

I-am-ddang avatar Apr 17 '25 03:04 I-am-ddang

THIS IS PULL REQEUST #12345 AND I LOVE IT (soory this might be off topic but i had to say it)

dashiellbenton avatar Apr 22 '25 16:04 dashiellbenton

I will fix the build error as soon as possible.

I-am-ddang avatar Apr 22 '25 23:04 I-am-ddang

@Strokkur424 your idea is previous my idea.

when I discussed this feature at Paper discord's paper-dev channel, I suggest that structure but lynxplay adviced me that, in his opinion, making the event just set value is not good idea

(the discord dialog link that starts to discuss this feature with lynxplay: https://discord.com/channels/289587909051416579/555462289851940864/1347917294382219417)

So I should change original PrepareItemEnchantEvent. Yeah. I also think it would be good if offers method have more role. and I think "why doesn't it process the values of offers member field at constructor point with considering the bonus value is changed? it would be easy way to handle the logic when making an event." but that is not really feasible. because paper-api package can not import the code from paper-src. (I don't know the principle why it should be like it.)

Finally my decision is making bonus member field non final instead of making new event to set the bonus value and to include the other fields of PrepareItemEnchantEvent, checking the value and refreshing the enchantment hint after PrepareItemEnchantEvent calls. (it is now structure.)

I-am-ddang avatar Apr 22 '25 23:04 I-am-ddang

Well, we still need some way to modify the new enchantment suggestions, because this is a valid thing a plugin would do:

  • Add 5 to the bookshelf bonus.
  • Replace smite and band of arthropods with sharpness.

Not entirely sure how this can be achieved cleanly though.

Strokkur424 avatar Apr 23 '25 08:04 Strokkur424

@Strokkur424 You are right. refreshing enchantment is needed hint when replacing one of offers to other enchantment. Because paper-src codes can not be imported to paper-api, we should process the entire refreshing logic at paper-src/.../PrepareItemEnchantEvent.java (like logics of my PR)

I-am-ddang avatar Apr 23 '25 08:04 I-am-ddang

I am sorry I haven't managed to read through this for so long. The suggestion I made on discord was

Yea, I think there might be a point in adding API. Tho I don't think I'd like an API that says "just set that value" of bookshelves around. The more powerful API on e.g. the EnchantmentView or whereever would be Construct me an EnchantmentOFfer for this slot with this amount of bookshelves around

which I still believe to hold true. Allowing a plugin to reroll specific offers and then setting them via Event#getOffers would enable doing all of this without the need for a second event.

lynxplay avatar Apr 23 '25 08:04 lynxplay

@lynxplay Yeah. and I don't make another event.

it is a simple quality-of-life feature update for users who want an enchantment offers of specific level of bonus.

I fix compile error of last commit.

I-am-ddang avatar Apr 23 '25 09:04 I-am-ddang

I retry same fix. before this, it is not properly updated. now this PR should pass the test.

I-am-ddang avatar May 01 '25 07:05 I-am-ddang

That pull id :eggplant:

Viibrant avatar Sep 06 '25 20:09 Viibrant