44
55import com .mojang .logging .LogUtils ;
66
7- import net .minecraft .client .Minecraft ;
87import net .minecraft .core .registries .BuiltInRegistries ;
98import net .minecraft .core .registries .Registries ;
109import net .minecraft .network .chat .Component ;
2019import net .neoforged .api .distmarker .Dist ;
2120import net .neoforged .bus .api .IEventBus ;
2221import net .neoforged .bus .api .SubscribeEvent ;
23- import net .neoforged .fml .ModContainer ;
24- import net .neoforged .fml .common .EventBusSubscriber ;
2522import net .neoforged .fml .common .Mod ;
2623import net .neoforged .fml .config .ModConfig ;
27- import net .neoforged .fml .event . lifecycle . FMLClientSetupEvent ;
24+ import net .neoforged .fml .ModContainer ;
2825import net .neoforged .fml .event .lifecycle .FMLCommonSetupEvent ;
2926import net .neoforged .neoforge .common .NeoForge ;
3027import net .neoforged .neoforge .event .BuildCreativeModeTabContentsEvent ;
@@ -40,7 +37,7 @@ public class ExampleMod {
4037 // Define mod id in a common place for everything to reference
4138 public static final String MODID = "examplemod" ;
4239 // Directly reference a slf4j logger
43- private static final Logger LOGGER = LogUtils .getLogger ();
40+ public static final Logger LOGGER = LogUtils .getLogger ();
4441 // Create a Deferred Register to hold Blocks which will all be registered under the "examplemod" namespace
4542 public static final DeferredRegister .Blocks BLOCKS = DeferredRegister .createBlocks (MODID );
4643 // Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace
@@ -117,15 +114,4 @@ public void onServerStarting(ServerStartingEvent event) {
117114 // Do something when the server starts
118115 LOGGER .info ("HELLO from server starting" );
119116 }
120-
121- // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
122- @ EventBusSubscriber (modid = MODID , bus = EventBusSubscriber .Bus .MOD , value = Dist .CLIENT )
123- public static class ClientModEvents {
124- @ SubscribeEvent
125- public static void onClientSetup (FMLClientSetupEvent event ) {
126- // Some client setup code
127- LOGGER .info ("HELLO FROM CLIENT SETUP" );
128- LOGGER .info ("MINECRAFT NAME >> {}" , Minecraft .getInstance ().getUser ().getName ());
129- }
130- }
131117}
0 commit comments