SteamPowered/src/main/java/com/teammoeg/steampowered/SteamPowered.java

102 lines
4 KiB
Java
Raw Normal View History

2021-10-25 01:55:17 +02:00
/*
* Copyright (c) 2021 TeamMoeg
*
* This file is part of Steam Powered.
*
* Steam Powered is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* Steam Powered is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Steam Powered. If not, see <https://www.gnu.org/licenses/>.
*/
2021-08-23 21:32:54 +02:00
package com.teammoeg.steampowered;
import javax.annotation.Nonnull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
2021-11-12 18:25:55 +01:00
import com.simibubi.create.foundation.block.BlockStressValues;
2021-08-23 21:32:54 +02:00
import com.simibubi.create.foundation.data.CreateRegistrate;
import com.simibubi.create.repack.registrate.util.NonNullLazyValue;
import com.teammoeg.steampowered.client.Particles;
2021-08-28 17:46:19 +02:00
import com.teammoeg.steampowered.client.SteamPoweredClient;
2021-08-29 10:56:44 +02:00
import com.teammoeg.steampowered.network.PacketHandler;
2021-08-29 08:47:39 +02:00
import com.teammoeg.steampowered.registrate.SPBlocks;
2021-08-29 10:55:48 +02:00
import com.teammoeg.steampowered.registrate.SPItems;
2021-08-29 08:47:39 +02:00
import com.teammoeg.steampowered.registrate.SPTiles;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraft.resources.ResourceLocation;
2021-08-28 17:46:19 +02:00
import net.minecraftforge.api.distmarker.Dist;
2021-08-23 21:32:54 +02:00
import net.minecraftforge.common.MinecraftForge;
2021-08-28 17:46:19 +02:00
import net.minecraftforge.fml.DistExecutor;
2021-09-01 17:34:40 +02:00
import net.minecraftforge.fml.ModLoadingContext;
2021-08-23 21:32:54 +02:00
import net.minecraftforge.fml.common.Mod;
2021-09-01 17:34:40 +02:00
import net.minecraftforge.fml.config.ModConfig;
2021-08-23 21:32:54 +02:00
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
// The value here should match an entry in the META-INF/mods.toml file
@Mod("steampowered")
public class SteamPowered {
public static final String MODID = "steampowered";
2021-08-27 20:40:34 +02:00
public static ResourceLocation rl(String path) {
return new ResourceLocation(MODID, path);
}
public static final CreativeModeTab itemGroup = new CreativeModeTab(MODID) {
2021-08-23 21:32:54 +02:00
@Override
@Nonnull
public ItemStack makeIcon() {
2021-09-03 15:44:43 +02:00
return new ItemStack(SPBlocks.STEEL_FLYWHEEL.get());
2021-08-23 21:32:54 +02:00
}
};
public static final NonNullLazyValue<CreateRegistrate> registrate = CreateRegistrate.lazy(MODID);
// Directly reference a log4j logger.
private static final Logger LOGGER = LogManager.getLogger();
public SteamPowered() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
MinecraftForge.EVENT_BUS.register(this);
2021-08-29 17:26:26 +02:00
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
() -> () -> SteamPoweredClient.addClientListeners(MinecraftForge.EVENT_BUS, FMLJavaModLoadingContext.get().getModEventBus()));
2021-08-26 13:45:06 +02:00
FluidRegistry.FLUIDS.register(FMLJavaModLoadingContext.get().getModEventBus());
BlockRegistry.BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
ItemRegistry.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
Particles.REGISTER.register(FMLJavaModLoadingContext.get().getModEventBus());
2021-08-23 21:32:54 +02:00
SPBlocks.register();
SPTiles.register();
2021-08-29 10:55:48 +02:00
SPItems.register();
2021-10-29 09:34:05 +02:00
SPTags.init();
2021-11-12 18:25:55 +01:00
BlockStressValues.registerProvider(MODID,new SPStress());
2021-09-01 17:34:40 +02:00
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, SPConfig.COMMON_CONFIG);
2021-10-23 15:57:32 +02:00
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, SPConfig.SERVER_CONFIG);
2021-08-27 20:40:34 +02:00
PacketHandler.register();
2021-08-23 21:32:54 +02:00
}
private void setup(final FMLCommonSetupEvent event) {
// some preinit code
}
private void doClientStuff(final FMLClientSetupEvent event) {
// do something that can only be done on the client
}
}