2019-07-11 09:03:08 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2019-07-11 19:55:11 +02:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
2019-07-11 09:03:08 +02:00
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
|
2020-01-26 23:58:55 +01:00
|
|
|
import com.simibubi.create.foundation.command.CreateCommand;
|
|
|
|
import com.simibubi.create.foundation.command.ServerLagger;
|
2019-12-06 19:48:15 +01:00
|
|
|
import com.simibubi.create.foundation.world.OreGeneration;
|
2019-09-12 10:00:15 +02:00
|
|
|
import com.simibubi.create.modules.ModuleLoadedCondition;
|
2019-11-01 01:09:38 +01:00
|
|
|
import com.simibubi.create.modules.contraptions.TorquePropagator;
|
2020-01-05 19:41:38 +01:00
|
|
|
import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler;
|
2019-07-23 12:54:53 +02:00
|
|
|
import com.simibubi.create.modules.schematics.ServerSchematicLoader;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
2019-10-05 19:00:43 +02:00
|
|
|
import net.minecraft.entity.EntityType;
|
2019-10-11 05:56:32 +02:00
|
|
|
import net.minecraft.entity.merchant.villager.VillagerProfession;
|
2019-10-15 22:22:19 +02:00
|
|
|
import net.minecraft.inventory.container.ContainerType;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemGroup;
|
2019-07-28 10:08:49 +02:00
|
|
|
import net.minecraft.item.crafting.IRecipeSerializer;
|
2019-12-05 23:42:01 +01:00
|
|
|
import net.minecraft.particles.ParticleType;
|
2019-10-15 22:22:19 +02:00
|
|
|
import net.minecraft.tileentity.TileEntityType;
|
2019-10-11 05:56:32 +02:00
|
|
|
import net.minecraft.village.PointOfInterestType;
|
2020-01-26 23:58:55 +01:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2019-09-12 10:00:15 +02:00
|
|
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraftforge.event.RegistryEvent;
|
2019-10-15 22:22:19 +02:00
|
|
|
import net.minecraftforge.eventbus.api.IEventBus;
|
2019-09-10 22:51:26 +02:00
|
|
|
import net.minecraftforge.fml.ModLoadingContext;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
2019-09-10 22:51:26 +02:00
|
|
|
import net.minecraftforge.fml.config.ModConfig;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
2020-01-26 23:58:55 +01:00
|
|
|
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
2019-10-15 22:22:19 +02:00
|
|
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
|
|
|
@Mod(Create.ID)
|
|
|
|
public class Create {
|
|
|
|
|
|
|
|
public static final String ID = "create";
|
|
|
|
public static final String NAME = "Create";
|
2019-11-07 12:00:27 +01:00
|
|
|
public static final String VERSION = "0.1.1b";
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2019-07-11 19:55:11 +02:00
|
|
|
public static Logger logger = LogManager.getLogger();
|
2019-07-11 09:03:08 +02:00
|
|
|
public static ItemGroup creativeTab = new CreateItemGroup();
|
2019-09-03 08:34:02 +02:00
|
|
|
public static ServerSchematicLoader schematicReceiver;
|
2020-01-05 19:41:38 +01:00
|
|
|
public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler;
|
2019-11-01 01:09:38 +01:00
|
|
|
public static TorquePropagator torquePropagator;
|
2019-12-15 01:13:36 +01:00
|
|
|
public static ServerLagger lagger;
|
2020-01-26 23:58:55 +01:00
|
|
|
// public static LogisticalNetworkHandler logisticalNetworkHandler;
|
|
|
|
// public static LogisticianHandler logisticianHandler;
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-09-10 22:51:26 +02:00
|
|
|
public static ModConfig config;
|
|
|
|
|
|
|
|
public Create() {
|
2019-10-15 22:22:19 +02:00
|
|
|
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
|
|
|
modEventBus.addListener(Create::init);
|
2019-12-05 23:42:01 +01:00
|
|
|
|
2019-12-15 01:13:36 +01:00
|
|
|
MinecraftForge.EVENT_BUS.addListener(Create::serverStarting);
|
|
|
|
|
2019-12-05 23:42:01 +01:00
|
|
|
modEventBus.addGenericListener(Block.class, AllBlocks::register);
|
|
|
|
modEventBus.addGenericListener(Item.class, AllItems::register);
|
|
|
|
modEventBus.addGenericListener(IRecipeSerializer.class, AllRecipes::register);
|
|
|
|
modEventBus.addGenericListener(TileEntityType.class, AllTileEntities::register);
|
|
|
|
modEventBus.addGenericListener(ContainerType.class, AllContainers::register);
|
2019-11-10 15:53:44 +01:00
|
|
|
modEventBus.addGenericListener(VillagerProfession.class, Create::registerVillagerProfessions);
|
|
|
|
modEventBus.addGenericListener(PointOfInterestType.class, Create::registerPointsOfInterest);
|
2019-12-05 23:42:01 +01:00
|
|
|
modEventBus.addGenericListener(EntityType.class, AllEntities::register);
|
|
|
|
modEventBus.addGenericListener(ParticleType.class, AllParticles::register);
|
|
|
|
|
2019-10-15 22:22:19 +02:00
|
|
|
modEventBus.addListener(Create::createConfigs);
|
|
|
|
CreateClient.addListeners(modEventBus);
|
2019-12-05 23:43:40 +01:00
|
|
|
OreGeneration.setupOreGeneration();
|
2019-10-15 22:22:19 +02:00
|
|
|
|
2019-09-18 11:16:57 +02:00
|
|
|
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, CreateConfig.specification);
|
2019-09-10 22:51:26 +02:00
|
|
|
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, CreateClientConfig.specification);
|
|
|
|
}
|
|
|
|
|
2019-09-03 08:34:02 +02:00
|
|
|
public static void init(final FMLCommonSetupEvent event) {
|
|
|
|
schematicReceiver = new ServerSchematicLoader();
|
2020-01-05 19:41:38 +01:00
|
|
|
redstoneLinkNetworkHandler = new RedstoneLinkNetworkHandler();
|
2020-01-26 23:58:55 +01:00
|
|
|
// logisticalNetworkHandler = new LogisticalNetworkHandler();
|
2019-11-01 01:09:38 +01:00
|
|
|
torquePropagator = new TorquePropagator();
|
2019-12-15 01:13:36 +01:00
|
|
|
lagger = new ServerLagger();
|
2019-10-11 05:56:32 +02:00
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
CraftingHelper.register(new ModuleLoadedCondition.Serializer());
|
2019-07-19 17:50:23 +02:00
|
|
|
AllPackets.registerPackets();
|
2019-07-11 19:55:11 +02:00
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-12-15 01:13:36 +01:00
|
|
|
public static void serverStarting(FMLServerStartingEvent event){
|
|
|
|
new CreateCommand(event.getCommandDispatcher());
|
|
|
|
}
|
|
|
|
|
2019-10-11 05:56:32 +02:00
|
|
|
public static void registerVillagerProfessions(RegistryEvent.Register<VillagerProfession> event) {
|
2020-01-26 23:58:55 +01:00
|
|
|
// LogisticianHandler.registerVillagerProfessions(event);
|
2019-10-11 05:56:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void registerPointsOfInterest(RegistryEvent.Register<PointOfInterestType> event) {
|
2020-01-26 23:58:55 +01:00
|
|
|
// LogisticianHandler.registerPointsOfInterest(event);
|
2019-10-11 05:56:32 +02:00
|
|
|
}
|
|
|
|
|
2019-09-10 22:51:26 +02:00
|
|
|
public static void createConfigs(ModConfig.ModConfigEvent event) {
|
2019-11-07 11:30:29 +01:00
|
|
|
if (event.getConfig().getSpec() == CreateConfig.specification)
|
|
|
|
config = event.getConfig();
|
2019-09-10 22:51:26 +02:00
|
|
|
}
|
|
|
|
|
2019-09-03 08:34:02 +02:00
|
|
|
public static void tick() {
|
2019-09-13 20:07:27 +02:00
|
|
|
if (schematicReceiver == null)
|
|
|
|
schematicReceiver = new ServerSchematicLoader();
|
2019-09-03 08:34:02 +02:00
|
|
|
schematicReceiver.tick();
|
2019-12-15 01:13:36 +01:00
|
|
|
|
|
|
|
lagger.tick();
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
|
|
|
|
2019-09-03 08:34:02 +02:00
|
|
|
public static void shutdown() {
|
|
|
|
schematicReceiver.shutdown();
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
2019-09-03 08:34:02 +02:00
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|