Skip to content
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

Feature: Home & Unstable scroll Durability & Improvements. #112

Closed

Conversation

ryantheleach
Copy link
Contributor

@ryantheleach ryantheleach commented Jan 10, 2022

Part 1:

https://youtu.be/abrylP-zHDs

Adds default minecraft translated elements to the action bar, to improve scroll first-use experience with new players.

(I may be giving them out as kits).

Part 2:

Adds custom durability data for Home Scroll & Unstable Scroll, allowing the configuration to customize the amount of uses they have.

Also has lore showing the custom durability.

This combined with noticing that Mending tends to heal up the scroll really quickly, owing to it's low durability & Minecraft's default handing of mending, means that it is very difficult to fix the amount the item is repaired at the moment, without outright disabling it: PaperMC/Paper#7313

Technical Notes

The durability is emulated using Persistent Data nodes by monitoring the item for real durability changes, when we attempt to damage it. The lore is updated by searching for the translated component and changing it's arguments. This is how compatibility with unbreaking etc is achieved.

Whilst it does track the data, it is idempotent, so any desyncs will quickly be resolved the next time the item is used.

Changing the config retains the amount of uses the item has currently, but changes the maximum for existing items in the world.

Worst-case, it gives the user 2 extra uses of the item, if the new durability is less then the amount of total uses so far.

1 to resync the real durability, (making it 1 use remaining if the durability is invalid) and another to consume the item.

If there is 1 use remaining, we always force the real durability to 1 use remaining, this is so we can use the natural minecraft item break in regards to enchants.

This can be changed by storing the maximum when the item is first created, if desired.

@ryantheleach ryantheleach force-pushed the home-scroll-notifications branch from 77e60d5 to 52f01b9 Compare January 11, 2022 07:58
@ryantheleach ryantheleach force-pushed the home-scroll-notifications branch from 044b9dd to 52eecc9 Compare January 11, 2022 20:12
@ryantheleach ryantheleach force-pushed the home-scroll-notifications branch from 52eecc9 to b557c76 Compare January 11, 2022 20:18
@ryantheleach ryantheleach changed the title Home scroll notifications Home & Unstable scroll improvements. Jan 11, 2022
@ryantheleach ryantheleach changed the title Home & Unstable scroll improvements. Feature: Home & Unstable scroll Durability & Improvements. Jan 11, 2022
@oddlama
Copy link
Owner

oddlama commented Feb 4, 2022

Any updates on the linked papermc issue?

Ah and BTW: This PR really includes a lot of commits that are now already merged. Do you want to rebase it on top of the current develop or should I also just cherry-pick from here and manually close the PR?

@ryantheleach
Copy link
Contributor Author

I hadn't played with the PR from paper, as I didn't have experience in developing against paper forks and it's not something I had the energy to learn to be frank.

They have appeared to come up with a solution, that I believe will work for our usecase (but not all the ones I outlined in the issue).

It's been too long since I've played with this branch, and with the sneaking in of the namespace key changes etc, you may want to double check you actually want all of it before merging.

That said, I believe the actual durability changes are good to ship.

@ryantheleach
Copy link
Contributor Author

PaperMC/Paper#7382

@oddlama
Copy link
Owner

oddlama commented Feb 4, 2022

They have appeared to come up with a solution, that I believe will work for our usecase (but not all the ones I outlined in the issue).

Perfect!

It's been too long since I've played with this branch, and with the sneaking in of the namespace key changes etc, you may want to double check you actually want all of it before merging.
That said, I believe the actual durability changes are good to ship.

No problemo, then I will just pick the relevant commits. And maybe implement some form of mending "attenuation" for items with custom durability?

@ryantheleach
Copy link
Contributor Author

The PR hasn't been merged yet, so if you want to check out the paper PR and test it, go ahead. Otherwise you won't be able to implement it in main yet.

@oddlama
Copy link
Owner

oddlama commented Feb 4, 2022

I'll make it an issue so I remember to do it when it is released.

@oddlama oddlama changed the base branch from main to develop February 4, 2022 13:12
oddlama added a commit that referenced this pull request Feb 4, 2022
@oddlama
Copy link
Owner

oddlama commented Feb 4, 2022

Thanks a lot! Merged.

@oddlama oddlama closed this Feb 4, 2022
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.

2 participants