-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Introduce Item Lock API mainly for Client-Side inventory action prevention #5333
base: minor-next
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.
The server-side validation for this is incomplete. Since the current transaction system does not allow actions to be tracked when moving from one inventory to another, validation for this can't be easily implemented. This means that this effectively becomes a cosmetic-only change.
Progress: this feature looks to be implementable with new inventory transaction system in current minor-next branch. |
The core transaction system remains unchanged, and implementing core logic in the network layer is pretty dubious |
Blocked waiting on #6505 |
Never mind, seems I misunderstood the function of the inventory lock. Apparently it allows moving from a chest -> player's inventory but not the other way round. It also allows moving from cursor <-> player inventory. |
this behaves the same as inventory-lock up until it's placed into a slot, in that it can be taken from a chest (but not returned), and placed down into the player's inventory. the only special behaviour of slot lock is that it can't be _removed_ from the slot.
transaction balancing & SlotChangeAction validation should stop this from happening anyway
PR is basically done but I think the terminology needs to be updated. |
Introduction
Currently, PocketMine-MP have no API for item lock api provided via item's NBT(minecraft:item_lock).
The purpose of this PR is to provide an API for item locking and implement logic for server-side validation
Relevant issues
N/A
Changes
API changes
Item::setLockMode(?ItemLockMode $lockMode) : self
Item::getLockMode() : ?ItemLockMode
ItemLockMode
enumBehavioural changes
N/A
Backwards compatibility
N/A
Follow-up
Currently, value used in NBT is hardcoded. This value may be defined in BedrockProtocol.
Tests
Check whether it works correctly with ScriptPlugin below.