2019-07-11 09:03:08 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2020-09-19 15:19:22 +02:00
|
|
|
import java.util.Random;
|
|
|
|
|
2022-11-17 22:50:15 +01:00
|
|
|
import org.slf4j.Logger;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2020-09-04 01:23:09 +02:00
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.GsonBuilder;
|
2022-11-17 22:50:15 +01:00
|
|
|
import com.mojang.logging.LogUtils;
|
2021-08-25 17:49:01 +02:00
|
|
|
import com.simibubi.create.api.behaviour.BlockSpoutingBehaviour;
|
2022-05-22 18:10:40 +02:00
|
|
|
import com.simibubi.create.compat.Mods;
|
|
|
|
import com.simibubi.create.compat.curios.Curios;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.content.contraptions.TorquePropagator;
|
2022-07-07 23:15:53 +02:00
|
|
|
import com.simibubi.create.content.contraptions.fluids.tank.BoilerHeaters;
|
2022-07-11 19:28:25 +02:00
|
|
|
import com.simibubi.create.content.curiosities.deco.SlidingDoorBlock;
|
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;
|
2022-05-15 23:40:33 +02:00
|
|
|
import com.simibubi.create.content.logistics.block.display.AllDisplayBehaviours;
|
2022-05-08 07:19:12 +02:00
|
|
|
import com.simibubi.create.content.logistics.block.mechanicalArm.AllArmInteractionPointTypes;
|
2022-02-01 01:14:21 +01:00
|
|
|
import com.simibubi.create.content.logistics.trains.GlobalRailwayManager;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.content.palettes.AllPaletteBlocks;
|
|
|
|
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;
|
2022-08-03 19:08:00 +02:00
|
|
|
import com.simibubi.create.foundation.config.ContraptionMovementSetting;
|
2022-12-12 00:23:15 +01:00
|
|
|
import com.simibubi.create.foundation.data.AllLangPartials;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.foundation.data.CreateRegistrate;
|
2020-05-23 21:03:35 +02:00
|
|
|
import com.simibubi.create.foundation.data.LangMerger;
|
2022-11-17 22:50:15 +01:00
|
|
|
import com.simibubi.create.foundation.data.TagGen;
|
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;
|
2023-01-29 20:09:32 +01:00
|
|
|
import com.simibubi.create.foundation.item.ItemDescription;
|
|
|
|
import com.simibubi.create.foundation.item.KineticStats;
|
|
|
|
import com.simibubi.create.foundation.item.TooltipHelper.Palette;
|
|
|
|
import com.simibubi.create.foundation.item.TooltipModifier;
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.foundation.networking.AllPackets;
|
2023-01-17 05:08:26 +01:00
|
|
|
import com.simibubi.create.foundation.utility.AttachedRegistry;
|
2022-08-05 20:39:34 +02:00
|
|
|
import com.simibubi.create.foundation.worldgen.AllFeatures;
|
2022-08-06 02:21:47 +02:00
|
|
|
import com.simibubi.create.foundation.worldgen.AllOreFeatureConfigEntries;
|
2022-08-05 20:39:34 +02:00
|
|
|
import com.simibubi.create.foundation.worldgen.AllPlacementModifiers;
|
|
|
|
import com.simibubi.create.foundation.worldgen.BuiltinRegistration;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
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;
|
2022-08-03 19:08:00 +02:00
|
|
|
import net.minecraft.world.entity.Entity;
|
|
|
|
import net.minecraft.world.level.Level;
|
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-10-19 00:37:05 +02:00
|
|
|
public static final String VERSION = "0.5.1-unstable";
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2022-11-17 22:50:15 +01:00
|
|
|
public static final Logger LOGGER = LogUtils.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
|
|
|
|
2022-11-17 22:50:15 +01:00
|
|
|
/** Use the {@link Random} of a local {@link Level} or {@link Entity} or create one */
|
|
|
|
@Deprecated
|
|
|
|
public static final Random RANDOM = new Random();
|
|
|
|
|
|
|
|
public static final CreateRegistrate REGISTRATE = CreateRegistrate.create(ID);
|
|
|
|
|
2023-01-29 20:09:32 +01:00
|
|
|
static {
|
|
|
|
// TODO 0.5.1: choose color palette
|
|
|
|
REGISTRATE.setTooltipModifierFactory(item -> {
|
|
|
|
return new ItemDescription.Modifier(item, Palette.BLUE)
|
|
|
|
.andThen(TooltipModifier.mapNull(KineticStats.create(item)));
|
|
|
|
});
|
|
|
|
}
|
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();
|
2022-02-01 01:14:21 +01:00
|
|
|
public static final GlobalRailwayManager RAILWAYS = new GlobalRailwayManager();
|
2021-05-23 03:00:10 +02:00
|
|
|
public static final ServerLagger LAGGER = new ServerLagger();
|
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();
|
|
|
|
|
2022-08-05 20:39:34 +02:00
|
|
|
IEventBus modEventBus = FMLJavaModLoadingContext.get()
|
|
|
|
.getModEventBus();
|
|
|
|
IEventBus forgeEventBus = MinecraftForge.EVENT_BUS;
|
|
|
|
|
2022-11-17 22:50:15 +01:00
|
|
|
REGISTRATE.registerEventListeners(modEventBus);
|
|
|
|
|
2021-05-04 18:04:00 +02:00
|
|
|
AllSoundEvents.prepare();
|
2022-11-17 22:50:15 +01:00
|
|
|
AllTags.init();
|
2023-01-29 20:09:32 +01:00
|
|
|
AllCreativeModeTabs.init();
|
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-05-13 01:11:07 +02:00
|
|
|
AllPaletteBlocks.register();
|
2023-01-17 22:37:18 +01:00
|
|
|
AllMenuTypes.register();
|
2020-06-01 00:12:10 +02:00
|
|
|
AllEntityTypes.register();
|
2023-01-19 22:35:41 +01:00
|
|
|
AllBlockEntityTypes.register();
|
2022-08-05 20:39:34 +02:00
|
|
|
AllEnchantments.register();
|
|
|
|
AllRecipeTypes.register(modEventBus);
|
|
|
|
AllParticleTypes.register(modEventBus);
|
|
|
|
AllStructureProcessorTypes.register(modEventBus);
|
|
|
|
AllEntityDataSerializers.register(modEventBus);
|
2022-08-06 02:21:47 +02:00
|
|
|
AllOreFeatureConfigEntries.init();
|
2022-08-05 20:39:34 +02:00
|
|
|
AllFeatures.register(modEventBus);
|
|
|
|
AllPlacementModifiers.register(modEventBus);
|
|
|
|
BuiltinRegistration.register(modEventBus);
|
|
|
|
|
|
|
|
AllConfigs.register(modLoadingContext);
|
|
|
|
|
2022-07-09 01:15:19 +02:00
|
|
|
AllMovementBehaviours.registerDefaults();
|
|
|
|
AllInteractionBehaviours.registerDefaults();
|
|
|
|
AllDisplayBehaviours.registerDefaults();
|
2022-08-03 19:08:00 +02:00
|
|
|
ContraptionMovementSetting.registerDefaults();
|
2022-05-08 07:19:12 +02:00
|
|
|
AllArmInteractionPointTypes.register();
|
2022-08-05 20:39:34 +02:00
|
|
|
BlockSpoutingBehaviour.registerDefaults();
|
2021-07-27 22:25:16 +02:00
|
|
|
|
|
|
|
ForgeMod.enableMilkFluid();
|
2021-12-04 08:48:55 +01:00
|
|
|
CopperRegistries.inject();
|
|
|
|
|
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);
|
2020-02-15 01:57:16 +01:00
|
|
|
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
|
2021-10-16 10:46:49 +02:00
|
|
|
|
2022-07-11 19:28:25 +02:00
|
|
|
forgeEventBus.addListener(EventPriority.HIGH, SlidingDoorBlock::stopItQuark);
|
2022-08-05 20:39:34 +02:00
|
|
|
|
2022-02-01 01:14:21 +01:00
|
|
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> CreateClient.onCtorClient(modEventBus, forgeEventBus));
|
2022-05-10 14:51:38 +02:00
|
|
|
|
2022-11-17 22:50:15 +01:00
|
|
|
Mods.CURIOS.executeIfInstalled(() -> () -> Curios.init(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(() -> {
|
2023-01-29 20:09:32 +01:00
|
|
|
AttachedRegistry.unwrapAll();
|
2022-06-18 19:54:35 +02:00
|
|
|
AllAdvancements.register();
|
2021-08-01 02:28:41 +02:00
|
|
|
AllTriggers.register();
|
2022-07-07 23:15:53 +02:00
|
|
|
BoilerHeaters.registerDefaults();
|
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) {
|
2022-11-17 22:50:15 +01:00
|
|
|
TagGen.datagen();
|
2021-05-23 03:00:10 +02:00
|
|
|
DataGenerator gen = event.getGenerator();
|
2022-08-05 20:39:34 +02:00
|
|
|
if (event.includeClient()) {
|
2023-01-29 20:09:32 +01:00
|
|
|
gen.addProvider(new LangMerger(gen, ID, NAME, AllLangPartials.values()));
|
2022-08-05 20:39:34 +02:00
|
|
|
gen.addProvider(AllSoundEvents.provider(gen));
|
|
|
|
}
|
|
|
|
if (event.includeServer()) {
|
|
|
|
gen.addProvider(new AllAdvancements(gen));
|
|
|
|
gen.addProvider(new StandardRecipeGen(gen));
|
|
|
|
gen.addProvider(new MechanicalCraftingRecipeGen(gen));
|
|
|
|
gen.addProvider(new SequencedAssemblyRecipeGen(gen));
|
|
|
|
ProcessingRecipeGen.registerAll(gen);
|
|
|
|
// AllOreFeatureConfigEntries.gatherData(event);
|
|
|
|
}
|
2021-05-23 03:00:10 +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
|
|
|
}
|