diff options
Diffstat (limited to 'versions/src/main/java/cc/polyfrost/oneconfig/events/event')
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 |