Skip to content

Commit 8b4e8bd

Browse files
Update to Neoforge
1 parent 3c143e5 commit 8b4e8bd

File tree

9 files changed

+77
-70
lines changed

9 files changed

+77
-70
lines changed

build.gradle

+28-45
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,44 @@
1-
buildscript {
2-
repositories {
3-
maven { url = 'https://maven.minecraftforge.net' }
4-
jcenter()
5-
mavenCentral()
6-
}
7-
dependencies {
8-
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
9-
}
1+
plugins {
2+
id 'java-library'
3+
id 'eclipse'
4+
id 'idea'
5+
id 'maven-publish'
6+
id 'net.neoforged.gradle.userdev' version '7.0.45'
107
}
11-
apply plugin: 'net.minecraftforge.gradle'
12-
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
13-
apply plugin: 'eclipse'
14-
apply plugin: 'maven-publish'
158

169
version = "${mod_version}"
17-
group = 'com.telepathicgrunt.structuretutorial' // https://maven.apache.org/guides/mini/guide-naming-conventions.html
10+
group = 'com.telepathicgrunt.structuretutorial'
1811
archivesBaseName = 'structure_tutorial'
1912

20-
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
21-
22-
minecraft {
23-
mappings channel: "official", version: "${mc_version}"
24-
//accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
25-
26-
runs {
27-
client {
28-
workingDirectory project.file('run')
29-
// Recommended logging data for a userdev environment
30-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
13+
repositories {
14+
mavenLocal()
15+
}
3116

32-
// Needed to make other mods with mixins be able to run in you development environment
33-
property 'mixin.env.remapRefMap', 'true'
34-
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
17+
base {
18+
archivesName = 'structure_tutorial'
19+
}
3520

36-
mods { examplemod { source sourceSets.main } }
37-
}
21+
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
3822

39-
server {
40-
workingDirectory project.file('run')
41-
// Recommended logging data for a userdev environment
42-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
23+
runs {
24+
configureEach {
25+
modSource project.sourceSets.main
26+
}
4327

44-
// Needed to make other mods with mixins be able to run in you development environment
45-
property 'mixin.env.remapRefMap', 'true'
46-
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
28+
client {
29+
}
4730

48-
mods { examplemod { source sourceSets.main } }
49-
}
31+
server {
32+
programArgument '--nogui'
5033
}
5134
}
5235

5336
dependencies {
54-
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
55-
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
56-
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
57-
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
37+
implementation "net.neoforged:neoforge:${neo_version}"
38+
}
39+
40+
tasks.withType(JavaCompile).configureEach {
41+
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
5842
}
5943

6044
// Example for how to get properties into the manifest for reading by the runtime..
@@ -70,8 +54,7 @@ jar {
7054
"Specification-Version": "1",
7155
"Implementation-Title": project.name,
7256
"Implementation-Version": project.version,
73-
"Implementation-Vendor" :"telepathicgrunt",
74-
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
57+
"Implementation-Vendor": "telepathicgrunt"
7558
])
7659
}
7760
}

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
org.gradle.jvmargs=-Xmx3G
44
org.gradle.daemon=false
55
mod_version=3.0.0
6-
mc_version=1.19.3
7-
forge_version=44.0.23
6+
mc_version=1.20.2
7+
neo_version=20.2.59-beta

gradle/wrapper/gradle-wrapper.jar

1.99 KB
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

gradlew

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015-2021 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -32,10 +32,10 @@
3232
# Busybox and similar reduced shells will NOT work, because this script
3333
# requires all of these POSIX shell features:
3434
# * functions;
35-
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36-
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37-
# * compound commands having a testable exit status, especially «case»;
38-
# * various built-in commands including «command», «set», and «ulimit».
35+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37+
# * compound commands having a testable exit status, especially «case»;
38+
# * various built-in commands including «command», «set», and «ulimit».
3939
#
4040
# Important for patching:
4141
#
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
86+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
8787

