Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
53 changes: 34 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project
### Gradle ###
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/**/build/

# idea
out
*.ipr
### IntelliJ IDEA ###
.idea/
*.iws
*.iml
.idea
*.ipr
out/
!**/src/**/out/

# gradle
build
.gradle
.run/

### Eclipse ###
.apt_generated
.classpath
.eclipse/
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/**/bin/

### VS Code ###
.vscode/

# other
eclipse
run
### Mac OS ###
.DS_Store

# Files from Forge MDK
forge*changelog.txt
### Minecraft Modding ###
run/
!**/src/**/run/
**/src/generated/**/.cache/
repo/
!**/src/**/repo/

# Project
secrets.properties
Expand Down
233 changes: 135 additions & 98 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,115 +1,157 @@
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'net.neoforged.moddev' version '2.0.141'
id 'idea'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'com.matthewprenger.cursegradle' version '1.4.0'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'maven-publish'
tasks.named('wrapper', Wrapper).configure {
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
distributionType = Wrapper.DistributionType.BIN
}

version = "${minecraft_version}-${mod_version}"
group = mod_group_id

sourceSets.main.resources {
// Include resources generated by data generators.
srcDir('src/generated/resources')

// Exclude common development only resources from finalized outputs
exclude("**/*.bbmodel") // BlockBench project files
exclude("src/generated/**/.cache") // datagen cache files
}

repositories {
maven { url "https://maven.blamejared.com/" }
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
}

base {
archivesName = mod_id
}

version = "$minecraft_version-$mod_version"
group = 'com.smashingmods'
archivesBaseName = 'chemlib'
// Mojang ships Java 21 to end users in 1.21.1, so mods should target Java 21.
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

neoForge {
// Specify the version of NeoForge to use.
version = project.neo_version

parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.parchment_minecraft_version
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
// This line is optional. Access Transformers are automatically detected
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')

minecraft {
mappings channel: mapping_channel, version: "$mapping_version-1.20.1"
copyIdeResources = true
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
jvmArgs '-XX:+AllowEnhancedClassRedefinition'

mods {
chemlib {
source sourceSets.main
}
}
client()

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

server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
jvmArgs '-XX:+AllowEnhancedClassRedefinition'

mods {
chemlib {
source sourceSets.main
}
}
server()
programArgument '--nogui'
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}

// 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
}

data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
jvmArgs '-XX:+AllowEnhancedClassRedefinition'
args '--mod', "$archivesBaseName", '--all', '--output', file('src/generated/resources'), '--existing', file('src/main/resources')

mods {
chemlib {
source sourceSets.main
}
}
data()

// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// 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()
}
}
}

sourceSets.main.resources { srcDir 'src/generated/resources' }
// applies to all the run configs above
configureEach {
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty 'forge.logging.markers', 'REGISTRIES'

// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
logLevel = org.slf4j.event.Level.DEBUG
}
}

repositories {
maven { url "https://maven.blamejared.com/" }
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
mods {
// define mod <-> source bindings
// these are used to tell the game which sources are for which mod
// multi mod projects should define one per mod
"${mod_id}" {
sourceSet(sourceSets.main)
}
}
}

dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")
configurations {
runtimeClasspath.extendsFrom localRuntime
}

def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
def replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description
]
processResources {
inputs.properties replaceProperties
replaceProperties.put 'project', project

filesMatching(resourceTargets) {
expand replaceProperties
}

dependencies {
compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}"
runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
}

jar {
manifest {
attributes([
"Specification-Title" : "$archivesBaseName",
"Specification-Vendor" : "SmashingMods",
"Specification-Version" : "1",
"Implementation-Title" : project.name,
"Implementation-Version" : project.version,
"Implementation-Vendor" : "SmashingMods",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
// This block of code expands all declared replace properties in the specified resource targets.
// 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,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : mod_name,
mod_authors : mod_authors,
mod_description : mod_description,
mod_license : mod_license,
mod_version : mod_version,
]
inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}
// Include the output of "generateModMetadata" as an input directory for the build
// this works with both building through Gradle and the IDE.
sourceSets.main.resources.srcDir generateModMetadata
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
neoForge.ideSyncTask generateModMetadata

def secrets = new Properties()
file('secrets.properties').withInputStream {
Expand All @@ -125,23 +167,10 @@ fileTree("secrets").matching {
}
}

jar.finalizedBy('reobfJar')

java {
withSourcesJar()
withJavadocJar()
}

publishing {
publications {
mavenJava(MavenPublication) {
afterEvaluate {
artifact project.jar
artifact project.sourcesJar
artifact project.javadocJar
}
setGroupId 'smashingmods'
setArtifactId 'chemlib'
register('mavenJava', MavenPublication) {
from components.java
}
}
repositories {
Expand Down Expand Up @@ -176,4 +205,12 @@ curseforge {

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}

// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
6 changes: 3 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ChemLib 1.20.1-2.0.19
# ChemLib 1.21.1-2.0.20

Changes:

- Fix all calls to toUpperCase() passing in Locale.ROOT. This should fix issues with the Turkish language loading the mod.
- Upgrade Forge version.
- Port to 1.21.1 neoforge
- Gaseous fluids flow upwards
23 changes: 13 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true

minecraft_version=1.20.1
minecraft_version_range=[1.20,1.21)
forge_version=47.1.3
forge_version_range=[47,)
loader_version_range=[47,)
mapping_channel=parchment
mapping_version=2023.09.03
minecraft_version=1.21.1
minecraft_version_range=[1.21,1.22)
neo_version=21.1.228
loader_version_range=[1,)
# https://parchmentmc.org/docs/getting-started
parchment_minecraft_version=1.21.1
parchment_mappings_version=2024.11.17

mod_id=chemlib
mod_name=ChemLib
mod_license=LGPLv2.1
mod_version=2.0.19
mod_version=2.0.20
mod_group_id=com.smashingmods.chemlib
mod_authors=DarkArcana
mod_description=ChemLib provides all of the elements of the periodic table and many compounds of those elements. It also includes some items based on the elements and compounds such as ingots and lamps.\nCredits:\n- Andrea Hazard, creator of 'Enhanced Bohr Model' images. Their work is shared under the Creative Commons Attribution-Share Alike 4.0 International license. Read more about the license here: https://creativecommons.org/licenses/by-sa/4.0/deed.en

jei_version=15.2.0.22
jei_version=19.27.0.340
Loading