File tree Expand file tree Collapse file tree
src/main/kotlin/me/apollointhehouse/raywire Expand file tree Collapse file tree Original file line number Diff line number Diff 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
141141java {
Original file line number Diff line number Diff line change @@ -16,6 +16,6 @@ flk_version=1.13.3
1616kotlin_version =2.1.21
1717
1818# Mod
19- mod_version =1.0.2
19+ mod_version =1.0.3
2020mod_group =me.apollointhehouse
2121mod_name =Raywire
Original file line number Diff line number Diff line change 11package me.apollointhehouse.raywire
22
3- import me.apollointhehouse.raywire.api.Registry
3+ import me.apollointhehouse.raywire.api.Bus
44import net.fabricmc.api.ModInitializer
55import org.slf4j.Logger
66import 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}
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ package me.apollointhehouse.raywire.api
22
33import 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}
Original file line number Diff line number Diff line change 11package me.apollointhehouse.raywire.api
22
3- import me.apollointhehouse.raywire.Raywire.globalRegistry
3+ import me.apollointhehouse.raywire.Raywire.globalBus
44
55interface Event {
6- fun call () = globalRegistry.invoke (this )
6+ fun call () = globalBus.post (this )
77}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import java.lang.reflect.Method
66
77typealias 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) {
You can’t perform that action at this time.
0 commit comments