Derive hasEmptySlots, isEmpty, countItem from other methods
This commit is contained in:
parent
69d9aaab50
commit
8b38504a26
@ -219,17 +219,11 @@ interface IEnhancedContainer<out S : IContainerSlot> : Container, RecipeInput, I
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean {
|
||||
return super.isEmpty()
|
||||
return nextNonEmptySlot(0) != -1
|
||||
}
|
||||
|
||||
val hasEmptySlots: Boolean get() {
|
||||
for (i in 0 until containerSize) {
|
||||
if (this[i].isEmpty) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
return nextEmptySlot(0) != -1
|
||||
}
|
||||
|
||||
override fun size(): Int {
|
||||
@ -239,11 +233,8 @@ interface IEnhancedContainer<out S : IContainerSlot> : Container, RecipeInput, I
|
||||
override fun countItem(item: Item): Int {
|
||||
var count = 0
|
||||
|
||||
for (stack in this) {
|
||||
if (stack.item === item) {
|
||||
count += stack.count
|
||||
}
|
||||
}
|
||||
for (slot in slotWithItemIterator(item))
|
||||
count += slot.item.count
|
||||
|
||||
return count
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user