/*
 *  Copyright 2025-2026 R3944Realms
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package top.r3944realms.eroticdungeongame.client.gui.components;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.StateSwitchingButton;
import net.minecraft.client.gui.screens.recipebook.RecipeBookPage;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jetbrains.annotations.NotNull;

@OnlyIn(Dist.CLIENT)
public class DungeonRecipeBookPage extends RecipeBookPage {
    public DungeonRecipeBookPage() {
        overlay = new DungeonOverlayRecipeComponent();
        for(int i = 0; i < 20; ++i) {
            this.buttons.set(i, new DungeonRecipeButton());
        }
    }
    @Override
    public void init(@NotNull Minecraft minecraft, int x, int y) {
        this.minecraft = minecraft;
        assert minecraft.player != null;
        this.recipeBook = minecraft.player.getRecipeBook();

        for(int i = 0; i < this.buttons.size(); ++i) {
            this.buttons.get(i).setPosition(x + 11 + 25 * (i % 5), y + 31 + 25 * (i / 5));
        }

        this.forwardButton = new StateSwitchingButton(x + 93, y + 137, 12, 17, false);
        this.forwardButton.initTextureValues(1, 208, 13, 18, DungeonRecipeBookComponent.RECIPE_BOOK_LOCATION);
        this.backButton = new StateSwitchingButton(x + 38, y + 137, 12, 17, true);
        this.backButton.initTextureValues(1, 208, 13, 18, DungeonRecipeBookComponent.RECIPE_BOOK_LOCATION);

    }
}
