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;
|
2014-11-10 16:47:04 +01:00
|
|
|
|
2016-05-14 13:51:18 +02:00
|
|
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
2023-12-20 22:02:25 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
2022-01-08 19:54:43 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
|
2021-02-28 11:35:10 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
2021-11-21 22:03:07 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
2022-12-30 01:02:38 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
|
2021-10-12 23:19:47 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
|
2021-10-12 23:19:47 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient;
|
2016-12-28 14:55:03 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
2021-11-13 20:09:55 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
|
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;
|
2021-02-27 21:24:26 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
|
2021-03-01 21:23:52 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
2023-12-20 22:02:25 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.items.Worm;
|
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;
|
2016-12-04 15:03:01 +01:00
|
|
|
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;
|
2023-01-19 16:27:56 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
2021-10-23 20:17:04 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
|
2021-11-13 20:09:55 +01:00
|
|
|
import net.minecraft.entity.EntityClassification;
|
|
|
|
import net.minecraft.entity.EntityType;
|
2021-11-23 23:42:12 +01:00
|
|
|
import net.minecraft.item.Item;
|
2021-02-26 22:15:48 +01:00
|
|
|
import net.minecraft.item.ItemGroup;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2021-11-23 23:42:12 +01:00
|
|
|
import net.minecraft.item.Items;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2021-12-30 18:30:01 +01:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
2023-01-19 16:27:56 +01:00
|
|
|
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
|
2017-06-29 13:00:11 +02:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2021-10-12 23:19:47 +02:00
|
|
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
2021-10-23 20:17:04 +02:00
|
|
|
import net.minecraftforge.event.AddReloadListenerEvent;
|
2021-02-27 21:24:26 +01:00
|
|
|
import net.minecraftforge.eventbus.api.IEventBus;
|
2021-11-21 22:03:07 +01:00
|
|
|
import net.minecraftforge.fml.ModLoadingContext;
|
2021-11-13 20:09:55 +01:00
|
|
|
import net.minecraftforge.fml.RegistryObject;
|
2016-01-07 18:20:59 +01:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
2021-11-21 22:03:07 +01:00
|
|
|
import net.minecraftforge.fml.config.ModConfig;
|
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-11-13 20:09:55 +01:00
|
|
|
import net.minecraftforge.registries.DeferredRegister;
|
|
|
|
import net.minecraftforge.registries.ForgeRegistries;
|
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(ActuallyAdditions.MODID)
|
2018-03-23 03:53:13 +01:00
|
|
|
public class ActuallyAdditions {
|
2014-11-10 16:47:04 +01:00
|
|
|
|
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,)";
|
2014-11-10 16:47:04 +01:00
|
|
|
|
2021-02-26 22:15:48 +01:00
|
|
|
public static final ItemGroup GROUP = new ItemGroup(MODID) {
|
2021-12-30 18:30:01 +01:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2021-02-26 22:15:48 +01:00
|
|
|
@Override
|
2021-08-22 17:09:06 +02:00
|
|
|
public ItemStack makeIcon() {
|
2021-05-02 18:10:21 +02:00
|
|
|
return new ItemStack(ActuallyItems.ITEM_BOOKLET.get());
|
2021-02-26 22:15:48 +01:00
|
|
|
}
|
|
|
|
};
|
2021-08-22 23:19:57 +02:00
|
|
|
public static final Logger LOGGER = LogManager.getLogger(NAME);
|
2021-11-13 20:09:55 +01:00
|
|
|
|
2023-01-15 23:42:43 +01:00
|
|
|
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, MODID);
|
|
|
|
public static final RegistryObject<EntityType<EntityWorm>> ENTITY_WORM = ENTITIES.register("worm", () -> EntityType.Builder.of(EntityWorm::new, EntityClassification.MISC).build(MODID + ":worm"));
|
2021-11-13 20:09:55 +01:00
|
|
|
|
2018-05-10 11:38:58 +02:00
|
|
|
public static boolean commonCapsLoaded;
|
|
|
|
|
2021-02-27 21:24:26 +01:00
|
|
|
public ActuallyAdditions() {
|
2021-11-21 22:03:07 +01:00
|
|
|
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
|
|
|
|
|
2021-02-27 21:24:26 +01:00
|
|
|
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
|
|
|
|
2021-11-21 21:45:33 +01:00
|
|
|
ActuallyBlocks.init(eventBus);
|
|
|
|
ActuallyItems.init(eventBus);
|
2021-10-12 23:19:47 +02:00
|
|
|
ActuallyRecipes.init(eventBus);
|
2022-05-18 22:39:49 +02:00
|
|
|
AASounds.init(eventBus);
|
2021-02-27 21:24:26 +01:00
|
|
|
ActuallyContainers.CONTAINERS.register(eventBus);
|
2021-11-13 20:09:55 +01:00
|
|
|
ENTITIES.register(eventBus);
|
2021-11-23 23:42:12 +01:00
|
|
|
eventBus.addListener(this::onConfigReload);
|
2023-01-19 16:27:56 +01:00
|
|
|
ActuallyParticles.init(eventBus);
|
2023-12-20 22:02:25 +01:00
|
|
|
ActuallyTags.init();
|
2021-02-27 21:24:26 +01:00
|
|
|
|
|
|
|
MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
|
|
|
|
MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
|
|
|
|
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
|
|
|
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
|
2021-10-23 20:17:04 +02:00
|
|
|
MinecraftForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
|
2023-12-20 22:02:25 +01:00
|
|
|
MinecraftForge.EVENT_BUS.addListener(Worm::onHoe);
|
2021-10-24 18:03:33 +02:00
|
|
|
InitFluids.init(eventBus);
|
2021-02-27 21:24:26 +01:00
|
|
|
|
|
|
|
eventBus.addListener(this::setup);
|
|
|
|
eventBus.addListener(this::clientSetup);
|
2023-01-19 16:27:56 +01:00
|
|
|
eventBus.addListener(this::particleFactoryRegister);
|
2022-01-08 19:54:43 +01:00
|
|
|
IFarmerBehavior.initBehaviors();
|
2021-02-27 21:24:26 +01:00
|
|
|
}
|
|
|
|
|
2021-11-13 20:09:55 +01:00
|
|
|
private static void reloadEvent(AddReloadListenerEvent event) {
|
|
|
|
event.addListener(new ResourceReloader(event.getDataPackRegistries()));
|
|
|
|
}
|
|
|
|
|
2021-02-27 21:24:26 +01:00
|
|
|
private void setup(FMLCommonSetupEvent event) {
|
|
|
|
PacketHandler.init();
|
2015-02-09 17:25:05 +01:00
|
|
|
|
2022-12-30 01:02:38 +01:00
|
|
|
event.enqueueWork(() -> {
|
|
|
|
CraftingHelper.register(BoolConfigCondition.Serializer.INSTANCE);
|
|
|
|
});
|
|
|
|
|
2016-05-14 13:51:18 +02:00
|
|
|
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
|
2016-07-30 17:07:32 +02:00
|
|
|
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
|
2022-06-24 21:23:43 +02:00
|
|
|
//Lenses.init();
|
2021-08-22 23:19:57 +02:00
|
|
|
// CompatUtil.registerCraftingTweaks();
|
2021-10-12 23:19:47 +02:00
|
|
|
event.enqueueWork(() -> CraftingHelper.register(TargetNBTIngredient.Serializer.NAME, TargetNBTIngredient.SERIALIZER));
|
2016-07-25 02:07:16 +02:00
|
|
|
|
2021-02-27 21:24:26 +01:00
|
|
|
commonCapsLoaded = false; // Loader.isModLoaded("commoncapabilities");
|
2017-06-29 13:00:11 +02:00
|
|
|
|
2016-07-03 20:57:00 +02:00
|
|
|
new UpdateChecker();
|
2017-06-29 13:00:11 +02:00
|
|
|
BannerHelper.init();
|
2021-02-27 21:24:26 +01:00
|
|
|
InitEntities.init(); // todo: [port] replace
|
2021-08-31 00:44:39 +02:00
|
|
|
//AAWorldGen gen = new AAWorldGen();
|
2016-11-16 19:08:56 +01:00
|
|
|
ItemCoffee.initIngredients();
|
|
|
|
CrusherCrafting.init();
|
2022-08-31 00:20:32 +02:00
|
|
|
//LensMining.init();
|
2021-10-23 20:17:04 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 23:42:12 +01:00
|
|
|
private void onConfigReload(ModConfig.ModConfigEvent event) {
|
2022-03-13 20:29:06 +01:00
|
|
|
Item item1 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
|
|
|
|
Item item2 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.RELAYCONFIGURATOR.get()));
|
|
|
|
CommonConfig.Other.redstoneConfigureItem = item1 != null?item1: Items.AIR;
|
|
|
|
CommonConfig.Other.relayConfigureItem = item2 != null?item2: Items.AIR;
|
2021-11-23 23:42:12 +01:00
|
|
|
}
|
|
|
|
|
2021-02-27 21:24:26 +01:00
|
|
|
private void clientSetup(FMLClientSetupEvent event) {
|
2023-01-16 22:47:31 +01:00
|
|
|
ActuallyAdditionsClient.setup(event);
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|
2015-06-28 03:12:32 +02:00
|
|
|
|
2023-01-19 16:27:56 +01:00
|
|
|
private void particleFactoryRegister(ParticleFactoryRegisterEvent event) {
|
|
|
|
ActuallyAdditionsClient.registerParticleFactories();
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
// }
|
|
|
|
// }
|
2016-12-28 14:55:03 +01:00
|
|
|
}
|
|
|
|
|
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
|
2017-02-13 15:23:28 +01:00
|
|
|
WorldData.clear();
|
|
|
|
}
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|