Skip to content

Commit ded6877

Browse files
committed
Rollback from mod messaging system.
Signed-off-by: Pavel Erokhin (MairwunNx) <MairwunNx@gmail.com>
1 parent 976fb6e commit ded6877

File tree

1 file changed

+15
-30
lines changed
  • src/main/kotlin/com/mairwunnx/projectessentials/core

1 file changed

+15
-30
lines changed

src/main/kotlin/com/mairwunnx/projectessentials/core/EntryPoint.kt

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import com.mairwunnx.projectessentials.core.api.v1.IMCProvidersMessage
77
import com.mairwunnx.projectessentials.core.api.v1.configuration.ConfigurationAPI
88
import com.mairwunnx.projectessentials.core.api.v1.events.ModuleEventAPI.subscribeOn
99
import com.mairwunnx.projectessentials.core.api.v1.events.forge.ForgeEventType
10-
import com.mairwunnx.projectessentials.core.api.v1.events.forge.InterModEnqueueEventData
1110
import com.mairwunnx.projectessentials.core.api.v1.events.forge.InterModProcessEventData
1211
import com.mairwunnx.projectessentials.core.api.v1.localization.LocalizationAPI
1312
import com.mairwunnx.projectessentials.core.api.v1.localizationMarker
@@ -22,7 +21,6 @@ import com.mairwunnx.projectessentials.core.impl.configurations.NativeAliasesCon
2221
import com.mairwunnx.projectessentials.core.impl.events.EventBridge
2322
import net.minecraftforge.common.MinecraftForge.EVENT_BUS
2423
import net.minecraftforge.eventbus.api.SubscribeEvent
25-
import net.minecraftforge.fml.InterModComms
2624
import net.minecraftforge.fml.ModList
2725
import net.minecraftforge.fml.common.Mod
2826
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent
@@ -36,6 +34,8 @@ internal class EntryPoint {
3634
init {
3735
EventBridge.initialize()
3836
EVENT_BUS.register(this)
37+
initProviders()
38+
initLocalization()
3939
subscribeEvents()
4040
}
4141

@@ -46,13 +46,6 @@ internal class EntryPoint {
4646
}
4747

4848
private fun subscribeEvents() {
49-
subscribeOn<InterModEnqueueEventData>(
50-
ForgeEventType.EnqueueIMCEvent
51-
) {
52-
sendLocalizationRequest()
53-
sendProvidersRequest()
54-
}
55-
5649
subscribeOn<InterModProcessEventData>(
5750
ForgeEventType.ProcessIMCEvent
5851
) { event ->
@@ -61,34 +54,26 @@ internal class EntryPoint {
6154
}
6255
}
6356

64-
private fun sendLocalizationRequest() {
65-
InterModComms.sendTo(
66-
"project_essentials_core",
67-
IMCLocalizationMessage
68-
) {
69-
fun() = mutableListOf(
57+
private fun initProviders() {
58+
listOf(
59+
GeneralConfiguration::class.java,
60+
NativeAliasesConfiguration::class.java,
61+
ModuleObject::class.java,
62+
BackLocationCommand::class.java,
63+
ConfigureEssentialsCommand::class.java
64+
).forEach(ProviderAPI::addProvider)
65+
}
66+
67+
private fun initLocalization() {
68+
LocalizationAPI.apply(this.javaClass) {
69+
mutableListOf(
7070
"/assets/projectessentialscore/lang/en_us.json",
7171
"/assets/projectessentialscore/lang/ru_ru.json",
7272
"/assets/projectessentialscore/lang/zh_cn.json"
7373
)
7474
}
7575
}
7676

77-
private fun sendProvidersRequest() {
78-
InterModComms.sendTo(
79-
"project_essentials_core",
80-
IMCProvidersMessage
81-
) {
82-
fun() = listOf(
83-
GeneralConfiguration::class.java,
84-
NativeAliasesConfiguration::class.java,
85-
ModuleObject::class.java,
86-
BackLocationCommand::class.java,
87-
ConfigureEssentialsCommand::class.java
88-
)
89-
}
90-
}
91-
9277
private fun processLocalizationRequest(event: InterModProcessEventData) {
9378
event.event.getIMCStream { method ->
9479
method == IMCLocalizationMessage

0 commit comments

Comments
 (0)