NaturesAura/src/main/java/de/ellpeck/naturesaura/NaturesAura.java

78 lines
2.6 KiB
Java
Raw Normal View History

2018-10-13 20:35:18 +02:00
package de.ellpeck.naturesaura;
import com.google.common.base.Strings;
2018-11-11 13:26:19 +01:00
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
2018-11-07 13:33:49 +01:00
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.chunk.effect.DrainSpotEffects;
2018-10-19 14:35:25 +02:00
import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.events.CommonEvents;
2019-11-04 19:08:49 +01:00
import de.ellpeck.naturesaura.proxy.ClientProxy;
2018-10-13 20:35:18 +02:00
import de.ellpeck.naturesaura.proxy.IProxy;
2019-11-04 19:08:49 +01:00
import de.ellpeck.naturesaura.proxy.ServerProxy;
2018-10-16 01:36:30 +02:00
import de.ellpeck.naturesaura.recipes.ModRecipes;
2024-03-10 11:29:12 +01:00
import net.neoforged.bus.api.IEventBus;
2024-02-03 14:56:07 +01:00
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
2024-03-10 11:29:12 +01:00
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.common.ModConfigSpec;
import net.neoforged.neoforge.common.NeoForge;
2018-10-13 20:35:18 +02:00
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
2019-11-04 19:08:49 +01:00
@Mod(NaturesAura.MOD_ID)
2018-10-13 20:35:18 +02:00
public final class NaturesAura {
public static final String MOD_ID = NaturesAuraAPI.MOD_ID;
2018-10-13 20:35:18 +02:00
public static final String MOD_NAME = "Nature's Aura";
2022-06-27 15:24:04 +02:00
public static final Logger LOGGER = LogManager.getLogger(NaturesAura.MOD_NAME);
2019-03-19 17:21:06 +01:00
public static NaturesAura instance;
2024-03-10 11:29:12 +01:00
public static IProxy proxy;
2019-03-19 17:21:06 +01:00
2024-03-10 11:29:12 +01:00
public NaturesAura(IEventBus eventBus) {
2022-06-27 15:24:04 +02:00
NaturesAura.instance = this;
2024-03-10 11:29:12 +01:00
NaturesAura.proxy = FMLEnvironment.dist.isClient() ? new ClientProxy() : new ServerProxy();
eventBus.addListener(this::setup);
2019-11-04 19:08:49 +01:00
2024-02-03 14:56:07 +01:00
var builder = new ModConfigSpec.Builder();
2020-01-24 17:05:41 +01:00
ModConfig.instance = new ModConfig(builder);
2024-02-03 14:56:07 +01:00
ModLoadingContext.get().registerConfig(net.neoforged.fml.config.ModConfig.Type.COMMON, builder.build());
2019-11-04 19:08:49 +01:00
}
public void setup(FMLCommonSetupEvent event) {
2020-01-21 23:54:01 +01:00
this.preInit(event);
this.init(event);
this.postInit(event);
2019-11-04 19:08:49 +01:00
}
2020-01-24 17:05:41 +01:00
private void preInit(FMLCommonSetupEvent event) {
2021-03-30 16:22:40 +02:00
Compat.setup(event);
new Multiblocks();
2018-10-16 01:36:30 +02:00
2024-02-03 14:56:07 +01:00
NeoForge.EVENT_BUS.register(new CommonEvents());
2018-10-16 01:36:30 +02:00
2022-06-27 15:24:04 +02:00
NaturesAura.proxy.preInit(event);
2018-10-13 20:35:18 +02:00
}
2020-01-24 17:05:41 +01:00
private void init(FMLCommonSetupEvent event) {
2021-03-30 16:22:40 +02:00
event.enqueueWork(ModConfig.instance::apply);
2020-01-26 19:26:50 +01:00
ModRecipes.init();
DrainSpotEffects.init();
2018-10-16 01:36:30 +02:00
2022-06-27 15:24:04 +02:00
NaturesAura.proxy.init(event);
2018-10-13 20:35:18 +02:00
}
2020-01-24 17:05:41 +01:00
private void postInit(FMLCommonSetupEvent event) {
2022-06-27 15:24:04 +02:00
NaturesAura.proxy.postInit(event);
2022-06-27 15:24:04 +02:00
NaturesAura.LOGGER.info("-- Nature's Aura Fake Player Information --");
NaturesAura.LOGGER.info("Name: [Minecraft]");
NaturesAura.LOGGER.info("UUID: 41C82C87-7AfB-4024-BA57-13D2C99CAE77");
NaturesAura.LOGGER.info(Strings.padStart("", 43, '-'));
2018-10-13 20:35:18 +02:00
}
2018-10-13 20:35:18 +02:00
}