-
Notifications
You must be signed in to change notification settings - Fork 143
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
Implement curse of binding #716
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.
It might be a good idea to move the Curse of Binding logic to its own function, since it's duplicated several times in this handler, something like:
func (h *ItemStackRequestHandler) validateCurse(slot protocol.StackRequestSlotInfo, s *Session) error {
}
if err := validateCurse(a.Source, s); err != nil {
return err
}
You could also change that function to return a bool rather than an error if you want more descriptive errors (swap vs. transfer vs. drop).
Co-authored-by: DaPigGuy <mcpepig123@gmail.com>
@Sandertv Can we try and get this merged soon? |
@@ -2930,6 +2930,11 @@ func (p *Player) useContext() *item.UseContext { | |||
srcIt, _ := srcInv.Item(src) | |||
dstIt, _ := dstInv.Item(dst) | |||
|
|||
// If dstIt is enchanted with curse of binding, do not swap. | |||
if _, isCursed := dstIt.Enchantment(enchantment.CurseOfBinding{}); isCursed && !p.GameMode().CreativeInventory() { |
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 feels out of place. How could this ever happen? I assume any attempt to move the item out will be cancelled at the session level?
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.
It does not get cancelled at the session level.
Alternatively, I could modify relevant items' Use() function and check if the carrier (player) is wearing armour enchanted with curse of binding.
No description provided.