// Path: src/main/java/net/darkhax/darkutils/features/slimecrucible/SlimeCrucibleEvents.java
// @OnlyIn(Dist.CLIENT)
// public static class RecipeVisibleEvent extends Event {
//         
//     /**
//      * The recipe being tested for visibility.
//      */
//     private final RecipeSlimeCrafting recipe;
//         
//     /**
//      * The player trying to view the recipe.
//      */
//     private final PlayerEntity player;
//         
//     /**
//      * Whether or not the recipe is visible under normal circumstances.
//      */
//     private final boolean originallyVisible;
//         
//     /**
//      * Whether or not the recipe will be visible.
//      */
//     private boolean isVisible;
//         
//     public RecipeVisibleEvent(RecipeSlimeCrafting recipe, PlayerEntity player, boolean isVisible) {
//             
//         this.recipe = recipe;
//         this.player = player;
//         this.originallyVisible = isVisible;
//         this.isVisible = isVisible;
//     }
//         
//     /**
//      * Checks if the recipe would originally be visible to the player.
//      * 
//      * @return Whether or not the recipe would normally be visible.
//      */
//     public boolean wasOriginallyVisible () {
//             
//         return this.originallyVisible;
//     }
//         
//     /**
//      * Checks if the recipe is currently visible.
//      * 
//      * @return Whether or not the recipe is currently visible.
//      */
//     public boolean isVisible () {
//             
//         return this.isVisible;
//     }
//         
//     /**
//      * Sets the visibility of the recipe. Allows the recipe to be hidden or made visible.
//      * 
//      * @param isVisible Whether or not the recipe should be visible.
//      */
//     public void setVisible (boolean isVisible) {
//             
//         this.isVisible = isVisible;
//     }
//         
//     /**
//      * The recipe being tested.
//      * 
//      * @return The recipe being tested.
//      */
//     public RecipeSlimeCrafting getRecipe () {
//             
//         return this.recipe;
//     }
//         
//     /**
//      * The player trying to view the recipe.
//      * 
//      * @return The player trying to view the recipe.
//      */
//     public PlayerEntity getPlayer () {
//             
//         return this.player;
//     }
// }


