Skip to content

Instantly share code, notes, and snippets.

@nbness2
Created May 22, 2023 22:39
Show Gist options
  • Save nbness2/8512734d8a01631698d65294567212ec to your computer and use it in GitHub Desktop.
Save nbness2/8512734d8a01631698d65294567212ec to your computer and use it in GitHub Desktop.
fun <I: Item> ItemContainer<I>.nbxShiftModified() {
var item: I
val slotsToShift = firstEmptySlot .. secondEmptySlot
for (slot in slotsToShift) {
item = items[slot]
if (slot == slotsToShift.first) continue
items[slot-1] = item
if (item.isInvalidItem()) {
secondEmptySlot--
return
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment