mcwpy 0.3.1
A new way to create Minecraft datapacks
License: MIT
Keywords: Minecraft,Datapack,Function,MCFunction

# [Minecraft](https://www.minecraft.net)-[Datapacks](https://minecraft.gamepedia.com/Data_Pack)-Generator  

## Description:  
A new way of coding [Minecraft](https://www.minecraft.net).
[Minecraft](https://www.minecraft.net) is a game that you can play on your computer. It is a popular game for people who are interested in building their own worlds. And since a way to code the game itself has been implemented, I tried it. But it was not simple. So I decided to make a generator for the [Minecraft](https://www.minecraft.net) [Datapacks](https://minecraft.gamepedia.com/Data_Pack), so people can make their own [Datapacks](https://minecraft.gamepedia.com/Data_Pack) easily, even though they still need to know Python until I can make it look like [Scratch](https:/scratch.mit.edu) or something this easy.

## Installation:  
* First of all make sure you have one of the latest [Python](https://www.python.org/downloads/) version installed on your computer.  
* Ensure you also have [pip](https://pip.pypa.io/en/stable/installation/) installed: try running the command "`pip3 -V`" in a terminal.  
* If this gets you an error message follow [these steps](https://pip.pypa.io/en/stable/installation/) to install it.  
* Once you have [Python](https://www.python.org/downloads/) and [pip](https://pip.pypa.io/en/stable/installation/) installed, run the command: "`pip3 install mcwpy`".  


## Usage:  
Now you should be able to import the library in your new [Python](https://www.python.org/downloads/) programs you can use the project below to help you get started with the library:  
```py 
import mcwpy
```  
* Create and compile your own datapack.  
* Once the datapack is generated, paste it in the *datapacks* folder of your [Minecraft](https://www.minecraft.net/download) world.  
* Type `/reload` to load the datapack.  
* Have fun playing with your brand new handmade datapack!  

### Example:  
```python
# -*- coding: ascii -*-
from mcwpy import *

workspace1 = Workspace(
    name = 'my_workspace',
    functions = {
        'load': 'tellraw @a {"text":"Datapack loaded!"}',
        'hello_world': 'say Hello World!'
    }
)

my_datapack = Datapack(
    title = 'My Datapack',
    pack_mcmeta = Pack_Meta(
        author = 'Myself',
        description = 'My very own Minecraft datapack',
        minecraft_version = Minecraft_Pack_Version.LATEST
    ),
    workspaces = [workspace1]
)

workspace2 = Workspace(
    functions = {
        'main': 'title @a actionbar {"text":"Hey!"}',
        'test': [
            'say Test',
            'execute as @s at @s run summon pig ~ ~ ~'
        ]
    }
)

my_datapack.append(workspace2)
my_datapack.compile()
```
```mcfunction
function my_workspace:hello_world
```
![Screenshot 2021-10-07 162422](https://user-images.githubusercontent.com/88092549/136458850-c71a3e5b-4351-498f-9161-9f2438f8ea91.png)

## Contributing:
If you want to contribute to this project, you can do so by forking it and sending a pull request, I am opened to any idea and contribution.

## Credits:
Thanks to [@theskyblockman](https://github.com/theskyblockman) for the idea of using workspaces.
Thanks to [@Silvathor](https://github.com/SilvaUnCompte) for the idea of redesigning the workspaces.


# 0.3.1 (2021/10/20)
* Fixed Workspaces.  
* Updated the `README.md`.  

# 0.3.0 (2021/10/18)
+ Added easy-to-use ray trace function.  
+ Added scripts to ease Python package update.  
* Updated the way Workspaces work.  

# 0.2.0 [Beta release] (2021/10/13)
+ Added importation function.  
+ Added a default Minecraft functions library to import from.  

# 0.1.3 (2021/10/06)
+ Added `load.json` and `tick.json` generation.  

# 0.1.2 (2021/10/05)
+ Started adding `load.json` and `tick.json` generation.  

# 0.1.1 (2021/09/25)
+ Added `pack.mcmeta` generation.  

# 0.1.0 (2021/08/08)
+ Added sub-workspaces.  

# 0.0.13 (2021/08/06)
+ Added a check to verify whether the Minecraft Workspace can be automatically created.  
+ Added a function to remove directories.  
+ Added `__format__` representation for Datapack objects.  
* Changed code encryption from `utf-8` to `ascii`.  
* Changed the way the Datapack folder is ziped.  
* Changed replacement of older versions of the Datapack folder.  
* Changed the Font class to a dataclass.  
* Updated the `.gitignore` file to ignore the generated test files.  
- Removed unused import in `datapack.py`.  

# 0.0.12 (2021/07/31)
+ Added `utility.py` to the library for tools that can be useful for other modules.  
* Made the Datapack compilation delete the old Datapack folder if authorized.  
* Made the library inform the user where the Datapack folder by default is.  
* Changed `ansi_escape_sequence.py` into `utility.py`.  

# 0.0.11 (2021/07/30)
+ Added many more tests to `datapack.py`.  
+ Made Datapacks iterable by going through their Workspaces.  
* Updated `CHANGELOG.md` way of displaying additions *(`+`)*, changes *(`*`)* and removals *(`-`)*.  
* Updated the way to do the tests.  

# 0.0.10 [0.0.9, 0.0.8] (2021/07/30)
* Fixed library import issues - `datapack.py` was not importing `workspace.py` with relative imports.  

# 0.0.7 (2021/07/30)
+ Added `requests==2.26.0` to `REQUIREMENTS.txt`.  
+ Added `tests.py` in which unit tests are and will be written.  
+ Added `workspace.py` to create the class `Workspace` which handles the `Datapack` workspaces.  
+ Wrote several tests for the `Datapack` class (`datapack.py`).  
* Improved the `README.md`.  
* Improved the `Datapack`'s `workspaces` default attribute.  
- Removed `test.py`.  

# 0.0.6 (2021/07/29)
+ Now printing the library version when imported.  
* Fixed version **0.0.5** by using relative imports.  

# 0.0.5 (2021/07/29)
* Fixed version **0.0.4** by removing inputs in `setup.py`.  
* Updated `verify_setup.py` to check if the display format is correct.  

# 0.0.4 (2021/07/29)
+ Added ANSI escape sequences to the output for prettier messages (`ansi_escape_sequences.py`).  
+ Added an automatic version code for Datapacks with unspecified versions.  
+ Added `verify_setup.py` to check if the package can be created.  
* Changed warnings to be easier to read.  
* Version **0.0.3** did not work so MCWPy will be developed without subfolders.  

# 0.0.3 (2021/07/29)
* Attempt to use subfolders...  
* If creating a Datapack using the MCWPy library works then it is a success.  

# 0.0.2 (2021/07/28)
+ Made the library check if is running on [Python](https://www.python.org/downloads/) **3.9.5** or above.  

# 0.0.1 (2021/07/28)
* Fixed (or tried to) `CHANGELOG.md`, `LICENSE` and `README.md` looks on [pypi.org](https://pypi.org/project/mcwpy/).  

# Initial (2021/07/28)
+ Created a `setup.py` file to setup the library.  
+ Created two functions to add or substract numbers together.  
+ Created `mcwpy\__init__.py`.  
+ Created `REQUIREMENTS.txt`.  
+ Wrote `LICENSE`.  
+ Wrote `MANIFEST.md`.  
+ Wrote `README.md`.  
* Used `python3 setup.py sdist` in a terminal to create the library's first package.  
* Used `twine upload --repository-url https://upload.pypi.org/legacy/ dist/*` to upload the library's first package on pypi.