-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
fix(BlockPlacer/MLG): add offhand support #5960
base: nextgen
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.
A great addition 👍🏻 We can merge this after you fixed the three issues.
inline fun selectSlotSilently(requester: Any?, slot: HotbarItemSlot, ticksUntilReset: () -> Int): Hand { | ||
return if (slot !is OffHandSlot) { | ||
selectSlotSilently(requester, slot.hotbarSlot, ticksUntilReset()) | ||
Hand.MAIN_HAND | ||
} else { | ||
Hand.OFF_HAND | ||
} | ||
} | ||
|
||
fun selectSlotSilently(requester: Any?, slot: Int, ticksUntilReset: Int = 20) { |
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.
- There is no point in having two separate functions for doing the exact same thing. Just make the
selectSlotSilently
function expect aHotbarItemSlot
instead of anInt
in the first place. - The functional parameter
ticksUntilReset
is a bit overkill. It is only used for callingrandom
. A function with no side-effects and almost no computational complexity. Just calculaterandom()
every time, even if it might also be anOffHandSlot
.
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's changed but I have a question: should we skip main hand slot index and offhand slot index directly in fun selectSlotSilently(requester: Any?, slot: Int, ticksUntilReset: Int)
?
fixes #5956