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;
|
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
import com.simibubi.create.modules.ModuleLoadedCondition;
|
2019-09-05 14:23:52 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.MovingConstructHandler;
|
2019-09-03 23:03:52 +02:00
|
|
|
import com.simibubi.create.modules.logistics.FrequencyHandler;
|
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;
|
|
|
|
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-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;
|
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
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;
|
|
|
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|
|
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
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;
|
|
|
|
|
2019-09-03 08:34:02 +02:00
|
|
|
@EventBusSubscriber(bus = Bus.MOD)
|
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-09-24 14:40:01 +02:00
|
|
|
public static final String VERSION = "0.1.1";
|
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;
|
2019-09-03 23:03:52 +02:00
|
|
|
public static FrequencyHandler frequencyHandler;
|
2019-09-05 14:23:52 +02:00
|
|
|
public static MovingConstructHandler constructHandler;
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-09-10 22:51:26 +02:00
|
|
|
public static ModConfig config;
|
|
|
|
|
|
|
|
public Create() {
|
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
|
|
|
@SubscribeEvent
|
|
|
|
public static void init(final FMLCommonSetupEvent event) {
|
|
|
|
schematicReceiver = new ServerSchematicLoader();
|
2019-09-03 23:03:52 +02:00
|
|
|
frequencyHandler = new FrequencyHandler();
|
2019-09-05 14:23:52 +02:00
|
|
|
constructHandler = new MovingConstructHandler();
|
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-07-17 14:36:51 +02:00
|
|
|
@SubscribeEvent
|
2019-09-03 08:34:02 +02:00
|
|
|
public static void registerItems(RegistryEvent.Register<Item> event) {
|
|
|
|
AllItems.registerItems(event.getRegistry());
|
|
|
|
AllBlocks.registerItemBlocks(event.getRegistry());
|
2019-07-17 14:36:51 +02:00
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-07-17 14:36:51 +02:00
|
|
|
@SubscribeEvent
|
2019-09-03 08:34:02 +02:00
|
|
|
public static void registerBlocks(RegistryEvent.Register<Block> event) {
|
|
|
|
AllBlocks.registerBlocks(event.getRegistry());
|
2019-07-17 14:36:51 +02:00
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-07-11 19:55:11 +02:00
|
|
|
@SubscribeEvent
|
2019-09-03 08:34:02 +02:00
|
|
|
public static void registerRecipes(RegistryEvent.Register<IRecipeSerializer<?>> event) {
|
|
|
|
AllRecipes.register(event);
|
|
|
|
}
|
2019-09-10 22:51:26 +02:00
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
public static void createConfigs(ModConfig.ModConfigEvent event) {
|
|
|
|
if (event.getConfig().getSpec() == CreateClientConfig.specification)
|
|
|
|
return;
|
|
|
|
|
|
|
|
config = event.getConfig();
|
|
|
|
}
|
|
|
|
|
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-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
|
|
|
}
|