本项目已于 2026 年 6 月 20 日归档。详情请参阅 GitHub README。

APEL 全称为 Animative Particle Engine Library(动画粒子引擎库)。它的目标是通过集成一个强大的动画引擎,赋予开发者巨大的生产力提升,从而实现对复杂粒子动画的管理。因此,该库旨在提供:
简单来说,APEL 允许你仅用极少量的代码就能完全实现这些动画:
APEL 的核心优势具体包括:
- 易用性: 该库将组件简化为其最基本的根源。这提供了一个直观且易于使用的开发者接口,使得任何开发者都能轻松上手。
- 灵活性: 另一个目标是使库尽可能灵活,同时不破坏其他目标因素。该库允许在不涉及额外语法糖的情况下组合复杂的场景。
- 丰富的文档: 我们的团队致力于提供详细的文档,清楚地解释每个功能的工作原理。我们积极改进文档,您可以通过 JavaDocs 或 GitHub 中的 Markdown 文档阅读相关说明。
- 高性能: 由于该库旨在用于创建错综复杂的粒子场景,因此经过高度优化,对性能非常友好。

开发者
本节面向将 APEL 作为库使用的开发者。
- 在你的
gradle.properties 文件中,添加以下行:
apel_version=0.1.5+1.21.8
- 在
build.gradle 中,找到顶层的 repositories 块,如果你尚未从 Modrinth 安装任何其他依赖模组,请添加以下行:
repositories {
// ...
maven {
url = "https://api.modrinth.com/maven"
}
}
- 同样在
build.gradle 中,在 dependencies 块下添加依赖项:
dependencies {
// ...
modImplementation "maven.modrinth:apel:${project.apel_version}"
// ...
}
- 刷新 Gradle(在 IntelliJ IDEA 中,点击带有旋转子图标的 Gradle 图标)
- 尝试输入
Apel 并让 IDE 自动补全,或者导入 net.mcbrincie.apel.Apel。如果所有步骤都已完成,一切应按预期工作。
玩家
通过常规方式下载模组并将其放入你的 mods 文件夹中。
对于一个沿直线从一个点移动到另一个点、绕 Y 轴旋转,并通过在 3 条边到 30 条边之间动画循环的正方形多边形粒子,代码如下(这不是一个简单的入门示例,但展示了其可能性):
AtomicBoolean reverse = new AtomicBoolean(false);
ParticlePolygon polygon = ParticlePolygon.builder()
.particleEffect(ParticleTypes.END_ROD)
.sides(3)
.scale(3.0f)
.amount(100)
.beforeDraw((data, obj) -> {
if (data.getCurrentStep() <= 15) {
return;
}
boolean isStepZero = data.getCurrentStep() % 15 == 0;
int sides = ApelUtils.getValueFromEasingCurve(obj.getSides());
if (isStepZero && !reverse.get()) {
obj.setSides(sides + 1);
if (sides >= 30) {
reverse.set(true);
}
} else if (isStepZero && reverse.get()) {
obj.setSides(sides - 1);
if (sides == 4) {
reverse.set(false);
}
}
Vector3f newRot = ApelUtils.getValueFromEasingCurve(obj.getRotation()).add(0, 0.002f, 0);
obj.setRotation(newRot);
})
.build();
LinearAnimator linearAnimator = LinearAnimator.builder()
.endpoint(new Vector3f())
.endpoint(new Vector3f(10, 0, 0))
.particleObject(polygon)
.delay(1)
.stepsForAllSegments(1000)
.build();
ApelServerRenderer renderer = ApelServerRenderer.client((ServerWorld) world);
linearAnimator.beginAnimation(renderer);
我们定义了粒子对象 (ParticlePolygon),指定了要使用的粒子效果、多边形的边数、多边形的大小以及要在多边形上使用的粒子数量。
之后,我们利用库在每一帧渲染之前修改对象的能力。这是通过一个接收某些上下文和要渲染对象的 lambda 函数实现的。此示例通过检查动画处于哪个步骤,来确定多边形应有的边数,从而修改多边形的边数。它还展示了如何增加旋转角度(以每个轴的欧拉角表示),在这种情况下,是在每个刻度的 Y 轴上进行轻微旋转。
注意:我们使用 ApelUtils.getValueFromEasingCurve 提取旋转和边数的值,在我们的案例中,我们知道这不是空值,所以可以完美运行。
然后,我们创建一个线性路径动画器,并提供帧之间的延迟(以刻度为单位)、直线的起始位置、直线的结束位置、要使用的粒子对象以及动画的渲染步骤数。
最后,我们播放线性路径动画器,并为服务器端渲染提供一个渲染器实例。
注意
根据开发者是否选择使用 Apel 的客户端渲染器(它比服务器端渲染器更优化粒子,但需要人们安装客户端模组),可能需要客户端安装该模组。如果他们不选择客户端渲染器,则无需客户端模组。

This project has been archived as of June 20 - 2026. See the github README as to why

Apel stands for Animative Particle Engine Library. Its goal is to give the developer a huge productivity boost by incorporating a powerful animation engine that allows for the management of complex particle animations. Thus the library aims to provide:
To put it simply. APEL allows you to fully make these animations with very few lines of code:
The key strengths of APEL are specifically:
- Ease Of Use: The library cuts down the components into its simplest roots. This provides a straightforward and easy to use developer interface, so any developer can use.
- Flexiblity: Another goal is to make the library as flexible as it can be without ruining the other goal factors. The library allows for composing complex scenes without additional syntactic sugar involved.
- Rich Documentation: Our team aims for detailed documentation that clearly explains how each feature works. We actively work on improving it, and documentation can be read from java docs or from the markdown documents in github.
- High Performance: Since the library is meant to be used for creating intricate particle scenes, the library is very optimised and performance friendly.

Developers
This section is for developers using APEL as a library.
- In your
gradle.properties file, add this line:
apel_version=0.1.5+1.21.8
- In
build.gradle, find the top-level repositories block, and add these lines if you haven't installed any other dependency mods from modrinth:
repositories {
// ...
maven {
url = "https://api.modrinth.com/maven"
}
}
- Also in
build.gradle, add the dependency under the dependencies block:
dependencies {
// ...
modImplementation "maven.modrinth:apel:${project.apel_version}"
// ...
}
- Refresh gradle (in IntelliJ IDEA, press the gradle icon with a rotate sub-icon)
- Try to either type
Apel and let your IDE autocomplete it, or import net.mcbrincie.apel.Apel. If all steps are done, everything should work as expected.
Players
Download the mod via your usual means and place it in your mods folder.
For a regular particle polygon that moves in a line from one point to another, rotates around the Y axis, and loops by animating between 3 sides to 30 sides, the code looks like this (not a straightforward first example, but showcases the possibilities):
AtomicBoolean reverse = new AtomicBoolean(false);
ParticlePolygon polygon = ParticlePolygon.builder()
.particleEffect(ParticleTypes.END_ROD)
.sides(3)
.scale(3.0f)
.amount(100)
.beforeDraw((data, obj) -> {
if (data.getCurrentStep() <= 15) {
return;
}
boolean isStepZero = data.getCurrentStep() % 15 == 0;
int sides = ApelUtils.getValueFromEasingCurve(obj.getSides());
if (isStepZero && !reverse.get()) {
obj.setSides(sides + 1);
if (sides >= 30) {
reverse.set(true);
}
} else if (isStepZero && reverse.get()) {
obj.setSides(sides - 1);
if (sides == 4) {
reverse.set(false);
}
}
Vector3f newRot = ApelUtils.getValueFromEasingCurve(obj.getRotation()).add(0, 0.002f, 0);
obj.setRotation(newRot);
})
.build();
LinearAnimator linearAnimator = LinearAnimator.builder()
.endpoint(new Vector3f())
.endpoint(new Vector3f(10, 0, 0))
.particleObject(polygon)
.delay(1)
.stepsForAllSegments(1000)
.build();
ApelServerRenderer renderer = ApelServerRenderer.client((ServerWorld) world);
linearAnimator.beginAnimation(renderer);
We define the particle object (ParticlePolygon) with the particle effect to use, the sides of the polygon, the size of the polygon, and the number of particles to use on the polygon.
After that we use the library's ability to modify the object before each frame is rendered. This is via a lambda function that receives some context and the object to be rendered. This example modifies the number of sides on the polygon by checking what step the animation is on, and using that to determine the number of sides the polygon should have. It also shows how to increment the rotation (expressed in Euler angles per axis), in this case a slight rotation around the y-axis on each tick.
Note: We extract the value using ApelUtils.getValueFromEasingCurve for rotation and the number of sides, in our case we know this is not a null value so it works perfectly fine
We then create a linear path animator and supply it with the delay in ticks between frames, the starting position of the line, the ending position of the line, the particle object to use, and the number of rendering steps for the animation.
Finally, we play the linear path animator and supply it with a renderer instance for server-side rendering.
Note
The mod may be required to be installed client-side depending on if the developer chooses to use Apel's client-side renderer, which optimises the particles way more than the server-side renderer although it requires that people need the client mod to be installed. If they don't choose client-side renderer then no need for the client mod

评论 0
登录后参与评分
还没有评论,来抢沙发吧