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-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.content.CreateItemGroup;
|
|
|
|
import com.simibubi.create.content.contraptions.TorquePropagator;
|
|
|
|
import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler;
|
|
|
|
import com.simibubi.create.content.palettes.AllPaletteBlocks;
|
|
|
|
import com.simibubi.create.content.palettes.PalettesItemGroup;
|
|
|
|
import com.simibubi.create.content.schematics.ServerSchematicLoader;
|
2020-05-23 21:03:35 +02:00
|
|
|
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
2020-03-23 17:04:09 +01:00
|
|
|
import com.simibubi.create.foundation.advancement.AllTriggers;
|
2020-01-26 23:58:55 +01:00
|
|
|
import com.simibubi.create.foundation.command.ServerLagger;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.foundation.config.AllConfigs;
|
|
|
|
import com.simibubi.create.foundation.data.CreateRegistrate;
|
2020-05-23 21:03:35 +02:00
|
|
|
import com.simibubi.create.foundation.data.LangMerger;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.foundation.networking.AllPackets;
|
|
|
|
import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
|
2020-04-26 06:58:38 +02:00
|
|
|
import com.tterrag.registrate.util.NonNullLazyValue;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2020-05-23 21:03:35 +02:00
|
|
|
import net.minecraft.data.DataGenerator;
|
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.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;
|
2020-05-13 01:11:07 +02:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2020-03-23 17:04:09 +01:00
|
|
|
import net.minecraft.util.SoundEvent;
|
2020-05-23 21:03:35 +02:00
|
|
|
import net.minecraftforge.eventbus.api.EventPriority;
|
2019-10-15 22:22:19 +02:00
|
|
|
import net.minecraftforge.eventbus.api.IEventBus;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
|
|
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
2020-05-23 21:03:35 +02:00
|
|
|
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
|
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";
|
2020-06-15 02:25:33 +02:00
|
|
|
public static final String VERSION = "0.3";
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2019-07-11 19:55:11 +02:00
|
|
|
public static Logger logger = LogManager.getLogger();
|
2020-05-12 14:06:50 +02:00
|
|
|
public static ItemGroup baseCreativeTab = new CreateItemGroup();
|
|
|
|
public static ItemGroup palettesCreativeTab = new PalettesItemGroup();
|
2020-05-23 21:03:35 +02:00
|
|
|
|
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-05-23 21:03:35 +02:00
|
|
|
|
2020-04-26 06:58:38 +02:00
|
|
|
private static final NonNullLazyValue<CreateRegistrate> registrate = CreateRegistrate.lazy(ID);
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-09-10 22:51:26 +02:00
|
|
|
public Create() {
|
2020-05-23 21:03:35 +02:00
|
|
|
IEventBus modEventBus = FMLJavaModLoadingContext.get()
|
|
|
|
.getModEventBus();
|
2019-12-05 23:42:01 +01:00
|
|
|
|
2020-05-22 20:12:53 +02:00
|
|
|
AllBlocks.register();
|
2020-05-28 01:30:14 +02:00
|
|
|
AllItems.register();
|
2020-06-19 22:59:38 +02:00
|
|
|
AllTags.register();
|
2020-05-13 01:11:07 +02:00
|
|
|
AllPaletteBlocks.register();
|
2020-06-01 00:12:10 +02:00
|
|
|
AllEntityTypes.register();
|
2020-06-01 06:33:08 +02:00
|
|
|
AllTileEntities.register();
|
2020-05-23 21:03:35 +02:00
|
|
|
|
2020-06-05 13:02:11 +02:00
|
|
|
modEventBus.addListener(Create::init);
|
2020-05-23 14:02:38 +02:00
|
|
|
modEventBus.addGenericListener(IRecipeSerializer.class, AllRecipeTypes::register);
|
|
|
|
modEventBus.addGenericListener(ContainerType.class, AllContainerTypes::register);
|
|
|
|
modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register);
|
2020-02-15 01:57:16 +01:00
|
|
|
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
|
2020-02-07 19:25:38 +01:00
|
|
|
modEventBus.addListener(AllConfigs::onLoad);
|
|
|
|
modEventBus.addListener(AllConfigs::onReload);
|
2020-05-23 21:03:35 +02:00
|
|
|
modEventBus.addListener(EventPriority.LOWEST, this::gatherData);
|
2020-06-05 13:02:11 +02:00
|
|
|
CreateClient.addClientListeners(modEventBus);
|
|
|
|
AllConfigs.register();
|
2019-09-10 22:51:26 +02:00
|
|
|
}
|
|
|
|
|
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();
|
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-07-19 17:50:23 +02:00
|
|
|
AllPackets.registerPackets();
|
2020-03-06 01:09:10 +01:00
|
|
|
AllTriggers.register();
|
2020-04-13 08:58:57 +02:00
|
|
|
AllWorldFeatures.reload();
|
2019-07-11 19:55:11 +02:00
|
|
|
}
|
2019-07-28 10:08:49 +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
|
|
|
|
2020-04-26 06:58:38 +02:00
|
|
|
public static CreateRegistrate registrate() {
|
2020-05-23 21:03:35 +02:00
|
|
|
return registrate.get();
|
2020-04-13 08:58:57 +02:00
|
|
|
}
|
2020-05-23 21:03:35 +02:00
|
|
|
|
2020-05-13 01:11:07 +02:00
|
|
|
public static ResourceLocation asResource(String path) {
|
|
|
|
return new ResourceLocation(ID, path);
|
|
|
|
}
|
2020-05-23 21:03:35 +02:00
|
|
|
|
|
|
|
public void gatherData(GatherDataEvent event) {
|
|
|
|
DataGenerator gen = event.getGenerator();
|
|
|
|
gen.addProvider(new AllAdvancements(gen));
|
|
|
|
gen.addProvider(new LangMerger(gen));
|
2020-07-19 17:08:20 +02:00
|
|
|
gen.addProvider(AllSoundEvents.BLAZE_MUNCH.generator(gen));
|
2020-05-23 21:03:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|