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

import com.mojang.blaze3d.vertex.PoseStack
import mezz.jei.api.gui.drawable.IDrawable

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(stack: PoseStack, xOffset: Int, yOffset: Int) {
		parent.render(MGUIGraphics(stack), xOffset.toFloat(), yOffset.toFloat())
	}
}
