-
-
Notifications
You must be signed in to change notification settings - Fork 385
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
Update SlotWithIndex and InventorySlot Comparisons #7713
base: dev/feature
Are you sure you want to change the base?
Update SlotWithIndex and InventorySlot Comparisons #7713
Conversation
what do you think about deprecating |
I'd be perfectly with that type of implementation, however I'd like to hear one or two more team member's opinions before I go and do that change |
Makes sense to me, remember to change the slot comparator accordingly and check for any breaking changes. |
Alright I've gone ahead and committed the deprecation as well as update their related classes. Do we believe the
|
No, I think it should maintain the same behavior as |
l've tested the latter, but I will test the former shortly |
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.
Based on some testing, I believe the rawIndex approach is fundamentally flawed and there's a better and easier solution by implementing isSameSlot on InventorySlot to compare inventories as well as indices. See https://discord.com/channels/135877399391764480/836220422223036467/1353113589841531021 for discussion.
Sorry to flip flop my opinion here but after looking into it further I don't think equals is appropriate here. The behavior implemented does not satisfy the constraints the javadocs for equals() set out. I think it's best to stick with isSameSlot. |
I've reverted the isSameSlot deprecation and equals, along with added a few public methods for developers to get the core object references in the classes. i.e. DisplayEntitySlot |
Description
This PR aims to change how the comparison of SlotWihtIndex behaviors, old behavior would cause some relatively less than desired behavior if two different inventories were comparing with the same index.
This would be a mild breaking change to some degree on servers, however this change should attempt to make the comparison a bit more stricter. Only two areas in skript actually set the raw index accordingly and that's
clicked slot
andevent-slot
for InventoryClickEventEverywhere else handles it as
this.index = this.rawIndex = index
an example of this change being in effect is
Before this would return true for both the bottom and top, now only when it's the top
Target Minecraft Versions: any
Requirements: none
Related Issues: #5928