-
Notifications
You must be signed in to change notification settings - Fork 41
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
Improve player inventory handling #209
Conversation
This removes the need for a lot of messy magic trying to prevent item deletion or duplication.
Default shift-clicking (at least the version the decompiler spits out) is a bit of a mess. It checks emptiness against raw slot content rather than reported slot content, so we can't use placeholders and allow shift-clicking into slots. Since armor placeholders would be really nice, that's a bit of a nuisance. Additionally, if we do not have placeholders in some slots (i.e. future state where we allow removal based on settings), nonstandard slots should never be quick-moved into.
There goes my secret plan to dupe diamonds by putting a diamond block in the grid, removing it with another account viewing my inventory, and crafting the result once the grid is clear.
This idea was a bit dumb, but I was mostly done before I realized it would be much safer to create fake items by lying to the client during the sync process. Since it took a while, I'm committing it in case I need it in the future.
This reverts commit 7805e93. It was a neat idea and kinda worked, but if Minecraft ever modifies click handling this will have a high probability of breaking.
This is what I get for not working in a linear fashion
Prevents other people grabbing them entirely
I was right, it was a single little mistake! Honestly no idea why armor was working, it shouldn't have.
Good ol' order of operations
Drop now-useless methods from internals
I'm really excited about placeholders! All of the fake items in the inventory are now fake clientside items that the server knows about and keeps in sync. Even if an inventory sorting plugin is improperly sorting our container (which very carefully reports its slots as what they are, check I've squashed all of the bugs I could locate, so ideally the only things left to do are cosmetics and backporting. I'm marking the PR ready for review to indicate that I believe the current build is safe to use. If anyone does have feedback please let me know what you think. If you have layout suggestions, now is the time - once I settle on something and it goes live, I am unlikely to reorganize. |
This should improve consistency with Paper's Adventure-based API, ideally.
I'm not thrilled about adding keeping the unported versions around, but 1.21 is only 18.7% market share right now. 1.20.4 is 24.6%, and 1.20.6 is 11%. Realistically I should drop 1.20.6 first, but eh.
Improve compatibility/reduce risk of breakages by creating an entirely new inventory implementation wrapping internals.
If anyone is interested in testing this out, I believe it is currently very stable. Builds are available from Actions runs.
Note that earlier builds of 1.21 that have an abstract class InventoryView are probably unsupported.
TODO:
Add translations for new features?Piggybacking Minecraft translations now.Backport to older supported versionsOlder versions are on life support. Backporting is a lot of work (mostly on the verifying behavior side, Mojang mappings do make most version changes a copy+paste).Subsequent PRs will cover the ender chest and feature configuration/management. Feature configuration will in turn enable advanced resource pack usage for increased inventory legibility.
Closes #200
Closes lishid#172
Closes lishid#92