Skip to content
This repository was archived by the owner on Mar 22, 2026. It is now read-only.
Closed
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
20 changes: 20 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,23 @@ common --java_runtime_version=remotejdk_21
common --tool_java_runtime_version=remotejdk_21
common --tool_java_language_version=21
common --java_language_version=21

# For minimum binary size
build --copt -flto --copt -Os
build --linkopt -flto

# For Zig CC
build:linux --sandbox_add_mount_pair=/tmp
build:macos --sandbox_add_mount_pair=/var/tmp

# For Android Rules
common --android_platforms=@//:android_arm32,@//:android_arm64,@//:android_x86,@//:android_x86_64
common:linux --cxxopt=-std=c++17
common:linux --host_cxxopt=-std=c++17
common:macos --cxxopt=-std=c++17
common:macos --host_cxxopt=-std=c++17
common:windows --cxxopt=/std:c++17
common:windows --host_cxxopt=/std:c++17
build:windows --define=protobuf_allow_msvc=true

common --enable_platform_specific_config
102 changes: 102 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,108 @@ extract_update_log(
],
)

platform(
name = "android_arm32",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:armv7",
],
)

platform(
name = "android_arm64",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:aarch64",
],
)

platform(
name = "android_x86",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:x86_32",
],
)

platform(
name = "android_x86_64",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:x86_64",
],
)

platform(
name = "linux_x86",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_32",
]
)

platform(
name = "linux_x86_64_glibc",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
"@zig_sdk//libc:gnu.2.24",
],
)

platform(
name = "linux_arm32_glibc",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:armv7",
"@zig_sdk//libc:gnu.2.24",
],
)

platform(
name = "linux_arm64_glibc",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
"@zig_sdk//libc:gnu.2.24",
],
)

platform(
name = "windows_x86",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_32",
]
)

platform(
name = "windows_x86_64",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
)

platform(
name = "windows_arm64",
visibility = ["//visibility:public"],
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:aarch64",
]
)

alias(
name = "license",
visibility = ["//visibility:public"],
Expand Down
41 changes: 41 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@ bazel_dep(name = "rules_java", version = "8.12.0")
bazel_dep(name = "rules_kotlin", version = "2.1.4")
bazel_dep(name = "rules_jvm_external", version = "6.7")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_android_ndk", version = "0.1.3")
bazel_dep(name = "rules_jni", version = "0.11.0")
bazel_dep(name = "hermetic_cc_toolchain", version = "4.0.1")

git_override(
module_name = "rules_jni",
remote = "https://github.com/fmeum/rules_jni.git",
commit = "22b643d23414379b760fced29f36e766dde5fd2a",
patch_strip = 1,
patches = [
"@//third_party/rules_jni/patches:armv7-cpu.patch",
],
)

androidndk = use_extension("@rules_android_ndk//:extension.bzl", "android_ndk_repository_extension")
use_repo(androidndk, "androidndk")
register_toolchains("@androidndk//:all")

zig_cc = use_extension("@hermetic_cc_toolchain//toolchain:ext.bzl", "toolchains")
use_repo(zig_cc, "zig_sdk")

register_toolchains(
"@zig_sdk//toolchain/...",
"@zig_sdk//libc_aware/toolchain/...",
)

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
Expand Down Expand Up @@ -88,6 +114,21 @@ maven.install(
)
use_repo(maven, "maven")

git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "libbulletjme",
commit = "ea117c17501001bd96db05e0fc479420efb3d79e",
build_file = "@//third_party/libbulletjme:BUILD.libbulletjme.bazel",
remote = "https://github.com/stephengold/Libbulletjme.git",
patch_strip = 1,
patches = [
"@//third_party/libbulletjme/patches:vhacd-mutex.patch",
"@//third_party/libbulletjme/patches:winsock2-case.patch",
"@//third_party/libbulletjme/patches:remove-collision-group-one-bit-assert.patch",
"@//third_party/libbulletjme/patches:add-ground-object.patch",
],
)

