Skip to content

Commit bc461e6

Browse files
Update MDK with new output from mod generator
1 parent bc320de commit bc461e6

File tree

11 files changed

+139
-132
lines changed

11 files changed

+139
-132
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
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.91'
4+
id 'net.neoforged.moddev' version '2.0.92'
55
id 'idea'
66
}
77

@@ -64,7 +64,7 @@ neoForge {
6464
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
6565
}
6666

67-
clientData {
67+
data {
6868
clientData()
6969

7070
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ minecraft_version=1.21.4
1616
# The Minecraft version range can use any release version of Minecraft as bounds.
1717
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
1818
# as they do not follow standard versioning conventions.
19-
minecraft_version_range=[1.21.4, 1.22)
19+
minecraft_version_range=[1.21.4]
2020
# The Neo version must agree with the Minecraft version to get a valid artifact
2121
neo_version=21.4.138
2222
# The Neo version range can use any version of Neo as bounds
23-
neo_version_range=[21.4.0-beta,)
23+
neo_version_range=[21.4.138,)
2424
# The loader version range can only use the major version of FML as bounds
25-
loader_version_range=[4,)
25+
loader_version_range=[1,)
2626

2727
## Mod Properties
2828

gradle/wrapper/gradle-wrapper.jar

181 Bytes
Binary file not shown.

gradlew

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90-
' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9190

9291
# Use the maximum available, or set MAX_FD != -1 to use that value.
9392
MAX_FD=maximum
@@ -115,7 +114,7 @@ case "$( uname )" in #(
115114
NONSTOP* ) nonstop=true ;;
116115
esac
117116

118-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
119118

120119

121120
# Determine the Java command to use to start the JVM.
@@ -206,15 +205,15 @@ fi
206205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207206

208207
# Collect all arguments for the java command:
209-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210209
# and any embedded shellness will be escaped.
211210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212211
# treated as '${Hostname}' itself on the command line.
213212

214213
set -- \
215214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
216215
-classpath "$CLASSPATH" \
217-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
218217
"$@"
219218

220219
# Stop when "xargs" is not available.

gradlew.bat

Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,94 @@
1-
@rem
2-
@rem Copyright 2015 the original author or authors.
3-
@rem
4-
@rem Licensed under the Apache License, Version 2.0 (the "License");
5-
@rem you may not use this file except in compliance with the License.
6-
@rem You may obtain a copy of the License at
7-
@rem
8-
@rem https://www.apache.org/licenses/LICENSE-2.0
9-
@rem
10-
@rem Unless required by applicable law or agreed to in writing, software
11-
@rem distributed under the License is distributed on an "AS IS" BASIS,
12-
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
@rem See the License for the specific language governing permissions and
14-
@rem limitations under the License.
15-
@rem
16-
@rem SPDX-License-Identifier: Apache-2.0
17-
@rem
18-
19-
@if "%DEBUG%"=="" @echo off
20-
@rem ##########################################################################
21-
@rem
22-
@rem Gradle startup script for Windows
23-
@rem
24-
@rem ##########################################################################
25-
26-
@rem Set local scope for the variables with windows NT shell
27-
if "%OS%"=="Windows_NT" setlocal
28-
29-
set DIRNAME=%~dp0
30-
if "%DIRNAME%"=="" set DIRNAME=.
31-
@rem This is normally unused
32-
set APP_BASE_NAME=%~n0
33-
set APP_HOME=%DIRNAME%
34-
35-
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
36-
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37-
38-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39-
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40-
41-
@rem Find java.exe
42-
if defined JAVA_HOME goto findJavaFromJavaHome
43-
44-
set JAVA_EXE=java.exe
45-
%JAVA_EXE% -version >NUL 2>&1
46-
if %ERRORLEVEL% equ 0 goto execute
47-
48-
echo. 1>&2
49-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50-
echo. 1>&2
51-
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52-
echo location of your Java installation. 1>&2
53-
54-
goto fail
55-
56-
:findJavaFromJavaHome
57-
set JAVA_HOME=%JAVA_HOME:"=%
58-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59-
60-
if exist "%JAVA_EXE%" goto execute
61-
62-
echo. 1>&2
63-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64-
echo. 1>&2
65-
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66-
echo location of your Java installation. 1>&2
67-
68-
goto fail
69-
70-
:execute
71-
@rem Setup the command line
72-
73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74-
75-
76-
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78-
79-
:end
80-
@rem End local scope for the variables with windows NT shell
81-
if %ERRORLEVEL% equ 0 goto mainEnd
82-
83-
:fail
84-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85-
rem the _cmd.exe /c_ return code!
86-
set EXIT_CODE=%ERRORLEVEL%
87-
if %EXIT_CODE% equ 0 set EXIT_CODE=1
88-
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89-
exit /b %EXIT_CODE%
90-
91-
:mainEnd
92-
if "%OS%"=="Windows_NT" endlocal
93-
94-
:omega
1+
@rem
2+
@rem Copyright 2015 the original author or authors.
3+
@rem
4+
@rem Licensed under the Apache License, Version 2.0 (the "License");
5+
@rem you may not use this file except in compliance with the License.
6+
@rem You may obtain a copy of the License at
7+
@rem
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
9+
@rem
10+
@rem Unless required by applicable law or agreed to in writing, software
11+
@rem distributed under the License is distributed on an "AS IS" BASIS,
12+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
@rem See the License for the specific language governing permissions and
14+
@rem limitations under the License.
15+
@rem
16+
@rem SPDX-License-Identifier: Apache-2.0
17+
@rem
18+
19+
@if "%DEBUG%"=="" @echo off
20+
@rem ##########################################################################
21+
@rem
22+
@rem Gradle startup script for Windows
23+
@rem
24+
@rem ##########################################################################
25+
26+
@rem Set local scope for the variables with windows NT shell
27+
if "%OS%"=="Windows_NT" setlocal
28+
29+
set DIRNAME=%~dp0
30+
if "%DIRNAME%"=="" set DIRNAME=.
31+
@rem This is normally unused
32+
set APP_BASE_NAME=%~n0
33+
set APP_HOME=%DIRNAME%
34+
35+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
36+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37+
38+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40+
41+
@rem Find java.exe
42+
if defined JAVA_HOME goto findJavaFromJavaHome
43+
44+
set JAVA_EXE=java.exe
45+
%JAVA_EXE% -version >NUL 2>&1
46+
if %ERRORLEVEL% equ 0 goto execute
47+
48+
echo. 1>&2
49+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50+
echo. 1>&2
51+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52+
echo location of your Java installation. 1>&2
53+
54+
goto fail
55+
56+
:findJavaFromJavaHome
57+
set JAVA_HOME=%JAVA_HOME:"=%
58+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59+
60+
if exist "%JAVA_EXE%" goto execute
61+
62+
echo. 1>&2
63+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64+
echo. 1>&2
65+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66+
echo location of your Java installation. 1>&2
67+
68+
goto fail
69+
70+
:execute
71+
@rem Setup the command line
72+
73+
set CLASSPATH=
74+
75+
76+
@rem Execute Gradle
77+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
78+
79+
:end
80+
@rem End local scope for the variables with windows NT shell
81+
if %ERRORLEVEL% equ 0 goto mainEnd
82+
83+
:fail
84+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85+
rem the _cmd.exe /c_ return code!
86+
set EXIT_CODE=%ERRORLEVEL%
87+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
88+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89+
exit /b %EXIT_CODE%
90+
91+
:mainEnd
92+
if "%OS%"=="Windows_NT" endlocal
93+
94+
:omega

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ pluginManagement {
77
}
88

99
plugins {
10-
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
10+
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
1111
}

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

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
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-
@EventBusSubscriber(modid = ExampleMod.MODID, bus = EventBusSubscriber.Bus.MOD)
1817
public class Config
1918
{
2019
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
2120

22-
private static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER
21+
public static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER
2322
.comment("Whether to log the dirt block on common setup")
2423
.define("logDirtBlock", true);
2524

26-
private static final ModConfigSpec.IntValue MAGIC_NUMBER = BUILDER
25+
public static final ModConfigSpec.IntValue MAGIC_NUMBER = BUILDER
2726
.comment("A magic number")
2827
.defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE);
2928

@@ -32,32 +31,14 @@ public class Config
3231
.define("magicNumberIntroduction", "The magic number is... ");
3332

3433
// a list of strings that are treated as resource locations for items
35-
private static final ModConfigSpec.ConfigValue<List<? extends String>> ITEM_STRINGS = BUILDER
34+
public static final ModConfigSpec.ConfigValue<List<? extends String>> ITEM_STRINGS = BUILDER
3635
.comment("A list of items to log on common setup.")
37-
.defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName);
36+
.defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), () -> "", Config::validateItemName);
3837

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

