summaryrefslogtreecommitdiff
path: root/src/main/kotlin/event
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-10-19 18:20:55 +0200
committerLinnea Gräf <nea@nea.moe>2024-10-19 18:20:55 +0200
commit5aa969979ab1dd0e64e5b569cc3b7b281b3e536f (patch)
tree55a7b8029dc76fd44078bca056fe31ac2f76833b /src/main/kotlin/event
parent3d7ace2e0fd66a2c83222d35331b27783268deea (diff)
downloadultra-notifier-5aa969979ab1dd0e64e5b569cc3b7b281b3e536f.tar.gz
ultra-notifier-5aa969979ab1dd0e64e5b569cc3b7b281b3e536f.tar.bz2
ultra-notifier-5aa969979ab1dd0e64e5b569cc3b7b281b3e536f.zip
Fix tick event and texture renderingHEADmaster
Diffstat (limited to 'src/main/kotlin/event')
-rw-r--r--src/main/kotlin/event/TickEvent.kt6
-rw-r--r--src/main/kotlin/event/UltraEvent.kt2
-rw-r--r--src/main/kotlin/event/UltraNotifierEvents.kt5
3 files changed, 9 insertions, 4 deletions
diff --git a/src/main/kotlin/event/TickEvent.kt b/src/main/kotlin/event/TickEvent.kt
index 8643261..4bd2c6c 100644
--- a/src/main/kotlin/event/TickEvent.kt
+++ b/src/main/kotlin/event/TickEvent.kt
@@ -4,10 +4,10 @@ package moe.nea.ultranotifier.event
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
//#endif
-class TickEvent : UltraEvent() {
+class TickEvent : UltraEvent(), UltraEvent.Silent<TickEvent> {
- companion object {
- init {
+ companion object : SubscriptionTarget {
+ override fun init() {
//#if FABRIC
ClientTickEvents.END_CLIENT_TICK.register(ClientTickEvents.EndTick {
TickEvent().post()
diff --git a/src/main/kotlin/event/UltraEvent.kt b/src/main/kotlin/event/UltraEvent.kt
index 4f615c1..80f63fc 100644
--- a/src/main/kotlin/event/UltraEvent.kt
+++ b/src/main/kotlin/event/UltraEvent.kt
@@ -7,6 +7,8 @@ abstract class UltraEvent :
me.bush.eventbus.event.Event()
//#endif
{
+ interface Silent<T> where T : Silent<T>, T : UltraEvent
+
//#if FORGE
//$$ override fun isCancelable(): Boolean {
//$$ return this.isCancellable()
diff --git a/src/main/kotlin/event/UltraNotifierEvents.kt b/src/main/kotlin/event/UltraNotifierEvents.kt
index 7190b63..9c1e1ee 100644
--- a/src/main/kotlin/event/UltraNotifierEvents.kt
+++ b/src/main/kotlin/event/UltraNotifierEvents.kt
@@ -9,9 +9,12 @@ object UltraNotifierEvents {
//#else
me.bush.eventbus.bus.EventBus { UltraNotifier.logger.warn("EventBus: $it") }
//#endif
+
@JvmStatic
fun <T : UltraEvent> post(event: T): T {
- UltraNotifier.logger.info("Posting $event")
+ if (event !is UltraEvent.Silent<*>) {
+ UltraNotifier.logger.info("Posting $event")
+ }
eventBus.post(event)
return event
}