2019-07-11 09:03:08 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2020-09-19 15:19:22 +02:00
|
|
|
import java.util.Random;
|
|
|
|
|
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-09-04 01:23:09 +02:00
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.GsonBuilder;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.content.CreateItemGroup;
|
|
|
|
import com.simibubi.create.content.contraptions.TorquePropagator;
|
2020-10-08 20:13:17 +02:00
|
|
|
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
|
2021-06-26 01:17:35 +02:00
|
|
|
import com.simibubi.create.content.curiosities.weapons.PotatoCannonProjectileTypes;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler;
|
|
|
|
import com.simibubi.create.content.palettes.AllPaletteBlocks;
|
|
|
|
import com.simibubi.create.content.palettes.PalettesItemGroup;
|
2021-02-06 22:03:48 +01:00
|
|
|
import com.simibubi.create.content.schematics.SchematicProcessor;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.content.schematics.ServerSchematicLoader;
|
2021-02-04 21:02:30 +01:00
|
|
|
import com.simibubi.create.content.schematics.filtering.SchematicInstances;
|
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-09-19 15:19:22 +02:00
|
|
|
import com.simibubi.create.foundation.command.ChunkUtil;
|
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-09-04 12:20:19 +02:00
|
|
|
import com.simibubi.create.foundation.data.recipe.MechanicalCraftingRecipeGen;
|
2020-09-04 01:23:09 +02:00
|
|
|
import com.simibubi.create.foundation.data.recipe.ProcessingRecipeGen;
|
2021-06-28 04:00:24 +02:00
|
|
|
import com.simibubi.create.foundation.data.recipe.SequencedAssemblyRecipeGen;
|
2020-09-04 01:23:09 +02:00
|
|
|
import com.simibubi.create.foundation.data.recipe.StandardRecipeGen;
|
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-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;
|
2021-04-08 19:22:11 +02:00
|
|
|
import net.minecraft.world.gen.feature.Feature;
|
|
|
|
import net.minecraft.world.gen.placement.Placement;
|
2020-08-05 22:10:05 +02:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
2020-09-19 15:19:22 +02:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2020-10-03 23:12:32 +02:00
|
|
|
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
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;
|
2020-08-05 22:10:05 +02:00
|
|
|
import net.minecraftforge.fml.DistExecutor;
|
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";
|
2021-06-10 20:32:17 +02:00
|
|
|
public static final String VERSION = "0.3.2";
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2021-05-23 03:00:10 +02:00
|
|
|
public static final Logger LOGGER = LogManager.getLogger();
|
2020-05-23 21:03:35 +02:00
|
|
|
|
2021-05-23 03:00:10 +02:00
|
|
|
public static final Gson GSON = new GsonBuilder().setPrettyPrinting()
|
2021-06-26 16:32:56 +02:00
|
|
|
.disableHtmlEscaping()
|
|
|
|
.create();
|
2020-09-04 01:23:09 +02:00
|
|
|
|
2021-05-23 03:00:10 +02:00
|
|
|
public static final ItemGroup BASE_CREATIVE_TAB = new CreateItemGroup();
|
|
|
|
public static final ItemGroup PALETTES_CREATIVE_TAB = new PalettesItemGroup();
|
2020-05-23 21:03:35 +02:00
|
|
|
|
2021-05-23 03:00:10 +02:00
|
|
|
public static final ServerSchematicLoader SCHEMATIC_RECEIVER = new ServerSchematicLoader();
|
|
|
|
public static final RedstoneLinkNetworkHandler REDSTONE_LINK_NETWORK_HANDLER = new RedstoneLinkNetworkHandler();
|
|
|
|
public static final TorquePropagator TORQUE_PROPAGATOR = new TorquePropagator();
|
|
|
|
public static final ServerLagger LAGGER = new ServerLagger();
|
|
|
|
public static final ChunkUtil CHUNK_UTIL = new ChunkUtil();
|
|
|
|
public static final Random RANDOM = new Random();
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2021-05-23 03:00:10 +02:00
|
|
|
private static final NonNullLazyValue<CreateRegistrate> REGISTRATE = CreateRegistrate.lazy(ID);
|
2019-12-05 23:42:01 +01:00
|
|
|
|
2021-05-23 03:00:10 +02:00
|
|
|
public Create() {
|
2021-05-04 18:04:00 +02:00
|
|
|
AllSoundEvents.prepare();
|
2020-05-22 20:12:53 +02:00
|
|
|
AllBlocks.register();
|
2020-05-28 01:30:14 +02:00
|
|
|
AllItems.register();
|
2020-10-19 22:07:05 +02:00
|
|
|
AllFluids.register();
|
2020-06-19 22:59:38 +02:00
|
|
|
AllTags.register();
|
2020-05-13 01:11:07 +02:00
|
|
|
AllPaletteBlocks.register();
|
2021-05-23 03:00:10 +02:00
|
|
|
AllContainerTypes.register();
|
2020-06-01 00:12:10 +02:00
|
|
|
AllEntityTypes.register();
|
2020-06-01 06:33:08 +02:00
|
|
|
AllTileEntities.register();
|
2020-08-08 23:16:22 +02:00
|
|
|
AllMovementBehaviours.register();
|
2021-02-07 21:27:55 +01:00
|
|
|
AllWorldFeatures.register();
|
2021-05-23 03:00:10 +02:00
|
|
|
AllConfigs.register();
|
|
|
|
|
|
|
|
IEventBus modEventBus = FMLJavaModLoadingContext.get()
|
2021-06-26 16:32:56 +02:00
|
|
|
.getModEventBus();
|
2021-05-23 03:00:10 +02:00
|
|
|
IEventBus forgeEventBus = MinecraftForge.EVENT_BUS;
|
2020-05-23 21:03:35 +02:00
|
|
|
|
2020-06-05 13:02:11 +02:00
|
|
|
modEventBus.addListener(Create::init);
|
2021-03-27 19:15:52 +01:00
|
|
|
modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures);
|
|
|
|
modEventBus.addGenericListener(Placement.class, AllWorldFeatures::registerDecoratorFeatures);
|
2020-05-23 14:02:38 +02:00
|
|
|
modEventBus.addGenericListener(IRecipeSerializer.class, AllRecipeTypes::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);
|
2021-05-23 03:00:10 +02:00
|
|
|
forgeEventBus.addListener(EventPriority.HIGH, Create::onBiomeLoad);
|
2020-08-05 22:10:05 +02:00
|
|
|
|
2021-06-26 16:32:56 +02:00
|
|
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
|
|
|
|
() -> () -> CreateClient.addClientListeners(forgeEventBus, modEventBus));
|
2019-09-10 22:51:26 +02:00
|
|
|
}
|
|
|
|
|
2019-09-03 08:34:02 +02:00
|
|
|
public static void init(final FMLCommonSetupEvent event) {
|
2020-10-08 20:13:17 +02:00
|
|
|
CapabilityMinecartController.register();
|
2021-02-04 21:02:30 +01:00
|
|
|
SchematicInstances.register();
|
2019-10-11 05:56:32 +02:00
|
|
|
|
2021-05-23 03:00:10 +02:00
|
|
|
CHUNK_UTIL.init();
|
|
|
|
MinecraftForge.EVENT_BUS.register(CHUNK_UTIL);
|
2020-09-04 18:04:00 +02:00
|
|
|
|
2019-07-19 17:50:23 +02:00
|
|
|
AllPackets.registerPackets();
|
2020-03-06 01:09:10 +01:00
|
|
|
AllTriggers.register();
|
2021-06-26 01:17:35 +02:00
|
|
|
PotatoCannonProjectileTypes.register();
|
2021-04-08 19:22:11 +02:00
|
|
|
|
2021-02-06 22:03:48 +01:00
|
|
|
event.enqueueWork(() -> {
|
|
|
|
SchematicProcessor.register();
|
2021-02-07 21:27:55 +01:00
|
|
|
AllWorldFeatures.registerFeatures();
|
2021-02-06 22:03:48 +01:00
|
|
|
});
|
2020-10-03 23:12:32 +02:00
|
|
|
}
|
2021-04-08 19:22:11 +02:00
|
|
|
|
2021-05-23 03:00:10 +02:00
|
|
|
public void gatherData(GatherDataEvent event) {
|
|
|
|
DataGenerator gen = event.getGenerator();
|
|
|
|
gen.addProvider(new AllAdvancements(gen));
|
|
|
|
gen.addProvider(new LangMerger(gen));
|
|
|
|
gen.addProvider(AllSoundEvents.provider(gen));
|
|
|
|
gen.addProvider(new StandardRecipeGen(gen));
|
|
|
|
gen.addProvider(new MechanicalCraftingRecipeGen(gen));
|
2021-06-28 04:00:24 +02:00
|
|
|
gen.addProvider(new SequencedAssemblyRecipeGen(gen));
|
2021-05-23 03:00:10 +02:00
|
|
|
ProcessingRecipeGen.registerAll(gen);
|
|
|
|
}
|
|
|
|
|
2020-10-03 23:12:32 +02:00
|
|
|
public static void onBiomeLoad(BiomeLoadingEvent event) {
|
|
|
|
AllWorldFeatures.reload(event);
|
2019-07-11 19:55:11 +02:00
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2020-04-26 06:58:38 +02:00
|
|
|
public static CreateRegistrate registrate() {
|
2021-05-23 03:00:10 +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
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|