Kotlin for Kotlin (switch to KFF loader)
This commit is contained in:
parent
991582f930
commit
1712f92335
@ -1,272 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm;
|
||||
|
||||
import kotlin.KotlinVersion;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.EventPriority;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.ModContainer;
|
||||
import net.neoforged.fml.ModList;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchDescription;
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchDescriptions;
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchManager;
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchResult;
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchResults;
|
||||
import ru.dbotthepony.mc.otm.android.feature.EnderTeleporterFeature;
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity;
|
||||
import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity;
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayer;
|
||||
import ru.dbotthepony.mc.otm.capability.drive.DrivePool;
|
||||
import ru.dbotthepony.mc.otm.client.AndroidAbilityKeyMapping;
|
||||
import ru.dbotthepony.mc.otm.client.AndroidMenuKeyMapping;
|
||||
import ru.dbotthepony.mc.otm.client.ClientEventHandlerKt;
|
||||
import ru.dbotthepony.mc.otm.client.ClientTickHandlerKt;
|
||||
import ru.dbotthepony.mc.otm.client.MatteryGUI;
|
||||
import ru.dbotthepony.mc.otm.client.model.ExosuitModel;
|
||||
import ru.dbotthepony.mc.otm.client.model.GravitationStabilizerModel;
|
||||
import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel;
|
||||
import ru.dbotthepony.mc.otm.client.render.ChartTooltipElement;
|
||||
import ru.dbotthepony.mc.otm.client.render.ShockwaveRenderer;
|
||||
import ru.dbotthepony.mc.otm.client.render.blockentity.BatteryBankRenderer;
|
||||
import ru.dbotthepony.mc.otm.client.render.blockentity.MatterBatteryBankRenderer;
|
||||
import ru.dbotthepony.mc.otm.compat.curios.CuriosCompatKt;
|
||||
import ru.dbotthepony.mc.otm.compat.vanilla.MatteryChestMenu;
|
||||
import ru.dbotthepony.mc.otm.config.AndroidConfig;
|
||||
import ru.dbotthepony.mc.otm.config.CablesConfig;
|
||||
import ru.dbotthepony.mc.otm.config.ClientConfig;
|
||||
import ru.dbotthepony.mc.otm.config.ExopackConfig;
|
||||
import ru.dbotthepony.mc.otm.config.ItemsConfig;
|
||||
import ru.dbotthepony.mc.otm.config.MachinesConfig;
|
||||
import ru.dbotthepony.mc.otm.config.ServerConfig;
|
||||
import ru.dbotthepony.mc.otm.config.ToolsConfig;
|
||||
import ru.dbotthepony.mc.otm.data.DecimalProvider;
|
||||
import ru.dbotthepony.mc.otm.item.ChestUpgraderItem;
|
||||
import ru.dbotthepony.mc.otm.item.tool.ExplosiveHammerItem;
|
||||
import ru.dbotthepony.mc.otm.item.armor.TritaniumArmorItem;
|
||||
import ru.dbotthepony.mc.otm.item.QuantumBatteryItem;
|
||||
import ru.dbotthepony.mc.otm.item.PortableCondensationDriveItem;
|
||||
import ru.dbotthepony.mc.otm.matter.AbstractRegistryAction;
|
||||
import ru.dbotthepony.mc.otm.matter.IMatterFunction;
|
||||
import ru.dbotthepony.mc.otm.matter.MatterManager;
|
||||
import ru.dbotthepony.mc.otm.network.*;
|
||||
import ru.dbotthepony.mc.otm.registry.*;
|
||||
import ru.dbotthepony.mc.otm.server.MCommands;
|
||||
import ru.dbotthepony.mc.otm.storage.StorageStack;
|
||||
import ru.dbotthepony.mc.otm.triggers.KillAsAndroidTrigger;
|
||||
import top.theillusivec4.curios.api.CuriosApi;
|
||||
|
||||
import static net.neoforged.neoforge.common.NeoForge.EVENT_BUS;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
// The value here should match an entry in the META-INF/mods.toml file
|
||||
@Mod(OverdriveThatMatters.MOD_ID)
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
public final class OverdriveThatMatters {
|
||||
// Directly reference a log4j logger.
|
||||
public static final String MOD_ID = "overdrive_that_matters";
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
public static OverdriveThatMatters INSTANCE;
|
||||
public static ResourceLocation loc(String path) {
|
||||
return ResourceLocation.fromNamespaceAndPath(MOD_ID, path);
|
||||
}
|
||||
|
||||
private static void checkIfKotlinIsInstalled() {
|
||||
if (!KotlinVersion.CURRENT.isAtLeast(2, 0, 0)) {
|
||||
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 2.0.0 is required.");
|
||||
}
|
||||
}
|
||||
|
||||
public OverdriveThatMatters(IEventBus bus, Dist dist, ModContainer container) {
|
||||
if (INSTANCE != null) {
|
||||
throw new IllegalStateException("wei wei wei... hello?");
|
||||
}
|
||||
|
||||
try {
|
||||
checkIfKotlinIsInstalled();
|
||||
} catch (Throwable err) {
|
||||
if (err instanceof NoClassDefFoundError) {
|
||||
for (int i = 0; i < 16; i++)
|
||||
LOGGER.fatal("Overdrive That Matters requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge");
|
||||
|
||||
LOGGER.fatal("Overdrive That Matters requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge", err);
|
||||
throw new RuntimeException("Overdrive That Matters requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge");
|
||||
}
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
LOGGER.fatal("Overdrive That Matters' Kotlin version is not satisfied, get newer Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge");
|
||||
|
||||
LOGGER.fatal("Overdrive That Matters' Kotlin version is not satisfied, get newer Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge", err);
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
INSTANCE = this;
|
||||
|
||||
MBlocks.INSTANCE.register(bus);
|
||||
MFluids.INSTANCE.register(bus);
|
||||
MBlockEntities.INSTANCE.register(bus);
|
||||
MEntityTypes.INSTANCE.register(bus);
|
||||
MMenus.INSTANCE.register(bus);
|
||||
MItems.INSTANCE.register(bus);
|
||||
AndroidFeatures.INSTANCE.register(bus);
|
||||
MSoundEvents.INSTANCE.register(bus);
|
||||
LootModifiers.INSTANCE.register(bus);
|
||||
MItemFunctionTypes.INSTANCE.register(bus);
|
||||
MLootItemConditions.INSTANCE.register(bus);
|
||||
MRecipes.INSTANCE.register(bus);
|
||||
MDataComponentTypes.INSTANCE.register(bus);
|
||||
MArmorMaterials.INSTANCE.register(bus);
|
||||
MCriteriaTriggers.INSTANCE.register(bus);
|
||||
MStats.INSTANCE.register(bus);
|
||||
MWorldGenFeatures.INSTANCE.register(bus);
|
||||
CommandArgumentTypes.INSTANCE.register(bus);
|
||||
|
||||
StorageStack.Companion.register(bus);
|
||||
MatteryChestMenu.Companion.register(bus);
|
||||
|
||||
MCreativeTabs.INSTANCE.initialize(bus);
|
||||
|
||||
bus.addListener(NetworkPacketsKt::registerNetworkPackets);
|
||||
|
||||
DecimalProvider.Companion.register(bus);
|
||||
AndroidResearchDescription.Companion.register(bus);
|
||||
AndroidResearchDescriptions.INSTANCE.register(bus);
|
||||
AndroidResearchResult.Companion.register(bus);
|
||||
AndroidResearchResults.INSTANCE.register(bus);
|
||||
|
||||
AbstractRegistryAction.Companion.register(bus);
|
||||
IMatterFunction.Companion.register(bus);
|
||||
|
||||
MRegistry.INSTANCE.initialize(bus);
|
||||
MatterManager.INSTANCE.initialize(bus);
|
||||
|
||||
bus.addListener(EventPriority.HIGHEST, this::setup);
|
||||
bus.addListener(EventPriority.NORMAL, this::setupClient);
|
||||
|
||||
if (dist == Dist.CLIENT) {
|
||||
bus.addListener(EventPriority.NORMAL, AndroidMenuKeyMapping.INSTANCE::register);
|
||||
bus.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping.INSTANCE::register);
|
||||
bus.addListener(EventPriority.NORMAL, TritaniumArmorModel::register);
|
||||
bus.addListener(EventPriority.NORMAL, GravitationStabilizerModel::register);
|
||||
bus.addListener(EventPriority.NORMAL, MCreativeTabs.INSTANCE::register);
|
||||
|
||||
bus.addListener(EventPriority.NORMAL, BatteryBankRenderer.Companion::onRegisterAdditionalModels);
|
||||
bus.addListener(EventPriority.NORMAL, MatterBatteryBankRenderer.Companion::onRegisterAdditionalModels);
|
||||
|
||||
bus.addListener(EventPriority.NORMAL, ChartTooltipElement.Companion::register);
|
||||
|
||||
MBlockColors.INSTANCE.register(bus);
|
||||
}
|
||||
|
||||
ClientConfig.INSTANCE.register(container);
|
||||
ServerConfig.INSTANCE.register(container);
|
||||
CablesConfig.INSTANCE.register(container);
|
||||
AndroidConfig.INSTANCE.register(container);
|
||||
ExopackConfig.INSTANCE.register(container);
|
||||
ItemsConfig.INSTANCE.register(container);
|
||||
MachinesConfig.INSTANCE.register(container);
|
||||
ToolsConfig.INSTANCE.register(container);
|
||||
}
|
||||
|
||||
private void setup(final FMLCommonSetupEvent event) {
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, DrivePool.INSTANCE::onWorldSave);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.HIGHEST, GlobalEventHandlerKt::onServerStopped);
|
||||
EVENT_BUS.addListener(EventPriority.HIGHEST, GlobalEventHandlerKt::onServerStopping);
|
||||
EVENT_BUS.addListener(EventPriority.HIGHEST, GlobalEventHandlerKt::onServerStarting);
|
||||
EVENT_BUS.addListener(EventPriority.HIGH, GlobalEventHandlerKt::onLevelTickPre);
|
||||
EVENT_BUS.addListener(EventPriority.LOWEST, GlobalEventHandlerKt::onLevelTickPost);
|
||||
EVENT_BUS.addListener(EventPriority.HIGH, GlobalEventHandlerKt::onServerTickPre);
|
||||
EVENT_BUS.addListener(EventPriority.LOWEST, GlobalEventHandlerKt::onServerTickPost);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerTickPre);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerTickPost);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::isMobEffectApplicable);
|
||||
EVENT_BUS.addListener(EventPriority.LOW, MatteryPlayer.Companion::onHurtEvent);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerChangeDimensionEvent);
|
||||
EVENT_BUS.addListener(EventPriority.LOWEST, MatteryPlayer.Companion::onPlayerDeath);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerCloneEvent);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerSpawnPhantoms);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onStartTracking);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onStopTracking);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, QuantumBatteryItem.Companion::tick);
|
||||
EVENT_BUS.addListener(EventPriority.LOWEST, PortableCondensationDriveItem.Companion::onPickupEvent);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidResearchManager.INSTANCE::reloadEvent);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidResearchManager.INSTANCE::syncEvent);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::reloadEvent);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::onServerStarted);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::onDataPackSync);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::addCommands);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onServerStopping);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onLevelUnload);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onWatch);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onForget);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::playerDisconnected);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::postLevelTick);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.LOWEST, KillAsAndroidTrigger.INSTANCE::onKill);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, EnderTeleporterFeature.Companion::onEntityDeath);
|
||||
EVENT_BUS.addListener(EventPriority.HIGH, TritaniumArmorItem.Companion::onHurt);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ExplosiveHammerItem.Companion::onLeftClickBlock);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ChestUpgraderItem.Companion::onEntityInteract);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, DevChestBlockEntity.Companion::mappingsChanged);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MCommands.INSTANCE::register);
|
||||
|
||||
if (ModList.get().isLoaded(CuriosApi.MODID)) {
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, CuriosCompatKt::onCuriosSlotModifiersUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupClient(final FMLClientSetupEvent event) {
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::tooltipEvent);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryGUI.INSTANCE::onScreenRender);
|
||||
EVENT_BUS.addListener(EventPriority.LOWEST, MatteryGUI.INSTANCE::onOpenGUIEvent);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryGUI.INSTANCE::onRenderGuiEvent);
|
||||
EVENT_BUS.addListener(EventPriority.HIGH, MatteryGUI.INSTANCE::onLayerRenderEvent);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ShockwaveRenderer.INSTANCE::onRender);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onMovementInputUpdate);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onScreenOpen);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onPostScreenInit);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onMouseDragged);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onMouseScrolled);
|
||||
EVENT_BUS.addListener(EventPriority.LOWEST, ClientTickHandlerKt::onClientTickPre);
|
||||
EVENT_BUS.addListener(EventPriority.LOWEST, ClientTickHandlerKt::onClientTickPost);
|
||||
EVENT_BUS.addListener(EventPriority.HIGHEST, ClientTickHandlerKt::onClientConnected);
|
||||
EVENT_BUS.addListener(EventPriority.HIGHEST, ClientTickHandlerKt::onClientDisconnected);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientTickHandlerKt::onClientPostRender);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::tooltipEvent);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, QuantumBatteryItem.Companion::clientDisconnect);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidMenuKeyMapping.INSTANCE::onRenderGuiEvent);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidMenuKeyMapping.INSTANCE::onMouseClick);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping.INSTANCE::onRenderGuiEvent);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping.INSTANCE::onRenderLevel);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ExosuitModel::onPlayerRendered);
|
||||
|
||||
event.enqueueWork(GlobalEventHandlerKt::recordClientThread);
|
||||
event.enqueueWork(ClientTickHandlerKt::createCursors);
|
||||
}
|
||||
}
|
239
src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt
Normal file
239
src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt
Normal file
@ -0,0 +1,239 @@
|
||||
package ru.dbotthepony.mc.otm
|
||||
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.neoforged.api.distmarker.Dist
|
||||
import net.neoforged.bus.api.EventPriority
|
||||
import net.neoforged.fml.common.Mod
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent
|
||||
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchDescription
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchDescriptions
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchManager
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchResult
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchResults
|
||||
import ru.dbotthepony.mc.otm.android.feature.EnderTeleporterFeature
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayer
|
||||
import ru.dbotthepony.mc.otm.capability.drive.DrivePool
|
||||
import ru.dbotthepony.mc.otm.client.AndroidAbilityKeyMapping
|
||||
import ru.dbotthepony.mc.otm.client.AndroidMenuKeyMapping
|
||||
import ru.dbotthepony.mc.otm.client.MatteryGUI
|
||||
import ru.dbotthepony.mc.otm.client.createCursors
|
||||
import ru.dbotthepony.mc.otm.client.model.ExosuitModel
|
||||
import ru.dbotthepony.mc.otm.client.model.GravitationStabilizerModel
|
||||
import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel
|
||||
import ru.dbotthepony.mc.otm.client.onMovementInputUpdate
|
||||
import ru.dbotthepony.mc.otm.client.onScreenOpen
|
||||
import ru.dbotthepony.mc.otm.client.onPostScreenInit
|
||||
import ru.dbotthepony.mc.otm.client.onMouseDragged
|
||||
import ru.dbotthepony.mc.otm.client.onMouseScrolled
|
||||
import ru.dbotthepony.mc.otm.client.onClientTickPre
|
||||
import ru.dbotthepony.mc.otm.client.onClientTickPost
|
||||
import ru.dbotthepony.mc.otm.client.onClientConnected
|
||||
import ru.dbotthepony.mc.otm.client.onClientDisconnected
|
||||
import ru.dbotthepony.mc.otm.client.onClientPostRender
|
||||
import ru.dbotthepony.mc.otm.client.tooltipEvent
|
||||
import ru.dbotthepony.mc.otm.client.render.ChartTooltipElement
|
||||
import ru.dbotthepony.mc.otm.client.render.ShockwaveRenderer
|
||||
import ru.dbotthepony.mc.otm.client.render.blockentity.BatteryBankRenderer
|
||||
import ru.dbotthepony.mc.otm.client.render.blockentity.MatterBatteryBankRenderer
|
||||
import ru.dbotthepony.mc.otm.compat.curios.isCuriosLoaded
|
||||
import ru.dbotthepony.mc.otm.compat.curios.onCuriosSlotModifiersUpdated
|
||||
import ru.dbotthepony.mc.otm.compat.vanilla.MatteryChestMenu
|
||||
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
||||
import ru.dbotthepony.mc.otm.config.CablesConfig
|
||||
import ru.dbotthepony.mc.otm.config.ClientConfig
|
||||
import ru.dbotthepony.mc.otm.config.ExopackConfig
|
||||
import ru.dbotthepony.mc.otm.config.ItemsConfig
|
||||
import ru.dbotthepony.mc.otm.config.MachinesConfig
|
||||
import ru.dbotthepony.mc.otm.config.ServerConfig
|
||||
import ru.dbotthepony.mc.otm.config.ToolsConfig
|
||||
import ru.dbotthepony.mc.otm.data.DecimalProvider
|
||||
import ru.dbotthepony.mc.otm.item.ChestUpgraderItem
|
||||
import ru.dbotthepony.mc.otm.item.tool.ExplosiveHammerItem
|
||||
import ru.dbotthepony.mc.otm.item.armor.TritaniumArmorItem
|
||||
import ru.dbotthepony.mc.otm.item.QuantumBatteryItem
|
||||
import ru.dbotthepony.mc.otm.item.PortableCondensationDriveItem
|
||||
import ru.dbotthepony.mc.otm.matter.AbstractRegistryAction
|
||||
import ru.dbotthepony.mc.otm.matter.IMatterFunction
|
||||
import ru.dbotthepony.mc.otm.matter.MatterManager
|
||||
import ru.dbotthepony.mc.otm.network.*
|
||||
import ru.dbotthepony.mc.otm.registry.*
|
||||
import ru.dbotthepony.mc.otm.server.MCommands
|
||||
import ru.dbotthepony.mc.otm.storage.StorageStack
|
||||
import ru.dbotthepony.mc.otm.triggers.KillAsAndroidTrigger
|
||||
import thedarkcolour.kotlinforforge.neoforge.forge.DIST
|
||||
import thedarkcolour.kotlinforforge.neoforge.forge.FORGE_BUS
|
||||
import thedarkcolour.kotlinforforge.neoforge.forge.LOADING_CONTEXT
|
||||
import thedarkcolour.kotlinforforge.neoforge.forge.MOD_BUS
|
||||
|
||||
@Mod(OverdriveThatMatters.MOD_ID)
|
||||
object OverdriveThatMatters {
|
||||
const val MOD_ID = "overdrive_that_matters"
|
||||
|
||||
@JvmStatic
|
||||
fun loc(path: String): ResourceLocation = ResourceLocation.fromNamespaceAndPath(MOD_ID, path)
|
||||
|
||||
init {
|
||||
MBlocks.register(MOD_BUS)
|
||||
MFluids.register(MOD_BUS)
|
||||
MBlockEntities.register(MOD_BUS)
|
||||
MEntityTypes.register(MOD_BUS)
|
||||
MMenus.register(MOD_BUS)
|
||||
MItems.register(MOD_BUS)
|
||||
AndroidFeatures.register(MOD_BUS)
|
||||
MSoundEvents.register(MOD_BUS)
|
||||
LootModifiers.register(MOD_BUS)
|
||||
MItemFunctionTypes.register(MOD_BUS)
|
||||
MLootItemConditions.register(MOD_BUS)
|
||||
MRecipes.register(MOD_BUS)
|
||||
MDataComponentTypes.register(MOD_BUS)
|
||||
MArmorMaterials.register(MOD_BUS)
|
||||
MCriteriaTriggers.register(MOD_BUS)
|
||||
MStats.register(MOD_BUS)
|
||||
MWorldGenFeatures.register(MOD_BUS)
|
||||
CommandArgumentTypes.register(MOD_BUS)
|
||||
|
||||
StorageStack.Companion.register(MOD_BUS)
|
||||
MatteryChestMenu.Companion.register(MOD_BUS)
|
||||
|
||||
MCreativeTabs.initialize(MOD_BUS)
|
||||
|
||||
MOD_BUS.addListener(::registerNetworkPackets)
|
||||
|
||||
DecimalProvider.Companion.register(MOD_BUS)
|
||||
AndroidResearchDescription.Companion.register(MOD_BUS)
|
||||
AndroidResearchDescriptions.register(MOD_BUS)
|
||||
AndroidResearchResult.Companion.register(MOD_BUS)
|
||||
AndroidResearchResults.register(MOD_BUS)
|
||||
|
||||
AbstractRegistryAction.Companion.register(MOD_BUS)
|
||||
IMatterFunction.Companion.register(MOD_BUS)
|
||||
|
||||
MRegistry.initialize(MOD_BUS)
|
||||
MatterManager.initialize(MOD_BUS)
|
||||
|
||||
MOD_BUS.addListener(EventPriority.HIGHEST, this::setup)
|
||||
MOD_BUS.addListener(EventPriority.NORMAL, this::setupClient)
|
||||
|
||||
if (DIST == Dist.CLIENT) {
|
||||
MOD_BUS.addListener(EventPriority.NORMAL, AndroidMenuKeyMapping::register)
|
||||
MOD_BUS.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping::register)
|
||||
MOD_BUS.addListener(EventPriority.NORMAL, TritaniumArmorModel::register)
|
||||
MOD_BUS.addListener(EventPriority.NORMAL, GravitationStabilizerModel::register)
|
||||
MOD_BUS.addListener(EventPriority.NORMAL, MCreativeTabs::register)
|
||||
|
||||
MOD_BUS.addListener(EventPriority.NORMAL, BatteryBankRenderer.Companion::onRegisterAdditionalModels)
|
||||
MOD_BUS.addListener(EventPriority.NORMAL, MatterBatteryBankRenderer.Companion::onRegisterAdditionalModels)
|
||||
|
||||
MOD_BUS.addListener(EventPriority.NORMAL, ChartTooltipElement.Companion::register)
|
||||
|
||||
MBlockColors.register(MOD_BUS)
|
||||
}
|
||||
|
||||
val container = LOADING_CONTEXT.activeContainer
|
||||
ClientConfig.register(container)
|
||||
ServerConfig.register(container)
|
||||
CablesConfig.register(container)
|
||||
AndroidConfig.register(container)
|
||||
ExopackConfig.register(container)
|
||||
ItemsConfig.register(container)
|
||||
MachinesConfig.register(container)
|
||||
ToolsConfig.register(container)
|
||||
}
|
||||
|
||||
private fun setup(event: FMLCommonSetupEvent) {
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, DrivePool::onWorldSave)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.HIGHEST, ::onServerStopped)
|
||||
FORGE_BUS.addListener(EventPriority.HIGHEST, ::onServerStopping)
|
||||
FORGE_BUS.addListener(EventPriority.HIGHEST, ::onServerStarting)
|
||||
FORGE_BUS.addListener(EventPriority.HIGH, ::onLevelTickPre)
|
||||
FORGE_BUS.addListener(EventPriority.LOWEST, ::onLevelTickPost)
|
||||
FORGE_BUS.addListener(EventPriority.HIGH, ::onServerTickPre)
|
||||
FORGE_BUS.addListener(EventPriority.LOWEST, ::onServerTickPost)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerTickPre)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerTickPost)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::isMobEffectApplicable)
|
||||
FORGE_BUS.addListener(EventPriority.LOW, MatteryPlayer.Companion::onHurtEvent)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerChangeDimensionEvent)
|
||||
FORGE_BUS.addListener(EventPriority.LOWEST, MatteryPlayer.Companion::onPlayerDeath)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerCloneEvent)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onPlayerSpawnPhantoms)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onStartTracking)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryPlayer.Companion::onStopTracking)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, QuantumBatteryItem.Companion::tick)
|
||||
FORGE_BUS.addListener(EventPriority.LOWEST, PortableCondensationDriveItem.Companion::onPickupEvent)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, AndroidResearchManager::reloadEvent)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, AndroidResearchManager::syncEvent)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatterManager::reloadEvent)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatterManager::onServerStarted)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatterManager::onDataPackSync)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatterManager::addCommands)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onServerStopping)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onLevelUnload)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onWatch)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onForget)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::playerDisconnected)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::postLevelTick)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.LOWEST, KillAsAndroidTrigger::onKill)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, EnderTeleporterFeature.Companion::onEntityDeath)
|
||||
FORGE_BUS.addListener(EventPriority.HIGH, TritaniumArmorItem.Companion::onHurt)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ExplosiveHammerItem.Companion::onLeftClickBlock)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ChestUpgraderItem.Companion::onEntityInteract)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, DevChestBlockEntity.Companion::mappingsChanged)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MCommands::register)
|
||||
|
||||
if (isCuriosLoaded) {
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ::onCuriosSlotModifiersUpdated)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupClient(event: FMLClientSetupEvent) {
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatterManager::tooltipEvent)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryGUI::onScreenRender)
|
||||
FORGE_BUS.addListener(EventPriority.LOWEST, MatteryGUI::onOpenGUIEvent)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MatteryGUI::onRenderGuiEvent)
|
||||
FORGE_BUS.addListener(EventPriority.HIGH, MatteryGUI::onLayerRenderEvent)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ShockwaveRenderer::onRender)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ::onMovementInputUpdate)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ::onScreenOpen)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ::onPostScreenInit)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ::onMouseDragged)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ::onMouseScrolled)
|
||||
FORGE_BUS.addListener(EventPriority.LOWEST, ::onClientTickPre)
|
||||
FORGE_BUS.addListener(EventPriority.LOWEST, ::onClientTickPost)
|
||||
FORGE_BUS.addListener(EventPriority.HIGHEST, ::onClientConnected)
|
||||
FORGE_BUS.addListener(EventPriority.HIGHEST, ::onClientDisconnected)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ::onClientPostRender)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ::tooltipEvent)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, QuantumBatteryItem.Companion::clientDisconnect)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, AndroidMenuKeyMapping::onRenderGuiEvent)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, AndroidMenuKeyMapping::onMouseClick)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping::onRenderGuiEvent)
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping::onRenderLevel)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ExosuitModel::onPlayerRendered)
|
||||
|
||||
event.enqueueWork(::recordClientThread)
|
||||
event.enqueueWork(::createCursors)
|
||||
}
|
||||
}
|
@ -4,9 +4,9 @@
|
||||
# Note that there are a couple of TOML lists in this file.
|
||||
# Find more information on toml format here: https://github.com/toml-lang/toml
|
||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader="javafml" #mandatory
|
||||
modLoader="kotlinforforge" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="[4,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="[5.5,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
license="2 Clause BSD"
|
||||
|
Loading…
Reference in New Issue
Block a user