Skip to content

Commit 2d4a64c

Browse files
Update MDK with new output from mod generator (#1)
* 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>
1 parent 9782d26 commit 2d4a64c

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(new ResourceLocation(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
@@ -35,8 +35,7 @@
3535

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

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

@@ -92,41 +90,38 @@ public ExampleMod(IEventBus modEventBus)
9290
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC);
9391
}
9492

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

100-
if (Config.LOG_DIRT_BLOCK.getAsBoolean())
97+
if (Config.LOG_DIRT_BLOCK.getAsBoolean()) {
10198
LOGGER.info("DIRT BLOCK >> {}", BuiltInRegistries.BLOCK.getKey(Blocks.DIRT));
99+
}
102100

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

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

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

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

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

0 commit comments

Comments
 (0)