Skip to content

Commit d53a0b7

Browse files
Update MDK with new output from mod generator (#3)
* 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>
1 parent d899141 commit d53a0b7

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'java-library'
33
id 'maven-publish'
4-
id 'net.neoforged.moddev' version '2.0.92'
4+
id 'net.neoforged.moddev' version '2.0.94'
55
id 'idea'
66
}
77

src/main/java/com/example/examplemod/Config.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
1616
// Demonstrates how to use Neo's config APIs
17-
public class Config
18-
{
17+
public class Config {
1918
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
2019

2120
public static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER
@@ -37,8 +36,7 @@ public class Config
3736

3837
static final ModConfigSpec SPEC = BUILDER.build();
3938

40-
private static boolean validateItemName(final Object obj)
41-
{
39+
private static boolean validateItemName(final Object obj) {
4240
return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(ResourceLocation.parse(itemName));
4341
}
4442
}

src/main/java/com/example/examplemod/ExampleMod.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636

3737
// The value here should match an entry in the META-INF/neoforge.mods.toml file
3838
@Mod(ExampleMod.MODID)
39-
public class ExampleMod
40-
{
39+
public class ExampleMod {
4140
// Define mod id in a common place for everything to reference
4241
public static final String MODID = "examplemod";
4342
// Directly reference a slf4j logger
@@ -69,8 +68,7 @@ public class ExampleMod
6968

7069
// The constructor for the mod class is the first code that is run when your mod is loaded.
7170
// FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically.
72-
public ExampleMod(IEventBus modEventBus, ModContainer modContainer)
73-
{
71+
public ExampleMod(IEventBus modEventBus, ModContainer modContainer) {
7472
// Register the commonSetup method for modloading
7573
modEventBus.addListener(this::commonSetup);
7674

@@ -93,41 +91,38 @@ public ExampleMod(IEventBus modEventBus, ModContainer modContainer)
9391
modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
9492
}
9593

96-
private void commonSetup(final FMLCommonSetupEvent event)
97-
{
94+
private void commonSetup(FMLCommonSetupEvent event) {
9895
// Some common setup code
9996
LOGGER.info("HELLO FROM COMMON SETUP");
10097

101-
if (Config.LOG_DIRT_BLOCK.getAsBoolean())
98+
if (Config.LOG_DIRT_BLOCK.getAsBoolean()) {
10299
LOGGER.info("DIRT BLOCK >> {}", BuiltInRegistries.BLOCK.getKey(Blocks.DIRT));
100+
}
103101

104102
LOGGER.info("{}{}", Config.MAGIC_NUMBER_INTRODUCTION.get(), Config.MAGIC_NUMBER.getAsInt());
105103

106104
Config.ITEM_STRINGS.get().forEach((item) -> LOGGER.info("ITEM >> {}", item));
107105
}
108106

109107
// Add the example block item to the building blocks tab
110-
private void addCreative(BuildCreativeModeTabContentsEvent event)
111-
{
112-
if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS)
108+
private void addCreative(BuildCreativeModeTabContentsEvent event) {
109+
if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) {
113110
event.accept(EXAMPLE_BLOCK_ITEM);
111+
}
114112
}
115113

116114
// You can use SubscribeEvent and let the Event Bus discover methods to call
117115
@SubscribeEvent
118-
public void onServerStarting(ServerStartingEvent event)
119-
{
116+
public void onServerStarting(ServerStartingEvent event) {
120117
// Do something when the server starts
121118
LOGGER.info("HELLO from server starting");
122119
}
123120

124121
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
125122
@EventBusSubscriber(modid = MODID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
126-
public static class ClientModEvents
127-
{
123+
public static class ClientModEvents {
128124
@SubscribeEvent
129-
public static void onClientSetup(FMLClientSetupEvent event)
130-
{
125+
public static void onClientSetup(FMLClientSetupEvent event) {
131126
// Some client setup code
132127
LOGGER.info("HELLO FROM CLIENT SETUP");
133128
LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName());

0 commit comments

Comments
 (0)