package ru.dbotthepony.mc.otm.compat.jei

import mezz.jei.api.gui.drawable.IDrawable
import net.minecraft.client.gui.GuiGraphics
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
import ru.dbotthepony.mc.otm.client.render.IGUIRenderable

class IGUIRenderable2IDrawable(val parent: IGUIRenderable) : IDrawable {
	override fun getWidth(): Int {
		return parent.width.toInt()
	}

	override fun getHeight(): Int {
		return parent.height.toInt()
	}

	override fun draw(guiGraphics: GuiGraphics, xOffset: Int, yOffset: Int) {
		parent.render(MGUIGraphics(guiGraphics), xOffset.toFloat(), yOffset.toFloat())
	}
}
