From f6ab6798414b63e916706f053ea6d6bb6c24a1f1 Mon Sep 17 00:00:00 2001 From: Daniel Hazelton Date: Tue, 3 Nov 2026 12:32:53 -0500 Subject: [PATCH] how the hell did these get missed ? --- .gitignore | 65 ++++++- README.md | 2 +- build.gradle | 96 +++++----- docs/port-1.21.1.md | 11 +- gradle.properties | 50 ++++-- gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew.bat | 164 +++++++++--------- .../poweradvantage/blocks/ConveyorBlock.java | 7 +- .../templates/META-INF/neoforge.mods.toml | 5 +- 9 files changed, 251 insertions(+), 152 deletions(-) diff --git a/.gitignore b/.gitignore index bc1ca2d..7c59ec7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ bin .metadata .classpath .project +/.eclipse/ +/.factorypath # idea out @@ -14,6 +16,12 @@ out *.iml .idea +# vscode +/.vscode/ +/.vscode +.vscode/* +.vscode/ + # gradle build .gradle @@ -21,14 +29,65 @@ build # 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 diff --git a/README.md b/README.md index 2c61deb..1273d67 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/build.gradle b/build.gradle index 0fddb0a..2615ee1 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { @@ -33,7 +34,12 @@ javadoc { } neoForge { - version = project.neo_version + version = neoforge_version + + parchment { + minecraftVersion = parchment_minecraft_version + mappingsVersion = parchment_mappings_version + } runs { client { @@ -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 } @@ -67,7 +74,13 @@ 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') @@ -75,30 +88,38 @@ repositories { 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 '+' 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, ] @@ -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 { diff --git a/docs/port-1.21.1.md b/docs/port-1.21.1.md index 839f208..7960dc3 100644 --- a/docs/port-1.21.1.md +++ b/docs/port-1.21.1.md @@ -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 diff --git a/gradle.properties b/gradle.properties index dc5e38b..c905e0e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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' '+' 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 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ad7845b..5907d39 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew.bat b/gradlew.bat index 8508ef6..a51ec4f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,82 +1,82 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem gradlew startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables, and ensure extensions are enabled -setlocal EnableExtensions - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -"%COMSPEC%" /c exit 1 - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -"%COMSPEC%" /c exit 1 - -:execute -@rem Setup the command line - - - -@rem Execute gradlew -@rem endlocal doesn't take effect until after the line is parsed and variables are expanded -@rem which allows us to clear the local environment before executing the java command -endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel - -:exitWithErrorLevel -@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts -"%COMSPEC%" /c exit %ERRORLEVEL% +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem gradlew startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +"%COMSPEC%" /c exit 1 + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +"%COMSPEC%" /c exit 1 + +:execute +@rem Setup the command line + + + +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel + +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/src/main/java/zone/moddev/mc/poweradvantage/blocks/ConveyorBlock.java b/src/main/java/zone/moddev/mc/poweradvantage/blocks/ConveyorBlock.java index 5ee939b..4a45e25 100644 --- a/src/main/java/zone/moddev/mc/poweradvantage/blocks/ConveyorBlock.java +++ b/src/main/java/zone/moddev/mc/poweradvantage/blocks/ConveyorBlock.java @@ -37,7 +37,12 @@ public class ConveyorBlock extends Block { * Rendered belt form; left and right name the side, relative to the output direction, that feeds a corner. */ public enum Shape implements StringRepresentable { - STRAIGHT,LEFT,RIGHT; + /** Fed from behind, or from both sides or neither, so the belt runs straight. */ + STRAIGHT, + /** Fed only from the left of the output direction. */ + LEFT, + /** Fed only from the right of the output direction. */ + RIGHT; @Override public String getSerializedName(){return name().toLowerCase(Locale.ROOT);} } /** diff --git a/src/main/templates/META-INF/neoforge.mods.toml b/src/main/templates/META-INF/neoforge.mods.toml index 7de5379..0959f12 100644 --- a/src/main/templates/META-INF/neoforge.mods.toml +++ b/src/main/templates/META-INF/neoforge.mods.toml @@ -1,11 +1,14 @@ modLoader="javafml" loaderVersion="${loader_version_range}" license="${mod_license}" +issueTrackerURL="${issue_url}" [[mods]] modId="${mod_id}" version="${mod_version}" displayName="${mod_name}" +displayURL="${curseforge_url}" +updateJSONURL="${update_url}" authors="${mod_authors}" credits="The Forge and FML guys, for making the Forge modding API (you guys are awesome), engineers everywhere, and the mod author DrCyano (aka Cyanobacterium)" description='''${mod_description}''' @@ -13,7 +16,7 @@ description='''${mod_description}''' [[dependencies.${mod_id}]] modId="neoforge" type="required" - versionRange="${neo_version_range}" + versionRange="${neoforge_version_range}" ordering="NONE" side="BOTH"