blob: b57bd391c7fe6a76516aaa84725dfa1fb18cd133 [file] [log] [blame] [raw]
package li.cil.oc.client.gui
import li.cil.oc.Config
import li.cil.oc.api.driver.Slot
import net.minecraft.util.Icon
import net.minecraftforge.client.event.TextureStitchEvent
import net.minecraftforge.event.ForgeSubscribe
import scala.collection.mutable
object Icons {
private val bySlotType = mutable.Map.empty[Slot, Icon]
@ForgeSubscribe
def onItemIconRegister(e: TextureStitchEvent.Pre) {
val iconRegister = e.map
if (iconRegister.textureType == 1) {
bySlotType += Slot.Card -> iconRegister.registerIcon(Config.resourceDomain + ":icon_card")
bySlotType += Slot.HardDiskDrive -> iconRegister.registerIcon(Config.resourceDomain + ":icon_hdd")
bySlotType += Slot.Memory -> iconRegister.registerIcon(Config.resourceDomain + ":icon_ram")
bySlotType += Slot.Power -> iconRegister.registerIcon(Config.resourceDomain + ":icon_power")
}
}
def get(slotType: Slot) = bySlotType.get(slotType).orNull
}