Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 62 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ bin
.metadata
.classpath
.project
/.eclipse/
/.factorypath

# idea
out
Expand All @@ -14,21 +16,78 @@ out
*.iml
.idea

# vscode
/.vscode/
/.vscode
.vscode/*
.vscode/

# gradle
build
.gradle

# other
eclipse
run
run-data
run-upgrade
/run-*/
logs
classes
/crash-reports/
/screenshots/
/mcmodsrepo/
/run.*
/*.log
/*.jfr
/*.hprof
/hs_err_pid*.log
/replay_pid*.log

# local regression, benchmark, and profiling evidence
/benchmark-*/
/preferred-seed-*/
/validation/
/regression-*/
/evidence/
/evidence-*/
/*-evidence/

/README.txt
/forge-*-changelog.txt

secret.json
libs/*
/secret.json
/libs/*
!/libs/README.txt

.DS_Store
bugreport.md
Thumbs.db
Desktop.ini

# python
__pycache__/
*.py[cod]

/bugreport.md

# machine-specific agent context (public project notes belong under /docs)
AGENT.md
AGENTS.md
agent-notes/
.agent/
.agents/
.codex/
CLAUDE.md
.claude/
GEMINI.md
.gemini/
agent-*.md
codex-*.md

# local validation/audit reports
**/VALIDATION.md
**/validation.md
**/DEVELOPMENT.md
**/development.md
**/REGISTRY_AUDIT.md
**/registry_audit.md
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

A rewrite and reimagining of the MMD Mod "Power Advantage" originally written by @cyanobacterium.

This is not yet finished or feature-complete with the 2.x branch.
This is both a continuation by the same team and a spiritual successor.

This is ***NOT*** backwards compatible with the 2.x branch.
96 changes: 57 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.moddev' version "${moddevgradle_version}"
id 'net.neoforged.moddev' version '2.0.148'
}

version = "${minecraft_version}-${mod_version}"
if (System.getenv('BUILD_NUMBER')) {
version += '.' + System.getenv('BUILD_NUMBER')
}
group = mod_group_id
def env = System.getenv()
def tag = providers.environmentVariable('TAG')
version = tag.orElse("${mod_version}-development").get()
group = mod_group

base {
archivesName = 'PowerAdvantage'
archivesName = mod_archive_name
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
withSourcesJar()
//withJavadocJar()
withJavadocJar()
}

