Skip to content

A Minecraft Function compiler which aims to reduce time writing duplicate code.

License

Notifications You must be signed in to change notification settings

Geekid812/mcfunction-expand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub

Twitter Follow Discord

MCFunction Expand

A Minecraft Function compiler which aims to reduce time writing duplicate code.

mcfunction-expand is a CLI tool that compiles .mcfunction files. It can evaluate Python code and clone multiple lines with different arguments.

Installation

Python version 3.8 or higher is required.

# Clone the repository into your working directory
git clone https://github.com/geekid812/mcfunction-expand

# Install dependencies
pip install -r mcfunction-expand/requirements.txt

# Rename the directory
ren mcfunction-expand expand

# Show the CLI help message
python expand --help

Usage

Compiling a single file:

python expand path/to/file.mcfunction

Watching the current directory for file changes:

python expand --watch

To prevent mcfunction-expand from compiling a specific file, add this comment at the top of said file:

# NO-EXPAND

Example

mcfunction-expand will evaluate Python code written as such: *(YOUR CODE HERE)*. If the evaluation returns an iterable (except for strings), the line will be cloned for as many items it contains.

execute as @a[team=*(teams = ['red','blue','green','yellow'])*] run say I am in team *(teams)*!

will compile to

execute as @a[team=red] run say I am in team red!
execute as @a[team=blue] run say I am in team blue!
execute as @a[team=green] run say I am in team green!
execute as @a[team=yellow] run say I am in team yellow!

See the examples directory for more examples on how to use the compiler!

About

A Minecraft Function compiler which aims to reduce time writing duplicate code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages