Compare commits

...

10 Commits

Author SHA1 Message Date
5fb2c614db build: 版本号更为正式版
Some checks failed
Build and Release / build (push) Failing after 34s
Build and Release / release (push) Has been skipped
2026-03-18 23:24:26 +08:00
c05c0bdfc4 build: 修改导致curseforge推送失败的json写法
Some checks failed
Build and Release / build (push) Failing after 34s
Build and Release / release (push) Has been skipped
2026-03-18 23:03:54 +08:00
5a1c2fdbc5 build: 修正CurseForge发布 2026-03-18 22:51:35 +08:00
c9b9e0eefe build: 工作流修正
Some checks failed
Build and Release / build (push) Failing after 1m33s
Build and Release / release (push) Has been skipped
2026-03-18 22:30:37 +08:00
f589cf27a2 build: 修复错误发布问题
Some checks failed
Build and Release / build (push) Failing after 33s
Build and Release / release (push) Has been skipped
2026-03-18 22:02:08 +08:00
35ceb69f0b build: 工作流脚本修复 2026-03-18 21:35:36 +08:00
dbae05691d build: 工作流
Some checks failed
Build and Release / build (push) Failing after 33s
Build and Release / release (push) Has been skipped
2026-03-18 21:19:01 +08:00
a435c3b272 build: 工作流修正 2026-03-18 21:15:24 +08:00
04640d2b12 build: 发布工作流更新
Some checks failed
Build and Release / build (push) Failing after 2h30m21s
Build and Release / release (push) Has been skipped
2026-03-18 20:55:17 +08:00
9dbeb0732f build: 修复发布脚本
Some checks failed
Build and Release / build (push) Failing after 16m59s
Build and Release / release (push) Has been skipped
2026-03-16 15:31:03 +08:00
5 changed files with 192 additions and 37 deletions

View File