8888
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
8989
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
143143
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144144
case $MAX_FD in #(
145145
max*)
146+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147+
# shellcheck disable=SC3045
146148
MAX_FD=$( ulimit -H -n ) ||
147149
warn "Could not query maximum file descriptor limit"
148150
esac
149151
case $MAX_FD in #(
150152
'' | soft) :;; #(
151153
*)
154+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155+
# shellcheck disable=SC3045
152156
ulimit -n "$MAX_FD" ||
153157
warn "Could not set maximum file descriptor limit to $MAX_FD"
154158
esac
@@ -205,6 +209,12 @@ set -- \
205209
org.gradle.wrapper.GradleWrapperMain \
206210
"$@"
207211

212+
# Stop when "xargs" is not available.
213+
if ! command -v xargs >/dev/null 2>&1
214+
then
215+
die "xargs is not available"
216+
fi
217+
208218
# Use "xargs" to parse quoted args.
209219
#
210220
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

gradlew.bat

+9-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4041

4142
set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
44+
if %ERRORLEVEL% equ 0 goto execute
4445

4546
echo.
4647
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7576

7677
:end
7778
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
79+
if %ERRORLEVEL% equ 0 goto mainEnd
7980

8081
:fail
8182
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8283
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
84+
set EXIT_CODE=%ERRORLEVEL%
85+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
86+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87+
exit /b %EXIT_CODE%
8588

8689
:mainEnd
8790
if "%OS%"=="Windows_NT" endlocal

settings.gradle

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pluginManagement {
2+
repositories {
3+
mavenLocal()
4+
gradlePluginPortal()
5+
maven { url = 'https://maven.neoforged.net/releases' }
6+
}
7+
}
8+
9+
plugins {
10+
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
11+
}

src/main/java/com/telepathicgrunt/structuretutorial/STStructures.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
import com.mojang.serialization.Codec;
44
import com.telepathicgrunt.structuretutorial.structures.SkyStructures;
5-
import net.minecraft.core.Registry;
65
import net.minecraft.core.registries.Registries;
76
import net.minecraft.world.level.levelgen.structure.Structure;
87
import net.minecraft.world.level.levelgen.structure.StructureType;
9-
import net.minecraftforge.registries.DeferredRegister;
10-
import net.minecraftforge.registries.RegistryObject;
8+
import net.neoforged.neoforge.registries.DeferredHolder;
9+
import net.neoforged.neoforge.registries.DeferredRegister;
1110

1211
public class STStructures {
1312

@@ -21,7 +20,7 @@ public class STStructures {
2120
* Registers the base structure itself and sets what its path is. In this case,
2221
* this base structure will have the resourcelocation of structure_tutorial:sky_structures.
2322
*/
24-
public static final RegistryObject<StructureType<SkyStructures>> SKY_STRUCTURES = DEFERRED_REGISTRY_STRUCTURE.register("sky_structures", () -> explicitStructureTypeTyping(SkyStructures.CODEC));
23+
public static final DeferredHolder<StructureType<?>, StructureType<SkyStructures>> SKY_STRUCTURES = DEFERRED_REGISTRY_STRUCTURE.register("sky_structures", () -> explicitStructureTypeTyping(SkyStructures.CODEC));
2524

2625
/**
2726
* Originally, I had a double lambda ()->()-> for the RegistryObject line above, but it turns out that

src/main/java/com/telepathicgrunt/structuretutorial/StructureTutorialMain.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.telepathicgrunt.structuretutorial;
22

3-
import net.minecraftforge.eventbus.api.IEventBus;
4-
import net.minecraftforge.fml.common.Mod;
5-
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
3+
import net.neoforged.bus.api.IEventBus;
4+
import net.neoforged.fml.common.Mod;
5+
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
66
import org.apache.logging.log4j.LogManager;
77
import org.apache.logging.log4j.Logger;
88

0 commit comments

Comments
 (0)