Skip to content

Commit 5595b68

Browse files
committed
added loader orders
1 parent 4e3ddac commit 5595b68

File tree

10 files changed

+31
-0
lines changed

10 files changed

+31
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ package com.lambda.command
2020
import com.lambda.config.Configurable
2121
import com.lambda.config.configurations.LambdaConfig
2222
import com.lambda.core.loader.Loadable
23+
import com.lambda.core.loader.LoaderOrder
24+
import com.lambda.core.loader.Phase
2325
import com.lambda.util.reflections.getInstances
2426

2527
/**
2628
* The [CommandRegistry] object is responsible for managing all [LambdaCommand] instances in the system.
2729
*/
30+
@LoaderOrder(phase = Phase.Config)
2831
object CommandRegistry : Configurable(LambdaConfig), Loadable {
2932
override val name = "command"
3033
val prefix by setting("prefix", ';')

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ package com.lambda.friend
2020
import com.lambda.config.Configurable
2121
import com.lambda.config.configurations.FriendConfig
2222
import com.lambda.core.loader.Loadable
23+
import com.lambda.core.loader.LoaderOrder
24+
import com.lambda.core.loader.Phase
2325
import com.mojang.authlib.GameProfile
2426
import net.minecraft.client.network.OtherClientPlayerEntity
2527
import java.util.*
2628

29+
@LoaderOrder(phase = Phase.Config)
2730
object FriendManager : Configurable(FriendConfig), Loadable {
2831
override val name = "friends"
2932
val friends by setting("friends", listOf<GameProfile>(), hackDelegates = true)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
package com.lambda.graphics.renderer.gui.font
1919

2020
import com.lambda.core.loader.Loadable
21+
import com.lambda.core.loader.LoaderOrder
22+
import com.lambda.core.loader.Phase
2123
import com.lambda.graphics.renderer.gui.font.glyph.EmojiGlyphs
24+
import kotlin.Int.Companion
2225

2326
enum class LambdaEmoji(private val zipUrl: String) {
2427
Twemoji("https://github.com/Edouard127/emoji-generator/releases/latest/download/emojis.zip");
@@ -31,6 +34,7 @@ enum class LambdaEmoji(private val zipUrl: String) {
3134
glyphs = EmojiGlyphs(zipUrl)
3235
}
3336

37+
@LoaderOrder(phase = Phase.Render, priority = Int.MAX_VALUE)
3438
object Loader : Loadable {
3539
override fun load(): String {
3640
entries.forEach(LambdaEmoji::loadGlyphs)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package com.lambda.graphics.renderer.gui.font
1919

2020
import com.lambda.core.loader.Loadable
21+
import com.lambda.core.loader.LoaderOrder
22+
import com.lambda.core.loader.Phase
2123
import com.lambda.graphics.renderer.gui.font.glyph.FontGlyphs
2224
import com.lambda.util.LambdaResource
2325
import java.awt.Font
@@ -37,6 +39,7 @@ enum class LambdaFont(private val fontName: String) {
3739
glyphs = FontGlyphs(font)
3840
}
3941

42+
@LoaderOrder(phase = Phase.Render, priority = Int.MAX_VALUE)
4043
object Loader : Loadable {
4144
override fun load(): String {
4245
entries.forEach(LambdaFont::loadGlyphs)

common/src/main/kotlin/com/lambda/gui/GuiConfigurable.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717

1818
package com.lambda.gui
1919

20+
import com.lambda.core.loader.LoaderOrder
21+
import com.lambda.core.loader.Phase
2022
import com.lambda.gui.impl.clickgui.LambdaClickGui
2123
import com.lambda.gui.impl.clickgui.windows.tag.CustomModuleWindow
2224
import com.lambda.module.tag.ModuleTag
2325

26+
@LoaderOrder(phase = Phase.Render)
2427
object GuiConfigurable : AbstractGuiConfigurable(
2528
LambdaClickGui, ModuleTag.defaults, "gui"
2629
) {

common/src/main/kotlin/com/lambda/gui/HudGuiConfigurable.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717

1818
package com.lambda.gui
1919

20+
import com.lambda.core.loader.LoaderOrder
21+
import com.lambda.core.loader.Phase
2022
import com.lambda.gui.impl.hudgui.LambdaHudGui
2123
import com.lambda.module.tag.ModuleTag
2224

25+
@LoaderOrder(phase = Phase.Render)
2326
object HudGuiConfigurable : AbstractGuiConfigurable(
2427
LambdaHudGui, ModuleTag.hudDefaults, "hudgui"
2528
)

common/src/main/kotlin/com/lambda/interaction/RotationManager.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import com.lambda.Lambda.mc
2121
import com.lambda.config.groups.RotationSettings
2222
import com.lambda.context.SafeContext
2323
import com.lambda.core.loader.Loadable
24+
import com.lambda.core.loader.LoaderOrder
25+
import com.lambda.core.loader.Phase
2426
import com.lambda.event.EventFlow.post
2527
import com.lambda.event.events.*
2628
import com.lambda.event.listener.SafeListener.Companion.listener
@@ -43,6 +45,7 @@ import net.minecraft.client.input.Input
4345
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket
4446
import kotlin.math.*
4547

48+
@LoaderOrder(phase = Phase.Modules)
4649
object RotationManager : Loadable {
4750
var currentRotation = Rotation.ZERO
4851
var prevRotation = Rotation.ZERO

common/src/main/kotlin/com/lambda/interaction/material/ContainerManager.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package com.lambda.interaction.material
1919

2020
import com.lambda.core.loader.Loadable
21+
import com.lambda.core.loader.LoaderOrder
22+
import com.lambda.core.loader.Phase
2123
import com.lambda.event.events.PlayerEvent
2224
import com.lambda.event.events.ScreenHandlerEvent
2325
import com.lambda.event.listener.SafeListener.Companion.listener
@@ -40,6 +42,7 @@ import net.minecraft.screen.GenericContainerScreenHandler
4042
import net.minecraft.screen.ScreenHandlerType
4143

4244
// ToDo: Make this a Configurable to save container caches. Should use a cached region based storage system.
45+
@LoaderOrder(phase = Phase.Modules)
4346
object ContainerManager : Loadable {
4447
private val container: List<MaterialContainer>
4548
get() = compileContainers + runtimeContainers

common/src/main/kotlin/com/lambda/module/ModuleRegistry.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
package com.lambda.module
1919

2020
import com.lambda.core.loader.Loadable
21+
import com.lambda.core.loader.LoaderOrder
22+
import com.lambda.core.loader.Phase
2123
import com.lambda.util.reflections.getInstances
2224

2325
/**
2426
* The [ModuleRegistry] object is responsible for managing all [Module] instances in the system.
2527
*/
28+
@LoaderOrder(phase = Phase.Modules)
2629
object ModuleRegistry : Loadable {
2730
val modules = getInstances<Module> { forPackages("com.lambda.module.modules") }.toMutableList()
2831

common/src/main/kotlin/com/lambda/sound/SoundRegistry.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818
package com.lambda.sound
1919

2020
import com.lambda.core.loader.Loadable
21+
import com.lambda.core.loader.LoaderOrder
22+
import com.lambda.core.loader.Phase
2123
import com.lambda.core.registry.AgnosticRegistries
2224
import net.minecraft.registry.Registries
2325

26+
@LoaderOrder(phase = Phase.Resources)
2427
object SoundRegistry : Loadable {
2528
override fun load(): String {
2629
LambdaSound.entries.forEach {

0 commit comments

Comments
 (0)