aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/events
diff options
context:
space:
mode:
authoringle <inglettronald@gmail.com>2022-09-24 02:08:54 -0500
committeringle <inglettronald@gmail.com>2022-09-24 02:08:54 -0500
commit766e67b5a00af83bfbc25a1c0fa0a302225102bc (patch)
tree2937874aed28557414456d3d5b306fe7b551504f /src/main/kotlin/dulkirmod/events
parent3cd5f5f32cd60c15e1c68862d28885f733473dad (diff)
downloadDulkirMod-766e67b5a00af83bfbc25a1c0fa0a302225102bc.tar.gz
DulkirMod-766e67b5a00af83bfbc25a1c0fa0a302225102bc.tar.bz2
DulkirMod-766e67b5a00af83bfbc25a1c0fa0a302225102bc.zip
Some more things work now
Diffstat (limited to 'src/main/kotlin/dulkirmod/events')
-rw-r--r--src/main/kotlin/dulkirmod/events/ChatEvent.kt23
-rw-r--r--src/main/kotlin/dulkirmod/events/Events.kt43
2 files changed, 23 insertions, 43 deletions
diff --git a/src/main/kotlin/dulkirmod/events/ChatEvent.kt b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
new file mode 100644
index 0000000..898e2e7
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
@@ -0,0 +1,23 @@
+package dulkirmod.events
+
+import dulkirmod.DulkirMod
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class ChatEvent {
+ @SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW)
+ fun onChat(event: ClientChatReceivedEvent) {
+ if (event.type == 2.toByte()) {
+ return
+ }
+ val unformatted = stripColorCodes(event.message.unformattedText)
+ if (unformatted == "Warping you to your SkyBlock island..." && DulkirMod.config.throttleNotifier) {
+ event.isCanceled = true;
+ DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage)
+ }
+ }
+ private fun stripColorCodes(string: String): String {
+ return string.replace("ยง.".toRegex(), "")
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/events/Events.kt b/src/main/kotlin/dulkirmod/events/Events.kt
deleted file mode 100644
index bc4654d..0000000
--- a/src/main/kotlin/dulkirmod/events/Events.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package dulkirmod.events
-
-import net.minecraft.client.gui.inventory.GuiContainer
-import net.minecraft.client.model.ModelBase
-import net.minecraft.entity.EntityLivingBase
-import net.minecraft.inventory.Container
-import net.minecraft.inventory.Slot
-import net.minecraft.network.Packet
-import net.minecraftforge.fml.common.eventhandler.Cancelable
-import net.minecraftforge.fml.common.eventhandler.Event
-
-open class ClickEvent : Event() {
- @Cancelable
- class LeftClickEvent : ClickEvent()
-
- @Cancelable
- class RightClickEvent : ClickEvent()
-}
-
-open class GuiContainerEvent(val container: Container, val gui: GuiContainer) : Event() {
- @Cancelable
- class DrawSlotEvent(container: Container, gui: GuiContainer, var slot: Slot) :
- GuiContainerEvent(container, gui)
-
- @Cancelable
- class SlotClickEvent(container: Container, gui: GuiContainer, var slot: Slot?, var slotId: Int) :
- GuiContainerEvent(container, gui)
-}
-
-@Cancelable
-class ReceivePacketEvent(val packet: Packet<*>) : Event()
-
-@Cancelable
-class RenderLivingEntityEvent(
- var entity: EntityLivingBase,
- var p_77036_2_: Float,
- var p_77036_3_: Float,
- var p_77036_4_: Float,
- var p_77036_5_: Float,
- var p_77036_6_: Float,
- var scaleFactor: Float,
- var modelBase: ModelBase
-) : Event()