diff --git a/build.gradle b/build.gradle index e85a392..25fde73 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'maven-publish' - id 'net.neoforged.moddev' version '2.0.92' + id 'net.neoforged.moddev' version '2.0.94' id 'idea' } diff --git a/src/main/java/com/example/examplemod/Config.java b/src/main/java/com/example/examplemod/Config.java index 31c0747..1aa42d0 100644 --- a/src/main/java/com/example/examplemod/Config.java +++ b/src/main/java/com/example/examplemod/Config.java @@ -14,8 +14,7 @@ // An example config class. This is not required, but it's a good idea to have one to keep your config organized. // Demonstrates how to use Neo's config APIs -public class Config -{ +public class Config { private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); public static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER @@ -37,8 +36,7 @@ public class Config static final ModConfigSpec SPEC = BUILDER.build(); - private static boolean validateItemName(final Object obj) - { + private static boolean validateItemName(final Object obj) { return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(new ResourceLocation(itemName)); } } diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index cb2672b..1a32ce3 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -35,8 +35,7 @@ // The value here should match an entry in the META-INF/mods.toml file @Mod(ExampleMod.MODID) -public class ExampleMod -{ +public class ExampleMod { // Define mod id in a common place for everything to reference public static final String MODID = "examplemod"; // Directly reference a slf4j logger @@ -68,8 +67,7 @@ public class ExampleMod // The constructor for the mod class is the first code that is run when your mod is loaded. // FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically. - public ExampleMod(IEventBus modEventBus) - { + public ExampleMod(IEventBus modEventBus) { // Register the commonSetup method for modloading modEventBus.addListener(this::commonSetup); @@ -92,13 +90,13 @@ public ExampleMod(IEventBus modEventBus) ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); } - private void commonSetup(final FMLCommonSetupEvent event) - { + private void commonSetup(FMLCommonSetupEvent event) { // Some common setup code LOGGER.info("HELLO FROM COMMON SETUP"); - if (Config.LOG_DIRT_BLOCK.getAsBoolean()) + if (Config.LOG_DIRT_BLOCK.getAsBoolean()) { LOGGER.info("DIRT BLOCK >> {}", BuiltInRegistries.BLOCK.getKey(Blocks.DIRT)); + } LOGGER.info("{}{}", Config.MAGIC_NUMBER_INTRODUCTION.get(), Config.MAGIC_NUMBER.getAsInt()); @@ -106,27 +104,24 @@ private void commonSetup(final FMLCommonSetupEvent event) } // Add the example block item to the building blocks tab - private void addCreative(BuildCreativeModeTabContentsEvent event) - { - if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) + private void addCreative(BuildCreativeModeTabContentsEvent event) { + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) { event.accept(EXAMPLE_BLOCK_ITEM); + } } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) - { + public void onServerStarting(ServerStartingEvent event) { // Do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) - public static class ClientModEvents - { + public static class ClientModEvents { @SubscribeEvent - public static void onClientSetup(FMLClientSetupEvent event) - { + public static void onClientSetup(FMLClientSetupEvent event) { // Some client setup code LOGGER.info("HELLO FROM CLIENT SETUP"); LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName());