Skip to main content

A library for generating the texture of Minecraft's Totem of Undying

Reason this release was yanked:

Incorrect pyproject. Upgrade to 2.1.1

Project description

TotemLib

aka wavy-totem-lib

PyPI - Python Version GitHub License GitHub repo size

Python library to generate totems of undying for Minecraft.


Features

  • Support 64x32 skins
  • Zoning 2 layers and rounding the head
  • Lossless scaling image size
  • Asynchrony support
  • Supports PyPy
  • Supports different patterns (styles)

Installing

Using uv

uv add wavy-totem-lib

Using Poetry

poetry add wavy-totem-lib

Using pip

pip install wavy-totem-lib

Quick start

from 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 image

More examples

Generation 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 of resize() 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.

Patterns

[!NOTE] You can create your own pattern by creating subclass from Abstract class and implementing the image method.

Wavy

This is the default pattern in TotemBuilder.

Notch (wide) WavyCat (slim) CyCeKu (wide)
Skin Skin Skin
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.

STT

The code is taken from the UnFamousSoul/STT repository.

Notch (wide) WavyCat (slim) CyCeKu (wide)
Skin Skin Skin
from wavy_totem_lib import TotemBuilder
from wavy_totem_lib.patterns import STT

TotemBuilder(pattern=STT)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wavy_totem_lib-2.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wavy_totem_lib-2.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file wavy_totem_lib-2.1.0.tar.gz.

File metadata

  • Download URL: wavy_totem_lib-2.1.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wavy_totem_lib-2.1.0.tar.gz
Algorithm Hash digest
SHA256 fa6c19e844d87df2990c606bbfbcb391e3c4d4f0e56af6d4914b5a03e009f76b
MD5 1940298a739014cb03e8f77df3e2ca60
BLAKE2b-256 a69fece2773fc31be6eee8b8295914b6a359934c4615b36c5bf6b1aefdcfe7e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for wavy_totem_lib-2.1.0.tar.gz:

Publisher: publish.yml on wavy-cat/wavy-totem-lib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wavy_totem_lib-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: wavy_totem_lib-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wavy_totem_lib-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b42090bb604a3633a16facc299060f5eb691360f3a53c022f0125154d87a614f
MD5 f9d741c5e867195ae0c2d53d3c6bd8dc
BLAKE2b-256 28cf4f1277141b9682c5b18ff3ce3ce7fa5cca8d6fdf679f9afa383459861a88

See more details on using hashes here.

Provenance

The following attestation bundles were made for wavy_totem_lib-2.1.0-py3-none-any.whl:

Publisher: publish.yml on wavy-cat/wavy-totem-lib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page