41-
public static boolean logDirtBlock;
42-
public static int magicNumber;
43-
public static String magicNumberIntroduction;
44-
public static Set<Item> items;
45-
4640
private static boolean validateItemName(final Object obj)
4741
{
4842
return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(ResourceLocation.parse(itemName));
4943
}
50-
51-
@SubscribeEvent
52-
static void onLoad(final ModConfigEvent event)
53-
{
54-
logDirtBlock = LOG_DIRT_BLOCK.get();
55-
magicNumber = MAGIC_NUMBER.get();
56-
magicNumberIntroduction = MAGIC_NUMBER_INTRODUCTION.get();
57-
58-
// convert the list of strings into a set of items
59-
items = ITEM_STRINGS.get().stream()
60-
.map(itemName -> BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(itemName)))
61-
.collect(Collectors.toSet());
62-
}
6344
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ private void commonSetup(final FMLCommonSetupEvent event)
9898
// Some common setup code
9999
LOGGER.info("HELLO FROM COMMON SETUP");
100100

101-
if (Config.logDirtBlock)
101+
if (Config.LOG_DIRT_BLOCK.getAsBoolean())
102102
LOGGER.info("DIRT BLOCK >> {}", BuiltInRegistries.BLOCK.getKey(Blocks.DIRT));
103103

