Skip to content

Commit

Permalink
feat(code style): use libs.versions.toml and migrate to gay.sylv name…
Browse files Browse the repository at this point in the history
…space
  • Loading branch information
sylv256 committed Oct 4, 2024
1 parent dc3d236 commit f9d1afd
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 36 deletions.
27 changes: 14 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'net.neoforged.moddev' version '1.0.20'
alias(libs.plugins.moddevgradle)
}

tasks.named('wrapper', Wrapper).configure {
Expand All @@ -15,6 +15,7 @@ tasks.named('wrapper', Wrapper).configure {

version = mod_version
group = mod_group_id
var modId = project.mod_id

repositories {
mavenLocal()
Expand All @@ -29,11 +30,11 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(21)

neoForge {
// Specify the version of NeoForge to use.
version = project.neo_version
version = libs.versions.neoforge.asProvider().get()

parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.parchment_minecraft_version
mappingsVersion = libs.versions.parchment.get()
minecraftVersion = libs.versions.minecraft.asProvider().get()
}

// This line is optional. Access Transformers are automatically detected
Expand All @@ -46,21 +47,21 @@ neoForge {
client()

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
systemProperty 'neoforge.enabledGameTestNamespaces', modId
}

server {
server()
programArgument '--nogui'
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
systemProperty 'neoforge.enabledGameTestNamespaces', modId
}

// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
type = "gameTestServer"
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
systemProperty 'neoforge.enabledGameTestNamespaces', modId
}

data {
Expand All @@ -70,7 +71,7 @@ neoForge {
// gameDirectory = project.file('run-data')

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
programArguments.addAll '--mod', modId, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}

// applies to all the run configs above
Expand Down Expand Up @@ -139,11 +140,11 @@ dependencies {
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
neo_version : neo_version,
neo_version_range : neo_version_range,
loader_version_range : loader_version_range,
minecraft_version : libs.versions.minecraft.asProvider().get(),
minecraft_version_range: libs.versions.minecraft.range.get(),
neo_version : libs.versions.neoforge.asProvider().get(),
neo_version_range : libs.versions.neoforge.range.get(),
loader_version_range : libs.versions.loader.range.get(),
mod_id : mod_id,
mod_name : mod_name,
mod_license : mod_license,
Expand Down
25 changes: 4 additions & 21 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,7 @@ org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true

#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
parchment_minecraft_version=1.21
parchment_mappings_version=2024.07.28
# Environment Properties
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft_version=1.21.1
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.21.1, 1.22)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=21.1.64
# The Neo version range can use any version of Neo as bounds
neo_version_range=[21.1.0,)
# The loader version range can only use the major version of FML as bounds
loader_version_range=[4,)

## Mod Properties

Expand All @@ -32,14 +15,14 @@ mod_id=examplemod
# The human-readable display name for the mod.
mod_name=Example Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
mod_license=EUPLv1.2
# The mod version. See https://semver.org/
mod_version=1.0.0
mod_version=0.1.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=com.example.examplemod
mod_group_id=gay.sylv.examplemod
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=YourNameHere, OtherNameHere
mod_authors=Vulpixel, Sylv
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
26 changes: 26 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[versions]
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
moddevgradle = "1.0.20"
# The Neo version must agree with the Minecraft version to get a valid artifact
neoforge = "21.0.167"
# The Neo version range can use any version of Neo as bounds
neoforge_range="[21.0.0-beta,)"
# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft = "1.21"
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_range = "[1.21,1.21.1)"
# The loader version range can only use the major version of FML as bounds
loader_range = "[4,)"
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
parchment = "2024.07.28"

[libraries]
neoforge = { module = "net.neoforged:neoforge", version.ref = "neoforge" }

[plugins]
moddevgradle = { id = "net.neoforged.moddev", version.ref = "moddevgradle" }

[bundles]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.examplemod;
package gay.sylv.examplemod;

import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.examplemod;
package gay.sylv.examplemod;

import org.slf4j.Logger;

Expand Down

0 comments on commit f9d1afd

Please sign in to comment.