Skip to content

Commit 1f6a880

Browse files
committed
Made the entire thing simpler
1 parent a5e417c commit 1f6a880

File tree

19 files changed

+48
-134
lines changed

19 files changed

+48
-134
lines changed

common/src/main/kotlin/com/lambda/command/CommandRegistry.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.lambda.command
22

33
import com.lambda.config.Configurable
44
import com.lambda.config.configurations.LambdaConfig
5-
import com.lambda.core.lifecycle.Loadable
5+
import com.lambda.core.Loadable
66
import org.reflections.Reflections
77
import org.reflections.scanners.Scanners
88
import org.reflections.util.ConfigurationBuilder
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.lambda.core
2+
3+
/**
4+
* Represents a loadable object.
5+
*/
6+
interface Loadable {
7+
fun load() = this::class.simpleName?.let { "Loaded $it" } ?: "Loaded"
8+
}

common/src/main/kotlin/com/lambda/core/Loader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object Loader {
2424
val runtime: String
2525
get() = "${(System.currentTimeMillis() - started).toDuration(DurationUnit.MILLISECONDS)}"
2626

27-
private val loadables = listOf(
27+
val loadables = listOf(
2828
ModuleRegistry,
2929
CommandRegistry,
3030
RotationManager,

common/src/main/kotlin/com/lambda/core/PingManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.lambda.core
22

3-
import com.lambda.core.lifecycle.Loadable
43
import com.lambda.event.events.PacketEvent
54
import com.lambda.event.events.TickEvent
65
import com.lambda.event.listener.SafeListener.Companion.listener

common/src/main/kotlin/com/lambda/core/TimerManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.lambda.core
22

3-
import com.lambda.core.lifecycle.Loadable
43
import com.lambda.event.EventFlow.post
54
import com.lambda.event.events.ClientEvent
65
import com.lambda.event.events.TickEvent

common/src/main/kotlin/com/lambda/core/lifecycle/Loadable.kt

Lines changed: 0 additions & 59 deletions
This file was deleted.

common/src/main/kotlin/com/lambda/core/registry/RegistryController.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import net.minecraft.util.Identifier
77

88
object RegistryController {
99
private val REGISTRIES = HashMap<RegistryKey<out Registry<*>?>, MutableList<RegistryHolder<*>>>()
10-
private var frozen = false
1110

1211
fun <T> register(registry: Registry<T>, id: Identifier, value: T): RegistryHolder<T> {
13-
check(!frozen) { "Cannot register, RegistryController is frozen." }
1412
val holder = RegistryHolder(id, value)
1513

1614
REGISTRIES.computeIfAbsent(registry.key) { mutableListOf(holder) }
@@ -20,10 +18,8 @@ object RegistryController {
2018
/**
2119
* Loads the temporary registry holders into the actual registry.
2220
* This should be called after all registry holders have been created.
23-
* It will also freeze the controller to prevent further registrations.
2421
*/
2522
fun register(resourceKey: RegistryKey<out Registry<*>?>, registry: RegistryWrapper<*>) {
26-
frozen = true
2723
REGISTRIES[resourceKey]?.forEach { it.handleRegister(registry) }
2824
REGISTRIES.remove(resourceKey)
2925
}

common/src/main/kotlin/com/lambda/friend/FriendRegistry.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.lambda.friend
22

33
import com.lambda.config.Configurable
44
import com.lambda.config.configurations.FriendConfig
5-
import com.lambda.core.lifecycle.Loadable
5+
import com.lambda.core.Loadable
66
import com.mojang.authlib.GameProfile
77

88
object FriendRegistry : Configurable(FriendConfig), Loadable {

common/src/main/kotlin/com/lambda/graphics/renderer/gui/font/LambdaEmoji.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.lambda.graphics.renderer.gui.font
22

3-
import com.lambda.core.lifecycle.Loadable
3+
import com.lambda.core.Loadable
44
import com.lambda.graphics.renderer.gui.font.glyph.EmojiGlyphs
55

66
enum class LambdaEmoji(private val zipUrl: String) {

common/src/main/kotlin/com/lambda/graphics/renderer/gui/font/LambdaFont.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.lambda.graphics.renderer.gui.font
22

3-
import com.lambda.core.lifecycle.Loadable
3+
import com.lambda.core.Loadable
44
import com.lambda.graphics.renderer.gui.font.glyph.FontGlyphs
55
import com.lambda.util.LambdaResource
66
import java.awt.Font

0 commit comments

Comments
 (0)