aka wavy-totem-lib
Python library to generate totems of undying for Minecraft.
- Support 64x32 skins
- Zoning 2 layers and rounding the head
- Lossless scaling image size
- Asynchrony support
- Supports PyPy
- Supports different patterns (styles)
uv add wavy-totem-libpoetry add wavy-totem-libpip install wavy-totem-libfrom wavy_totem_lib import TotemBuilder, Skin, Totem, TopLayer
builder = TotemBuilder(
Skin('my_skin.png'),
top_layers=[TopLayer.HEAD], # the second layer will be applied only to the head
round_head=True # the head will be rounded at the corners
)
totem: Totem = builder.build()
totem.image.save('totem.png') # .image is Pillow imageGeneration and scaling
from wavy_totem_lib import TotemBuilder, Skin, Totem
builder = TotemBuilder(Skin('my_skin.png', slim=True))
totem: Totem = builder.build()
scaled = totem.scale(factor=8) # Scaling from 16×16 to 128×128
scaled.save('totem.png')To scale up, use the built-in
scale()method instead ofresize()from Pillow, because it may blur the image.
Asynchronous generation
import asyncio
from io import BytesIO
from wavy_totem_lib import TotemBuilder, Skin, Totem, TopLayer
# To save a file asynchronously, install the aiofiles package
import aiofiles
async def main():
builder = TotemBuilder(Skin('my_skin.png', slim=False),
top_layers=[TopLayer.HEAD, TopLayer.HANDS],
round_head=True)
totem: Totem = await builder.build_async()
temp = BytesIO()
totem.image.save(temp, format='png')
async with aiofiles.open('totem.png', 'wb') as f:
await f.write(temp.getvalue())
asyncio.run(main())Specifying a pattern
from wavy_totem_lib import TotemBuilder, Skin, Totem
from wavy_totem_lib.patterns import STT
# Wavy is default, STT available built-in
builder = TotemBuilder(Skin('my_skin.png'), pattern=STT)
totem: Totem = builder.build()
totem.image.save('totem.png')The
generate()method accepts **kwargs, which will be passed on to the pattern class. None of the built-in patterns support them.
Note
You can create your own pattern by creating subclass from Abstract class and implementing the image method.
This is the default pattern in TotemBuilder.
| Notch (wide) | WavyCat (slim) | CyCeKu (wide) |
|---|---|---|
![]() |
![]() |
![]() |
from wavy_totem_lib import TotemBuilder
from wavy_totem_lib.patterns import Wavy
TotemBuilder(pattern=Wavy)
# You can also not specify the pattern at all, because WavyStyle – default pattern.The code is taken from the UnFamousSoul/STT repository.
| Notch (wide) | WavyCat (slim) | CyCeKu (wide) |
|---|---|---|
![]() |
![]() |
![]() |
from wavy_totem_lib import TotemBuilder
from wavy_totem_lib.patterns import STT
TotemBuilder(pattern=STT)




