ConditionalSet#actuallyContains
This commit is contained in:
parent
b578e9d8d8
commit
92fa4a4130
@ -30,6 +30,10 @@ class ConditionalSet<E : Any> : Set<E> {
|
|||||||
return backing.entries.iterator().filter { it.value.asBoolean }.map { it.key }
|
return backing.entries.iterator().filter { it.value.asBoolean }.map { it.key }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun actuallyContains(element: E): Boolean {
|
||||||
|
return element in backing
|
||||||
|
}
|
||||||
|
|
||||||
fun add(element: E, condition: BooleanSupplier): Boolean {
|
fun add(element: E, condition: BooleanSupplier): Boolean {
|
||||||
if (element in backing) return false
|
if (element in backing) return false
|
||||||
backing[element] = condition
|
backing[element] = condition
|
||||||
|
@ -440,7 +440,7 @@ abstract class MatteryMenu @JvmOverloads protected constructor(
|
|||||||
* [condition] allows to specify when slot is invisible on GUI (hence being ignored by quick move)
|
* [condition] allows to specify when slot is invisible on GUI (hence being ignored by quick move)
|
||||||
*/
|
*/
|
||||||
protected fun <T : Slot> addStorageSlot(slot: T, addMapping: Boolean = true, prepend: Boolean = false, condition: BooleanSupplier = BooleanSupplier { true }): T {
|
protected fun <T : Slot> addStorageSlot(slot: T, addMapping: Boolean = true, prepend: Boolean = false, condition: BooleanSupplier = BooleanSupplier { true }): T {
|
||||||
if (slot !in externalSlots) {
|
if (!externalSlots.actuallyContains(slot)) {
|
||||||
addSlot(slot)
|
addSlot(slot)
|
||||||
|
|
||||||
if (prepend)
|
if (prepend)
|
||||||
|
Loading…
Reference in New Issue
Block a user