tasks.withType(JavaCompile).configureEach {
Expand All @@ -33,7 +34,12 @@ javadoc {
}

neoForge {
version = project.neo_version
version = neoforge_version

parchment {
minecraftVersion = parchment_minecraft_version
mappingsVersion = parchment_mappings_version
}

runs {
client {
Expand All @@ -52,6 +58,7 @@ neoForge {
'--existing', file('src/main/resources/').getAbsolutePath()
}
configureEach {
gameDirectory = file('run')
systemProperty 'forge.logging.markers', 'REGISTRIES'
logLevel = org.slf4j.event.Level.DEBUG
}
Expand All @@ -67,38 +74,52 @@ neoForge {
sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {
mavenLocal()
mavenCentral()
mavenLocal {
// A stale local MMDLib build must not shadow the published one
content {
excludeGroup 'zone.moddev.mc.lib'
}
}
maven {
name = 'ModDevZone'
url = uri('https://maven.moddev.zone/releases')
content {
includeGroupByRegex 'zone\\.moddev\\.mc.*'
}
}
// MMDLib 2.0 is not published yet; it lives in libs/ until it is
flatDir {
dirs 'libs'
}

// MMDLib publishes every loader under one artifact, distinguished by a '+<Loader>' version suffix
configurations.configureEach {
resolutionStrategy.componentSelection.all { ComponentSelection selection ->
def candidate = selection.candidate
if (candidate.group == 'zone.moddev.mc.lib' && candidate.module == 'mmdlib' && !candidate.version.endsWith('+Neo')) {
selection.reject('not a NeoForge build of MMDLib')
}
}
}

dependencies {
implementation files("libs/mmdlib-${mmdlib_version}.jar")
implementation "zone.moddev.mc.lib:mmdlib:${mmdlib_version}"
runtimeOnly "zone.moddev.mc.orespawn:OreSpawn:${orespawn_version}"
}

// Kept as a separate task (rather than expanding in processResources) so IDE runs see the metadata too
def generateModMetadata = tasks.register('generateModMetadata', ProcessResources) {
def replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
neo_version : neo_version,
neo_version_range : neo_version_range,
neoforge_version_range : neoforge_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_version : project.version,
mod_authors : mod_authors,
mod_description : mod_description,
curseforge_url : curseforge_id ? "https://www.curseforge.com/projects/${curseforge_id}" : homepage_url,
issue_url : issue_url,
update_url : update_url,
mmdlib_version_range : mmdlib_version_range,
orespawn_version_range : orespawn_version_range,
]
Expand All @@ -110,42 +131,39 @@ def generateModMetadata = tasks.register('generateModMetadata', ProcessResources
sourceSets.main.resources.srcDir generateModMetadata
neoForge.ideSyncTask generateModMetadata

class Secrets {
def data = null

def getProperty(String key) {
return data ? data[key] : ''
}
}

def secret = new Secrets()
def secretFile = file(System.getenv('SECRET_FILE') ?: 'secret.json')
if (secretFile.exists()) {
secretFile.withReader {
secret.data = new groovy.json.JsonSlurper().parse it
}
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId = base.archivesName.get()
artifactId = mod_archive_name
from components.java
}
}
repositories {
if (secret.data) {
if (env.MAVEN_UPLOAD_URL) {
maven {
url = uri(env.MAVEN_UPLOAD_URL)
credentials {
username = secret.username
password = secret.password
username = env.MAVEN_UPLOAD_USERNAME
password = env.MAVEN_UPLOAD_PASSWORD
}
url = secret.url
}
}
}
}

idea {
module {
downloadSources = true
}
}

eclipse {
classpath {
downloadJavadoc = true
downloadSources = true
}
}

// Integration tests are opt-in and are never included in the distributable mod.
if (project.hasProperty('gameTests')) {
sourceSets {
Expand Down
11 changes: 5 additions & 6 deletions docs/port-1.21.1.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Power Advantage on NeoForge 1.21.1

Requires Java 21, NeoForge 21.1.265, and the MMDLib 2.0 alpha API with
Requires Java 21, NeoForge 21.1.265, and the MMDLib 2.0 API with
`StandaloneBlock.blockEntityData`, `BlockContext.blockEntity`, and
`RuntimeContentRegistrar.blockEntityTypes`.

The build uses `libs/mmdlib-2.0.0-alpha.jar` directly so an older Maven-local
artifact cannot silently replace it. This copy came from the adjacent
`MMDLib-2.x/build/libs/mmdlib-2.0.0-alpha-all.jar`; the `-all` distribution
includes MMDLib's nested dependencies. MMDLib remains a separate required mod
when installing the built Power Advantage JAR. `libs/` is ignored by Git.
MMDLib comes from `maven.moddev.zone` as `zone.moddev.mc.lib:mmdlib:2.0.+`,
restricted to the `+Neo` builds. Maven-local is excluded for that group so an
older local build cannot silently replace the published one. MMDLib remains a
separate required mod when installing the built Power Advantage JAR.

## Content and implementation

Expand Down
50 changes: 32 additions & 18 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
org.gradle.jvmargs = -Xmx2G
org.gradle.daemon = false
org.gradle.caching = true
org.gradle.configuration-cache = true

# Mod
mod_id = poweradvantage
# Project
# Version string only used in dev, however when making a tag on github it should be like major.minor.bug.mc+loader
# Example: 3.1.0. 1 21 01 2 - the Minecraft version without dots, then the loader (1 Forge, 2 NeoForge).
mod_version = 3.1.0.121012
mod_name = Power Advantage
mod_version = 3.1.0
mod_group_id = zone.moddev.mc
mod_authors = DrCyano (aka Cyanobacterium), DShadowWolf
mod_id = poweradvantage
mod_archive_name = PowerAdvantage
mod_description = API for DrCyano's power systems mods.
mod_license = LGPL-2.1
mod_group = zone.moddev.mc.poweradvantage
mod_authors = DrCyano (aka Cyanobacterium), DShadowWolf
mod_license = https://raw.githubusercontent.com/dshadowwolf/PA3/refs/heads/master/LICENSE.md
# No CurseForge project yet; while this is empty the mod's display link falls back to homepage_url
curseforge_id =
homepage_url = https://github.com/dshadowwolf/PA3
update_url = https://raw.githubusercontent.com/dshadowwolf/PA3/refs/heads/master/update.json
issue_url = https://github.com/dshadowwolf/PA3/issues

# Environment
# Dependencies
minecraft_version = 1.21.1
minecraft_version_range = [1.21.1,1.21.2)
neo_version = 21.1.265
neo_version_range = [21.1.247,21.2)
neoforge_version = 21.1.265
neoforge_version_range = [21.1.247,21.2)
loader_version_range = [4,)
moddevgradle_version = 2.0.148

# Dependencies
mmdlib_version = 2.0.0-alpha
mmdlib_version_range = [2.0.0-alpha,)
# Any 2.0.x NeoForge build; build.gradle rejects the other loaders' '+<Loader>' variants
mmdlib_version = 2.0.+
mmdlib_version_range = [2.0.0,2.1)
# OreSpawn places the crude oil deposits from data/poweradvantage/orespawn/provider.json
orespawn_version = 4.1.0.121012
orespawn_version_range = [4.1.0,)

# Parchment (parameter names + javadocs on top of Mojang mappings)
# Versions: https://parchmentmc.org/docs/getting-started
parchment_minecraft_version = 1.21.1
parchment_mappings_version = 2024.11.17

# Gradle
org.gradle.jvmargs = -Xmx3G
org.gradle.daemon = false
org.gradle.configuration-cache = false
org.gradle.caching = true
org.gradle.parallel = false
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
distributionSha256Sum=21bd5da2de49b642904077f38c0efdc7778e92b3ed0889392dca61b97e389607
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
Expand Down
Loading
Loading