// Path: src/main/java/com/openmodloader/api/event/GenericEventTarget.java
// public class GenericEventTarget<E extends IEvent, G> implements IEventTarget<E> {
//     private final Class<E> eventType;
//     private final Class<G> genericType;
// 
//     protected GenericEventTarget(Class<E> eventType, Class<G> genericType) {
//         this.eventType = eventType;
//         this.genericType = genericType;
//     }
// 
//     @SuppressWarnings("unchecked")
//     public static <E extends IEvent, G> GenericEventTarget<E, G> of(Class<?> eventClass, Class<?> genericType) {
//         return new GenericEventTarget<>((Class<E>) eventClass, (Class<G>) genericType);
//     }
// 
//     @Override
//     public Class<E> getType() {
//         return this.eventType;
//     }
// 
//     @Override
//     public boolean canReceive(IEventTarget<?> target) {
//         if (target.getType().equals(this.eventType)) {
//             if (target instanceof GenericEventTarget) {
//                 GenericEventTarget<?, ?> genericTarget = (GenericEventTarget<?, ?>) target;
//                 return this.genericType.isAssignableFrom(genericTarget.genericType);
//             }
//             return true;
//         }
//         return false;
//     }
// }
// 
// Path: src/main/java/com/openmodloader/api/event/IEvent.java
// public interface IEvent {
//     IEventTarget<?> makeTarget();
// }
// 
// Path: src/main/java/com/openmodloader/api/event/IEventTarget.java
// public interface IEventTarget<E extends IEvent> {
//     Class<E> getType();
// 
//     boolean canReceive(IEventTarget<?> target);
// }


import com.openmodloader.api.event.GenericEventTarget;
import com.openmodloader.api.event.IEvent;
import com.openmodloader.api.event.IEventTarget;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.render.text.TextRenderer;
        public static <T extends GuiScreen> IEventTarget<Open<T>> target(Class<T> target) {
            return GenericEventTarget.of(Open.class, target);
        }

        public static <T extends GuiScreen> IEventTarget<Open<T>> target() {
            return GenericEventTarget.of(Open.class, GuiScreen.class);
        }
    }

    public static class Draw<T extends GuiScreen> extends GuiEvent<T> {
        protected final TextRenderer textRenderer;

        public Draw(T gui, TextRenderer textRenderer) {
            super(gui);
            this.textRenderer = textRenderer;
        }

        public TextRenderer getTextRenderer() {
            return textRenderer;
        }

        @Override
        public IEventTarget<?> makeTarget() {
            return target(gui.getClass());
        }

        public static <T extends GuiScreen> IEventTarget<Draw<T>> target(Class<T> target) {
            return GenericEventTarget.of(Draw.class, target);
        }

// Path: src/main/java/com/openmodloader/api/event/GenericEventTarget.java
// public class GenericEventTarget<E extends IEvent, G> implements IEventTarget<E> {
//     private final Class<E> eventType;
//     private final Class<G> genericType;
// 
//     protected GenericEventTarget(Class<E> eventType, Class<G> genericType) {
//         this.eventType = eventType;
//         this.genericType = genericType;
//     }
// 
//     @SuppressWarnings("unchecked")
//     public static <E extends IEvent, G> GenericEventTarget<E, G> of(Class<?> eventClass, Class<?> genericType) {
//         return new GenericEventTarget<>((Class<E>) eventClass, (Class<G>) genericType);
//     }
// 
//     @Override
//     public Class<E> getType() {
//         return this.eventType;
//     }
// 
//     @Override
//     public boolean canReceive(IEventTarget<?> target) {
//         if (target.getType().equals(this.eventType)) {
//             if (target instanceof GenericEventTarget) {
//                 GenericEventTarget<?, ?> genericTarget = (GenericEventTarget<?, ?>) target;
//                 return this.genericType.isAssignableFrom(genericTarget.genericType);
//             }
//             return true;
//         }
//         return false;
//     }
// }
// 
// Path: src/main/java/com/openmodloader/api/event/IEvent.java
// public interface IEvent {
//     IEventTarget<?> makeTarget();
// }
// 
// Path: src/main/java/com/openmodloader/api/event/IEventTarget.java
// public interface IEventTarget<E extends IEvent> {
//     Class<E> getType();
// 
//     boolean canReceive(IEventTarget<?> target);
// }


// Path: src/main/java/com/openmodloader/core/event/GuiEvent.java
import com.openmodloader.api.event.GenericEventTarget;
import com.openmodloader.api.event.IEvent;
import com.openmodloader.api.event.IEventTarget;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.render.text.TextRenderer;

        public static <T extends GuiScreen> IEventTarget<Open<T>> target(Class<T> target) {
            return GenericEventTarget.of(Open.class, target);
        }

        public static <T extends GuiScreen> IEventTarget<Open<T>> target() {
            return GenericEventTarget.of(Open.class, GuiScreen.class);
        }
    }

    public static class Draw<T extends GuiScreen> extends GuiEvent<T> {
        protected final TextRenderer textRenderer;

        public Draw(T gui, TextRenderer textRenderer) {
            super(gui);
            this.textRenderer = textRenderer;
        }

        public TextRenderer getTextRenderer() {
            return textRenderer;
        }

        @Override
        public IEventTarget<?> makeTarget() {
            return target(gui.getClass());
        }

        public static <T extends GuiScreen> IEventTarget<Draw<T>> target(Class<T> target) {
            return GenericEventTarget.of(Draw.class, target);
        }

        public static <T extends GuiScreen> IEventTarget<Draw<T>> target() {