diff options
| author | SizableShrimp <sizableshrimp@sizableshrimp.me> | 2022-03-01 14:59:27 -0600 |
|---|---|---|
| committer | LexManos <LexManos@gmail.com> | 2022-03-01 14:16:46 -0800 |
| commit | 03379dea274fba774b828d9625d11adbf6403f0a (patch) | |
| tree | bcaeeedb0c3674d0523c3746f783a3eee916e101 /src/main/java/com | |
| parent | 7f65352e09aced40e534901c9d0e6deb6191101d (diff) | |
Update to 1.18.2
Co-authored-by: sciwhiz12 <arnoldnunag12@gmail.com>
Co-authored-by: Marc Hermans <marc.hermans@ldtteam.com>
Co-authored-by: LexManos <LexManos@gmail.com>
Co-authored-by: Curle <curle@gemwire.uk>
Signed-off-by: SizableShrimp <sizableshrimp@sizableshrimp.me>
Diffstat (limited to 'src/main/java/com')
| -rw-r--r-- | src/main/java/com/example/examplemod/ExampleMod.java | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 27476be..421fd07 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,5 +1,6 @@ package com.example.examplemod; +import com.mojang.logging.LogUtils; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.MinecraftForge; @@ -12,8 +13,7 @@ import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.util.stream.Collectors; @@ -21,10 +21,11 @@ import java.util.stream.Collectors; @Mod("examplemod") public class ExampleMod { - // Directly reference a log4j logger. - private static final Logger LOGGER = LogManager.getLogger(); + // Directly reference a slf4j logger + private static final Logger LOGGER = LogUtils.getLogger(); - public ExampleMod() { + public ExampleMod() + { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading @@ -45,31 +46,35 @@ public class ExampleMod private void enqueueIMC(final InterModEnqueueEvent event) { - // some example code to dispatch IMC to another mod + // Some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { - // some example code to receive and process InterModComms from other mods + // Some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.messageSupplier().get()). collect(Collectors.toList())); } + // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) { - // do something when the server starts + public void onServerStarting(ServerStartingEvent event) + { + // Do something when the server starts LOGGER.info("HELLO from server starting"); } // 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 { + @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 + public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) + { + // Register a new block here LOGGER.info("HELLO from Register Block"); } } |
