ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java

145 lines
5.8 KiB
Java
Raw Normal View History

2015-08-29 14:33:25 +02:00
/*
2016-05-16 22:52:27 +02:00
* This file ("ActuallyAdditions.java") is part of the Actually Additions mod for Minecraft.
2015-08-29 14:33:25 +02:00
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
2016-05-16 22:52:27 +02:00
* http://ellpeck.de/actaddlicense
2015-08-29 14:33:25 +02:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2017-01-01 16:23:26 +01:00
* © 2015-2017 Ellpeck
2015-08-29 14:33:25 +02:00
*/
2016-01-05 04:47:35 +01:00
package de.ellpeck.actuallyadditions.mod;
2016-05-14 13:51:18 +02:00
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
import de.ellpeck.actuallyadditions.mod.data.WorldData;
2016-07-22 20:23:51 +02:00
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
2016-07-03 20:57:00 +02:00
import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
2016-01-29 17:38:31 +01:00
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
2019-02-27 19:44:33 +01:00
import de.ellpeck.actuallyadditions.mod.gen.AAWorldGen;
2021-02-27 21:24:26 +01:00
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
2016-05-15 12:01:26 +02:00
import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
2016-10-31 19:05:29 +01:00
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
2019-02-27 19:44:33 +01:00
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.recipe.EmpowererHandler;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler;
2021-02-27 21:24:26 +01:00
import de.ellpeck.actuallyadditions.mod.tile.ActuallyTiles;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
2018-03-23 03:53:13 +01:00
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
2021-02-26 22:15:48 +01:00
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
2021-02-27 21:24:26 +01:00
import net.minecraftforge.eventbus.api.IEventBus;
2016-01-07 18:20:59 +01:00
import net.minecraftforge.fml.common.Mod;
2021-02-27 21:24:26 +01:00
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppedEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
2021-02-26 22:15:48 +01:00
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
2015-10-02 16:48:01 +02:00
2021-02-27 21:24:26 +01:00
//@Mod(modid = ActuallyAdditions.MODID, name = ActuallyAdditions.NAME, version = ActuallyAdditions.VERSION, guiFactory = ActuallyAdditions.GUIFACTORY, dependencies = ActuallyAdditions.DEPS)
@Mod(ActuallyAdditions.MODID)
2018-03-23 03:53:13 +01:00
public class ActuallyAdditions {
2018-05-10 11:38:58 +02:00
public static final String MODID = ActuallyAdditionsAPI.MOD_ID;
2021-02-27 21:24:26 +01:00
@Deprecated
2018-05-10 11:38:58 +02:00
public static final String NAME = "Actually Additions";
2021-02-27 21:24:26 +01:00
@Deprecated
2018-05-10 11:38:58 +02:00
public static final String VERSION = "@VERSION@";
2021-02-27 21:24:26 +01:00
@Deprecated
2018-05-10 11:38:58 +02:00
public static final String GUIFACTORY = "de.ellpeck.actuallyadditions.mod.config.GuiFactory";
2019-05-18 20:40:53 +02:00
public static final String DEPS = "required:forge@[14.23.5.2836,);before:craftingtweaks;after:fastbench@[1.3.2,)";
2021-02-27 21:24:26 +01:00
// public static final boolean DEOBF = (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
2021-02-26 22:15:48 +01:00
public static final ItemGroup GROUP = new ItemGroup(MODID) {
@Override
public ItemStack createIcon() {
2021-05-02 18:10:21 +02:00
return new ItemStack(ActuallyItems.ITEM_BOOKLET.get());
2021-02-26 22:15:48 +01:00
}
};
2021-02-27 21:24:26 +01:00
@Deprecated
2018-05-10 11:38:58 +02:00
public static ActuallyAdditions INSTANCE;
2018-05-10 11:38:58 +02:00
public static final Logger LOGGER = LogManager.getLogger(NAME);
2021-02-27 21:24:26 +01:00
// TODO: [port] eval
// static {
// FluidRegistry.enableUniversalBucket();
// }
2016-05-06 22:23:41 +02:00
2018-05-10 11:38:58 +02:00
public static boolean commonCapsLoaded;
2021-02-27 21:24:26 +01:00
public ActuallyAdditions() {
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
ActuallyBlocks.BLOCKS.register(eventBus);
2021-02-27 21:24:26 +01:00
ActuallyTiles.TILES.register(eventBus);
ActuallyContainers.CONTAINERS.register(eventBus);
MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
MinecraftForge.EVENT_BUS.register(new CommonEvents());
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
eventBus.addListener(this::setup);
eventBus.addListener(this::clientSetup);
}
private void setup(FMLCommonSetupEvent event) {
PacketHandler.init();
2016-05-14 13:51:18 +02:00
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
2016-05-15 12:01:26 +02:00
Lenses.init();
2018-03-23 03:53:13 +01:00
CompatUtil.registerCraftingTweaks();
2021-02-27 21:24:26 +01:00
commonCapsLoaded = false; // Loader.isModLoaded("commoncapabilities");
2016-01-29 17:38:31 +01:00
InitFluids.init();
2016-07-03 20:57:00 +02:00
new UpdateChecker();
BannerHelper.init();
2021-02-27 21:24:26 +01:00
InitEntities.init(); // todo: [port] replace
2019-02-27 19:44:33 +01:00
AAWorldGen gen = new AAWorldGen();
ItemCoffee.initIngredients();
CrusherCrafting.init();
HairyBallHandler.init();
LensRecipeHandler.init();
EmpowererHandler.init();
LensMining.init();
2021-02-27 21:24:26 +01:00
InitBooklet.init();
}
2021-02-27 21:24:26 +01:00
private void clientSetup(FMLClientSetupEvent event) {
ActuallyAdditionsClient.setup();
}
2015-06-28 03:12:32 +02:00
2018-03-23 03:53:13 +01:00
public void serverStarted(FMLServerStartedEvent event) {
2021-02-27 21:24:26 +01:00
// TODO: [port] check if this is needed
// if (event.getServer() != null) {
// World world = event.getServer().getWorld(OVERWORLD);
// if (world != null && !world.isRemote) {
// WorldData.get(world, true).markDirty();
// }
// }
}
2018-03-23 03:53:13 +01:00
public void serverStopped(FMLServerStoppedEvent event) {
2021-02-27 21:24:26 +01:00
// TODO: [port] check if this is needed
WorldData.clear();
}
}