// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
//     Event<InitScreenCallback> EVENT = Event.create((listeners) ->
//             (screen, buttons) -> {
//                 for (InitScreenCallback listener : listeners) {
//                     listener.initScreen(screen, buttons);
//                 }
//             }
//     );
// 
//     void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
// 
//     interface Pre {
//         Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
//                 (screen) -> {
//                     for (InitScreenCallback.Pre listener : listeners) {
//                         listener.preInitScreen(screen);
//                     }
//                 }
//         );
// 
//         void preInitScreen(Screen screen);
//     }
// }


import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List;
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;



//#if MC>=11700
//$$ import com.google.common.collect.Collections2;
//$$ import net.minecraft.client.gui.Element;
//#endif

@Mixin(Screen.class)
public class MixinScreen {

    //#if MC>=11700
    //$$ @Shadow @Final private List<Element> children;
    //#else
    @Shadow
    protected @Final List<AbstractButtonWidget> buttons;
    //#endif

    @Inject(method = "init(Lnet/minecraft/client/MinecraftClient;II)V", at = @At("HEAD"))
    private void preInit(MinecraftClient minecraftClient_1, int int_1, int int_2, CallbackInfo ci) {
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
//     Event<InitScreenCallback> EVENT = Event.create((listeners) ->
//             (screen, buttons) -> {
//                 for (InitScreenCallback listener : listeners) {
//                     listener.initScreen(screen, buttons);
//                 }
//             }
//     );
// 
//     void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
// 
//     interface Pre {
//         Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
//                 (screen) -> {
//                     for (InitScreenCallback.Pre listener : listeners) {
//                         listener.preInitScreen(screen);
//                     }
//                 }
//         );
// 
//         void preInitScreen(Screen screen);
//     }
// }


// Path: src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinScreen.java
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List;

//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;



//#if MC>=11700
//$$ import com.google.common.collect.Collections2;
//$$ import net.minecraft.client.gui.Element;
//#endif

@Mixin(Screen.class)
public class MixinScreen {

    //#if MC>=11700
    //$$ @Shadow @Final private List<Element> children;
    //#else
    @Shadow
    protected @Final List<AbstractButtonWidget> buttons;
    //#endif

    @Inject(method = "init(Lnet/minecraft/client/MinecraftClient;II)V", at = @At("HEAD"))
    private void preInit(MinecraftClient minecraftClient_1, int int_1, int int_2, CallbackInfo ci) {
        InitScreenCallback.Pre.EVENT.invoker().preInitScreen((Screen) (Object) this);