An animation generator for Minecraft .mcmeta files
Project description
Mcanitexgen
Mcanitexgen is a generator for ".mcmeta" files that Minecraft uses to animate textures.
The full power of Python
Mcanitexgen allows you to write texture animations in Python instead of json. Using a programming language allows you to create much more complex animations, like this dog that has 3 textures that are synchronised with each other.
Table of contents
Installation
pip install mcanitexgen
Usage
Generate .mcmeta files for all animations in a file
mcanitexgen generate <animation_file> [out_dir]
Create gifs for all animations in animation a file
mcanitexgen gif <animation_file> [out_dir]
Example
We are going to create this animation.
First we have to create the different states of the animation.
I created a simple steve.png file:
Top to Bottom: Looking normal, blinking, wink with right eye, wink with left eye.
Now we can create the animation file steve.animation .py that uses these states to create an animation:
from mcanitexgen import animation, TextureAnimation, State, Sequence
@animation("steve.png")
class Steve(TextureAnimation):
NORMAL = State(0) # Look normal
BLINK = State(1)
WINK_RIGHT = State(2) # Wink with right eye
WINK_LEFT = State(3) # Wink with left eye
# Look normal and blink shortly
look_and_blink = Sequence(NORMAL(duration=60), BLINK(duration=2))
# The main Sequence used to create the animation
main = Sequence(
3 * look_and_blink, # Play "look_and_blink" Sequence 3 times
NORMAL(duration=60),
WINK_LEFT(duration=30),
look_and_blink,
NORMAL(duration=60),
WINK_RIGHT(duration=30),
)
Now run mcanitexgen steve.animation.py
and Mcanitexgen will create a steve.png.mcmeta file:
{
"animation": {
"interpolate": false,
"frametime": 1,
"frames": [
{"index": 0, "time": 60},
{"index": 1, "time": 2},
{"index": 0, "time": 60},
{"index": 1, "time": 2},
{"index": 0, "time": 60},
{"index": 1, "time": 2},
{"index": 0, "time": 60},
{"index": 3, "time": 30},
{"index": 0, "time": 60},
{"index": 1, "time": 2},
{"index": 0, "time": 60},
{"index": 2, "time": 30}
]
}
}
Put steve.png.mcmeta into the same directory as steve.png. Minecraft will then detect it and animate the texture.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mcanitexgen-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e62b614eeac02c42a5e8a7c3057e7e70e332aac2ccdeed18f51fbf1d9d5b014c |
|
MD5 | 04aac7bb1c6d8bd4ca20c416cbcb785e |
|
BLAKE2b-256 | 388866e14192f8c657d9276020245ef8d378d62b247e4fd6f7877e1fe798f8cf |