73 lines
2.7 KiB
Java
73 lines
2.7 KiB
Java
package com.teammoeg.steampowered;
|
|
|
|
import com.simibubi.create.foundation.data.CreateRegistrate;
|
|
import com.simibubi.create.repack.registrate.util.NonNullLazyValue;
|
|
import com.teammoeg.steampowered.create.SPBlocks;
|
|
import com.teammoeg.steampowered.create.SPTiles;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.item.ItemGroup;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
import net.minecraftforge.event.RegistryEvent;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.fml.common.Mod;
|
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
// 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";
|
|
|
|
public static final ItemGroup itemGroup = new ItemGroup(MODID) {
|
|
@Override
|
|
@Nonnull
|
|
public ItemStack makeIcon() {
|
|
return new ItemStack(SPBlocks.STEAM_ENGINE.get());
|
|
}
|
|
};
|
|
|
|
public static final NonNullLazyValue<CreateRegistrate> registrate = CreateRegistrate.lazy(MODID);
|
|
|
|
// Directly reference a log4j logger.
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
|
|
|
public SteamPowered() {
|
|
// Register the setup method for modloading
|
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
|
|
// Register the doClientStuff method for modloading
|
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
|
|
|
|
// Register ourselves for server and other game events we are interested in
|
|
MinecraftForge.EVENT_BUS.register(this);
|
|
|
|
SPBlocks.register();
|
|
SPTiles.register();
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
|
|
// Event bus for receiving Registry Events)
|
|
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
|
public static class RegistryEvents {
|
|
@SubscribeEvent
|
|
public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
|
|
// register a new block here
|
|
LOGGER.info("HELLO from Register Block");
|
|
}
|
|
}
|
|
}
|