2018-10-13 20:35:18 +02:00
|
|
|
package de.ellpeck.naturesaura;
|
|
|
|
|
2018-11-11 13:26:19 +01:00
|
|
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|
|
|
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|
|
|
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
|
|
|
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
|
2019-02-17 22:51:05 +01:00
|
|
|
import de.ellpeck.naturesaura.api.misc.IWorldData;
|
2018-11-07 13:33:49 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
2018-11-13 11:39:28 +01:00
|
|
|
import de.ellpeck.naturesaura.chunk.effect.DrainSpotEffects;
|
2018-10-19 14:35:25 +02:00
|
|
|
import de.ellpeck.naturesaura.compat.Compat;
|
2018-10-21 12:51:13 +02:00
|
|
|
import de.ellpeck.naturesaura.events.CommonEvents;
|
2018-10-14 17:46:00 +02:00
|
|
|
import de.ellpeck.naturesaura.items.ModItems;
|
2018-10-14 14:27:18 +02:00
|
|
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
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;
|
2018-10-13 20:35:18 +02:00
|
|
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
2019-10-20 22:30:49 +02:00
|
|
|
import net.minecraft.item.ItemGroup;
|
2018-10-13 20:35:18 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2020-01-24 17:05:41 +01:00
|
|
|
import net.minecraftforge.common.ForgeConfigSpec;
|
2018-10-16 11:49:30 +02:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2020-04-03 23:11:59 +02:00
|
|
|
import net.minecraftforge.fml.DeferredWorkQueue;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraftforge.fml.DistExecutor;
|
2020-01-24 17:05:41 +01:00
|
|
|
import net.minecraftforge.fml.ModLoadingContext;
|
2018-10-13 20:35:18 +02:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
|
|
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
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 {
|
|
|
|
|
2018-11-12 01:29:33 +01:00
|
|
|
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";
|
|
|
|
public static final String VERSION = "@VERSION@";
|
|
|
|
|
|
|
|
public static final Logger LOGGER = LogManager.getLogger(MOD_NAME);
|
2020-02-07 15:22:30 +01:00
|
|
|
public static final ItemGroup CREATIVE_TAB = new ItemGroup(MOD_ID) {
|
|
|
|
@Override
|
|
|
|
public ItemStack createIcon() {
|
|
|
|
return new ItemStack(ModItems.GOLD_LEAF);
|
|
|
|
}
|
|
|
|
};
|
2019-03-19 17:21:06 +01:00
|
|
|
public static NaturesAura instance;
|
2020-02-07 15:22:30 +01:00
|
|
|
public static IProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new);
|
2019-03-19 17:21:06 +01:00
|
|
|
|
2019-11-04 19:08:49 +01:00
|
|
|
public NaturesAura() {
|
|
|
|
instance = this;
|
2020-01-24 17:05:41 +01:00
|
|
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
|
2019-11-04 19:08:49 +01:00
|
|
|
|
2020-01-24 17:05:41 +01:00
|
|
|
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
|
|
|
ModConfig.instance = new ModConfig(builder);
|
|
|
|
ModLoadingContext.get().registerConfig(net.minecraftforge.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) {
|
2018-11-11 13:26:19 +01:00
|
|
|
NaturesAuraAPI.setInstance(new InternalHooks());
|
2018-11-12 22:04:40 +01:00
|
|
|
Helper.registerCap(IAuraContainer.class);
|
|
|
|
Helper.registerCap(IAuraRecharge.class);
|
|
|
|
Helper.registerCap(IAuraChunk.class);
|
2019-02-17 22:51:05 +01:00
|
|
|
Helper.registerCap(IWorldData.class);
|
2018-10-20 21:19:08 +02:00
|
|
|
|
2020-04-26 20:40:28 +02:00
|
|
|
Compat.setup();
|
2018-10-14 14:27:18 +02:00
|
|
|
PacketHandler.init();
|
2018-10-27 01:49:57 +02:00
|
|
|
new Multiblocks();
|
2018-10-16 01:36:30 +02:00
|
|
|
|
2018-10-21 12:51:13 +02:00
|
|
|
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
2018-10-16 01:36:30 +02:00
|
|
|
|
2018-10-13 20:35:18 +02:00
|
|
|
proxy.preInit(event);
|
|
|
|
}
|
|
|
|
|
2020-01-24 17:05:41 +01:00
|
|
|
private void init(FMLCommonSetupEvent event) {
|
2020-05-12 14:24:50 +02:00
|
|
|
DeferredWorkQueue.runLater(ModConfig.instance::apply);
|
2020-01-26 19:26:50 +01:00
|
|
|
|
2020-05-01 22:44:05 +02:00
|
|
|
ModRecipes.init();
|
2020-01-22 01:32:26 +01:00
|
|
|
ModRegistry.init();
|
2018-11-13 11:39:28 +01:00
|
|
|
DrainSpotEffects.init();
|
2018-10-16 01:36:30 +02:00
|
|
|
|
2018-10-13 20:35:18 +02:00
|
|
|
proxy.init(event);
|
|
|
|
}
|
|
|
|
|
2020-01-24 17:05:41 +01:00
|
|
|
private void postInit(FMLCommonSetupEvent event) {
|
2018-10-13 20:35:18 +02:00
|
|
|
proxy.postInit(event);
|
|
|
|
}
|
2018-10-25 18:49:42 +02:00
|
|
|
|
2018-10-13 20:35:18 +02:00
|
|
|
}
|