-
Notifications
You must be signed in to change notification settings - Fork 149
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
Added Held Slot handler #430
Conversation
CiviledCode
commented
Feb 20, 2022
- Removed session.UpdateHeldSlot
- Added player.SetHeldSlot
- Added HeldSlotChange to handler
- Removed session.UpdateHeldSlot - Added player.SetHeldSlot - Added HeldSlotChange to handler
// is the correct item. | ||
// This invokes the HandleHeldSlotChange handler. | ||
func (p *Player) SetHeldSlot(slot int, expected item.Stack) error { | ||
if slot > 8 { |
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.
Why'd you remove all the documentation for this method?
actual, _ := p.inv.Item(slot) | ||
|
||
if !clientSideItem.Equal(actual) { | ||
return fmt.Errorf("client side item isn't equal to expected slot item") |
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 code no longer belongs here now that it's a player method, should be moved to packet handling (check a0bb8dd).
return nil | ||
} | ||
|
||
p.ReleaseItem() |
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.
Should just set (Player).usingItem
to false here.
// SetHeldSlot updates the held slot of the player with the slot passed. It also verifies that the item within the spot | ||
// is the correct item. | ||
// This invokes the HandleHeldSlotChange handler. | ||
func (p *Player) SetHeldSlot(slot int, expected item.Stack) error { |
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.
Passing an expected item stack no longer makes sense here, should be removed.
@@ -367,6 +368,37 @@ func (p *Player) Transfer(address string) (err error) { | |||
return | |||
} | |||
|
|||
// SetHeldSlot updates the held slot of the player with the slot passed. It also verifies that the item within the spot |
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.
Should remove the middle sentence in this doc.
Any update on this? |