aboutsummaryrefslogtreecommitdiff
path: root/versions/src/main/java/cc/polyfrost/oneconfig/events/event
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-07-02 06:12:23 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-07-02 06:12:23 +0700
commitd4bb5a94308d4379ef3d6cc7b9221ea0d98ff051 (patch)
tree9bb9b53e2823f73084780673763504f4098bae69 /versions/src/main/java/cc/polyfrost/oneconfig/events/event
parentd2b1d57120bb51e76191302a58d935afe52b89df (diff)
downloadOneConfig-d4bb5a94308d4379ef3d6cc7b9221ea0d98ff051.tar.gz
OneConfig-d4bb5a94308d4379ef3d6cc7b9221ea0d98ff051.tar.bz2
OneConfig-d4bb5a94308d4379ef3d6cc7b9221ea0d98ff051.zip
Separate Minecraft dependant and non-dependant code
Diffstat (limited to 'versions/src/main/java/cc/polyfrost/oneconfig/events/event')
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/events/event/ChatReceiveEvent.java22
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java11
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/events/event/ScreenOpenEvent.java17
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java11
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/events/event/TimerUpdateEvent.java24
5 files changed, 85 insertions, 0 deletions
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/events/event/ChatReceiveEvent.java b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/ChatReceiveEvent.java
new file mode 100644
index 0000000..6585729
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/ChatReceiveEvent.java
@@ -0,0 +1,22 @@
+package cc.polyfrost.oneconfig.events.event;
+
+import cc.polyfrost.oneconfig.libs.universal.wrappers.message.UTextComponent;
+import net.minecraft.util.IChatComponent;
+
+/**
+ * Called when a chat message is received.
+ */
+public class ChatReceiveEvent extends CancellableEvent {
+ /**
+ * The message that was received.
+ */
+ public final IChatComponent message;
+
+ public ChatReceiveEvent(IChatComponent message) {
+ this.message = message;
+ }
+
+ public String getFullyUnformattedMessage() {
+ return UTextComponent.Companion.stripFormatting(message.getUnformattedText());
+ }
+}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java
new file mode 100644
index 0000000..17bc16d
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java
@@ -0,0 +1,11 @@
+package cc.polyfrost.oneconfig.events.event;
+
+import net.minecraft.network.Packet;
+
+public class ReceivePacketEvent extends CancellableEvent {
+ public final Packet<?> packet;
+
+ public ReceivePacketEvent(Packet<?> packet) {
+ this.packet = packet;
+ }
+}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/events/event/ScreenOpenEvent.java b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/ScreenOpenEvent.java
new file mode 100644
index 0000000..4593638
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/ScreenOpenEvent.java
@@ -0,0 +1,17 @@
+package cc.polyfrost.oneconfig.events.event;
+
+import net.minecraft.client.gui.GuiScreen;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when a screen is opened or closed.
+ * If the screen is closed, {@link ScreenOpenEvent#screen} will be null.
+ */
+public class ScreenOpenEvent extends CancellableEvent {
+ @Nullable
+ public final GuiScreen screen;
+
+ public ScreenOpenEvent(@Nullable GuiScreen screen) {
+ this.screen = screen;
+ }
+}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java
new file mode 100644
index 0000000..3cee784
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java
@@ -0,0 +1,11 @@
+package cc.polyfrost.oneconfig.events.event;
+
+import net.minecraft.network.Packet;
+
+public class SendPacketEvent extends CancellableEvent {
+ public final Packet<?> packet;
+
+ public SendPacketEvent(Packet<?> packet) {
+ this.packet = packet;
+ }
+}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/events/event/TimerUpdateEvent.java b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/TimerUpdateEvent.java
new file mode 100644
index 0000000..a8b88dc
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/events/event/TimerUpdateEvent.java
@@ -0,0 +1,24 @@
+package cc.polyfrost.oneconfig.events.event;
+
+import net.minecraft.util.Timer;
+
+/**
+ * Called when the {@link Timer} is updated.
+ * Can be used as an alternative to getting instances of {@link Timer}
+ * via Mixin or Access Wideners / Transformers
+ */
+public class TimerUpdateEvent {
+ /**
+ * Whether the deltaTicks / renderPartialTicks was updated
+ */
+ public final boolean updatedDeltaTicks;
+ /**
+ * The {@link Timer} instance
+ */
+ public final Timer timer;
+
+ public TimerUpdateEvent(Timer timer, boolean updatedDeltaTicks) {
+ this.timer = timer;
+ this.updatedDeltaTicks = updatedDeltaTicks;
+ }
+} \ No newline at end of file