104-
LOGGER.info(Config.magicNumberIntroduction + Config.magicNumber);
104+
LOGGER.info("{}{}", Config.MAGIC_NUMBER_INTRODUCTION.get(), Config.MAGIC_NUMBER.getAsInt());
105105

106-
Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString()));
106+
Config.ITEM_STRINGS.get().forEach((item) -> LOGGER.info("ITEM >> {}", item));
107107
}
108108

109109
// Add the example block item to the building blocks tab
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.example.examplemod;
2+
3+
import net.neoforged.api.distmarker.Dist;
4+
import net.neoforged.fml.ModContainer;
5+
import net.neoforged.fml.common.Mod;
6+
import net.neoforged.neoforge.client.gui.ConfigurationScreen;
7+
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
8+
9+
// This class will not load on dedicated servers. Accessing client side code from here is safe.
10+
@Mod(value = ExampleMod.MODID, dist = Dist.CLIENT)
11+
public class ExampleModClient {
12+
public ExampleModClient(ModContainer container) {
13+
// Allows NeoForge to create a config screen for this mod's configs.
14+
// The config screen is accessed by going to the Mods screen > clicking on your mod > clicking on config.
15+
// Do not forget to add translations for your config options to the en_us.json file.
16+
container.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);
17+
}
18+
}
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"itemGroup.examplemod": "Example Mod Tab",
33
"block.examplemod.example_block": "Example Block",
4-
"item.examplemod.example_item": "Example Item"
4+
"item.examplemod.example_item": "Example Item",
5+
6+
"examplemod.configuration.title": "Example Mod Configs",
7+
"examplemod.configuration.section.examplemod.common.toml": "Example Mod Configs",
8+
"examplemod.configuration.section.examplemod.common.toml.title": "Example Mod Configs",
9+
"examplemod.configuration.items": "Item List",
10+
"examplemod.configuration.logDirtBlock": "Log Dirt Block",
11+
"examplemod.configuration.magicNumberIntroduction": "Magic Number Text",
12+
"examplemod.configuration.magicNumber": "Magic Number"
513
}

0 commit comments

Comments
 (0)