http_jar = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")
http_jar(
name = "sodium",
Expand Down
25 changes: 24 additions & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 39 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ mod 采取同步模型哈希值的方式,因此你可以重命名模型,甚
- 游戏内模型渲染
- glTF 和 VMD 动画支持

烈焰棒由 Kotlin 和 Java 编写,不使用原生库,不依赖特定平台,因此可以运行在各种环境上。
烈焰棒核心部分由 Kotlin 和 Java 编写,不使用原生库,不依赖特定平台,因此可以运行在各种环境上。

物理引擎由 [libbulletjme](https://github.com/stephengold/Libbulletjme) 提供支持,其调用了 C++ 的 [bullet](https://pybullet.org/) 物理引擎,目前捆绑了以下平台的原生库:

- Android (x86、x86_64、armv7、armv8)
- Linux (x86_64、armv8, 仅 glibc)
- Windows (x86_64、armv8)

没有原生库的平台会自动禁用物理。

烈焰棒目前作为一个 Jar-in-Jar mod 打包在盔甲架中,但可以作为一个单独的库来使用。由于目前没有详细的文档,并且 API
随时可能发生变化,目前不建议在其他项目使用烈焰棒。
Expand All @@ -59,6 +67,8 @@ Apache 2.0 许可证授权。

使用了来自 [Cherished Worlds](https://github.com/illusivesoulworks/cherishedworlds)(LGPL 3.0 及以上版本) 的贴图作为收藏图标,在此感谢。

捆绑了 [bullet](https://pybullet.org/wordpress/)(zlib) 物理引擎及其 Java 绑定 [libbulletjme](https://github.com/stephengold/Libbulletjme)(BSD、zlib、MIT),在此感谢。

## 许可证

本 mod 以 LGPL 3.0 及以上版本授权,在发布和修改时请遵守许可证要求。
Expand All @@ -80,23 +90,31 @@ Currently, the mod is in early development, and supports the following features:
- Support multiplayer (can synchronize model display, but won't support synchronizing model files)
- Shader support (Change renderer in mod config to use shader)

If you encounter any problems or have any ideas, please feel free to open an issue or discussion in the [issue area](https://github.com/fifth-light/ArmorStand/issues) and [discussion area](https://github.com/fifth-light/ArmorStand/discussions).
If you encounter any problems or have any ideas, please feel free to open an issue or discussion in the
[issue area](https://github.com/fifth-light/ArmorStand/issues) and [discussion area](https://github.com/fifth-light/ArmorStand/discussions).

## Usage

First, you need to prepare a model. Before using any model, please check the copyright of the model to avoid copyright issues. Once you have prepared the model file, place it in the `models` directory to load it.
First, you need to prepare a model. Before using any model, please check the copyright of the model to avoid copyright
issues. Once you have prepared the model file, place it in the `models` directory to load it.

In game, press `I` to open the mod settings, and choose the model you prepared.

In game, press `K` to open the animation control interface, where you can load animation files (you also need to place them in the `models` directory), and control the animation speed and playback progress.
In game, press `K` to open the animation control interface, where you can load animation files (you also need to place
them in the `models` directory), and control the animation speed and playback progress.

## Multiplayer

The mod supports multiplayer model synchronization. Before using it, please ensure that your server also has the mod installed (if the server does not have the mod, other players will not be able to see your model, but your own model can still be displayed).
The mod supports multiplayer model synchronization. Before using it, please ensure that your server also has the mod
installed (if the server does not have the mod, other players will not be able to see your model, but your own model can
still be displayed).

Considering distributing models causes copyright issues, the mod can not and will not support synchronizing model files. You need to ensure that other players will also place your model in the `models` directory, so that they can see your model.
Considering distributing models causes copyright issues, the mod can not and will not support synchronizing model files.
You need to ensure that other players will also place your model in the `models` directory, so that they can see your
model.

The mod uses the model's hash value to synchronize models, so you can rename the model, even put it in a subdirectory. As long as the model content does not change, you can see other players' models.
The mod uses the model's hash value to synchronize models, so you can rename the model, even put it in a subdirectory.
As long as the model content does not change, you can see other players' models.

## BlazeRod

Expand All @@ -106,8 +124,17 @@ BlazeRod is the library providing underlying render abilities for ArmorStand, an
- In-game model rendering
- glTF and VMD animation support

BlazeRod is written in Kotlin and Java. It doesn't use native library, and don't depend on particular platform, so
BlazeRod can run in many environment.
Core part of BlazeRod is written in Kotlin and Java. It doesn't use native library, and don't depend on particular
platform, so BlazeRod can run in many environment.

Physics engine is powered by [libbulletjme](https://github.com/stephengold/Libbulletjme), it calls
[bullet](https://pybullet.org/) physic engine written in C++. Currently, native libraries of these platforms is bundled:

- Android (x86, x86_64, armv7, armv8)
- Linux (x86_64, armv8, only glibc)
- Windows (x86_64, armv8)

On platforms without native library, physics will be disabled.

BlazeRod is currently packed as a Jar-in-Jar mod in ArmorStand, but it can also be used as a standalone library. Due to
lack of documentation, and it's API can be changed in any time, it is not encouraged to use BlazeRod in other project
Expand All @@ -128,6 +155,9 @@ to redistribute) as default animation, thanks to them.

The favorite icon is from [Cherished Worlds](https://github.com/illusivesoulworks/cherishedworlds)(LGPL 3.0 or later), thanks to them.

Bundled [bullet](https://pybullet.org/wordpress/) (zlib) physics engine and its Java binding
[libbulletjme](https://github.com/stephengold/Libbulletjme)(BSD, zlib, MIT), thanks to them.

## License

The mod is licensed under the LGPL 3.0 or later. Please comply with the license requirements when distributing and modifying.
Expand Down
3 changes: 2 additions & 1 deletion blazerod/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("//rule:fabric_mod_json_jar.bzl", "fabric_mod_json_jar")
load("@rules_java//java:defs.bzl", "java_library")
load("//:properties.bzl", "blazerod_version")
load("//rule:merge_jar.bzl", "merge_jar")
load("//rule:merge_jij.bzl", "merge_jij")

java_library(
Expand Down Expand Up @@ -53,5 +52,7 @@ merge_jij(
"//blazerod/model/model-vmd": "blazerod-model-formats-vmd:=",
"//blazerod/model/model-bedrock": "blazerod-model-formats-bedrock:=",
"//blazerod/render": "blazerod-render:=",
"@libbulletjme//:libbulletjme": "libbulletjme_blazerod:22.0.1+patch1",
"@libbulletjme//:libbulletjme_natives": "libbulletjme_natives_blazerod:22.0.1+patch1",
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ private void loadModel() {
matrix.getScale().mul(0.5f);
matrix.getTranslation().add(0.5f, 0.5f, 0.5f);
});
BALL_INSTANCE.updateRenderData();
// No physics applied
BALL_INSTANCE.updateRenderData(0f);
});
}

Expand Down
1 change: 0 additions & 1 deletion blazerod/model/model-base/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("//rule:fabric_mod_json_jar.bzl", "fabric_mod_json_jar")
load("//rule:merge_jar.bzl", "merge_jar")
load("//:properties.bzl", "blazerod_version")

fabric_mod_json_jar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ data class Model(
val scenes: List<Scene>,
val defaultScene: Scene? = null,
val skins: List<Skin>,
val physicalJoints: List<PhysicalJoint> = listOf(),
val expressions: List<Expression> = listOf(),
) {
init {
Expand Down
Loading