mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-07 22:27:42 -04:00
31 lines
1019 B
Scala
31 lines
1019 B
Scala
package li.cil.oc.integration.util
|
|
|
|
import codechicken.nei.LayoutManager
|
|
import li.cil.oc.integration.Mods
|
|
import net.minecraft.block.Block
|
|
import net.minecraft.client.gui.inventory.GuiContainer
|
|
import net.minecraft.item.ItemStack
|
|
|
|
import scala.collection.mutable
|
|
|
|
object NEI {
|
|
val hiddenBlocks = mutable.Set.empty[Block]
|
|
|
|
def isInputFocused =
|
|
Mods.NotEnoughItems.isAvailable && (try isInputFocused0 catch {
|
|
case _: Throwable => false
|
|
})
|
|
|
|
private def isInputFocused0 = LayoutManager.getInputFocused != null
|
|
|
|
def hoveredStack(container: GuiContainer, mouseX: Int, mouseY: Int): Option[ItemStack] =
|
|
if (Mods.NotEnoughItems.isAvailable) try Option(hoveredStack0(container, mouseX, mouseY)) catch {
|
|
case t: Throwable => None
|
|
}
|
|
else None
|
|
|
|
private def hoveredStack0(container: GuiContainer, mouseX: Int, mouseY: Int) = LayoutManager.instance.getStackUnderMouse(container, mouseX, mouseY)
|
|
|
|
def hide(block: Block): Unit = if (Mods.NotEnoughItems.isAvailable) hiddenBlocks += block
|
|
}
|