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;
|
2021-08-25 17:49:01 +02:00
|
|
|
import com.simibubi.create.api.behaviour.BlockSpoutingBehaviour;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.content.CreateItemGroup;
|
|
|
|
import com.simibubi.create.content.contraptions.TorquePropagator;
|
2022-01-09 23:00:55 +01:00
|
|
|
import com.simibubi.create.content.contraptions.components.flywheel.engine.FurnaceEngineInteractions;
|
2021-09-19 02:40:57 +02:00
|
|
|
import com.simibubi.create.content.curiosities.weapons.BuiltinPotatoProjectileTypes;
|
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;
|
2021-12-04 08:48:55 +01:00
|
|
|
import com.simibubi.create.foundation.block.CopperRegistries;
|
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
|
|
|
|
2021-11-02 00:08:20 +01:00
|
|
|
import net.minecraft.core.particles.ParticleType;
|
2021-11-02 06:18:30 +01:00
|
|
|
import net.minecraft.data.DataGenerator;
|
2021-11-02 00:08:20 +01:00
|
|
|
import net.minecraft.resources.ResourceLocation;
|
|
|
|
import net.minecraft.sounds.SoundEvent;
|
2021-11-02 06:18:30 +01:00
|
|
|
import net.minecraft.world.item.CreativeModeTab;
|
|
|
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
2021-11-02 00:08:20 +01:00
|
|
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
2020-08-05 22:10:05 +02:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
2021-07-04 20:09:43 +02:00
|
|
|
import net.minecraftforge.common.ForgeMod;
|
2020-09-19 15:19:22 +02:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
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;
|
2021-07-27 22:25:16 +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.event.lifecycle.FMLCommonSetupEvent;
|
2019-10-15 22:22:19 +02:00
|
|
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
2021-11-02 06:18:30 +01:00
|
|
|
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
|
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";
|
2022-01-09 15:54:50 +01:00
|
|
|
public static final String VERSION = "0.4c";
|
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-11-02 00:08:20 +01:00
|
|
|
public static final CreativeModeTab BASE_CREATIVE_TAB = new CreateItemGroup();
|
|
|
|
public static final CreativeModeTab 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 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-10-16 10:46:49 +02:00
|
|
|
onCtor();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void onCtor() {
|
|
|
|
ModLoadingContext modLoadingContext = ModLoadingContext.get();
|
|
|
|
|
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-08-09 07:21:48 +02:00
|
|
|
AllInteractionBehaviours.register();
|
2021-02-07 21:27:55 +01:00
|
|
|
AllWorldFeatures.register();
|
2021-07-07 17:33:43 +02:00
|
|
|
AllEnchantments.register();
|
2021-10-16 10:46:49 +02:00
|
|
|
AllConfigs.register(modLoadingContext);
|
2022-01-09 23:00:55 +01:00
|
|
|
FurnaceEngineInteractions.registerDefaults();
|
2021-08-25 13:46:53 +02:00
|
|
|
BlockSpoutingBehaviour.register();
|
2021-07-27 22:25:16 +02:00
|
|
|
|
|
|
|
ForgeMod.enableMilkFluid();
|
2021-05-23 03:00:10 +02:00
|
|
|
|
2021-12-04 08:48:55 +01:00
|
|
|
CopperRegistries.inject();
|
|
|
|
|
2021-05-23 03:00:10 +02:00
|
|
|
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-11-11 07:15:26 +01:00
|
|
|
modEventBus.addListener(EventPriority.LOWEST, Create::gatherData);
|
2021-03-27 19:15:52 +01:00
|
|
|
modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures);
|
2021-11-02 00:08:20 +01:00
|
|
|
modEventBus.addGenericListener(RecipeSerializer.class, AllRecipeTypes::register);
|
2020-05-23 14:02:38 +02:00
|
|
|
modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register);
|
2020-02-15 01:57:16 +01:00
|
|
|
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
|
2021-10-16 10:46:49 +02:00
|
|
|
|
2021-06-26 16:32:56 +02:00
|
|
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
|
2021-10-16 10:46:49 +02:00
|
|
|
() -> () -> CreateClient.onCtorClient(modEventBus, forgeEventBus));
|
2019-09-10 22:51:26 +02:00
|
|
|
}
|
|
|
|
|
2019-09-03 08:34:02 +02:00
|
|
|
public static void init(final FMLCommonSetupEvent event) {
|
2021-08-01 02:28:41 +02:00
|
|
|
AllPackets.registerPackets();
|
2021-02-04 21:02:30 +01:00
|
|
|
SchematicInstances.register();
|
2021-09-19 02:40:57 +02:00
|
|
|
BuiltinPotatoProjectileTypes.register();
|
2019-10-11 05:56:32 +02:00
|
|
|
|
2021-02-06 22:03:48 +01:00
|
|
|
event.enqueueWork(() -> {
|
2021-08-01 02:28:41 +02:00
|
|
|
AllTriggers.register();
|
2021-02-06 22:03:48 +01:00
|
|
|
SchematicProcessor.register();
|
2021-02-07 21:27:55 +01:00
|
|
|
AllWorldFeatures.registerFeatures();
|
2021-12-07 18:24:57 +01:00
|
|
|
AllWorldFeatures.registerPlacementTypes();
|
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-10-16 10:46:49 +02:00
|
|
|
public static void gatherData(GatherDataEvent event) {
|
2021-05-23 03:00:10 +02:00
|
|
|
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-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
|
|
|
}
|