-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Simplify offhand swapping #5772
base: dev/feature
Are you sure you want to change the base?
Conversation
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.
Good in general but all the casting is a mess.
bd134d0
to
3f08853
Compare
Closing due to inactivity. |
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.
This PR needs a LOT more testing, it only works in a few specific cases right now.
it's also odd that offhand tool would properly support future values while tool still doesn't
} else if (inventoryClickEvent.getClick() == ClickType.SWAP_OFFHAND) { | ||
PlayerInventory inventory = inventoryClickEvent.getWhoClicked().getInventory(); | ||
return new InventorySlot(inventory, inventoryClickEvent.getSlot()); | ||
} else if (inventoryClickEvent.getSlot() == EquipmentSlot.EquipSlot.OFF_HAND.slotNumber) { |
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.
What about the case where another slot is being double clicked to collect_to_cursor, which pulls from the offhand? Currently it just says null for the future offhand tool.
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.
I don't believe Spigot/Minecraft has an API for determining the slots a double click is pulling from.
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.
Yeah you'd have to manually write checks for this (from my experience with skript-gui)
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.
Just a small unnoticed detail
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.
Looks good :)
@@ -18,18 +18,6 @@ | |||
*/ |
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.
remove license
case PLACE_ONE: | ||
case PLACE_SOME: | ||
case SWAP_WITH_CURSOR: | ||
return new CursorSlot((Player) inventoryClickEvent.getWhoClicked(), inventoryClickEvent.getCurrentItem()); |
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.
This should be returning the value of the future offhand slot. Right now it's returning the future cursor slot.
Description
Simplify number key and swap offhand inventory click events.
So this may be hard to understand, but i'll explain.
I was helping a Skript user on SkUnity Discord and their problem was a hard understanding of how to only cancel an event when a specific item was swapped using the number keys in an inventory click event from the hotbar to the offhand player slot when having the player's inventory open, and the only solution was;
This pull request simplifies this process with
This will mean no matter how the click event happens, if the offhand is modified, it'll be tracked with this future state.
I also removed the default expression from the setTime as it makes no sense to restrict it here. This basically means that
offhand item
would have worked andoffhand item of player
would not, because it would only work if it was a default expression. It now works for both.Target Minecraft Versions: any
Requirements: none
Related Issues: none