From 8f623ed7568eb5b8dd6ed848128c9bb7e43cd6f0 Mon Sep 17 00:00:00 2001 From: "neoforge-mdk-automation[bot]" <173375039+neoforge-mdk-automation[bot]@users.noreply.github.com> Date: Sun, 6 Jul 2025 04:31:10 +0000 Subject: Update MDK with new output from mod generator (#9) * Update MDK with new output from mod generator * Update MDK with new output from mod generator * Update MDK with new output from mod generator --------- Co-authored-by: NeoForge MDK Automation <173375039+neoforge-mdk-automation[bot]@users.noreply.github.com> --- .../java/com/example/examplemod/ExampleModClient.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/example/examplemod/ExampleModClient.java') diff --git a/src/main/java/com/example/examplemod/ExampleModClient.java b/src/main/java/com/example/examplemod/ExampleModClient.java index 3079631..bf9b4c6 100644 --- a/src/main/java/com/example/examplemod/ExampleModClient.java +++ b/src/main/java/com/example/examplemod/ExampleModClient.java @@ -1,13 +1,19 @@ package com.example.examplemod; +import net.minecraft.client.Minecraft; import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.fml.common.Mod; +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; import net.neoforged.neoforge.client.gui.ConfigurationScreen; import net.neoforged.neoforge.client.gui.IConfigScreenFactory; // This class will not load on dedicated servers. Accessing client side code from here is safe. @Mod(value = ExampleMod.MODID, dist = Dist.CLIENT) +// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent +@EventBusSubscriber(modid = ExampleMod.MODID, value = Dist.CLIENT) public class ExampleModClient { public ExampleModClient(ModContainer container) { // Allows NeoForge to create a config screen for this mod's configs. @@ -15,4 +21,11 @@ public class ExampleModClient { // Do not forget to add translations for your config options to the en_us.json file. container.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new); } -} \ No newline at end of file + + @SubscribeEvent + static void onClientSetup(FMLClientSetupEvent event) { + // Some client setup code + ExampleMod.LOGGER.info("HELLO FROM CLIENT SETUP"); + ExampleMod.LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); + } +} -- cgit v1.2.3