aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/events
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-05-27 23:39:11 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-05-27 23:39:11 +0700
commitf1509146f504707dfab3e9abac36038f94040b64 (patch)
treec1bc7b68627aa43692ba732a75841ef545afa61f /src/main/java/cc/polyfrost/oneconfig/events
parent358d5ca1a93b07003c5f45c30364de27a7fc101d (diff)
downloadOneConfig-f1509146f504707dfab3e9abac36038f94040b64.tar.gz
OneConfig-f1509146f504707dfab3e9abac36038f94040b64.tar.bz2
OneConfig-f1509146f504707dfab3e9abac36038f94040b64.zip
universal events
add mixinextras and keventbus
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/events')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/EventManager.java17
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/CancellableEvent.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/HudRenderEvent.java9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/RenderEvent.java11
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/ScreenOpenEvent.java11
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/Stage.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/TickEvent.java9
7 files changed, 68 insertions, 0 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/EventManager.java b/src/main/java/cc/polyfrost/oneconfig/events/EventManager.java
new file mode 100644
index 0000000..956c9b6
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/events/EventManager.java
@@ -0,0 +1,17 @@
+package cc.polyfrost.oneconfig.events;
+
+import cc.polyfrost.oneconfig.libs.eventbus.EventBus;
+import cc.polyfrost.oneconfig.libs.eventbus.invokers.LMFInvoker;
+
+public final class EventManager {
+ private EventManager() {
+
+ }
+
+ public static final EventManager INSTANCE = new EventManager();
+ private final EventBus eventBus = new EventBus(new LMFInvoker(), Throwable::printStackTrace);
+
+ public EventBus getEventBus() {
+ return eventBus;
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/CancellableEvent.java b/src/main/java/cc/polyfrost/oneconfig/events/event/CancellableEvent.java
new file mode 100644
index 0000000..2afa613
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/CancellableEvent.java
@@ -0,0 +1,5 @@
+package cc.polyfrost.oneconfig.events.event;
+
+public class CancellableEvent {
+ public boolean isCancelled = false;
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/HudRenderEvent.java b/src/main/java/cc/polyfrost/oneconfig/events/event/HudRenderEvent.java
new file mode 100644
index 0000000..974508d
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/HudRenderEvent.java
@@ -0,0 +1,9 @@
+package cc.polyfrost.oneconfig.events.event;
+
+public class HudRenderEvent {
+ public final float deltaTicks;
+
+ public HudRenderEvent(float deltaTicks) {
+ this.deltaTicks = deltaTicks;
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/RenderEvent.java b/src/main/java/cc/polyfrost/oneconfig/events/event/RenderEvent.java
new file mode 100644
index 0000000..aa305a1
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/RenderEvent.java
@@ -0,0 +1,11 @@
+package cc.polyfrost.oneconfig.events.event;
+
+public class RenderEvent {
+ public final Stage stage;
+ public final float deltaTicks;
+
+ public RenderEvent(Stage stage, float deltaTicks) {
+ this.stage = stage;
+ this.deltaTicks = deltaTicks;
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/ScreenOpenEvent.java b/src/main/java/cc/polyfrost/oneconfig/events/event/ScreenOpenEvent.java
new file mode 100644
index 0000000..d3a5b66
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/ScreenOpenEvent.java
@@ -0,0 +1,11 @@
+package cc.polyfrost.oneconfig.events.event;
+
+import net.minecraft.client.gui.GuiScreen;
+
+public class ScreenOpenEvent extends CancellableEvent {
+ public final GuiScreen screen;
+
+ public ScreenOpenEvent(GuiScreen screen) {
+ this.screen = screen;
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/Stage.java b/src/main/java/cc/polyfrost/oneconfig/events/event/Stage.java
new file mode 100644
index 0000000..77c93b8
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/Stage.java
@@ -0,0 +1,6 @@
+package cc.polyfrost.oneconfig.events.event;
+
+public enum Stage {
+ START,
+ END
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/TickEvent.java b/src/main/java/cc/polyfrost/oneconfig/events/event/TickEvent.java
new file mode 100644
index 0000000..5eb776c
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/TickEvent.java
@@ -0,0 +1,9 @@
+package cc.polyfrost.oneconfig.events.event;
+
+public class TickEvent {
+ public final Stage stage;
+
+ public TickEvent(Stage stage) {
+ this.stage = stage;
+ }
+}