Fix slots hidden behind by other panels still being visible to "lookup recipes" keybind

This commit is contained in:
DBotThePony 2024-01-09 14:38:53 +07:00
parent c1fbdfa1a6
commit 6ff737a315
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -21,9 +21,10 @@ class Panel2ClickableIngredient<P : EditablePanel<*>, T>(val panel: P, val ingre
inline fun <reified P : EditablePanel<*>, T : Any> find(mouseX: Double, mouseY: Double, type: IIngredientType<T>, source: Collection<EditablePanel<*>>, noinline provider: (P) -> T): Optional<IClickableIngredient<*>> { inline fun <reified P : EditablePanel<*>, T : Any> find(mouseX: Double, mouseY: Double, type: IIngredientType<T>, source: Collection<EditablePanel<*>>, noinline provider: (P) -> T): Optional<IClickableIngredient<*>> {
return source return source
.stream() .stream()
.map { it.panelOfTypeUnderCursor<P>(mouseX.toFloat(), mouseY.toFloat(), ignoreMouseInputLock = true).panel } .map { it.panelOfTypeUnderCursor<P>(mouseX.toFloat(), mouseY.toFloat(), ignoreMouseInputLock = true) }
.filterNotNull() .filter { it.interrupt }
.findAny() .findFirst()
.flatMap { Optional.ofNullable(it.panel) }
.flatMap { a -> JEIPlugin.helpers.ingredientManager.createTypedIngredient(type, provider(a)).map { a to it } } .flatMap { a -> JEIPlugin.helpers.ingredientManager.createTypedIngredient(type, provider(a)).map { a to it } }
.map { Panel2ClickableIngredient(it.first!!, it.second) } .map { Panel2ClickableIngredient(it.first!!, it.second) }
} }