// Path: src/main/java/de/johni0702/minecraft/gui/utils/Event.java
// public class Event<T> {
//     public static <T> Event<T> create(Function<List<T>, T> invokerFactory) {
//         return new Event<>(invokerFactory);
//     }
// 
//     private T invoker;
//     private Function<List<T>, T> invokerFactory;
//     private List<T> listeners = new ArrayList<>();
// 
//     private Event(Function<List<T>, T> invokerFactory) {
//         this.invokerFactory = invokerFactory;
//         update();
//     }
// 
//     void register(T listener) {
//         listeners.add(listener);
//         update();
//     }
// 
//     void unregister(T listener) {
//         listeners.remove(listener);
//         update();
//     }
// 
//     private void update() {
//         invoker = invokerFactory.apply(new ArrayList<>(listeners));
//     }
// 
//     public T invoker() {
//         return invoker;
//     }
// }


import de.johni0702.minecraft.gui.utils.Event;
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.callbacks;


public interface KeyboardCallback {
    Event<KeyboardCallback> EVENT = Event.create((listeners) ->
            new KeyboardCallback() {
                @Override
                public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
                    for (KeyboardCallback listener : listeners) {
                        if (listener.keyPressed(keyCode, scanCode, modifiers)) {
                            return true;
                        }
                    }
                    return false;
                }

                @Override
                public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
                    for (KeyboardCallback listener : listeners) {
                        if (listener.keyReleased(keyCode, scanCode, modifiers)) {
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Event.java
// public class Event<T> {
//     public static <T> Event<T> create(Function<List<T>, T> invokerFactory) {
//         return new Event<>(invokerFactory);
//     }
// 
//     private T invoker;
//     private Function<List<T>, T> invokerFactory;
//     private List<T> listeners = new ArrayList<>();
// 
//     private Event(Function<List<T>, T> invokerFactory) {
//         this.invokerFactory = invokerFactory;
//         update();
//     }
// 
//     void register(T listener) {
//         listeners.add(listener);
//         update();
//     }
// 
//     void unregister(T listener) {
//         listeners.remove(listener);
//         update();
//     }
// 
//     private void update() {
//         invoker = invokerFactory.apply(new ArrayList<>(listeners));
//     }
// 
//     public T invoker() {
//         return invoker;
//     }
// }


// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/KeyboardCallback.java
import de.johni0702.minecraft.gui.utils.Event;

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


public interface KeyboardCallback {
    Event<KeyboardCallback> EVENT = Event.create((listeners) ->
            new KeyboardCallback() {
                @Override
                public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
                    for (KeyboardCallback listener : listeners) {
                        if (listener.keyPressed(keyCode, scanCode, modifiers)) {
                            return true;
                        }
                    }
                    return false;
                }

                @Override
                public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
                    for (KeyboardCallback listener : listeners) {
                        if (listener.keyReleased(keyCode, scanCode, modifiers)) {
                            return true;