Skip to content

Commit 739e9c2

Browse files
committed
Move to NeoForge Platform
1 parent 65d77c3 commit 739e9c2

File tree

7 files changed

+205
-161
lines changed

7 files changed

+205
-161
lines changed

build.gradle

Lines changed: 111 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,82 +11,146 @@ buildscript {
1111
}
1212

1313
plugins {
14-
id 'java'
15-
id 'net.minecraftforge.gradle' version '6.0.+'
16-
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
14+
id 'java-library'
15+
id 'net.neoforged.moddev' version '2.0.78'
16+
id 'idea'
1717
}
1818

19-
apply plugin: 'idea'
19+
tasks.named('wrapper', Wrapper).configure {
20+
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
21+
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
22+
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
23+
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
24+
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
25+
distributionType = Wrapper.DistributionType.BIN
26+
}
27+
28+
base {
29+
archivesName = mod_id
30+
}
31+
32+
group = mod_group_id
33+
version = "${mod_version}-${minecraft_version}"
2034

21-
group = 'com.zengyj.exposer'
22-
version = "${mod_version}-${mc_version}"
2335

24-
minecraft {
25-
// the mappings can be changed at any time, and must be in the following format.
26-
// snapshot_YYYYMMDD snapshot are built nightly.
27-
// stable_# stables are built at the discretion of the MCP team.
28-
// Use non-default mappings at your own risk. they may not always work.
29-
// simply re-run your setup task after changing the mappings to update your workspace.
30-
mappings channel: "${mapping_channel}", version: "${mc_version}"
31-
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
36+
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
37+
38+
repositories {
39+
gradlePluginPortal()
40+
maven { url 'https://cursemaven.com/' }
41+
}
42+
43+
neoForge {
44+
// Specify the version of NeoForge to use.
45+
version = project.neo_version
3246

47+
parchment {
48+
mappingsVersion = project.parchment_mappings_version
49+
minecraftVersion = project.parchment_minecraft_version
50+
}
3351

34-
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
52+
// This line is optional. Access Transformers are automatically detected
53+
// accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
3554

3655
// Default run configurations.
3756
// These can be tweaked, removed, or duplicated as needed.
3857
runs {
3958
client {
40-
workingDirectory project.file('run')
59+
client()
4160

42-
// Recommended logging data for a userdev environment
43-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
61+
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
62+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
63+
}
4464

45-
// Recommended logging level for the console
46-
property 'forge.logging.console.level', 'debug'
65+
server {
66+
server()
67+
programArgument '--nogui'
68+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
69+
}
4770

48-
//JvmArgs += "-Dfml.coreMods.load=com.github.vfyjxf.nee.asm.NEELoadingPlugin"
71+
// This run config launches GameTestServer and runs all registered gametests, then exits.
72+
// By default, the server will crash when no gametests are provided.
73+
// The gametest system is also enabled by default for other run configs under the /test command.
74+
gameTestServer {
75+
type = "gameTestServer"
76+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
4977
}
5078

51-
server {
52-
workingDirectory project.file('run')
79+
data {
80+
data()
81+
82+
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
83+
// gameDirectory = project.file('run-data')
84+
85+
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
86+
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
87+
}
5388

89+
// applies to all the run configs above
90+
configureEach {
5491
// Recommended logging data for a userdev environment
55-
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
92+
// The markers can be added/remove as needed separated by commas.
93+
// "SCAN": For mods scan.
94+
// "REGISTRIES": For firing of registry events.
95+
// "REGISTRYDUMP": For getting the contents of all registries.
96+
systemProperty 'forge.logging.markers', 'REGISTRIES'
5697

5798
// Recommended logging level for the console
58-
property 'forge.logging.console.level', 'debug'
99+
// You can set various levels here.
100+
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
101+
logLevel = org.slf4j.event.Level.DEBUG
102+
}
103+
}
59104

60-
//JvmArgs += "-Dfml.coreMods.load=com.github.vfyjxf.nee.asm.NEELoadingPlugin"
105+
mods {
106+
// define mod <-> source bindings
107+
// these are used to tell the game which sources are for which mod
108+
// mostly optional in a single mod project
109+
// but multi mod projects should define one per mod
110+
"${mod_id}" {
111+
sourceSet(sourceSets.main)
61112
}
62113
}
63114
}
64115

65-
repositories {
66-
gradlePluginPortal()
67-
maven { url 'https://cursemaven.com/' }
116+
// Include resources generated by data generators.
117+
sourceSets.main.resources { srcDir 'src/generated/resources' }
118+
119+
// Sets up a dependency configuration called 'localRuntime'.
120+
// This configuration should be used instead of 'runtimeOnly' to declare
121+
// a dependency that will be present for runtime testing but that is
122+
// "optional", meaning it will not be pulled by dependents of this mod.
123+
configurations {
124+
runtimeClasspath.extendsFrom localRuntime
68125
}
69126

70127
dependencies {
71-
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
72-
implementation fg.deobf("curse.maven:refined-storage-243076:4844585")
128+
implementation "net.neoforged:neoforge:${neo_version}"
129+
implementation "curse.maven:refined-storage-243076:6391989"
73130

74131
}
75132

76-
processResources {
77-
duplicatesStrategy = DuplicatesStrategy.INCLUDE
78-
79-
inputs.property "version", "${mod_version}"
80-
inputs.property "mcversion", "${mc_version}"
81-
82-
from(sourceSets.main.resources.srcDirs) {
83-
include 'META-INF/mods.toml'
84-
filesMatching(['META-INF/mods.toml']){
85-
expand 'version': "${mod_version}"
86-
}
87-
}
133+
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
134+
var replaceProperties = [
135+
minecraft_version : minecraft_version,
136+
minecraft_version_range: minecraft_version_range,
137+
neo_version : neo_version,
138+
neo_version_range : neo_version_range,
139+
loader_version_range : loader_version_range,
140+
mod_id : mod_id,
141+
mod_name : mod_name,
142+
mod_license : mod_license,
143+
mod_version : mod_version,
144+
mod_authors : mod_authors,
145+
mod_description : mod_description
146+
]
147+
inputs.properties replaceProperties
148+
expand replaceProperties
149+
from "src/main/templates"
150+
into "build/generated/sources/modMetadata"
88151
}
89-
90-
test {
91-
92-
}
152+
// Include the output of "generateModMetadata" as an input directory for the build
153+
// this works with both building through Gradle and the IDE.
154+
sourceSets.main.resources.srcDir generateModMetadata
155+
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
156+
neoForge.ideSyncTask generateModMetadata

gradle.properties

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,45 @@
1-
mc_version=1.20.1
1+
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
2+
org.gradle.jvmargs=-Xmx1G
3+
org.gradle.daemon=true
4+
org.gradle.parallel=true
5+
org.gradle.caching=true
6+
org.gradle.configuration-cache=true
7+
8+
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
9+
# 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.17
12+
# Environment Properties
13+
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
14+
# The Minecraft version must agree with the Neo version to get a valid artifact
15+
minecraft_version=1.21.1
16+
# The Minecraft version range can use any release version of Minecraft as bounds.
17+
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
18+
# as they do not follow standard versioning conventions.
19+
minecraft_version_range=[1.21.1, 1.22)
20+
# The Neo version must agree with the Minecraft version to get a valid artifact
21+
neo_version=21.1.156
22+
# The Neo version range can use any version of Neo as bounds
23+
neo_version_range=[21.4.0-beta,)
24+
# The loader version range can only use the major version of FML as bounds
25+
loader_version_range=[4,)
26+
27+
## Mod Properties
28+
29+
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
30+
# Must match the String constant located in the main mod class annotated with @Mod.
31+
mod_id=exposer
32+
# The human-readable display name for the mod.
33+
mod_name=Re-Exposer
34+
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
35+
mod_license=All Rights Reserved
36+
# The mod version. See https://semver.org/
237
mod_version=2.3.4
3-
mapping_channel=official
4-
forge_version=47.3.1
38+
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
39+
# This should match the base package used for the mod sources.
40+
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
41+
mod_group_id=com.zengyj.exposer
42+
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
43+
mod_authors=Zengyj
44+
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
45+
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Dec 28 14:53:10 CST 2023
1+
#Sun Apr 20 21:37:34 CST 2025
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

settings.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
pluginManagement {
22
repositories {
3+
mavenLocal()
34
gradlePluginPortal()
45
maven {
5-
name = 'MinecraftForge'
6-
url = 'https://maven.minecraftforge.net/'
6+
name = 'MinecraftNeoForge'
7+
url = 'https://maven.neoforged.net/releases'
78
}
8-
maven { url = 'https://maven.parchmentmc.org' }
99
}
1010
}
1111

12+
plugins {
13+
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
14+
}
15+
Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,15 @@
11
package com.zengyj.exposer.block;
22

3-
import com.refinedmods.refinedstorage.apiimpl.API;
4-
import com.refinedmods.refinedstorage.block.BlockDirection;
5-
import com.refinedmods.refinedstorage.block.NetworkNodeBlock;
6-
import com.refinedmods.refinedstorage.util.BlockUtils;
7-
import com.zengyj.exposer.tile.TileExposer;
8-
import net.minecraft.core.BlockPos;
9-
import net.minecraft.world.level.block.entity.BlockEntity;
10-
import net.minecraft.world.level.block.state.BlockState;
3+
import com.refinedmods.refinedstorage.common.content.BlockConstants;
4+
import com.refinedmods.refinedstorage.common.support.AbstractBaseBlock;
115

12-
import javax.annotation.Nullable;
136

14-
public class BlockExposer extends NetworkNodeBlock {
7+
8+
public class BlockExposer extends AbstractBaseBlock {
159

1610
public BlockExposer() {
17-
super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
11+
super(BlockConstants.PROPERTIES);
1812
}
1913

20-
public BlockDirection getDirection() {
21-
return BlockDirection.HORIZONTAL;
22-
}
2314

24-
@Nullable
25-
@Override
26-
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
27-
return new TileExposer(blockPos, blockState);
28-
}
29-
30-
@Override
31-
public boolean hasConnectedState() {
32-
return true;
33-
}
3415
}

0 commit comments

Comments
 (0)