Skip to content
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

Open
wants to merge 18 commits into
base: nextgen
Choose a base branch
from

Conversation

MukjepScarlet
Copy link
Contributor

fixes #5956

@MukjepScarlet MukjepScarlet marked this pull request as draft April 10, 2025 08:44
@MukjepScarlet MukjepScarlet changed the title fix(BlockPlacer): add offhand support fix(BlockPlacer/MLG): add offhand support Apr 10, 2025
@MukjepScarlet MukjepScarlet marked this pull request as ready for review April 10, 2025 10:36
Copy link
Contributor

@superblaubeere27 superblaubeere27 left a 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.

Comment on lines 52 to 61
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. There is no point in having two separate functions for doing the exact same thing. Just make the selectSlotSilently function expect a HotbarItemSlot instead of an Int in the first place.
  2. The functional parameter ticksUntilReset is a bit overkill. It is only used for calling random. A function with no side-effects and almost no computational complexity. Just calculate random() every time, even if it might also be an OffHandSlot.

Copy link
Contributor Author

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)?

@1zun4 1zun4 added this to the 0.30.0 milestone Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] BlockIn ignores offhand blocks
3 participants