package com.acethewildfire.acesbs.compat;

import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.recipe.EntropicEntanglerRecipe;
import com.acethewildfire.acesbs.recipe.EntropicEvisceratorRecipe;
import com.acethewildfire.acesbs.recipe.EntropicStabilizerRecipe;
import com.acethewildfire.acesbs.recipe.ModRecipies;
import com.acethewildfire.acesbs.screen.custom.EntropicEntanglerScreen;
import com.acethewildfire.acesbs.screen.custom.EntropicEvisceratorScreen;
import com.acethewildfire.acesbs.screen.custom.EntropicStabilizerScreen;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry;
import me.shedaniel.rei.api.common.util.EntryStacks;

public class AcesBSREIClient implements REIClientPlugin {

    @Override
    public void registerCategories(CategoryRegistry registry) {
        registry.add(new EntropicStabilizerCategory());
        registry.addWorkstations(EntropicStabilizerCategory.ENTROPIC_STABILIZER, EntryStacks.of(ModBlocks.ENTROPIC_STABILIZER));

        registry.add(new EntropicEvisceratorCategory());
        registry.addWorkstations(EntropicEvisceratorCategory.ENTROPIC_EVISCERATOR, EntryStacks.of(ModBlocks.ENTROPIC_EVISCERATOR));

        registry.add(new EntropicEntanglerCategory());
        registry.addWorkstations(EntropicEntanglerCategory.ENTROPIC_ENTANGLER, EntryStacks.of(ModBlocks.ENTROPIC_ENTANGLER));
    }

    @Override
    public void registerDisplays(DisplayRegistry registry) {
        registry.registerRecipeFiller(EntropicStabilizerRecipe.class, ModRecipies.ENTROPIC_STABILIZER_TYPE, EntropicStabilizerDisplay::new);
        registry.registerRecipeFiller(EntropicEvisceratorRecipe.class, ModRecipies.ENTROPIC_EVISCERATOR_TYPE, EntropicEvisceratorDisplay::new);
        registry.registerRecipeFiller(EntropicEntanglerRecipe.class, ModRecipies.ENTROPIC_ENTANGLER_TYPE, EntropicEntanglerDisplay::new);
    }

    @Override
    public void registerScreens(ScreenRegistry registry) {
        registry.registerClickArea(screen -> new Rectangle(((screen.width - 176) / 2) + 78,
                ((screen.height - 166) / 2) + 30, 20, 25 ), EntropicStabilizerScreen.class, EntropicStabilizerCategory.ENTROPIC_STABILIZER);
        registry.registerClickArea(screen -> new Rectangle(((screen.width - 176) / 2) + 78,
                ((screen.height - 166) / 2) + 30, 20, 25 ), EntropicEvisceratorScreen.class, EntropicEvisceratorCategory.ENTROPIC_EVISCERATOR);
        registry.registerClickArea(screen -> new Rectangle(((screen.width - 176) / 2) + 53,
                ((screen.height - 166) / 2) + 25, 37, 9 ), EntropicEntanglerScreen.class, EntropicEntanglerCategory.ENTROPIC_ENTANGLER);
        registry.registerClickArea(screen -> new Rectangle(((screen.width - 176) / 2) + 90,
                ((screen.height - 166) / 2) + 52, 37, 9 ), EntropicEntanglerScreen.class, EntropicEntanglerCategory.ENTROPIC_ENTANGLER);
    }
}
