Tags
Creators
Details
0.1.0-alpha1
Compatibility
Changes
🚀 PASM v0.1.0-alpha1
PASM(Plugin ASM) 是一个轻量级、Mixin 风格的字节码注入框架,专为 Paper/Bukkit 服务端设计。这是 PASM 的首个公开预览版本,核心功能已稳定,欢迎社区试用反馈。
✨ 核心特性
-
声明式注入 –仅需
@Pasm+@Inject注解,零字节码基础即可修改目标方法。 -
完整注入类型 –
BEFORE/AFTER/REPLACE/HEAD/TAIL全部可用,覆盖绝大多数增强场景。 -
构造函数支持 –可对
<init>方法进行HEAD注入,自动在super()后插入。 -
异常处理兼容 –完美保留
try-catch-finally结构,注入后异常表不丢失。 -
宽类型自动偏移 –
long/double参数在静态→非静态注入时自动计算双槽位偏移,无需手动配置。 -
REPLACE 独占语义 –同一方法的多个注入点若包含
REPLACE,仅执行优先级最高的REPLACE,其余自动跳过,避免冲突。 -
ASM 处理器扩展 –通过
pasm.json的asms字段注册自定义处理器,在beforeInject/afterInject生命周期执行任意字节码增强,支持优先级排序。 -
热加载支持(实验性) –提供
reloadPlugins()接口,可运行时重新扫描插件并重新注入,适合开发调试。
📦 系统兼容性
-
Java 8~25 –框架自身完全兼容,已在 Java 8、11、17、21完成测试。
-
Paper 1.16.5~1.21+ –实际运行版本取决于服务端要求,最低支持 Java 8(配合 Paper 1.16.5)。
-
ASM 9.x + Gson 2.10 –内置依赖,无外部冲突风险。
⚠️ 已知限制
-
AROUND注入暂未实现,使用时会降级为REPLACE并输出警告。 -
热加载功能尚不稳定,频繁重载可能导致类冲突,不建议在生产环境高频使用。
-
ASM 处理器钩子(
asms)为预览特性,API 可能在未来调整。
📥 快速开始
-
下载
pasm-0.1.0-alpha1.jar放置于服务端根目录。 -
启动参数添加
-javaagent:pasm-0.1.0-alpha1.jar[=debug]。 -
在插件 JAR 的
src/main/resources/pasm.json中声明注入类。 -
编写带
@Pasm和@Inject注解的静态方法,打包后放入plugins/目录。 -
启动服务端,框架将自动扫描并完成注入。
详细使用示例请参阅 README。
🙏 致谢
感谢所有在开发过程中提供反馈与测试的朋友,特别感谢 PaperMC 社区对字节码操作技术的无私分享。
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle. To learn more about the Modrinth Maven API, click here.
Note: When available, you should use the creator's maven repo instead as it will have transitive dependency information that the Modrinth Maven API does not. You may also end up with duplicate dependencies if you use a mix of Modrinth and non-Modrinth Maven repositories for your dependencies, because the group identifier will be different when served through the Modrinth Maven API.
Maven coordinates:
Version ID:
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
// forRepositories(fg.repository) // Uncomment when using ForgeGradle
filter {
includeGroup "maven.modrinth"
}
}
}
// Standard Gradle dependency
dependencies {
implementation "maven.modrinth:cJCbP6Hi:BFxb2hAE"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:cJCbP6Hi:BFxb2hAE"
}

