Metadata-Version: 2.4
Name: chanty
Version: 0.4.0
Summary: Tool for creating cool Minecraft datapacks
Project-URL: Homepage, https://github.com/Ethosa/chanty
Project-URL: Source, https://github.com/Ethosa/chanty
Author-email: Ethosa <social.ethosa@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Ethosa
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: automation,commands,datapack,dsl,minecraft
Requires-Python: >=3.10
Description-Content-Type: text/markdown

<div align="center">

# Chanty
### Write Minecraft datapacks easely with Python

</div>

**chanty** is a Python DSL for writing Minecraft datapacks as if they were real code.  
No more messy `.mcfunction` files - just cliean, structured logic.


## Features

- **Pythonic Datapack Development**
  Write Minecraft datapack using real Python code instead of raw `.mcfunction` files.
- **Command Builder API**
  Generate complex Minecraft commands (`execute`, `summon`, `scoreboard`, etc.) programmatically and dynamically.
- **Custom Item System**
  Create fully functional custom items with names, lore, events and NBT attributes - all in code.
- **Hot Reloading**
  Automatically rebuild and export your dapatack whenever a Python file changes (you still should to use `/reload` command in game).
- **Automatic Resourcepack Exporting**
  Export resourcepaks as ready-to-import `.zip` archives.


## Install
```shell
pip install chanty
```


## CLI Usage

### Creating Project
```shell
chanty create test-project

cd test-project
```

### Build Datapack
To build and export your datapack, use:
```shell
chanty build MAIN_FILE:PACK_VARIABLE --ARGS
```

Exporting to the default .minecraft saves folder:
```shell
chanty build main:pack --world_name="New World"
```

Exporting to Modrinth App:
```shell
chanty build main:pack --modrinth="ProfileName:New World"
```

Exporting to a custom destination:
```shell
chanty build main:pack --to="./builds/datapack"
```


Exporting to a `./builds/<datapack_name>` folder:
```shell
chanty build main:pack --output="./builds"
```


### Development Mode
You can start the `dev` mode to automatically re-export your datapack every time any `.py` file changes. 

Supported arguments: `--save_folder`, `--world_name`, and `--modrinth`.

```shell
chanty dev main:pack --modrinth="ProfileName:New World"
```


### Up Project
After updating your Chanty version, use:
```shell
chanty up
```
to synchronize your project structure with the latest Chanty template.


## Usage

### Simple example
```py
from chanty import Datapack, Namespace, CommandBuilder

pack = DataPack('my_awesome_datapack')
namespace = Namespace('main')

@namespace.on_load
def handle_on_load() -> str:
    with CommandBuilder() as cmd:
        cmd.tellraw('Hello world from chanty datapack!')
    return cmd.build()


# Export into folder
if __name__ == '__main__':
    pack.export('./my_datapack')
```


### Custom Items
```py
from chanty import DataPack Namespace, CommandBuilder, CustomItem, Item


pack = DataPack('my_awesome_datapack')
namespace = Namespace('main')

my_cool_item = CustomItem(Item.STICK)
my_cool_item.set_name('§6§l[Chanty]§f§r Debugger')
my_cool_item.set_lore(
    'This is a not just stick ...',
    'This is a §6§l[Chanty]§f§r Debugger!',
)
my_cool_item.glint(True)
@my_cool_item.on_right_click
def handle_right_click():
    with CommandBuilder() as cmd:
        cmd.say('Hello!')
    return cmd.build()

namespace.register(my_cool_item)

if __name__ == '__main__':
    pack.export('./my_datapack')
```


## In The Future ...

- Asset management
- Achievements
- More built-in event hooks
- CLI improvements
