mirror of
https://github.com/Theta-Dev/ConstructionWand.git
synced 2025-08-02 08:55:26 +02:00
80 lines
3 KiB
Java
80 lines
3 KiB
Java
package thetadev.constructionwand;
|
|
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
import net.minecraftforge.fml.ModLoadingContext;
|
|
import net.minecraftforge.fml.common.Mod;
|
|
import net.minecraftforge.fml.config.ModConfig;
|
|
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 thetadev.constructionwand.basics.ConfigClient;
|
|
import thetadev.constructionwand.basics.ConfigServer;
|
|
import thetadev.constructionwand.basics.ModStats;
|
|
import thetadev.constructionwand.client.ClientEvents;
|
|
import thetadev.constructionwand.client.RenderBlockPreview;
|
|
import thetadev.constructionwand.containers.ContainerManager;
|
|
import thetadev.constructionwand.containers.ContainerRegistrar;
|
|
import thetadev.constructionwand.items.ModItems;
|
|
import thetadev.constructionwand.network.ModMessages;
|
|
import thetadev.constructionwand.wand.undo.UndoHistory;
|
|
|
|
|
|
@Mod(ConstructionWand.MODID)
|
|
public class ConstructionWand {
|
|
public static final String MODID = "constructionwand";
|
|
public static final String MODNAME = "ConstructionWand";
|
|
|
|
public static ConstructionWand instance;
|
|
public static final Logger LOGGER = LogManager.getLogger();
|
|
|
|
public ContainerManager containerManager;
|
|
public UndoHistory undoHistory;
|
|
public RenderBlockPreview renderBlockPreview;
|
|
|
|
public ConstructionWand() {
|
|
instance = this;
|
|
|
|
containerManager = new ContainerManager();
|
|
undoHistory = new UndoHistory();
|
|
|
|
// Register setup methods for modloading
|
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
|
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
|
|
MinecraftForge.EVENT_BUS.register(this);
|
|
|
|
// Register Item DeferredRegister
|
|
ModItems.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
|
|
|
// Config setup
|
|
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ConfigServer.SPEC);
|
|
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigClient.SPEC);
|
|
}
|
|
|
|
private void commonSetup(final FMLCommonSetupEvent event) {
|
|
LOGGER.info("ConstructionWand says hello - may the odds be ever in your favor.");
|
|
|
|
// Register packets
|
|
ModMessages.register();
|
|
|
|
// Container registry
|
|
ContainerRegistrar.register();
|
|
|
|
// Stats
|
|
ModStats.register();
|
|
}
|
|
|
|
private void clientSetup(final FMLClientSetupEvent event) {
|
|
renderBlockPreview = new RenderBlockPreview();
|
|
MinecraftForge.EVENT_BUS.register(renderBlockPreview);
|
|
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
|
|
|
event.enqueueWork(ModItems::registerModelProperties);
|
|
}
|
|
|
|
public static ResourceLocation loc(String name) {
|
|
return new ResourceLocation(MODID, name);
|
|
}
|
|
}
|