Skip to content

Commit 9ebf4d2

Browse files
Fixed issue with FLK, renamed Registry to Bus, bumped version to 1.0.3
1 parent f59defe commit 9ebf4d2

6 files changed

Lines changed: 15 additions & 15 deletions

File tree

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ dependencies {
133133
implementation("org.lwjgl:lwjgl-opengl:$lwjglVersion")
134134
implementation("org.lwjgl:lwjgl-stb:$lwjglVersion")
135135

136-
modImplementation("net.fabricmc:fabric-language-kotlin:$flk_version+kotlin.$kotlin_version") {
137-
exclude(group = "net.fabricmc", module = "fabric-loader")
138-
}
136+
modImplementation("net.fabricmc:fabric-language-kotlin:1.11.0+kotlin.2.0.0") {
137+
exclude(group = "net.fabricmc", module = "fabric-loader")
138+
}
139139
}
140140

141141
java {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ flk_version=1.13.3
1616
kotlin_version=2.1.21
1717

1818
# Mod
19-
mod_version=1.0.2
19+
mod_version=1.0.3
2020
mod_group=me.apollointhehouse
2121
mod_name=Raywire

src/main/kotlin/me/apollointhehouse/raywire/Raywire.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package me.apollointhehouse.raywire
22

3-
import me.apollointhehouse.raywire.api.Registry
3+
import me.apollointhehouse.raywire.api.Bus
44
import net.fabricmc.api.ModInitializer
55
import org.slf4j.Logger
66
import org.slf4j.LoggerFactory
@@ -11,5 +11,5 @@ object Raywire : ModInitializer {
1111

1212
override fun onInitialize() {}
1313

14-
val globalRegistry = Registry()
14+
val globalBus = Bus()
1515
}

src/main/kotlin/me/apollointhehouse/raywire/api/Registry.kt renamed to src/main/kotlin/me/apollointhehouse/raywire/api/Bus.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package me.apollointhehouse.raywire.api
22

33
import me.apollointhehouse.raywire.internal.EventManager
44

5-
fun Registry(): Registry = EventManager()
5+
fun Bus(): Bus = EventManager()
66

7-
interface Registry {
7+
interface Bus {
88
/**
99
* Subscribes given object to scan for event handlers to be invoked
1010
* @param obj the object to be subscribed
@@ -19,7 +19,7 @@ interface Registry {
1919

2020
/**
2121
* Invokes all event handlers for given event
22-
* @param event Event being invoked
22+
* @param event Event being posted
2323
*/
24-
fun invoke(event: Event)
24+
fun post(event: Event)
2525
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package me.apollointhehouse.raywire.api
22

3-
import me.apollointhehouse.raywire.Raywire.globalRegistry
3+
import me.apollointhehouse.raywire.Raywire.globalBus
44

55
interface Event {
6-
fun call() = globalRegistry.invoke(this)
6+
fun call() = globalBus.post(this)
77
}

src/main/kotlin/me/apollointhehouse/raywire/internal/EventManager.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import java.lang.reflect.Method
66

77
typealias Callable = Pair<Any, Method>
88

9-
internal class EventManager : Registry {
9+
internal class EventManager : Bus {
1010
private val methodCache: MutableMap<Class<out Any>, MutableList<Callable>> = mutableMapOf()
1111
private val objectEventMap: MutableMap<Any, MutableList<Class<out Any>>> = mutableMapOf()
1212

@@ -53,9 +53,9 @@ internal class EventManager : Registry {
5353

5454
/**
5555
* Invoke all event handlers for given event
56-
* @param event Event that called invoke with [Event.call]
56+
* @param event Event that called post
5757
*/
58-
override fun invoke(event: Event) = try {
58+
override fun post(event: Event) = try {
5959
val callables = methodCache[event::class.java]?.toList() ?: return
6060

6161
for ((obj, method) in callables) {

0 commit comments

Comments
 (0)