package mezz.jei.gui;

import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class RecipeGui {

	@Nonnull
	private final IRecipeCategory recipeCategory;
	private final GuiItemStacks guiItemStacks;

	private IRecipeWrapper recipeWrapper;
	private int posX;
	private int posY;

	public RecipeGui(@Nonnull IRecipeCategory recipeCategory) {
		this.recipeCategory = recipeCategory;
		this.guiItemStacks = new GuiItemStacks();
		this.recipeCategory.init(guiItemStacks);
	}

	public void setPosition(int posX, int posY) {
		this.posX = posX;
		this.posY = posY;
	}

	public void setRecipe(@Nonnull IRecipeWrapper recipeWrapper, @Nullable ItemStack focusStack) {
		this.recipeWrapper = recipeWrapper;

		guiItemStacks.clearItemStacks();
		guiItemStacks.setFocusStack(focusStack);
		recipeCategory.setRecipe(guiItemStacks, recipeWrapper);
	}

	public void draw(@Nonnull Minecraft minecraft, int mouseX, int mouseY) {
		if (recipeWrapper == null)
			return;

		GL11.glPushMatrix();
		GL11.glTranslatef(posX, posY, 0.0F);
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

		recipeCategory.getBackground().draw(minecraft);
		guiItemStacks.draw(minecraft, mouseX - posX, mouseY - posY);
		recipeWrapper.drawInfo(minecraft);

		GL11.glPopMatrix();
	}

	public ItemStack getStackUnderMouse(int mouseX, int mouseY) {
		return guiItemStacks.getStackUnderMouse(mouseX - posX, mouseY - posY);
	}
}

@@ -1312,16 +1312,53 @@
 craft);%0A
+%09%09recipeWrapper.drawInfo(minecraft);%0A
 %09%09guiIte
@@ -1415,45 +1415,8 @@
 sY);
-%0A%09%09recipeWrapper.drawInfo(minecraft);
 %0A%0A%09%09

Fix hover text displaying under info text