import java.util.ArrayList;
import java.util.List;
import com.mojang.blaze3d.platform.GlStateManager;
import net.darkhax.bookshelf.util.MathsUtils;
import net.darkhax.bookshelf.util.RenderUtils;
import net.darkhax.bookshelf.util.RenderUtils.IQuadColorHandler;
import net.darkhax.darkutils.features.slimecrucible.SlimeCrucibleEvents.RecipeVisibleEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SimpleSound;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.monster.SlimeEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
        
        // Render the recipe output item icons.
        this.renderRecipeOutputs(mouseX, mouseY, selectionBoxX, selectionBoxY, lastRecipeIndex);
    }
    
    /**
     * Renders the button backgrounds for the recipe outputs.
     * 
     * @param mouseX The x position of the mouse.
     * @param mouseY The y position of the mouse.
     * @param selectionBoxX The starting x position of the selection box.
     * @param selectionBoxY The starting y position of the selection box.
     * @param lastRecipeIndex The last recipe index to display.
     */
    private void renderRecipeOutputButtons (int mouseX, int mouseY, int selectionBoxX, int selectionBoxY, int lastRecipeIndex) {
        
        // Iterate through the first 12 or less recipes to show.
        for (int i = this.recipeIndexOffset; i < lastRecipeIndex && i < this.container.getAvailableRecipesSize(); i++) {
            
            final int recipeIndex = i - this.recipeIndexOffset;
            final int recipeX = selectionBoxX + recipeIndex % 4 * 16;
            final int recipeRow = recipeIndex / 4;
            final int recipeY = selectionBoxY + recipeRow * 18 + 2;
            final boolean canCraftRecipe = this.container.canCraft(i);
            final RecipeSlimeCrafting recipe = this.container.getAvailableRecipes().get(i);
            int textureY = this.ySize;
            int color = 0xffffffff;
            
            boolean isRecipeVisible = recipe.isHidden() ? canCraftRecipe : true;
            
// Path: src/main/java/net/darkhax/darkutils/features/slimecrucible/SlimeCrucibleEvents.java
// @OnlyIn(Dist.CLIENT)
// public static class RecipeVisibleEvent extends Event {
//         
//     /**
//      * The recipe being tested for visibility.
//      */
//     private final RecipeSlimeCrafting recipe;
//         
//     /**
//      * The player trying to view the recipe.
//      */
//     private final PlayerEntity player;
//         
//     /**
//      * Whether or not the recipe is visible under normal circumstances.
//      */
//     private final boolean originallyVisible;
//         
//     /**
//      * Whether or not the recipe will be visible.
//      */
//     private boolean isVisible;
//         
//     public RecipeVisibleEvent(RecipeSlimeCrafting recipe, PlayerEntity player, boolean isVisible) {
//             
//         this.recipe = recipe;
//         this.player = player;
//         this.originallyVisible = isVisible;
//         this.isVisible = isVisible;
//     }
//         
//     /**
//      * Checks if the recipe would originally be visible to the player.
//      * 
//      * @return Whether or not the recipe would normally be visible.
//      */
//     public boolean wasOriginallyVisible () {
//             
//         return this.originallyVisible;
//     }
//         
//     /**
//      * Checks if the recipe is currently visible.
//      * 
//      * @return Whether or not the recipe is currently visible.
//      */
//     public boolean isVisible () {
//             
//         return this.isVisible;
//     }
//         
//     /**
//      * Sets the visibility of the recipe. Allows the recipe to be hidden or made visible.
//      * 
//      * @param isVisible Whether or not the recipe should be visible.
//      */
//     public void setVisible (boolean isVisible) {
//             
//         this.isVisible = isVisible;
//     }
//         
//     /**
//      * The recipe being tested.
//      * 
//      * @return The recipe being tested.
//      */
//     public RecipeSlimeCrafting getRecipe () {
//             
//         return this.recipe;
//     }
//         
//     /**
//      * The player trying to view the recipe.
//      * 
//      * @return The player trying to view the recipe.
//      */
//     public PlayerEntity getPlayer () {
//             
//         return this.player;
//     }
// }


// Path: src/main/java/net/darkhax/darkutils/features/slimecrucible/ScreenSlimeCrucible.java
import java.util.ArrayList;
import java.util.List;
import com.mojang.blaze3d.platform.GlStateManager;
import net.darkhax.bookshelf.util.MathsUtils;
import net.darkhax.bookshelf.util.RenderUtils;
import net.darkhax.bookshelf.util.RenderUtils.IQuadColorHandler;
import net.darkhax.darkutils.features.slimecrucible.SlimeCrucibleEvents.RecipeVisibleEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SimpleSound;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.monster.SlimeEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;

        
        // Render the recipe output item icons.
        this.renderRecipeOutputs(mouseX, mouseY, selectionBoxX, selectionBoxY, lastRecipeIndex);
    }
    
    /**
     * Renders the button backgrounds for the recipe outputs.
     * 
     * @param mouseX The x position of the mouse.
     * @param mouseY The y position of the mouse.
     * @param selectionBoxX The starting x position of the selection box.
     * @param selectionBoxY The starting y position of the selection box.
     * @param lastRecipeIndex The last recipe index to display.
     */
    private void renderRecipeOutputButtons (int mouseX, int mouseY, int selectionBoxX, int selectionBoxY, int lastRecipeIndex) {
        
        // Iterate through the first 12 or less recipes to show.
        for (int i = this.recipeIndexOffset; i < lastRecipeIndex && i < this.container.getAvailableRecipesSize(); i++) {
            
            final int recipeIndex = i - this.recipeIndexOffset;
            final int recipeX = selectionBoxX + recipeIndex % 4 * 16;
            final int recipeRow = recipeIndex / 4;
            final int recipeY = selectionBoxY + recipeRow * 18 + 2;
            final boolean canCraftRecipe = this.container.canCraft(i);
            final RecipeSlimeCrafting recipe = this.container.getAvailableRecipes().get(i);
            int textureY = this.ySize;
            int color = 0xffffffff;
            
            boolean isRecipeVisible = recipe.isHidden() ? canCraftRecipe : true;
            
            final RecipeVisibleEvent event = new RecipeVisibleEvent(recipe, Minecraft.getInstance().player, isRecipeVisible);