Skip to content

Commit f3473ba

Browse files
Update MDK with new output from mod generator
1 parent 691c9fb commit f3473ba

File tree

11 files changed

+124
-142
lines changed

11 files changed

+124
-142
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ jobs:
1212
fetch-depth: 0
1313
fetch-tags: true
1414

15-
- name: Setup JDK 17
15+
- name: Setup JDK 21
1616
uses: actions/setup-java@v4
1717
with:
18-
java-version: '17'
18+
java-version: '21'
1919
distribution: 'temurin'
2020

21+
- name: Setup Gradle
22+
uses: gradle/actions/setup-gradle@v4
23+
2124
- name: Build with Gradle
22-
uses: gradle/actions/setup-gradle@v3
23-
with:
24-
arguments: build
25+
run: ./gradlew build

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
plugins {
22
id 'java-library'
33
id 'maven-publish'
4-
id 'net.neoforged.moddev' version '1.0.21'
4+
id 'net.neoforged.moddev' version '2.0.92'
5+
id 'idea'
56
}
67

78
tasks.named('wrapper', Wrapper).configure {
@@ -92,8 +93,7 @@ neoForge {
9293
mods {
9394
// define mod <-> source bindings
9495
// these are used to tell the game which sources are for which mod
95-
// mostly optional in a single mod project
96-
// but multi mod projects should define one per mod
96+
// multi mod projects should define one per mod
9797
"${mod_id}" {
9898
sourceSet(sourceSets.main)
9999
}

gradle.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ org.gradle.configuration-cache=true
77

88
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
99
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
10-
parchment_minecraft_version=1.21.1
11-
parchment_mappings_version=2024.11.13
10+
parchment_minecraft_version=1.21
11+
parchment_mappings_version=2024.11.10
1212
# Environment Properties
1313
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
1414
# The Minecraft version must agree with the Neo version to get a valid artifact
15-
minecraft_version=1.21.1
15+
minecraft_version=1.21
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.1, 1.22)
19+
minecraft_version_range=[1.21]
2020
# The Neo version must agree with the Minecraft version to get a valid artifact
21-
neo_version=21.1.77
21+
neo_version=21.0.167
2222
# The Neo version range can use any version of Neo as bounds
23-
neo_version_range=[21.1.0,)
23+
neo_version_range=[21.0.167,)
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

260 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

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 '0.8.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.get(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

0 commit comments

Comments
 (0)