diff --git a/Common/src/main/java/com/blamejared/stuff/Constants.java b/Common/src/main/java/com/blamejared/stuff/Constants.java new file mode 100644 index 0000000..4090578 --- /dev/null +++ b/Common/src/main/java/com/blamejared/stuff/Constants.java @@ -0,0 +1,11 @@ +package com.blamejared.stuff; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class Constants { + + public static final String MOD_ID = "multiloader"; + public static final String MOD_NAME = "MultiLoader"; + public static final Logger LOG = LogManager.getLogger(MOD_NAME); +} diff --git a/Forge/src/main/java/com/example/examplemod/ExampleMod.java b/Forge/src/main/java/com/example/examplemod/ExampleMod.java index 462d5b2..a31e330 100644 --- a/Forge/src/main/java/com/example/examplemod/ExampleMod.java +++ b/Forge/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,23 +1,25 @@ package com.example.examplemod; -import net.minecraft.world.level.block.*; +import java.util.stream.Collectors; + +import com.blamejared.stuff.Constants; + +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.*; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; +import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; -import org.apache.logging.log4j.*; -import java.util.stream.Collectors; - -@Mod("examplemod") +@Mod(Constants.MOD_ID) public class ExampleMod { - private static final Logger LOGGER = LogManager.getLogger(); - public ExampleMod() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); @@ -29,21 +31,21 @@ public class ExampleMod { private void setup(final FMLCommonSetupEvent event) { - LOGGER.info("HELLO FROM PREINIT"); - LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); + Constants.LOG.info("HELLO FROM PREINIT"); + Constants.LOG.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void enqueueIMC(final InterModEnqueueEvent event) { InterModComms.sendTo("examplemod", "helloworld", () -> { - LOGGER.info("Hello world from the MDK"); + Constants.LOG.info("Hello world from the MDK"); return "Hello world"; }); } private void processIMC(final InterModProcessEvent event) { - LOGGER.info("Got IMC {}", event.getIMCStream() + Constants.LOG.info("Got IMC {}", event.getIMCStream() .map(m -> m.messageSupplier().get()) .collect(Collectors.toList())); } @@ -51,7 +53,7 @@ public class ExampleMod { @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { - LOGGER.info("HELLO from server starting"); + Constants.LOG.info("HELLO from server starting"); } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) @@ -60,7 +62,7 @@ public class ExampleMod { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { // register a new block here - LOGGER.info("HELLO from Register Block"); + Constants.LOG.info("HELLO from Register Block"); } } diff --git a/Forge/src/main/resources/META-INF/mods.toml b/Forge/src/main/resources/META-INF/mods.toml index 1b3f5eb..0c620ed 100644 --- a/Forge/src/main/resources/META-INF/mods.toml +++ b/Forge/src/main/resources/META-INF/mods.toml @@ -15,7 +15,7 @@ license="All rights reserved" # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod -modId="examplemod" #mandatory +modId="multiloader" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build @@ -27,7 +27,7 @@ displayName="Example Mod" #mandatory # A URL for the "homepage" for this mod, displayed in the mod UI #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional # A file name (in the root of the mod JAR) containing a logo for display -logoFile="examplemod.png" #optional +logoFile="multiloader.png" #optional # A text field displayed in the mod UI credits="Thanks for this example mod goes to Java" #optional # A text field displayed in the mod UI @@ -41,7 +41,7 @@ Have some lorem ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. ''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies.examplemod]] #optional +[[dependencies.multiloader]] #optional # the modid of the dependency modId="forge" #mandatory # Does this dependency have to exist - if not, ordering below must be specified @@ -53,7 +53,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Side this dependency is applied on - BOTH, CLIENT or SERVER side="BOTH" # Here's another dependency -[[dependencies.examplemod]] +[[dependencies.multiloader]] modId="minecraft" mandatory=true # This version range declares a minimum of the current minecraft version up to but not including the next major version