A simple library for loading and rendering Minecraft Bedrock Edition entity models and animations in Java Edition
- β Bedrock Model: Full support Bedrock Model loading and rendering
- β Bedrock Animation: Complex bone structures and transformations
- β Molang Support: In progress...
- β Animation Running: A full-featured animation player.
- β Animation Blending: Support for blendspace, layered, kinematic interpolation blending
- β Resource Pack Support: Load models and animations from resource packs
Add SimpleBedrockModel to your mod's dependencies:
repositories {
maven {
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}
dependencies {
jarJar(implementation(fg.deobf("maven.modrinth:simplebedrockmodel:1.5.0-forge+1.20.1"))) {
jarJar.ranged(it, "[1.5.0,)")
}
// The animation library is already included in jar (jar in jar),
// but since modrinth maven cannot handle transitive dependencies,
// you need to include it to pass the compilation.
compileOnly("com.maydaymemory:mae:1.0.2")
}repositories {
maven {
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}
dependencies {
implementation jarJar("maven.modrinth:simplebedrockmodel:1.5.0-neoforge+mc1.21.1") {
version {
prefer '1.5.0-neoforge+1.21.1'
}
}
// The animation library is already included in jar (jar in jar),
// but since modrinth maven cannot handle transitive dependencies,
// you need to include it to pass the compilation.
compileOnly("com.maydaymemory:mae:1.0.2")
}There is a utility class "GsonUtil" to help you create pojo from json:
InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
Gson gson = GsonUtil.GSON;
BedrockModelPOJO pojo = gson.fromJson(reader, BedrockModelPOJO.class);
BedrockModel model = new BedrockModel(pojo);There is a utility class "GsonUtil" to help you create pojo from json:
BedrockModel model = ...;
BoneIndexProvider indexProvider = new BedrockModelBoneIndexProvider(model);
InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
Gson gson = GsonUtil.GSON;
BedrockAnimationFile pojo = gson.fromJson(reader, BedrockAnimationFile.class);Animation Instance Construct: A utility class "Animations" could help construct animation instance as long as you got the pojo.
BedrockAnimationFile animationFilePojo = ...;
BedrockAnimationPOJO animationPojo = ...;
BedrockModel model = ...;
BoneIndexProvider indexProvider = new BedrockModelBoneIndexProvider(model);
// BedrockAnimationFile represents a complete Bedrock Edition animation file,
// which containing multiple animations.
List<BedrockAnimation> animations = Animations.createAnimation(animationFilePojo, indexProvider);
// BedrockAnimationPOJO represents a single animation.
BedrockAnimation animation = Animations.createAnimation("animation_name", animationPojo, indexProvider);Animation Runner can control the progress of animation according to time, and estimate Pose, Animation Events and Curves according to the progress.
BedrockAnimation animation = ...;
// use getSpecifiedEndTimeS because bedrock animation has its own end time.
AnimationContext animationContext = new AnimationContext(animation.getSpecifiedEndTimeS());
animationContext.setState(new LoopingState(System::nanoTime));
AnimationRunner animationRunner = new AnimationRunner(animation, animationContext);
// somewhere else
Pose pose = animationRunner.evaluate();// According to the Bedrock Edition animation standard,
// this type of blender must be used and ZYX BoneTransform must be used.
AdditiveBlender blender = new SimpleAdditiveBlender(new ZYXBoneTransformFactory(), ArrayPoseBuilder::new);
// Before rendering
Pose bindPose = model.getBindPose(); // The initial pose of the model
Pose animationPose = ...; // For example, animationRunner.evaluate()
Pose blended = blender.blend(bindPose, animationPose);
// Apply animation to model
model.applyPose(blended);
// Rendering
model.renderToBuffer(poseStack, buffer, packedLight, packedOverlay);
// After Rendering, You can choose whether to restore to binding pose according to your usage.
// model.applyPose(bindPose);See the documentation of Mayday Animation Engine
src/main/java/com/github/mcmodderanchor/simplebedrockmodel/
βββ v1/client/bedrock/
β βββ model/ # Core model classes
β βββ animation/ # Animation system
β βββ pojo/ # Data transfer objects
β βββ compat/ # Compatibility layers
βββ example/ # Usage examples, not included in builds
This project is licensed under the LGPL-3.0 License - see the LICENSE file for details.
Specifically, assets under the example namespace are provided solely as tutorial examples and for reference. Their respective owners retain ALL RIGHTS.
Please do not reuse or redistribute them without permission.
- TartaricAcid - Lead Developer
- MaydayMemory - Core Developer
- MoePus - Developer
- Hidomatn - Developer
- xjqsh - Developer
We welcome contributions! Please feel free to submit issues and pull requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Modrinth: Modrinth Page
- MaydayAnimationEngine - Providing animation infrastructure