@ -83,7 +83,18 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine version type
id: version_type
run: |
if [[ "${{ github.ref_name }}" == *"alpha"* ]]; then
echo "type=alpha" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == *"beta"* ]]; then
echo "type=beta" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == *"rc"* ]]; then
echo "type=beta" >> $GITHUB_OUTPUT
else
echo "type=release" >> $GITHUB_OUTPUT
fi
- name: Download artifacts
uses: actions/download-artifact@v4
with:
@ -97,6 +108,69 @@ jobs:
VERSION="${GITHUB_REF_NAME#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "minecraft_version=$(grep "^minecraft_version=" gradle.properties | cut -d'=' -f2)" >> $GITHUB_OUTPUT
# 从 gradle.properties 提取 mod_id如果没有则尝试从文件名推断
MOD_ID=$(grep "^mod_id=" gradle.properties | cut -d'=' -f2 || echo "")
if [ -z "$MOD_ID" ]; then
# 尝试从现有的 jar 文件名提取 mod_id
SAMPLE_JAR=$(ls dist/ | grep -m 1 -E ".*-(fabric|forge)-.*\.jar" || echo "")
if [ -n "$SAMPLE_JAR" ]; then
MOD_ID=$(echo "$SAMPLE_JAR" | sed -E 's/-(fabric|forge)-.*//')
else
MOD_ID="mymod" # 默认值,请根据实际情况修改
fi
fi
echo "mod_id=$MOD_ID" >> $GITHUB_OUTPUT
# 从 gradle.properties 提取 mod_name用于显示
MOD_NAME=$(grep "^mod_name=" gradle.properties | cut -d'=' -f2 || echo "My Mod")
echo "mod_name=$MOD_NAME" >> $GITHUB_OUTPUT
# 从 gradle.properties 提取 modrinth_id
MODRINTH_ID=$(grep "^modrinth_id=" gradle.properties | cut -d'=' -f2 || echo "")
echo "modrinth_id=$MODRINTH_ID" >> $GITHUB_OUTPUT
# 从 gradle.properties 提取 curseforge_id
CURSEFORGE_ID=$(grep "^curseforge_id=" gradle.properties | cut -d'=' -f2 || echo "")
echo "curseforge_id=$CURSEFORGE_ID" >> $GITHUB_OUTPUT
# Java版本 - 使用简单格式不用JSON
JAVA_VERSIONS=$(grep "^java_versions=" gradle.properties | cut -d'=' -f2- || echo "21,17")
# 清理格式,移除无效字符
JAVA_VERSIONS=$(echo "$JAVA_VERSIONS" | sed 's/\[//g; s/\]//g; s/"//g; s/ //g; s/21a/21/g' | tr -d '\r')
echo "java_versions=$JAVA_VERSIONS" >> $GITHUB_OUTPUT
# 读取发布控制布尔值(默认都为 true
PUBLISH_GITHUB=$(grep "^publish_github=" gradle.properties | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' | tr -d ' ' || echo "true")
if [ "$PUBLISH_GITHUB" = "true" ] || [ "$PUBLISH_GITHUB" = "1" ] || [ "$PUBLISH_GITHUB" = "yes" ]; then
echo "publish_github=true" >> $GITHUB_OUTPUT
else
echo "publish_github=false" >> $GITHUB_OUTPUT
fi
PUBLISH_MODRINTH=$(grep "^publish_modrinth=" gradle.properties | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' | tr -d ' ' || echo "true")
if [ "$PUBLISH_MODRINTH" = "true" ] || [ "$PUBLISH_MODRINTH" = "1" ] || [ "$PUBLISH_MODRINTH" = "yes" ]; then
echo "publish_modrinth=true" >> $GITHUB_OUTPUT
else
echo "publish_modrinth=false" >> $GITHUB_OUTPUT
fi
PUBLISH_CURSEFORGE=$(grep "^publish_curseforge=" gradle.properties | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' | tr -d ' ' || echo "true")
if [ "$PUBLISH_CURSEFORGE" = "true" ] || [ "$PUBLISH_CURSEFORGE" = "1" ] || [ "$PUBLISH_CURSEFORGE" = "yes" ]; then
echo "publish_curseforge=true" >> $GITHUB_OUTPUT
else
echo "publish_curseforge=false" >> $GITHUB_OUTPUT
fi
# 读取依赖配置 - 使用简单字符串不用JSON
FABRIC_MODRINTH_DEPS=$(grep "^fabric_modrinth_dependencies=" gradle.properties | cut -d'=' -f2- || echo "")
echo "fabric_modrinth_dependencies=$FABRIC_MODRINTH_DEPS" >> $GITHUB_OUTPUT
FORGE_MODRINTH_DEPS=$(grep "^forge_modrinth_dependencies=" gradle.properties | cut -d'=' -f2- || echo "")
echo "forge_modrinth_dependencies=$FORGE_MODRINTH_DEPS" >> $GITHUB_OUTPUT
FABRIC_CURSEFORGE_DEPS=$(grep "^fabric_curseforge_dependencies=" gradle.properties | cut -d'=' -f2- || echo "")
echo "fabric_curseforge_dependencies=$FABRIC_CURSEFORGE_DEPS" >> $GITHUB_OUTPUT
FORGE_CURSEFORGE_DEPS=$(grep "^forge_curseforge_dependencies=" gradle.properties | cut -d'=' -f2- || echo "")
echo "forge_curseforge_dependencies=$FORGE_CURSEFORGE_DEPS" >> $GITHUB_OUTPUT
- name: Generate CZ-compliant changelog
id: generate_changelog
@ -139,6 +213,7 @@ jobs:
["👷 CI"]="^(ci)(\(.*\))?:"
["📦 依赖"]="^(chore|deps)(\(.*\))?:"
["⏪ 回退"]="^(revert)(\(.*\))?:"
["🛠 合并"]="^Merge "
)
# 获取所有提交
@ -250,6 +325,7 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
if: steps.version_info.outputs.publish_github == 'true'
uses: ncipollo/release-action@v1
with:
artifacts: |
@ -258,63 +334,121 @@ jobs:
name: "${{ steps.version_info.outputs.minecraft_version }} - ${{ github.ref_name }}"
body: ${{ steps.generate_changelog.outputs.changelog }}
draft: false
prerelease: false
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
removeArtifacts: true
# 新增:使用 mc-publish 发布到 Modrinth 和 CurseForge
- name: Publish to Modrinth & CurseForge
# Fabric 发布到 Modrinth 和 CurseForge
- name: Publish Fabric to Modrinth & CurseForge
uses: Kir-Antipov/mc-publish@v3.3
if: success() # 只有在之前的步骤都成功时才运行
continue-on-error: true # 即使发布失败也不中断整个工作流
if: success() && (steps.version_info.outputs.publish_modrinth == 'true' || steps.version_info.outputs.publish_curseforge == 'true')
continue-on-error: true
with:
# 文件路径 - 指向所有构建的jar文件
# 文件匹配规则 - 只匹配 fabric 的文件
files: |
dist/*.jar
dist/${{ steps.version_info.outputs.mod_id }}-fabric-${{ steps.version_info.outputs.minecraft_version }}-${{ steps.version_info.outputs.version }}.jar
dist/${{ steps.version_info.outputs.mod_id }}-fabric-${{ steps.version_info.outputs.minecraft_version }}-${{ steps.version_info.outputs.version }}-javadoc.jar
dist/${{ steps.version_info.outputs.mod_id }}-fabric-${{ steps.version_info.outputs.minecraft_version }}-${{ steps.version_info.outputs.version }}-sources.jar
# 版本信息
name: "${{ steps.version_info.outputs.mod_name }} ${{ steps.version_info.outputs.version }}"
version: ${{ steps.version_info.outputs.version }}
name: ${{ steps.version_info.outputs.mod_name }} ${{ steps.version_info.outputs.version }} (Fabric/${{ steps.version_info.outputs.minecraft_version }})
version: "${{ steps.version_info.outputs.minecraft_version }}-fabric-${{ steps.version_info.outputs.version }}"
# 更新日志 - 使用上面生成的changelog
# 更新日志
changelog: ${{ steps.generate_changelog.outputs.changelog }}
# 版本类型:根据标签判断是否为预发布版本
# 如果标签包含 alpha/beta/rc 则视为预发布
version-type: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') && 'beta' || 'release' }}
# 版本类型
version-type: ${{ steps.version_type.outputs.type }}
# 支持的加载器
loaders: |
forge
fabric
# 只指定 Fabric 加载器
loaders: fabric
# 支持的Minecraft版本
# 游戏版本
game-versions: |
${{ steps.version_info.outputs.minecraft_version }}
# Java版本
java: |
21
17
${{ steps.version_info.outputs.java_versions }}
# Modrinth 配置
modrinth-id: n65Vs1Vk
modrinth-id: ${{ steps.version_info.outputs.modrinth_id }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true
modrinth-unfeature-mode: any-version
modrinth-unfeature-mode: any
modrinth-dependencies: ${{ steps.version_info.outputs.fabric_modrinth_dependencies }}
# CurseForge 配置
curseforge-id: ${{ steps.version_info.outputs.curseforge_id }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
curseforge-dependencies: ${{ steps.version_info.outputs.fabric_curseforge_dependencies }}
# 失败处理
fail-mode: skip
# Forge 发布到 Modrinth 和 CurseForge
- name: Publish Forge to Modrinth & CurseForge
uses: Kir-Antipov/mc-publish@v3.3
if: success() && (steps.version_info.outputs.publish_modrinth == 'true' || steps.version_info.outputs.publish_curseforge == 'true')
continue-on-error: true
with:
# 文件匹配规则 - 只匹配 forge 的文件
files: |
dist/${{ steps.version_info.outputs.mod_id }}-forge-${{ steps.version_info.outputs.minecraft_version }}-${{ steps.version_info.outputs.version }}.jar
dist/${{ steps.version_info.outputs.mod_id }}-forge-${{ steps.version_info.outputs.minecraft_version }}-${{ steps.version_info.outputs.version }}-javadoc.jar
dist/${{ steps.version_info.outputs.mod_id }}-forge-${{ steps.version_info.outputs.minecraft_version }}-${{ steps.version_info.outputs.version }}-sources.jar
# 版本信息
name: ${{ steps.version_info.outputs.mod_name }} ${{ steps.version_info.outputs.version }} (Forge/${{ steps.version_info.outputs.minecraft_version }})
version: "${{ steps.version_info.outputs.minecraft_version }}-forge-${{ steps.version_info.outputs.version }}"
# 更新日志
changelog: ${{ steps.generate_changelog.outputs.changelog }}
# 版本类型
version-type: ${{ steps.version_type.outputs.type }}
# 只指定 Forge 加载器
loaders: forge
# 游戏版本
game-versions: |
${{ steps.version_info.outputs.minecraft_version }}
# Java版本
java: |
${{ steps.version_info.outputs.java_versions }}
# Modrinth 配置
modrinth-id: ${{ steps.version_info.outputs.modrinth_id }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true
modrinth-unfeature-mode: any
modrinth-dependencies: ${{ steps.version_info.outputs.forge_modrinth_dependencies }}
# CurseForge 配置
curseforge-id: 1445917
curseforge-id: ${{ steps.version_info.outputs.curseforge_id }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
curseforge-dependencies: ${{ steps.version_info.outputs.forge_curseforge_dependencies }}
# 依赖关系配置(可选)
# dependencies: |
# required | curseforge:123456 | https://www.curseforge.com/minecraft/mc-mods/example
# optional | modrinth:abcdefg
# 失败处理
fail-mode: skip
# 文件排除模式(可选)
# files-primary: "*" # 主文件
# files-secondary: "*-sources.jar" # 额外文件
# 如果发布失败时的行为
fail-mode: skip # 可以设置为: fail, skip, warn
# 发布完成后列出结果
- name: Summary
if: always()
run: |
echo "## 发布结果摘要" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### GitHub Release" >> $GITHUB_STEP_SUMMARY
echo "- 标签: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "- URL: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Modrinth" >> $GITHUB_STEP_SUMMARY
echo "- 项目ID: ${{ steps.version_info.outputs.modrinth_id }}" >> $GITHUB_STEP_SUMMARY
echo "- Fabric版本: ${{ steps.version_info.outputs.version }}-fabric" >> $GITHUB_STEP_SUMMARY
echo "- Forge版本: ${{ steps.version_info.outputs.version }}-forge" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### CurseForge" >> $GITHUB_STEP_SUMMARY
echo "- 项目ID: ${{ steps.version_info.outputs.curseforge_id }}" >> $GITHUB_STEP_SUMMARY
echo "- Fabric版本: ${{ steps.version_info.outputs.version }}-fabric" >> $GITHUB_STEP_SUMMARY
echo "- Forge版本: ${{ steps.version_info.outputs.version }}-forge" >> $GITHUB_STEP_SUMMARY

View File

@ -13,7 +13,7 @@ import java.util.Map;
*/
public class EncryptedClassLoader extends ClassLoader {
static {
System.loadLibrary("ClassEncrypt");
// System.loadLibrary("ClassEncrypt");
}
private native byte[] decryptClass(byte[] encryptedData, String key);

View File

@ -78,7 +78,6 @@ public class AnvilUpdateCallback {
/**
* The constant EVENT.
*/
// 创建事件实例
public static final Event<AnvilUpdate> EVENT = EventFactory.createArrayBacked(
AnvilUpdate.class,
(listeners) -> (left, right, outputSlot, name, baseCost, player) -> {

View File

@ -37,6 +37,13 @@
},
"suggests": {
"another-mod": "*"
},
"custom": {
"mc-publish": {
"dependencies": [
"fabric-api(required)"
]
}
}
}

View File

@ -3,7 +3,7 @@
# Every field you add must be added to buildSrc/src/main/groovy/multiloader-common.gradle expandProps map.
# Project
version=0.5.1
version=0.5.5
group=top.r3944realms.lib39
java_version=17
@ -31,3 +31,18 @@ forge_loader_version_range=[47,)
# Gradle
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# Release
publish_github=true
publish_modrinth=true
publish_curseforge=true
modrinth_id=n65Vs1Vk
curseforge_id=1445917
java_versions=21 17
fabric_modrinth_dependencies=
forge_modrinth_dependencies=
fabric_curseforge_dependencies=
forge_curseforge_dependencies=