package asm.mixins;

import dev.crucifixbeta.mod.gui.menu.EpsilonMenuStyle;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.widget.EntryListWidget;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Environment(EnvType.CLIENT)
@Mixin({EntryListWidget.class})
public class MixinMenuEntryListWidget {
   @Inject(
      method = {"drawMenuListBackground"},
      at = {@At("HEAD")},
      cancellable = true
   )
   private void crucifix$skipMenuListBackground(DrawContext context, CallbackInfo ci) {
      if (EpsilonMenuStyle.isCurrentStyledScreen()) {
         ci.cancel();
      }
   }

   @Inject(
      method = {"drawHeaderAndFooterSeparators"},
      at = {@At("HEAD")},
      cancellable = true
   )
   private void crucifix$skipMenuListSeparators(DrawContext context, CallbackInfo ci) {
      if (EpsilonMenuStyle.isCurrentStyledScreen()) {
         ci.cancel();
      }
   }
}
